|
@@ -986,14 +986,8 @@ func (this *UserController) CountryCcode() {
|
|
|
br.Ret = 408
|
|
|
return
|
|
|
}
|
|
|
- detail, err := models.GetUserDetailByUserId(uid)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
resp := new(models.CountryCode)
|
|
|
- if len(detail.Mobile) != 11 && detail.CountryCode == "" {
|
|
|
+ if user.CountryCode == "" {
|
|
|
resp.IsNeedAddCountryCode = true
|
|
|
}
|
|
|
br.Ret = 200
|
|
@@ -1014,7 +1008,6 @@ func (this *UserController) AddCountryCcode() {
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
user := this.User
|
|
|
- uid := user.UserId
|
|
|
if user == nil {
|
|
|
br.Msg = "请登录"
|
|
|
br.ErrMsg = "请登录,用户信息为空"
|
|
@@ -1028,7 +1021,7 @@ func (this *UserController) AddCountryCcode() {
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- err = models.AddCountryCode(req.CountryCode, uid)
|
|
|
+ err = models.AddCountryCode(req.CountryCode, user)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
@@ -1039,39 +1032,39 @@ func (this *UserController) AddCountryCcode() {
|
|
|
br.Msg = "新增成功"
|
|
|
}
|
|
|
|
|
|
-// @Title 是否需要填写外呼手机号
|
|
|
-// @Description 获取是否需要填写外呼手机号接口
|
|
|
-// @Success 200 {object} models.CountryCode
|
|
|
-// @router /countryCcode/isNeedAddOutbound [get]
|
|
|
-func (this *UserController) OutboundMobile() {
|
|
|
- br := new(models.BaseResponse).Init()
|
|
|
- defer func() {
|
|
|
- this.Data["json"] = br
|
|
|
- this.ServeJSON()
|
|
|
- }()
|
|
|
- user := this.User
|
|
|
- uid := user.UserId
|
|
|
- if user == nil {
|
|
|
- br.Msg = "请登录"
|
|
|
- br.ErrMsg = "请登录,用户信息为空"
|
|
|
- br.Ret = 408
|
|
|
- return
|
|
|
- }
|
|
|
- if uid == 0 {
|
|
|
- br.Msg = "请登录"
|
|
|
- br.ErrMsg = "请登录,用户信息为空"
|
|
|
- br.Ret = 408
|
|
|
- return
|
|
|
- }
|
|
|
- resp := new(models.OutboundMobile)
|
|
|
- if user.OutboundMobile == "" {
|
|
|
- resp.IsNeedAddOutboundMobile = true
|
|
|
- }
|
|
|
- br.Ret = 200
|
|
|
- br.Success = true
|
|
|
- br.Msg = "获取成功"
|
|
|
- br.Data = resp
|
|
|
-}
|
|
|
+//// @Title 是否需要填写外呼手机号
|
|
|
+//// @Description 获取是否需要填写外呼手机号接口
|
|
|
+//// @Success 200 {object} models.CountryCode
|
|
|
+//// @router /countryCcode/isNeedAddOutbound [get]
|
|
|
+//func (this *UserController) OutboundMobile() {
|
|
|
+// br := new(models.BaseResponse).Init()
|
|
|
+// defer func() {
|
|
|
+// this.Data["json"] = br
|
|
|
+// this.ServeJSON()
|
|
|
+// }()
|
|
|
+// user := this.User
|
|
|
+// uid := user.UserId
|
|
|
+// if user == nil {
|
|
|
+// br.Msg = "请登录"
|
|
|
+// br.ErrMsg = "请登录,用户信息为空"
|
|
|
+// br.Ret = 408
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if uid == 0 {
|
|
|
+// br.Msg = "请登录"
|
|
|
+// br.ErrMsg = "请登录,用户信息为空"
|
|
|
+// br.Ret = 408
|
|
|
+// return
|
|
|
+// }
|
|
|
+// resp := new(models.OutboundMobile)
|
|
|
+// if user.OutboundMobile == "" && user.CountryCode == "" {
|
|
|
+// resp.IsNeedAddOutboundMobile = true
|
|
|
+// }
|
|
|
+// br.Ret = 200
|
|
|
+// br.Success = true
|
|
|
+// br.Msg = "获取成功"
|
|
|
+// br.Data = resp
|
|
|
+//}
|
|
|
|
|
|
// @Title 用户修改外呼手机号以及区号
|
|
|
// @Description 用户修改外呼手机号以及区号接口
|
|
@@ -1101,6 +1094,7 @@ func (this *UserController) AddOutboundMobile() {
|
|
|
}
|
|
|
if !utils.ValidateFixedTelephoneFormatat(req.OutboundMobile) && !utils.ValidateMobileFormatat(req.OutboundMobile) {
|
|
|
br.Msg = "号码格式有误,请重新填写!"
|
|
|
+ br.ErrMsg = "号码格式有误,请重新填写" + req.OutboundMobile
|
|
|
return
|
|
|
}
|
|
|
if req.OutboundMobile == "" {
|
|
@@ -1114,17 +1108,41 @@ func (this *UserController) AddOutboundMobile() {
|
|
|
if req.ActivityId == 0 {
|
|
|
err = models.AddOutboundMobile(item, uid)
|
|
|
} else {
|
|
|
- total, err := models.GetActivityCountByIdWithUid(item.ActivityId, uid)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- err = models.AddOutboundMobile(item, uid)
|
|
|
- if total == 0 {
|
|
|
- br.Msg = "报名信息不存在"
|
|
|
- br.ErrMsg = "报名信息不存在,Err:" + "活动ActivityId:" + strconv.Itoa(item.ActivityId) + "用户Uid:" + strconv.Itoa(uid)
|
|
|
- return
|
|
|
+ if user.Mobile == "" && user.OutboundMobile == "" {
|
|
|
+ items := new(models.CygxActivitySignup)
|
|
|
+ items.UserId = uid
|
|
|
+ items.ActivityId = req.ActivityId
|
|
|
+ items.CreateTime = time.Now()
|
|
|
+ items.Mobile = user.Mobile
|
|
|
+ items.Email = user.Email
|
|
|
+ items.CompanyId = user.CompanyId
|
|
|
+ items.CompanyName = user.CompanyName
|
|
|
+ items.SignupType = 1
|
|
|
+ items.FailType = 0
|
|
|
+ items.DoFailType = 0
|
|
|
+ items.OutboundMobile = req.OutboundMobile
|
|
|
+ items.CountryCode = req.OutboundCountryCode
|
|
|
+ _, errSignup := models.AddActivitySignup(items)
|
|
|
+ if errSignup != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "操作失败,Err:" + errSignup.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ err = models.AddOutboundMobile(item, uid)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ total, err := models.GetActivityCountByIdWithUid(item.ActivityId, uid)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ err = models.AddOutboundMobile(item, uid)
|
|
|
+ if total == 0 {
|
|
|
+ br.Msg = "报名信息不存在"
|
|
|
+ br.ErrMsg = "报名信息不存在,Err:" + "活动ActivityId:" + strconv.Itoa(item.ActivityId) + "用户Uid:" + strconv.Itoa(uid)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if err != nil {
|