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

Merge branch 'crm/crm_16.4' of http://8.136.199.33:3000/hongze/hz_crm_api

zhangchuanxing 2 сар өмнө
parent
commit
e6373546d3

+ 41 - 0
controllers/company_user.go

@@ -6478,3 +6478,44 @@ 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 req.OutboundMobile == "" {
+		br.Msg = "手机号不能为空"
+		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 = "标记成功"
+}

+ 1 - 0
controllers/cygx/user.go

@@ -316,6 +316,7 @@ func (this *UserController) List() {
 		UserRemindListMap := cygxService.GetCygxUserRemindListMap(userIdArr)
 		mapIsUserMaker := cygxService.GetCompanyProductIsUserMakerByCompanyIds(companyIds) //根据公司ID获取近四周之内有决策人互动的客户
 		userHaveMoveMap := services.GetWxUserHaveMoveMap(mobilesSlice)                     // 处理用户是否移动过按钮回显
+
 		for k, v := range list {
 			for _, vsplit := range splitList {
 				if vsplit.UserId == v.UserId {

+ 4 - 1
models/company/company_user.go

@@ -64,6 +64,7 @@ type CompanyUser struct {
 	IsFollow                 int       `description:"是否特别关注: 0-未关注; 1-已关注"`
 	IsSubscribeHzyj          int       `description:"是否关注了弘则研究微信公众号: 0-未关注; 1-已关注"`
 	IsSubscribeCygx          int       `description:"是否关注了查研观向微信公众号: 0-未关注; 1-已关注"`
+	IsSubscribeMfyx          int       `description:"是否关注了买方研选微信公众号: 0-未关注; 1-已关注"`
 	FiccViewTotal            int       `description:"ficc报告的阅读次数" json:"-"`
 	FiccLastViewTime         time.Time `description:"ficc报告最近一次阅读时间" json:"-"`
 	RaiViewTotal             int       `description:"权益报告的阅读次数" json:"-"`
@@ -76,6 +77,8 @@ type CompanyUser struct {
 	MfyxIsBinding            bool      `description:"买方研选是否绑定"`
 	MfyxBindingTime          string    `description:"买方研选绑定时间"`
 	HaveMoveButton           bool      `description:"是否移动过"`
+	OutboundMobile           string    `description:"外呼手机号"`
+	OutboundCountryCode      string    `description:"外呼手机号区号"`
 }
 
 type CompanyUserListResp struct {
@@ -137,7 +140,7 @@ func GetCompanyUserListCountV2(condition string, pars []interface{}, companyId i
 func GetCompanyUserListV2(condition string, pars []interface{}, companyId, startSize, pageSize int) (items []*CompanyUser, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
-				a.*, a.cygx_subscribe as is_subscribe_cygx,  c.subscribe AS is_subscribe_hzyj   
+				a.*, a.cygx_subscribe AS is_subscribe_cygx,  a.mfyx_subscribe AS is_subscribe_mfyx , c.subscribe AS is_subscribe_hzyj   
 			FROM
 				wx_user AS a
 			LEFT JOIN user_seller_relation AS b ON a.user_id = b.user_id

+ 5 - 0
models/cygx/cygx_user.go

@@ -51,8 +51,11 @@ type CygxCompanyUser struct {
 	Content                     string `description:"备注信息"`
 	IsRemind                    bool   `description:"是否添加互动提醒"`
 	IsSubscribeCygx             int    `description:"是否关注了查研观向微信公众号: 0-未关注; 1-已关注"`
+	IsSubscribeMfyx             int    `description:"是否关注了买方研选微信公众号: 0-未关注; 1-已关注"`
 	IsUserMaker                 int    `description:"近四周之内是否包含决策人互动过 ,0否,1是"`
 	HaveMoveButton              bool   `description:"是否移动过"`
+	MfyxIsBinding               bool   `description:"买方研选是否绑定"`
+	Position                    string `description:"职位"`
 }
 
 type CompanyUserListResp struct {
@@ -108,8 +111,10 @@ func GetCygxCompanyUserList(userCondition, keyWord, kwywordcondition, condition,
 			u.real_name,
 			u.is_register,
 			u.is_maker,
+			u.position,
 			u.user_label as  labels,
 			u.cygx_subscribe as is_subscribe_cygx, 
+			u.mfyx_subscribe as is_subscribe_mfyx, 
 			c.company_name,
 			c.company_id,
 			c.interaction_num as company_interaction_num,

+ 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",