Explorar o código

Merge branch 'master' of http://8.136.199.33:3000/hongze/hz_crm_api into cygx/mfyx_2.0

xingzai hai 9 meses
pai
achega
86be425c6c
Modificáronse 3 ficheiros con 39 adicións e 11 borrados
  1. 31 10
      controllers/cygx/yanxuan_special.go
  2. 2 1
      models/cygx/cygx_yanxuan_special.go
  3. 6 0
      utils/constants.go

+ 31 - 10
controllers/cygx/yanxuan_special.go

@@ -539,10 +539,10 @@ func (this *YanxuanSpecialController) Enable() {
 		go cygxService.SendWxMsgSpecialFollow(req.Id)
 		go services.SendWxCategoryMsgSpecialFollow(req.Id)
 	}
-	go cygxService.SendWxMsgSpecialAuthor(req.Id, req.Status) // 研选专栏审核完成时,给提交人发送模板消息
+	go cygxService.SendWxMsgSpecialAuthor(req.Id, req.Status)      // 研选专栏审核完成时,给提交人发送模板消息
 	go services.SendWxCategoryMsgSpecialAuthor(req.Id, req.Status) // 研选专栏审核完成时,给提交人发送模板消息
-	go cygxService.UpdateYanxuanSpecialResourceData(req.Id)   //  写入首页最新  cygx_resource_data 表
-	go elastic.EsAddYanxuanSpecial(req.Id)                    //  写入es 综合搜索
+	go cygxService.UpdateYanxuanSpecialResourceData(req.Id)        //  写入首页最新  cygx_resource_data 表
+	go elastic.EsAddYanxuanSpecial(req.Id)                         //  写入es 综合搜索
 	br.Msg = "审批成功"
 	br.Ret = 200
 	br.Success = true
@@ -801,25 +801,46 @@ func (this *YanxuanSpecialController) ShowButton() {
 	}
 
 	resp := new(cygx.CygxYanxuanSpecialShowButton)
-	configCode := utils.TPL_MSG_NEI_RONG_ZU
-	cnfNeiRong, err := cygx.GetConfigByCode(configCode)
+	//configCode := utils.TPL_MSG_NEI_RONG_ZU
+	//cnfNeiRong, err := cygx.GetConfigByCode(configCode)
+	//if err != nil {
+	//	br.Msg = "获取失败"
+	//	br.ErrMsg = "获取失败,Err:" + err.Error()
+	//	return
+	//}
+	////汪洋王芳手机号
+	//configCode = utils.TPL_MSG_WANG_FANG_WANG_YANG
+	//cnfWang, err := cygx.GetConfigByCode(configCode)
+	//if err != nil {
+	//	br.Msg = "获取失败"
+	//	br.ErrMsg = "获取失败,Err:" + err.Error()
+	//	return
+	//}
+
+	//文章管理专栏是否可见
+	cnfArticle, err := cygx.GetConfigByCode(utils.YANXUAN_SPECIAL_ARTICLE_BUTTON_MOBILE)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
 	}
-	//汪洋王芳手机号
-	configCode = utils.TPL_MSG_WANG_FANG_WANG_YANG
-	cnfWang, err := cygx.GetConfigByCode(configCode)
+	articleMobileSlice := strings.Split(cnfArticle.ConfigValue, ",")
+	if utils.InArrayByStr(articleMobileSlice, sysUser.Mobile) || sysUser.Role == utils.ROLE_TYPE_CODE_ADMIN {
+		resp.IsShowYanXuanSpecial = true
+	}
+
+	//作者管理专栏是否可见
+	cnfAuthor, err := cygx.GetConfigByCode(utils.YANXUAN_SPECIAL_AUTHOR_BUTTON_MOBILE)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
 	}
-	//作者管理栏,只有内容组、汪洋、王芳、超管可见
-	if strings.Contains(cnfNeiRong.ConfigValue, sysUser.Mobile) || strings.Contains(cnfWang.ConfigValue, sysUser.Mobile) || sysUser.Role == utils.ROLE_TYPE_CODE_ADMIN {
+	authorMobileSlice := strings.Split(cnfAuthor.ConfigValue, ",")
+	if utils.InArrayByStr(authorMobileSlice, sysUser.Mobile) || sysUser.Role == utils.ROLE_TYPE_CODE_ADMIN {
 		resp.IsShowSpecialAuthor = true
 	}
+
 	br.Data = resp
 	br.Ret = 200
 	br.Success = true

+ 2 - 1
models/cygx/cygx_yanxuan_special.go

@@ -188,7 +188,8 @@ func GetCygxYanxuanSpecialCount(condition string, pars []interface{}) (count int
 }
 
 type CygxYanxuanSpecialShowButton struct {
-	IsShowSpecialAuthor bool // 作者管理的按钮是否
+	IsShowYanXuanSpecial bool // 研选专栏文章管理按钮是否展示
+	IsShowSpecialAuthor  bool // 作者管理的按钮是否展示
 }
 
 func GetYanxuanSpecialBySpecialId(specialId int) (item *CygxYanxuanSpecialItem, err error) {

+ 6 - 0
utils/constants.go

@@ -423,6 +423,12 @@ const (
 	HONG_GUAN_NAME                          string = "宏观"
 )
 
+// 权益cygx_config配置主键以后放这里
+const (
+	YANXUAN_SPECIAL_ARTICLE_BUTTON_MOBILE string = "yanxuan_special_article_button_mobile" //CRM研选专栏模块文章管理可以查看的手机号
+	YANXUAN_SPECIAL_AUTHOR_BUTTON_MOBILE  string = "yanxuan_special_author_button_mobile"  //CRM研选专栏模块作者管理可以查看的手机号
+)
+
 var CYGX_REGISTER_PLATFORM_MAP = map[string]string{
 	"1": "小程序",
 	"2": "网页版",