Browse Source

no message

xingzai 11 months ago
parent
commit
f475f6f971
5 changed files with 15 additions and 7 deletions
  1. 1 4
      controllers/user.go
  2. 1 1
      controllers/wechat.go
  3. 7 1
      controllers/yanxuan_special.go
  4. 4 1
      services/user.go
  5. 2 0
      services/user_admin_share.go

+ 1 - 4
controllers/user.go

@@ -73,7 +73,7 @@ func (this *UserCommonController) Login() {
 		return
 	}
 
-	user, err := services.BindWxUser(mobile, "86")
+	user, err := services.BindWxUser(mobile, "86", inviteShareCode)
 	//user, err := models.GetWxUserItemByMobile(mobile)
 	if err != nil {
 		br.Msg = "登录失败"
@@ -127,9 +127,6 @@ func (this *UserCommonController) Login() {
 
 	{
 		services.AddInviteCompany(user) //记录通过三方合作机构过来的公司
-		if inviteShareCode != "" {      //记录分享来源
-			go services.AddCygxUserAdminShareHistory(user, "login", "", inviteShareCode, 0) //记录分享来源
-		}
 	}
 
 	resp := new(models.LoginResp)

+ 1 - 1
controllers/wechat.go

@@ -232,7 +232,7 @@ func (this *MobileWechatController) WechatBindMobile() {
 		br.Msg = "验证码错误,请重新输入"
 		return
 	}
-	user, err := services.BindWxUser(mobile, "86")
+	user, err := services.BindWxUser(mobile, "86", "")
 	if err != nil {
 		br.Msg = "登录失败"
 		br.ErrMsg = "获取用户信息失败,GetUserDetailByMobile Err:" + err.Error()

+ 7 - 1
controllers/yanxuan_special.go

@@ -154,6 +154,7 @@ func (this *YanxuanSpecialNoLoginController) List() {
 // @Title 专栏详情
 // @Description 专栏详情
 // @Param	request	body help_doc.AddHelpDocReq true "type json string"
+// @Param   InviteShareCode   query   string  false       "销售账号邀请码"
 // @Success 200 {object} models.AddEnglishReportResp
 // @router /detail [get]
 func (this *YanxuanSpecialNoLoginController) Detail() {
@@ -171,7 +172,7 @@ func (this *YanxuanSpecialNoLoginController) Detail() {
 	}
 
 	specialId, _ := this.GetInt("Id", 0)
-
+	inviteShareCode := this.GetString("InviteShareCode")
 	if specialId <= 0 {
 		br.Msg = "参数错误"
 		br.ErrMsg = "参数错误"
@@ -184,6 +185,11 @@ func (this *YanxuanSpecialNoLoginController) Detail() {
 		br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
 		return
 	}
+
+	//记录分享来源
+	if inviteShareCode != "" {
+		go services.AddCygxUserAdminShareHistory(sysUser, utils.CYGX_OBJ_YANXUANSPECIAL, item.Title, inviteShareCode, specialId)
+	}
 	if item.MyCollectNum > 0 {
 		item.IsCollect = 1
 	}

+ 4 - 1
services/user.go

@@ -231,7 +231,7 @@ func GetUserTypeZhengShi(companyId int) (userType int, permissionStrnew, permiss
 }
 
 // 用户绑定
-func BindWxUser(mobile, countryCode string) (wxUser *models.WxUserItem, err error) {
+func BindWxUser(mobile, countryCode, inviteShareCode string) (wxUser *models.WxUserItem, err error) {
 	if mobile == "" {
 		err = errors.New("手机号或邮箱必填一个")
 		return
@@ -271,6 +271,9 @@ func BindWxUser(mobile, countryCode string) (wxUser *models.WxUserItem, err erro
 		user.UserId = int(tmpUserId)
 		userId = int(tmpUserId)
 		wxUser, err = models.GetWxUserItemByUserId(userId)
+		if inviteShareCode != "" { //记录分享来源
+			go AddCygxUserAdminShareHistory(wxUser, "login", "", inviteShareCode, 0) //记录分享来源
+		}
 	} else {
 		userId = wxUser.UserId
 		err = models.BindUserOutboundMobile(mobile, countryCode, userId)

+ 2 - 0
services/user_admin_share.go

@@ -101,6 +101,8 @@ func AddCygxUserAdminShareHistory(user *models.WxUserItem, source, sourceTitle,
 		item.Action = "查看活动"
 	case utils.CYGX_OBJ_ARTICLE:
 		item.Action = "查看报告"
+	case utils.CYGX_OBJ_YANXUANSPECIAL:
+		item.Action = "查看专栏"
 	case "login":
 		item.Action = "注册"
 	}