Browse Source

no message

xingzai 1 year ago
parent
commit
c69754b1cc

+ 5 - 1
controllers/activity.go

@@ -67,7 +67,11 @@ func (this *ActivityNoLoginController) LabelTypeList() {
 		chartPermissionIds = strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN)
 	} else {
 		conditioninit += ` AND ( art.chart_permission_id  !=  ` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `  OR  ( art.is_show_hz = 1 AND art.chart_permission_id  =  ` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `)  )`
-		conditioninit += ` AND ( art.chart_permission_id  !=  ` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + ` AND art.active_state  != 3 )` // 研选活动结束后就不在已结束页面展示了
+
+		if activeState == "3" {
+			conditioninit += ` AND  art.chart_permission_id  !=  ` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) //V 11.0 研选活动结束后就不在已结束页面展示了
+		}
+
 	}
 	//行业名称
 	if len(chartPermissionIds) > 0 {

+ 8 - 0
models/admin.go

@@ -33,3 +33,11 @@ func GetRaiAdmin() (items []*AdminMobileResp, err error) {
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+// 根据角色名称获取手机号
+func GetAdminByRoleName(roleName string) (items []*AdminMobileResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT mobile  FROM admin  WHERE role_name =? ' `
+	_, err = o.Raw(sql, roleName).QueryRows(&items)
+	return
+}

+ 13 - 0
models/user_record.go

@@ -126,3 +126,16 @@ func GetUserRecordListByMobile(platform int, bindAccount string) (items []*OpenI
 	_, err = orm.NewOrm().Raw(sql, platform).QueryRows(&items)
 	return
 }
+
+func GetWxOpenIdByMobileSliceList(mobiles []string) (items []*OpenIdList, err error) {
+	itemsLen := len(mobiles)
+	if itemsLen == 0 {
+		return
+	}
+	o := orm.NewOrm()
+	sql := `SELECT cr.*,user_id FROM user_record  as c
+			INNER JOIN cygx_user_record AS cr ON cr.union_id = c.union_id
+			WHERE bind_account IN (` + utils.GetOrmInReplace(itemsLen) + `) AND create_platform = 4`
+	_, err = o.Raw(sql, mobiles).QueryRows(&items)
+	return
+}

+ 35 - 9
services/article_apply_appointment_expert.go

@@ -6,6 +6,7 @@ import (
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/utils"
 	"strconv"
+	"strings"
 	"time"
 )
 
@@ -52,26 +53,51 @@ func SendArticleApplyAppointmentExpertTemplateMsg(user *models.WxUserItem, artic
 			go utils.SendAlarmMsg("活动带问提醒发送模版消息失败"+msg, 2)
 		}
 	}()
+	//文章详情
+	detailArticle, e := models.GetArticleDetailById(articleId)
+	if e != nil {
+		err = errors.New("GetArticleDetailById, Err: " + e.Error())
+		return
+	}
+
+	var mobiles []string
 	//获取权益销售
-	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	sellerItem, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if e != nil {
+		err = errors.New("GetAdminByRoleName, Err: " + e.Error())
 		return
 	}
-	if sellerItem == nil {
+	//内容组全员手机号
+	configCode := utils.TPL_MSG_NEI_RONG_ZU
+	cnf, e := models.GetConfigByCode(configCode)
+	if e != nil {
+		err = errors.New("GetConfigByCode, Err: " + e.Error() + configCode)
 		return
 	}
-	//文章详情
-	detailArticle, e := models.GetArticleDetailById(articleId)
+
+	//汪洋手机号
+	cnfWangYang, e := models.GetConfigByCode(utils.TPL_MSG_WANG_YANG)
 	if e != nil {
-		err = errors.New("GetArticleDetailById, Err: " + e.Error())
+		err = errors.New("GetConfigByCode, Err: " + e.Error() + configCode)
 		return
 	}
-	//销售对应的Openid
-	openIdList, e := models.GetWxOpenIdByMobileList(sellerItem.Mobile)
+
+	mobiles = append(mobiles, sellerItem.Mobile)
+	mobiles = append(mobiles, cnfWangYang.ConfigValue)
+	listMobile := strings.Split(cnf.ConfigValue, ",")
+	for _, v := range listMobile {
+		mobiles = append(mobiles, v)
+	}
+
+	openIdList, e := models.GetWxOpenIdByMobileSliceList(mobiles)
 	if e != nil {
-		err = errors.New("GetWxOpenIdByMobileList, Err: " + e.Error())
+		err = errors.New("GetWxOpenIdByMobileSliceList, Err: " + e.Error() + configCode)
 		return
 	}
+	if len(openIdList) == 0 {
+		return
+	}
+
 	if len(openIdList) == 0 {
 		return
 	}

+ 28 - 7
services/banner_yx_survey.go

@@ -6,6 +6,7 @@ import (
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/utils"
 	"strconv"
+	"strings"
 	"time"
 )
 
@@ -43,7 +44,7 @@ func AddCygxBannerYxSurvey(user *models.WxUserItem, content string) (err error)
 	return
 }
 
-// 用户提交研选调研需求,向对应销售发送模版消息
+// 用户提交研选调研需求,给汪洋、对口销售、内容组全员发模板消息
 func SendCygxBannerYxSurveyTemplateMsg(user *models.WxUserItem, content string, articleId int) (err error) {
 	var msg string
 	msg = fmt.Sprint(user, articleId)
@@ -52,19 +53,39 @@ func SendCygxBannerYxSurveyTemplateMsg(user *models.WxUserItem, content string,
 			go utils.SendAlarmMsg("SendCygxBannerYxSurveyTemplateMsg Err"+msg, 2)
 		}
 	}()
+
+	var mobiles []string
 	//获取权益销售
-	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	sellerItem, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if e != nil {
+		err = errors.New("GetAdminByRoleName, Err: " + e.Error())
 		return
 	}
-	if sellerItem == nil {
+	//内容组全员手机号
+	configCode := utils.TPL_MSG_NEI_RONG_ZU
+	cnf, e := models.GetConfigByCode(configCode)
+	if e != nil {
+		err = errors.New("GetConfigByCode, Err: " + e.Error() + configCode)
 		return
 	}
 
-	//销售对应的Openid
-	openIdList, e := models.GetWxOpenIdByMobileList(sellerItem.Mobile)
+	//汪洋手机号
+	cnfWangYang, e := models.GetConfigByCode(utils.TPL_MSG_WANG_YANG)
+	if e != nil {
+		err = errors.New("GetConfigByCode, Err: " + e.Error() + configCode)
+		return
+	}
+
+	mobiles = append(mobiles, sellerItem.Mobile)
+	mobiles = append(mobiles, cnfWangYang.ConfigValue)
+	listMobile := strings.Split(cnf.ConfigValue, ",")
+	for _, v := range listMobile {
+		mobiles = append(mobiles, v)
+	}
+
+	openIdList, e := models.GetWxOpenIdByMobileSliceList(mobiles)
 	if e != nil {
-		err = errors.New("GetWxOpenIdByMobileList, Err: " + e.Error())
+		err = errors.New("GetWxOpenIdByMobileSliceList, Err: " + e.Error() + configCode)
 		return
 	}
 	if len(openIdList) == 0 {

+ 1 - 1
services/wx_template_msg.go

@@ -413,7 +413,7 @@ func SendActivitieCancelSignTemplateMsg(user *models.WxUserItem, activityDetail
 	}()
 	//获取销售手机号
 	sellerItemQy, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	if err != nil {
 		return
 	}
 	configCode := utils.TPL_MSG_NEI_RONG_ZU

+ 1 - 0
utils/constants.go

@@ -118,6 +118,7 @@ const (
 	COMPANY_PRODUCT_FICC_NAME = "ficc"
 	COMPANY_PRODUCT_RAI_ID    = 2
 	COMPANY_PRODUCT_RAI_NAME  = "权益"
+	ROLE_TYPE_RAI_PRODUCT     = "权益产品"
 )
 
 const (