This commit is contained in:
hero920103 committed 2026-10-19 01:13:17 +08:00
1 parent 5718a00e31
commit 1850ac640e
226 files changed
+37772 -12071

No files matched your search

+15 -7
View File
@@ -11,6 +11,7 @@ import (
"github.com/beego/beego/v2/client/orm"
beego "github.com/beego/beego/v2/server/web"
"server/pkg/identity"
)
// BackendCrmUnitController CRM 基本设置-计量单位(产品等单位下拉取自该表)
@@ -201,7 +202,8 @@ func crmUnitUsage(tenantID string) map[string]int64 {
func (c *BackendCrmUnitController) List() {
claims, err := pipelineClaims(&c.Controller)
if err != nil {
pipelineErr(&c.Controller, 401, 401, err.Error())
code := identity.Status(err)
pipelineErr(&c.Controller, code, code, err.Error())
return
}
page, _ := c.GetInt("page", 1)
@@ -249,7 +251,8 @@ func (c *BackendCrmUnitController) List() {
func (c *BackendCrmUnitController) All() {
claims, err := pipelineClaims(&c.Controller)
if err != nil {
pipelineErr(&c.Controller, 401, 401, err.Error())
code := identity.Status(err)
pipelineErr(&c.Controller, code, code, err.Error())
return
}
tenantID := pipelineTenantID(claims)
@@ -268,7 +271,8 @@ func (c *BackendCrmUnitController) All() {
func (c *BackendCrmUnitController) Detail() {
claims, err := pipelineClaims(&c.Controller)
if err != nil {
pipelineErr(&c.Controller, 401, 401, err.Error())
code := identity.Status(err)
pipelineErr(&c.Controller, code, code, err.Error())
return
}
id, _ := strconv.ParseUint(c.Ctx.Input.Param(":id"), 10, 64)
@@ -290,7 +294,8 @@ func (c *BackendCrmUnitController) Detail() {
func (c *BackendCrmUnitController) Create() {
claims, err := pipelineClaims(&c.Controller)
if err != nil {
pipelineErr(&c.Controller, 401, 401, err.Error())
code := identity.Status(err)
pipelineErr(&c.Controller, code, code, err.Error())
return
}
raw, _ := io.ReadAll(c.Ctx.Request.Body)
@@ -356,7 +361,8 @@ func (c *BackendCrmUnitController) Create() {
func (c *BackendCrmUnitController) Update() {
claims, err := pipelineClaims(&c.Controller)
if err != nil {
pipelineErr(&c.Controller, 401, 401, err.Error())
code := identity.Status(err)
pipelineErr(&c.Controller, code, code, err.Error())
return
}
id, _ := strconv.ParseUint(c.Ctx.Input.Param(":id"), 10, 64)
@@ -429,7 +435,8 @@ func (c *BackendCrmUnitController) Update() {
func (c *BackendCrmUnitController) Delete() {
claims, err := pipelineClaims(&c.Controller)
if err != nil {
pipelineErr(&c.Controller, 401, 401, err.Error())
code := identity.Status(err)
pipelineErr(&c.Controller, code, code, err.Error())
return
}
id, _ := strconv.ParseUint(c.Ctx.Input.Param(":id"), 10, 64)
@@ -465,7 +472,8 @@ func (c *BackendCrmUnitController) Delete() {
func (c *BackendCrmUnitController) InitDefault() {
claims, err := pipelineClaims(&c.Controller)
if err != nil {
pipelineErr(&c.Controller, 401, 401, err.Error())
code := identity.Status(err)
pipelineErr(&c.Controller, code, code, err.Error())
return
}
added := crmInitDefaultUnits(pipelineTenantID(claims))