Эх сурвалжийг харах

Merge branch 'master' of http://8.136.199.33:3000/hongze/hz_crm_api into cygx/cygx_12.4

xingzai 1 жил өмнө
parent
commit
c7ab96ae29

+ 7 - 0
controllers/cygx/micro_roadshow.go

@@ -223,6 +223,13 @@ func (this *MicroRoadshowController) Add() {
 		return
 	}
 
+	charInfo, errCategory := cygx.GetCategoryInfoById(nameItem.PermissionId)
+	if errCategory != nil {
+		br.Msg = "获取品种信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + errCategory.Error()
+		return
+	}
+	nameItem.PermissionName = charInfo.PermissionName
 	publishDate, err := time.Parse(utils.FormatDate, req.PublishDate)
 	if err != nil {
 		br.Msg = "时间格式转换失败"

+ 1 - 1
controllers/cygx/morning_meeting_review.go

@@ -90,7 +90,7 @@ func (this *MorningMeetingController) List() {
 		return
 	}
 
-	condition += ` ORDER BY meeting_time DESC  `
+	condition += ` ORDER BY publish_time DESC  `
 	resp := new(cygx.CygxMorningMeetingReviewsList)
 	list, err := cygx.GetCygxMorningMeetingReviewsList(condition, pars, startSize, pageSize)
 	if err != nil {

+ 38 - 10
controllers/cygx/yanxuan_special.go

@@ -55,18 +55,29 @@ func (this *YanxuanSpecialController) Add() {
 		br.Msg = "请输入手机号"
 		return
 	}
+
+	//获取关联公司的用户信息
+	infoUser, err := cygx.GetUserAndCompanyNameList(req.UserId)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+
 	rnd := utils.GetRandInt(1, 5)
 	item := cygx.CygxYanxuanSpecialAuthor{
-		UserId:     req.UserId,
-		RealName:   req.RealName,
-		Mobile:     req.Mobile,
-		CreateTime: time.Now(),
-		ModifyTime: time.Now(),
-		HeadImg:    utils.CYGX_YANXUAN_SPECIAL_HEAD_IMG_URL + strconv.Itoa(rnd) + ".png",
-		BgImg:      utils.CYGX_YANXUAN_SPECIAL_BG_IMG_URL + strconv.Itoa(rnd) + "a.png",
-		BgImgDown:  utils.CYGX_YANXUAN_SPECIAL_BG_IMG_URL + strconv.Itoa(rnd) + "b.png",
-		BgImgPc:    utils.CYGX_YANXUAN_SPECIAL_BG_IMG_URL_PC + strconv.Itoa(rnd) + ".png",
-		Status:     1,
+		UserId:      req.UserId,
+		RealName:    req.RealName,
+		Mobile:      req.Mobile,
+		CompanyName: infoUser.CompanyName,
+		CompanyId:   infoUser.CompanyId,
+		CreateTime:  time.Now(),
+		ModifyTime:  time.Now(),
+		HeadImg:     utils.CYGX_YANXUAN_SPECIAL_HEAD_IMG_URL + strconv.Itoa(rnd) + ".png",
+		BgImg:       utils.CYGX_YANXUAN_SPECIAL_BG_IMG_URL + strconv.Itoa(rnd) + "a.png",
+		BgImgDown:   utils.CYGX_YANXUAN_SPECIAL_BG_IMG_URL + strconv.Itoa(rnd) + "b.png",
+		BgImgPc:     utils.CYGX_YANXUAN_SPECIAL_BG_IMG_URL_PC + strconv.Itoa(rnd) + ".png",
+		Status:      1,
 	}
 
 	_, err = cygx.AddCygxYanxuanSpecialAuthor(&item)
@@ -163,6 +174,23 @@ func (this *YanxuanSpecialController) AuthorList() {
 	br.Msg = "获取成功"
 }
 
+//V12.0.1 上线脚本
+//func init() {
+//	list, err := cygx.GetYanxuanSpecialAuthorList()
+//	if err != nil {
+//		fmt.Println(err)
+//	}
+//	for _, v := range list {
+//		//获取关联公司的用户信息
+//		infoUser, err := cygx.GetUserAndCompanyNameList(v.UserId)
+//		if err != nil {
+//			fmt.Println(err)
+//		}
+//		err = cygx.UpdateSpecialAuthorComapony(infoUser.UserId, infoUser.CompanyId, infoUser.CompanyName)
+//		fmt.Println(infoUser.UserId)
+//	}
+//}
+
 // @Title 审核列表
 // @Description 审核列表
 // @Param	request	body help_doc.AddHelpDocReq true "type json string"

+ 3 - 3
controllers/yb/apply_record.go

@@ -374,9 +374,6 @@ func (this *ApplyRecordController) UserApplyList() {
 		} else if v.Email != "" {
 			emailsSlice = append(emailsSlice, v.Email)
 		}
-		if v.MarkGroup == "" {
-			v.OpStatus = 0
-		}
 	}
 	//统计申请数
 	userApplyTotalMap := make(map[int]int)
@@ -412,6 +409,9 @@ func (this *ApplyRecordController) UserApplyList() {
 	}()
 	w2.Wait()
 	for k, v := range list {
+		if v.OpStatus == 1 && v.MarkGroup == "" {
+			list[k].OpStatus = 0
+		}
 		sourceStr := ""
 		if v.ApplyRecordId > 0 {
 			if v.SourceAgent == 3 {

+ 11 - 0
models/cygx/cygx_yanxuan_special_user.go

@@ -21,6 +21,8 @@ type CygxYanxuanSpecialAuthor struct {
 	BgImgDown    string    // 背景图下部分
 	BgImgPc      string    // pc背景图
 	Status       int       // 1启用2禁用
+	CompanyId    int       `description:"公司id"`
+	CompanyName  string    `description:"公司名称"`
 }
 
 type CygxYanxuanSpecialAuthorItem struct {
@@ -76,3 +78,12 @@ FROM
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+// 启用禁用作者
+func UpdateSpecialAuthorComapony(userId, CompanyId int, CompanyName string) (err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := ``
+	sql = `UPDATE cygx_yanxuan_special_author SET company_id=?,company_name = ?  WHERE user_id = ? `
+	_, err = o.Raw(sql, CompanyId, CompanyName, userId).Exec()
+	return
+}

+ 1 - 1
models/yb/apply_record.go

@@ -158,7 +158,7 @@ SELECT
 	y.is_move,
 	y.source,
 	y.from_page,
-	IF(y.mark_group = '' OR y.mark_group IS NULL, a.mark_group, y.mark_group) AS mark_group,
+	IF(y.mark_group = '' OR y.mark_group IS NULL OR y.apply_record_id = 0 OR y.apply_record_id IS NULL , a.mark_group, y.mark_group) AS mark_group,
     y.company_name as user_company_name
     #bp.seller_id,
 	#bp.seller_name

+ 2 - 2
services/wechat_send_msg.go

@@ -2012,7 +2012,7 @@ func SendWxMsgWithCygxMorningMeeting(meetingId, industryId int, industryName str
 	sendInfo := new(SendWxTemplate)
 	//sendInfo.First = "【" + industryName + "】产业,有新的跟踪点评"
 	sendInfo.Keyword1 = "【" + industryName + "】产业,有新的跟踪点评"
-	sendInfo.Keyword2 = "点评内容:" + content
+	sendInfo.Keyword2 = content
 	sendInfo.Keyword3 = meetingTime
 	sendInfo.Remark = "点击进入小程序对应的产业资源包页面"
 	if utils.RunMode == "release" {
@@ -2020,7 +2020,7 @@ func SendWxMsgWithCygxMorningMeeting(meetingId, industryId int, industryName str
 	} else {
 		sendInfo.TemplateId = utils.TemplateIdByProductXzs
 	}
-	sendInfo.RedirectUrl = utils.WX_MSG_PATH_INDUSTRY_DETAIL + strconv.Itoa(industryId) + "&IsSendWx=1"
+	sendInfo.RedirectUrl = utils.WX_MSG_PATH_INDUSTRY_DETAIL + strconv.Itoa(industryId) + "&IsSendWx=1&ChapterId=" + strconv.Itoa(chapter.Id)
 	sendInfo.RedirectTarget = 3
 	sendInfo.Resource = strconv.Itoa(industryId)
 	sendInfo.SendType = utils.TEMPLATE_MSG_CYGX_MORNING_MEETING

+ 5 - 5
services/yb/apply_record.go

@@ -284,10 +284,10 @@ func MarkGroupApplyRecord(applyRecordId, adminId, userId int, groupName string)
 			}
 			return
 		}
-		if applyRecord.OpStatus != 0 {
-			err = errors.New(fmt.Sprint("申请记录处理状态有误:", err))
-			return
-		}
+		//if applyRecord.OpStatus != 0 {
+		//	err = errors.New(fmt.Sprint("申请记录处理状态有误:", err))
+		//	return
+		//}
 		if userId > 0 && userId != applyRecord.UserId {
 			err = errors.New(fmt.Sprint("申请记录ID与用户ID不匹配:", err))
 			return
@@ -317,7 +317,7 @@ func MarkGroupApplyRecord(applyRecordId, adminId, userId int, groupName string)
 		return
 	}
 	// 未处理过则进行标记
-	if wxUser.IsDeal == 0 {
+	if wxUser.IsDeal == 0 || wxUser.MarkGroup == "" {
 		wxUser.IsDeal = 1
 		wxUser.MarkGroup = groupName
 		wxUser.LastUpdatedTime = time.Now()