hsun 1 жил өмнө
parent
commit
d8aa0092b3

+ 1 - 1
controllers/classify.go

@@ -870,7 +870,7 @@ func (this *ClassifyController) TelListClassify() {
 	resp := make([]*models.SimpleClassifyList, 0)
 	var condition, orderRule string
 	var pars []interface{}
-	if utils.SystemType == "hz" {
+	if utils.BusinessCode == utils.BusinessCodeRelease {
 		condition += ` AND classify_name <> '晨报' AND classify_name <> '周报' `
 	}
 	telList, e := models.GetClassifyByCondition(condition, orderRule, pars)

+ 11 - 1
controllers/company_permission.go

@@ -32,11 +32,20 @@ func (this *CompanyPermissionController) List() {
 		br.Ret = 408
 		return
 	}
+	// 非自用无需查询
+	resp := new(company.PermissionSetResp)
+	if utils.BusinessCode != utils.BusinessCodeRelease {
+		br.Ret = 200
+		br.Success = true
+		br.Msg = "获取成功"
+		br.Data = resp
+		return
+	}
+
 	// Tips:目前这个接口权益在添加客户、申请转正、领取客户、续约申请均有用到
 
 	companyType := this.GetString("CompanyType")
 	var productId int
-	resp := new(company.PermissionSetResp)
 
 	roleTypeCode := sysUser.RoleTypeCode
 	productId = services.GetProductId(roleTypeCode)
@@ -93,6 +102,7 @@ func (this *CompanyPermissionController) PermissionVariety() {
 		return
 	}
 
+
 	companyType := this.GetString("CompanyType")
 
 	var productId int

+ 8 - 0
controllers/report_chapter_type.go

@@ -370,6 +370,14 @@ func (this *ReportChapterTypeController) AuthSetting() {
 		br.Ret = 408
 		return
 	}
+	// 非自用直接返回
+	if utils.BusinessCode != utils.BusinessCodeRelease {
+		br.Ret = 200
+		br.Success = true
+		br.Msg = "操作成功"
+		return
+	}
+
 	var req models.ReportChapterTypeAuthSettingReq
 	if err := json.Unmarshal(this.Ctx.Input.RequestBody, &req); err != nil {
 		br.Msg = "参数解析异常!"

+ 1 - 1
models/db.go

@@ -55,7 +55,7 @@ func init() {
 	gl.SetConnMaxLifetime(10 * time.Minute)
 
 	// 用户主库
-	if utils.MYSQL_WEEKLY_URL != `` {
+	if utils.MYSQL_WEEKLY_URL != `` && utils.BusinessCode == utils.BusinessCodeRelease {
 		_ = orm.RegisterDataBase("weekly", "mysql", utils.MYSQL_WEEKLY_URL)
 		orm.SetMaxIdleConns("weekly", 50)
 		orm.SetMaxOpenConns("weekly", 100)

+ 1 - 1
services/report_push.go

@@ -16,7 +16,7 @@ import (
 
 // SendReportToEmail 发送报告邮件
 func SendReportToEmail(report *models.ReportDetail) (err error) {
-	if utils.SystemType == "custom" {
+	if utils.BusinessCode != utils.BusinessCodeRelease {
 		// 客户不做报告邮件推送
 		return
 	}

+ 0 - 9
utils/config.go

@@ -23,8 +23,6 @@ var (
 	Re          error        //redis错误
 )
 
-var SystemType string // 系统类型; hz:弘则;trial:试用平台;custom:客户
-
 // 基础配置
 var (
 	STATIC_DIR       string
@@ -221,13 +219,6 @@ func init() {
 		panic(any(Re))
 	}
 
-	// 系统类型
-	systemType, err := web.AppConfig.String("system_type")
-	if err != nil {
-		panic(any("配置文件读取system_type错误 " + err.Error()))
-	}
-	SystemType = systemType
-
 	// 项目中文名称
 	appNameCn, err := web.AppConfig.String("app_name_cn")
 	if err != nil {

+ 6 - 0
utils/constants.go

@@ -299,3 +299,9 @@ const (
 
 // BusinessCodeSalt 商家编码盐值
 const BusinessCodeSalt = "dr7WY0OZgGR7upw1"
+
+// 自用商户号
+const (
+	BusinessCodeSandbox = "E2023080700" // 沙箱环境
+	BusinessCodeRelease = "E2023080900" // 生产环境
+)