Browse Source

Merge branch 'need/cygx_1006' of http://8.136.199.33:3000/hongze/hongze_mfyx into debug

zhangchuanxing 4 months ago
parent
commit
ffc17b8534

+ 2 - 2
controllers/base_auth.go

@@ -53,7 +53,7 @@ func (this *BaseAuthController) Prepare() {
 			session, err := models.GetSessionByToken(authorization)
 			if err != nil {
 				if err.Error() == utils.ErrNoRow() {
-					go utils.SendAlarmMsg(fmt.Sprint("信息已变更,请重新登陆!authorization:", authorization, "Url:", uri), 2)
+					//go utils.SendAlarmMsg(fmt.Sprint("信息已变更,请重新登陆!authorization:", authorization, "Url:", uri), 2)
 					this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "Token 信息已变更:Token: " + authorization}, false, false)
 					this.StopRun()
 					return
@@ -71,7 +71,7 @@ func (this *BaseAuthController) Prepare() {
 			wxUser, err := services.GetWxUserItemByOpenId(session.OpenId)
 			if err != nil && err != services.ERR_USER_NOT_BIND {
 				if err.Error() == utils.ErrNoRow() {
-					go utils.SendAlarmMsg(fmt.Sprint("信息已变更,请重新登陆!authorization:", authorization, "Url:", uri), 2)
+					//go utils.SendAlarmMsg(fmt.Sprint("信息已变更,请重新登陆!authorization:", authorization, "Url:", uri), 2)
 					this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "获取信息失败 " + strconv.Itoa(session.UserId)}, false, false)
 					this.StopRun()
 					return

+ 2 - 2
controllers/base_auth_mobile.go

@@ -50,7 +50,7 @@ func (this *BaseAuthMobileController) Prepare() {
 				session, err := models.GetSessionByToken(authorization)
 				if err != nil {
 					if err.Error() == utils.ErrNoRow() {
-						go utils.SendAlarmMsg(fmt.Sprint("信息已变更,请重新登陆!authorization:", authorization, "Url:", uri), 2)
+						//go utils.SendAlarmMsg(fmt.Sprint("信息已变更,请重新登陆!authorization:", authorization, "Url:", uri), 2)
 						this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "Token 信息已变更:Token: " + authorization}, false, false)
 						this.StopRun()
 						return
@@ -69,7 +69,7 @@ func (this *BaseAuthMobileController) Prepare() {
 				//wxUser, err := models.GetWxUserAouthByMobile(session.Mobile)
 				if err != nil && err != services.ERR_USER_NOT_BIND {
 					if err.Error() == utils.ErrNoRow() {
-						go utils.SendAlarmMsg(fmt.Sprint("信息已变更,请重新登陆!authorization:", authorization, "Url:", uri), 2)
+						//go utils.SendAlarmMsg(fmt.Sprint("信息已变更,请重新登陆!authorization:", authorization, "Url:", uri), 2)
 						this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "获取信息失败 " + strconv.Itoa(session.UserId)}, false, false)
 						this.StopRun()
 						return

+ 2 - 0
controllers/yanxuan_special.go

@@ -197,6 +197,8 @@ func (this *BaseAuthMobileController) Detail() {
 		item.IsLikeCount = true
 	}
 
+	item.Pv += item.HzPv // 添加弘则PV
+
 	//记录分享来源
 	if inviteShareCode != "" {
 		go services.AddCygxUserAdminShareHistory(user, utils.CYGX_OBJ_YANXUANSPECIAL, item.Title, inviteShareCode, specialId)

+ 19 - 0
models/cygx_seller_mobile_map.go

@@ -0,0 +1,19 @@
+package models
+
+import "github.com/beego/beego/v2/client/orm"
+
+//权益销售手机号映射关系表
+
+type CygxSellerMobileMap struct {
+	RealName       string `description:"销售姓名"`
+	Mobile         string `description:"销售手机号"`
+	ServerRealName string `description:"服务销售姓名"`
+	ServerMobile   string `description:"服务销售手机号"`
+}
+
+func GetCygxSellerMobileMap() (items []*CygxSellerMobileMap, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT *  FROM cygx_seller_mobile_map  LIMIT  100 `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 20 - 2
models/cygx_yanxuan_special.go

@@ -56,8 +56,9 @@ type CygxYanxuanSpecialItem struct {
 	ContentHasImg   int  //正文是否包含图片 1包含 0不包含
 	ContentHasStyle bool //正文是否包含格式
 	Docs            []Doc
-	Pv              string `description:"Pv"`
-	Uv              string `description:"Uv"`
+	Pv              int    `description:"Pv"`
+	Uv              int    `description:"Uv"`
+	HzPv            int    `description:"HzPv"`
 	MomentsImg      string `description:"分享到朋友圈的封面图片"`
 	LikeCount       int    `comment:"点赞数量"`
 	IsLikeCount     bool   `comment:"是否点赞"`
@@ -113,6 +114,7 @@ type CygxYanxuanSpecialCenterResp struct {
 	Source              string   `description:"来源"`
 	Pv                  int      `description:"Pv"`
 	Uv                  int      `description:"Uv"`
+	HzPv                int      `description:"HzPv"`
 	PublishDate         string   // 提审过审或驳回时间      string `description:"核心观点"`
 	BodyHighlight       []string `description:"搜索高亮展示结果"`
 	LabelKeyword        string   `description:"标签关键词"`
@@ -322,6 +324,14 @@ func UpdateYanxuanSpecialPv(id int) (err error) {
 	return
 }
 
+// UpdateYanxuanSpecialHzPv 修改研选专栏的阅读弘则Pv
+func UpdateYanxuanSpecialHzPv(id int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_yanxuan_special SET hz_pv=hz_pv+1 WHERE id = ? `
+	_, err = o.Raw(sql, id).Exec()
+	return
+}
+
 // UpdateYanxuanSpecialUv 修改研选专栏的阅读Uv
 func UpdateYanxuanSpecialUv(id int) (err error) {
 	o := orm.NewOrm()
@@ -330,6 +340,14 @@ func UpdateYanxuanSpecialUv(id int) (err error) {
 	return
 }
 
+// UpdateYanxuanSpecialHzUv 修改研选专栏的阅读弘则Uv
+func UpdateYanxuanSpecialHzUv(id int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_yanxuan_special SET hz_uv=hz_uv+1 WHERE id = ? `
+	_, err = o.Raw(sql, id).Exec()
+	return
+}
+
 func UpdateYanxuanSpecialPvNUm(pv, id int) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE cygx_yanxuan_special SET pv = ? WHERE id = ? `

+ 29 - 5
services/cygx_yanxuan_special_company.go

@@ -93,6 +93,22 @@ func AddSpecialRecord(user *models.WxUserItem, specialId, stopTime int) (err err
 					return
 				}
 			}
+		} else {
+			//专栏Pv数量进行加一
+			e = models.UpdateYanxuanSpecialHzPv(specialId)
+			if e != nil {
+				err = errors.New("UpdateYanxuanSpecialHzPv, Err: " + e.Error())
+				return
+			}
+
+			//如果没有阅读过,那么就给专栏文章的UV、作者的UV进行加一
+			if totalRecord == 0 {
+				e = models.UpdateYanxuanSpecialHzUv(specialId)
+				if e != nil {
+					err = errors.New("UpdateYanxuanSpecialHzUv, Err: " + e.Error())
+					return
+				}
+			}
 		}
 	}
 
@@ -133,16 +149,24 @@ func GetYanxuanSpecialRecordByYanxuanSpecialId(articleIds []int) (mapResp map[in
 	}
 	var condition string
 	var pars []interface{}
-	condition = ` AND yanxuan_special_id IN (` + utils.GetOrmInReplace(lenIds) + `) `
+	//condition = ` AND yanxuan_special_id IN (` + utils.GetOrmInReplace(lenIds) + `) `
+	//pars = append(pars, articleIds)
+	//listPv, e := models.GetCygxYanxuanSpecialRecordListPv(condition, pars)
+	//if e != nil {
+	//	err = errors.New("GetCygxArticleHistoryRecordNewpvListPvCy, Err: " + e.Error())
+	//	return
+	//}
+	condition += ` AND id  IN (` + utils.GetOrmInReplace(lenIds) + `) `
 	pars = append(pars, articleIds)
-	listPv, e := models.GetCygxYanxuanSpecialRecordListPv(condition, pars)
-	if e != nil {
-		err = errors.New("GetCygxArticleHistoryRecordNewpvListPvCy, Err: " + e.Error())
+	listPv, e := models.GetYanxuanSpecialListBycondition(condition, pars, 0, lenIds)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetYanxuanSpecialListBycondition, Err: " + e.Error())
 		return
 	}
+
 	mapResp = make(map[int]int, 0)
 	for _, v := range listPv {
-		mapResp[v.YanxuanSpecialId] = v.Pv
+		mapResp[v.Id] = v.Pv + v.HzPv
 	}
 	return
 }

+ 11 - 0
services/wechat_send_msg.go

@@ -148,6 +148,17 @@ func SendPermissionApplyTemplateMsg(realName, companyName, mobile, applyMethod,
 				err = errors.New("GetSellerByAdminId, Err: " + e.Error())
 				return
 			}
+			listSellerMobile, e := models.GetCygxSellerMobileMap()
+			if e != nil {
+				err = errors.New("GetCygxSellerMobileMap, Err: " + e.Error())
+				return
+			}
+			//mapMobile := make(map[string]string)
+			for _, vm := range listSellerMobile {
+				if adminShare.Mobile == vm.ServerMobile {
+					adminShare.Mobile = vm.Mobile
+				}
+			}
 			mobileOpenid = sealldetail.Mobile + "," + adminShare.Mobile
 		} else {
 			mobileOpenid = sealldetail.Mobile

+ 11 - 0
services/wx_category_template_msg.go

@@ -912,6 +912,17 @@ func SendPermissionApplyTemplateMsgAdminByYxCategory(req models.ApplyTryReq, com
 					err = errors.New("GetSellerByAdminId, Err: " + e.Error())
 					return
 				}
+				listSellerMobile, e := models.GetCygxSellerMobileMap()
+				if e != nil {
+					err = errors.New("GetCygxSellerMobileMap, Err: " + e.Error())
+					return
+				}
+				//mapMobile := make(map[string]string)
+				for _, vm := range listSellerMobile {
+					if adminShare.Mobile == vm.ServerMobile {
+						adminShare.Mobile = vm.Mobile
+					}
+				}
 				mobileOpenid = sealldetail.Mobile + "," + adminShare.Mobile
 			} else {
 				mobileOpenid = sealldetail.Mobile