|
@@ -6,46 +6,48 @@ import (
|
|
|
)
|
|
|
|
|
|
type WxUser struct {
|
|
|
- UserId int `orm:"column(user_id);pk"`
|
|
|
- OpenId string `description:"open_id"`
|
|
|
- UnionId string `description:"union_id"`
|
|
|
- Subscribe string `description:"是否关注"`
|
|
|
- CompanyId int `description:"客户id"`
|
|
|
- NickName string `description:"用户昵称"`
|
|
|
- RealName string `description:"用户实际名称"`
|
|
|
- UserCode string `description:"用户编码"`
|
|
|
- Mobile string `description:"手机号码"`
|
|
|
- BindAccount string `description:"绑定时的账号"`
|
|
|
- WxCode string `description:"微信号"`
|
|
|
- Profession string `description:"职业"`
|
|
|
- Email string `description:"邮箱"`
|
|
|
- Telephone string `description:"座机"`
|
|
|
- Sex int `description:"普通用户性别,1为男性,2为女性"`
|
|
|
- Province string `description:"普通用户个人资料填写的省份"`
|
|
|
- City string `description:"普通用户个人资料填写的城市"`
|
|
|
- Country string `description:"国家,如中国为CN"`
|
|
|
- SubscribeTime int `description:"关注时间"`
|
|
|
- Remark string `description:"备注"`
|
|
|
- Headimgurl string `description:"用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空"`
|
|
|
- Privilege string `description:"用户特权信息,json数组,如微信沃卡用户为(chinaunicom)"`
|
|
|
- Unionid string `description:"用户统一标识。针对一个微信开放平台帐号下的应用,同一用户的unionid是唯一的。"`
|
|
|
- FirstLogin int `description:"是否第一次登陆"`
|
|
|
- Enabled int `description:"是否可用"`
|
|
|
- CreatedTime time.Time `description:"创建时间"`
|
|
|
- LastUpdatedTime time.Time `description:"最新一次修改时间"`
|
|
|
- Seller string `description:"销售员"`
|
|
|
- Note string `description:"客户备份信息"`
|
|
|
- IsNote int `description:"是否备注过信息"`
|
|
|
- FromType string `description:"report' COMMENT 'report:研报,teleconference:电话会"`
|
|
|
- ApplyMethod int `description:"0:未申请,1:已付费客户申请试用,2:非客户申请试用"`
|
|
|
- RegisterTime time.Time `description:"注册时间"`
|
|
|
- RegisterPlatform int `description:"注册平台,1:微信端,2:PC网页端"`
|
|
|
- IsFreeLogin bool `description:"是否免登陆,true:免登陆,false:非免登陆"`
|
|
|
- LoginTime time.Time `description:"最近一次登录时间"`
|
|
|
- SessionKey string `description:"微信小程序会话密钥"`
|
|
|
- IsRegister int `description:"是否注册:1:已注册,0:未注册"`
|
|
|
- Source int `description:"绑定来源,1:微信端,2:pc网页端,3:查研观向小程序,4:每日咨询"`
|
|
|
- CountryCode string `description:"区号"`
|
|
|
+ UserId int `orm:"column(user_id);pk"`
|
|
|
+ OpenId string `description:"open_id"`
|
|
|
+ UnionId string `description:"union_id"`
|
|
|
+ Subscribe string `description:"是否关注"`
|
|
|
+ CompanyId int `description:"客户id"`
|
|
|
+ NickName string `description:"用户昵称"`
|
|
|
+ RealName string `description:"用户实际名称"`
|
|
|
+ UserCode string `description:"用户编码"`
|
|
|
+ Mobile string `description:"手机号码"`
|
|
|
+ BindAccount string `description:"绑定时的账号"`
|
|
|
+ WxCode string `description:"微信号"`
|
|
|
+ Profession string `description:"职业"`
|
|
|
+ Email string `description:"邮箱"`
|
|
|
+ Telephone string `description:"座机"`
|
|
|
+ Sex int `description:"普通用户性别,1为男性,2为女性"`
|
|
|
+ Province string `description:"普通用户个人资料填写的省份"`
|
|
|
+ City string `description:"普通用户个人资料填写的城市"`
|
|
|
+ Country string `description:"国家,如中国为CN"`
|
|
|
+ SubscribeTime int `description:"关注时间"`
|
|
|
+ Remark string `description:"备注"`
|
|
|
+ Headimgurl string `description:"用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空"`
|
|
|
+ Privilege string `description:"用户特权信息,json数组,如微信沃卡用户为(chinaunicom)"`
|
|
|
+ Unionid string `description:"用户统一标识。针对一个微信开放平台帐号下的应用,同一用户的unionid是唯一的。"`
|
|
|
+ FirstLogin int `description:"是否第一次登陆"`
|
|
|
+ Enabled int `description:"是否可用"`
|
|
|
+ CreatedTime time.Time `description:"创建时间"`
|
|
|
+ LastUpdatedTime time.Time `description:"最新一次修改时间"`
|
|
|
+ Seller string `description:"销售员"`
|
|
|
+ Note string `description:"客户备份信息"`
|
|
|
+ IsNote int `description:"是否备注过信息"`
|
|
|
+ FromType string `description:"report' COMMENT 'report:研报,teleconference:电话会"`
|
|
|
+ ApplyMethod int `description:"0:未申请,1:已付费客户申请试用,2:非客户申请试用"`
|
|
|
+ RegisterTime time.Time `description:"注册时间"`
|
|
|
+ RegisterPlatform int `description:"注册平台,1:微信端,2:PC网页端"`
|
|
|
+ IsFreeLogin bool `description:"是否免登陆,true:免登陆,false:非免登陆"`
|
|
|
+ LoginTime time.Time `description:"最近一次登录时间"`
|
|
|
+ SessionKey string `description:"微信小程序会话密钥"`
|
|
|
+ IsRegister int `description:"是否注册:1:已注册,0:未注册"`
|
|
|
+ Source int `description:"绑定来源,1:微信端,2:pc网页端,3:查研观向小程序,4:每日咨询"`
|
|
|
+ CountryCode string `description:"区号"`
|
|
|
+ OutboundMobile string `description:"外呼手机号"`
|
|
|
+ OutboundCountryCode string `description:"外呼手机号区号"`
|
|
|
}
|
|
|
|
|
|
//添加用户信息
|
|
@@ -226,12 +228,21 @@ func GetUserListAll() (items []*WxUserItem, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//修改是否推送消息状态
|
|
|
+//修改手机号区号 8位号码+852,9位号码+886,10位号码+1,11位及以上号码+86
|
|
|
func UPdateUserCountryCode(item *WxUserItem) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- if item.CountryCode == "" && len(item.Mobile) == 11 {
|
|
|
+ if item.CountryCode == "" && len(item.Mobile) >= 11 {
|
|
|
sql := ` UPDATE wx_user SET outbound_mobile= ? , outbound_country_code=86 , country_code=86 WHERE user_id = ?`
|
|
|
_, err = o.Raw(sql, item.Mobile, item.UserId).Exec()
|
|
|
+ } else if item.CountryCode == "" && len(item.Mobile) == 8 {
|
|
|
+ sql := ` UPDATE wx_user SET outbound_mobile= ? , outbound_country_code=852 , country_code=852 WHERE user_id = ?`
|
|
|
+ _, err = o.Raw(sql, item.Mobile, item.UserId).Exec()
|
|
|
+ } else if item.CountryCode == "" && len(item.Mobile) == 9 {
|
|
|
+ sql := ` UPDATE wx_user SET outbound_mobile= ? , outbound_country_code=886 , country_code=886 WHERE user_id = ?`
|
|
|
+ _, err = o.Raw(sql, item.Mobile, item.UserId).Exec()
|
|
|
+ } else if item.CountryCode == "" && len(item.Mobile) == 10 {
|
|
|
+ sql := ` UPDATE wx_user SET outbound_mobile= ? , outbound_country_code=1 , country_code=1 WHERE user_id = ?`
|
|
|
+ _, err = o.Raw(sql, item.Mobile, item.UserId).Exec()
|
|
|
} else {
|
|
|
sql := ` UPDATE wx_user SET outbound_mobile= ? , outbound_country_code=? WHERE user_id = ?`
|
|
|
_, err = o.Raw(sql, item.Mobile, item.CountryCode, item.UserId).Exec()
|