zhangchuanxing 3 hónapja
szülő
commit
1c2e877a2c

+ 36 - 0
controllers/company_user.go

@@ -6478,3 +6478,39 @@ func (this *CompanyUserController) ListMoveLog() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 修改联系人外呼手机号
+// @Description 修改联系人外呼手机号接口
+// @Param	request	body models.PotentialUserDealReq true "type json string"
+// @Success Ret=200 修改成功
+// @router /user/edit/outbound_mobile [post]
+func (this *CompanyController) EditUserOutboundMobile() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req models.EditUserOutboundMobileReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	if !utils.ValidateMobileFormatat(req.OutboundMobile) {
+		br.Msg = "手机号格式有误"
+		return
+	}
+	err = models.UpdateUserOutboundMobile(req.OutboundMobile, req.OutboundCountryCode, req.UserId)
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "标记成功"
+}

+ 15 - 0
controllers/cygx/user.go

@@ -316,6 +316,18 @@ func (this *UserController) List() {
 		UserRemindListMap := cygxService.GetCygxUserRemindListMap(userIdArr)
 		mapIsUserMaker := cygxService.GetCompanyProductIsUserMakerByCompanyIds(companyIds) //根据公司ID获取近四周之内有决策人互动的客户
 		userHaveMoveMap := services.GetWxUserHaveMoveMap(mobilesSlice)                     // 处理用户是否移动过按钮回显
+
+		mfyxuserRecordRegisterList, err := models.GetUserRecordRegisterByUserIdsMyfx(userIds)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败 GetUserRecordRegisterByUserIdsMyfx ,Err:" + err.Error()
+			return
+		}
+		mfyxuserRecordRegisterMap := make(map[int]string)
+		for _, userRecordRegister := range mfyxuserRecordRegisterList {
+			//如果注册时间早于网页版的,或者网页版没有注册,就用这里的时间替换
+			mfyxuserRecordRegisterMap[userRecordRegister.UserId] = userRecordRegister.CreateTime.Format(utils.FormatDateTime)
+		}
 		for k, v := range list {
 			for _, vsplit := range splitList {
 				if vsplit.UserId == v.UserId {
@@ -342,6 +354,9 @@ func (this *UserController) List() {
 			if v.Mobile != "" {
 				v.HaveMoveButton = userHaveMoveMap[v.Mobile]
 			}
+			if mfyxuserRecordRegisterMap[int(v.UserId)] != "" {
+				list[k].MfyxIsBinding = true
+			}
 		}
 		for k := range list {
 			list[k].InteractionNum = list[k].HistoryNum + list[k].CountNum + list[k].IndustryFllowNum + list[k].DepartmentFollowNum + list[k].KeyWordNum + list[k].OnLineNum + list[k].OfficeNum + list[k].ChartNum + list[k].TripNum + list[k].RoadshowVideoNum + list[k].ActivityVideoNum + list[k].ActivityVoiceNum + list[k].YanxuanspecialNum

+ 2 - 0
models/company/company_user.go

@@ -76,6 +76,8 @@ type CompanyUser struct {
 	MfyxIsBinding            bool      `description:"买方研选是否绑定"`
 	MfyxBindingTime          string    `description:"买方研选绑定时间"`
 	HaveMoveButton           bool      `description:"是否移动过"`
+	OutboundMobile           string    `description:"外呼手机号"`
+	OutboundCountryCode      string    `description:"外呼手机号区号"`
 }
 
 type CompanyUserListResp struct {

+ 1 - 0
models/cygx/cygx_user.go

@@ -53,6 +53,7 @@ type CygxCompanyUser struct {
 	IsSubscribeCygx             int    `description:"是否关注了查研观向微信公众号: 0-未关注; 1-已关注"`
 	IsUserMaker                 int    `description:"近四周之内是否包含决策人互动过 ,0否,1是"`
 	HaveMoveButton              bool   `description:"是否移动过"`
+	MfyxIsBinding               bool   `description:"买方研选是否绑定"`
 }
 
 type CompanyUserListResp struct {

+ 15 - 0
models/wx_user.go

@@ -636,3 +636,18 @@ func GetWxUserItemByUserId(userId int) (item *WxUserItem, err error) {
 	err = o.Raw(sql, userId).QueryRow(&item)
 	return
 }
+
+// 修改用户外呼号请求
+type EditUserOutboundMobileReq struct {
+	UserId              int    `description:"用户id"`
+	OutboundMobile      string `description:"外呼手机号"`
+	OutboundCountryCode string `description:"外呼手机号区号"`
+}
+
+// 修改用户外呼手机号
+func UpdateUserOutboundMobile(outboundMobile, outboundCountryCode string, userId int) (err error) {
+	o := orm.NewOrm()
+	sql := ` UPDATE wx_user SET outbound_mobile=? , outbound_country_code = ? WHERE user_id=? `
+	_, err = o.Raw(sql, outboundMobile, outboundCountryCode, userId).Exec()
+	return
+}

+ 9 - 0
routers/commentsRouter.go

@@ -9817,6 +9817,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:CompanyController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:CompanyController"],
+        beego.ControllerComments{
+            Method: "EditUserOutboundMobile",
+            Router: `/user/edit/outbound_mobile`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:CompanyController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:CompanyController"],
         beego.ControllerComments{
             Method: "CompanyUserExport",