|
@@ -1,6 +1,7 @@
|
|
|
package models
|
|
|
|
|
|
import (
|
|
|
+ "fmt"
|
|
|
"hongze/hongze_cygx/utils"
|
|
|
"rdluck_tools/orm"
|
|
|
"rdluck_tools/paging"
|
|
@@ -8,18 +9,20 @@ import (
|
|
|
)
|
|
|
|
|
|
type UserDetail struct {
|
|
|
- Headimgurl string `description:"用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空"`
|
|
|
- Mobile string `description:"手机号码"`
|
|
|
- Email string `description:"邮箱"`
|
|
|
- NickName string `description:"用户昵称"`
|
|
|
- RealName string `description:"用户实际名称"`
|
|
|
- CompanyName string `description:"公司名称"`
|
|
|
- PermissionName string `description:"拥有权限分类,多个用英文逗号分隔"`
|
|
|
- HasPermission int `description:"1:无该行业权限,不存在权益客户下,2:潜在客户,未提交过申请,3:潜在客户,已提交过申请"`
|
|
|
- SellerMobile string `description:"销售手机号"`
|
|
|
- SellerName string `description:"销售名称"`
|
|
|
- Note string `json:"-" description:"申请提交时,公司名称"`
|
|
|
- CountryCode string `description:"区号"`
|
|
|
+ Headimgurl string `description:"用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空"`
|
|
|
+ Mobile string `description:"手机号码"`
|
|
|
+ Email string `description:"邮箱"`
|
|
|
+ NickName string `description:"用户昵称"`
|
|
|
+ RealName string `description:"用户实际名称"`
|
|
|
+ CompanyName string `description:"公司名称"`
|
|
|
+ PermissionName string `description:"拥有权限分类,多个用英文逗号分隔"`
|
|
|
+ HasPermission int `description:"1:无该行业权限,不存在权益客户下,2:潜在客户,未提交过申请,3:潜在客户,已提交过申请"`
|
|
|
+ SellerMobile string `description:"销售手机号"`
|
|
|
+ SellerName string `description:"销售名称"`
|
|
|
+ Note string `json:"-" description:"申请提交时,公司名称"`
|
|
|
+ CountryCode string `description:"区号"`
|
|
|
+ OutboundMobile string `description:"外呼手机号"`
|
|
|
+ OutboundCountryCode string `description:"外呼手机号区号"`
|
|
|
}
|
|
|
|
|
|
func GetUserDetailByUserId(userId int) (item *UserDetail, err error) {
|
|
@@ -200,6 +203,10 @@ type CountryCode struct {
|
|
|
IsNeedAddCountryCode bool `description:"是否需要填写区号:需要填写,false:不需要填写"`
|
|
|
}
|
|
|
|
|
|
+type OutboundMobile struct {
|
|
|
+ IsNeedAddOutboundMobile bool `description:"是否需要填写外呼手机号:需要填写,false:不需要填写"`
|
|
|
+}
|
|
|
+
|
|
|
type CountryCodeItem struct {
|
|
|
CountryCode string `description:"区号"`
|
|
|
}
|
|
@@ -210,3 +217,33 @@ func AddCountryCode(CountryCode string, userId int) (err error) {
|
|
|
_, err = o.Raw(sql, CountryCode, userId).Exec()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+//修改外呼手机号
|
|
|
+type OutboundMobileItem struct {
|
|
|
+ OutboundMobile string `description:"外呼手机号"`
|
|
|
+ OutboundCountryCode string `description:"外呼手机号区号"`
|
|
|
+ ActivityId int `description:"活动ID"`
|
|
|
+}
|
|
|
+
|
|
|
+func AddOutboundMobile(item *OutboundMobileItem, userId int) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ o.Begin()
|
|
|
+ defer func() {
|
|
|
+ fmt.Println(err)
|
|
|
+ if err == nil {
|
|
|
+ o.Commit()
|
|
|
+ } else {
|
|
|
+ o.Rollback()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ sql := `UPDATE wx_user SET outbound_mobile=? ,outbound_country_code = ? WHERE user_id=? `
|
|
|
+ _, err = o.Raw(sql, item.OutboundMobile, item.OutboundCountryCode, userId).Exec()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if item.ActivityId > 0 {
|
|
|
+ sql = `UPDATE cygx_activity_signup SET outbound_mobile=? ,country_code = ? WHERE user_id=? AND activity_id = ?`
|
|
|
+ _, err = o.Raw(sql, item.OutboundMobile, item.OutboundCountryCode, userId, item.ActivityId).Exec()
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|