xingzai vor 1 Jahr
Ursprung
Commit
a7299f043f
3 geänderte Dateien mit 33 neuen und 7 gelöschten Zeilen
  1. 21 0
      models/tables/cygx_config/config.go
  2. 11 7
      services/company_approval_message.go
  3. 1 0
      utils/constants.go

+ 21 - 0
models/tables/cygx_config/config.go

@@ -0,0 +1,21 @@
+package cygx_config
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxConfig struct {
+	ConfigId    int    `json:"-" orm:"column(config_id);pk"`
+	ConfigCode  string `json:"-"`
+	ConfigValue string
+	Remark      string    `json:"-"`
+	CreateTime  time.Time `json:"-"`
+}
+
+
+func GetConfigByCode(configCode string) (item *CygxConfig, err error) {
+	sql := `SELECT * FROM cygx_config WHERE config_code=? `
+	err = orm.NewOrm().Raw(sql, configCode).QueryRow(&item)
+	return
+}

+ 11 - 7
services/company_approval_message.go

@@ -7,10 +7,12 @@ import (
 	"hongze/hongze_mobile_admin/models/tables/company_approval_message"
 	"hongze/hongze_mobile_admin/models/tables/company_contract"
 	"hongze/hongze_mobile_admin/models/tables/company_product"
+	"hongze/hongze_mobile_admin/models/tables/cygx_config"
 	"hongze/hongze_mobile_admin/services/alarm_msg"
 	"hongze/hongze_mobile_admin/utils"
 	"strings"
 	"time"
+	"errors"
 )
 
 //消息来源类型,1:客户,2:合同,3:用印,4:指标替换,5:问答社区,6:问答评论,7:视频评论,8:线上路演评论
@@ -185,8 +187,10 @@ func AddCompanyApprovalMessageWangYang(companyId , companyContractId int, applyR
 			go alarm_msg.SendAlarmMsg("客户研选行业转正时(王芳审批通过),模板消息提醒汪洋,Err:"+err.Error()+fmt.Sprint("companyId:",companyId,"companyContractId:",companyContractId,"applyRealName:",applyRealName,"companyName:",companyName), 3)
 		}
 	}()
-	count, err := company_contract.GetCompanyContractPermissionCheckByContractId(companyId, companyContractId, utils.CHART_PERMISSION_ID_YANXUAN)
-	if err != nil {
+	//如果是研选的就推送给汪洋
+	count, e := company_contract.GetCompanyContractPermissionCheckByContractId(companyId, companyContractId, utils.CHART_PERMISSION_ID_YANXUAN)
+	if e != nil {
+		err = errors.New("GetCompanyContractPermissionCheckByContractId, Err: " + e.Error())
 		return
 	}
 	if count == 0 {
@@ -196,12 +200,12 @@ func AddCompanyApprovalMessageWangYang(companyId , companyContractId int, applyR
 	keyword1 = companyName  + "(" + applyRealName+")"
 	keyword2 = "买方研选转正"
 	var mobiles string
-	if utils.RunMode == "release" {
-		mobiles ="18955528215" //汪洋手机号
-	}else{
-		mobiles = "15557270714"
+	cnf, e := cygx_config.GetConfigByCode(utils.TPL_MSG_WANG_YANG)
+	if e != nil {
+		err = errors.New("GetConfigByCode, Err: " + e.Error())
+		return
 	}
-
+	mobiles = cnf.ConfigValue
 	openIdList, err := models.GetUserRecordListByMobile(4, mobiles)
 	if err != nil && err.Error() != utils.ErrNoRow() {
 		return err

+ 1 - 0
utils/constants.go

@@ -164,4 +164,5 @@ const (
 	KE_JI_NAME                       string = "科技"
 	ZHI_ZAO_NAME                     string = "智造"
 	CHART_PERMISSION_ID_YANXUAN      int    = 31 // 研选ID
+	TPL_MSG_WANG_YANG           = "tpl_msg_wang_yang"           //汪洋手机号地址参数
 )