浏览代码

no message

xingzai 1 年之前
父节点
当前提交
ee763de2b9
共有 4 个文件被更改,包括 24 次插入10 次删除
  1. 6 0
      controllers/activity.go
  2. 6 1
      controllers/article.go
  3. 5 3
      controllers/user.go
  4. 7 6
      models/user.go

+ 6 - 0
controllers/activity.go

@@ -309,6 +309,7 @@ func (this *ActivityCoAntroller) ScheduleList() {
 // @Description 获取活动详情接口
 // @Param   ActivityId   query   int  true       "活动ID"
 // @Param   IsSendWx   query   int  false       "是否是通过微信模版进来的 1是,其它否"
+// @Param   InviteShareCode   query   string  false       "销售账号邀请码"
 // @Success Ret=200 {object} models.CygxActivityResp
 // @router /detail [get]
 func (this *ActivityCoAntroller) Detail() {
@@ -331,6 +332,7 @@ func (this *ActivityCoAntroller) Detail() {
 		br.Msg = "请输入活动ID"
 		return
 	}
+	inviteShareCode := this.GetString("InviteShareCode")
 	resp := new(models.CygxActivityResp)
 	activityInfo, err := models.GetAddActivityInfoByIdShow(uid, activityId)
 	if err != nil && err.Error() != utils.ErrNoRow() {
@@ -343,6 +345,10 @@ func (this *ActivityCoAntroller) Detail() {
 		br.ErrMsg = "活动ID错误,Err:" + "activityId:" + strconv.Itoa(activityId)
 		return
 	}
+	//记录分享来源
+	if inviteShareCode != "" {
+		go services.AddCygxUserAdminShareHistory(user, utils.CYGX_OBJ_ACTIVITY, activityInfo.ActivityName, inviteShareCode, activityId)
+	}
 	// 判断是否属于研选类型的活动
 	if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
 		resp.IsResearch = true

+ 6 - 1
controllers/article.go

@@ -41,6 +41,7 @@ type ArticleControllerMobile struct {
 // @Description 获取报告详情接口
 // @Param   ArticleId   query   int  true       "报告ID"
 // @Param   IsSendWx   query   int  false       "是否是通过微信模版进来的 1是,其它否"
+// @Param   InviteShareCode   query   string  false       "销售账号邀请码"
 // @Success 200 {object} models.ArticleDetailResp
 // @router /detail [get]
 func (this *ArticleController) Detail() {
@@ -65,6 +66,7 @@ func (this *ArticleController) Detail() {
 		br.ErrMsg = "文章不存在,文章ID错误"
 		return
 	}
+	inviteShareCode := this.GetString("InviteShareCode")
 	detail := new(models.ArticleDetail)
 	//detailInit := new(models.ArticleDetail) // 初始化的文章信息,用来处理body 内容回显
 	hasPermission := 0
@@ -83,7 +85,10 @@ func (this *ArticleController) Detail() {
 		br.ErrMsg = "获取信息失败,Err:" + err.Error()
 		return
 	}
-
+	//记录分享来源
+	if inviteShareCode != "" {
+		go services.AddCygxUserAdminShareHistory(user, utils.CYGX_OBJ_ARTICLE, detail.Title, inviteShareCode, articleId)
+	}
 	detail.PublishDate = utils.TimeRemoveHms2(detail.PublishDate)
 	detail.Body = html.UnescapeString(detail.Body)
 	detail.Body = strings.Replace(detail.Body, "<p data-f-id=\"pbf\" style=\"text-align: center; font-size: 14px; margin-top: 30px; opacity: 0.65; font-family: sans-serif;\">Powered by <a href=\"https://www.froala.com/wysiwyg-editor?pb=1\" title=\"Froala Editor\">Froala Editor</a></p>", "", -1)

+ 5 - 3
controllers/user.go

@@ -46,7 +46,7 @@ func (this *UserController) Login() {
 		br.Ret = 408
 		return
 	}
-
+	inviteShareCode := req.InviteShareCode
 	unionId := this.User.UnionId
 	openId := this.User.OpenId
 	if unionId == "" {
@@ -188,9 +188,11 @@ func (this *UserController) Login() {
 		}
 	}
 
-	//先关注后登录,更新用户是否关注过查研观向小助手公众号
 	{
-		services.UpdateCygxSubscribe(userId, unionId)
+		services.UpdateCygxSubscribe(userId, unionId) //先关注后登录,更新用户是否关注过查研观向小助手公众号
+		if inviteShareCode != "" {                    //记录分享来源
+			go services.AddCygxUserAdminShareHistory(user, "login", "", inviteShareCode, 0) //记录分享来源
+		}
 	}
 
 	resp := new(models.LoginResp)

+ 7 - 6
models/user.go

@@ -64,12 +64,13 @@ type UserPermission struct {
 }
 
 type LoginReq struct {
-	LoginType     int    `description:"登录方式:1:微信手机,2:邮箱,3:自定义手机登录"`
-	Mobile        string `description:"手机号"`
-	Email         string `description:"邮箱"`
-	VCode         string `description:"验证码"`
-	CountryCode   string `description:"区号"`
-	ShareUserCode string `description:"分享人的分享码"`
+	LoginType       int    `description:"登录方式:1:微信手机,2:邮箱,3:自定义手机登录"`
+	Mobile          string `description:"手机号"`
+	Email           string `description:"邮箱"`
+	VCode           string `description:"验证码"`
+	CountryCode     string `description:"区号"`
+	ShareUserCode   string `description:"分享人的分享码"`
+	InviteShareCode string `description:"销售账号邀请码"`
 }
 
 func PcBindMobile(unionId, mobile string, userId, loginType int) (wxUserId int, err error) {