@@ -252,3 +252,11 @@ func AddOutboundMobile(item *OutboundMobileItem, userId int) (err error) {
}
return
+
+//用户绑定手机号时同时绑定外呼手机号
+func BindUserOutboundMobile(mobile, countryCode string, userId int) (err error) {
+ o := orm.NewOrm()
+ sql := `UPDATE wx_user SET outbound_mobile=? ,outbound_country_code = ?, country_code= ? WHERE user_id=? `
+ _, err = o.Raw(sql, mobile, countryCode, countryCode, userId).Exec()
+ return
+}
@@ -226,6 +226,10 @@ func BindWxUser(openid, mobile, email, countryCode string) (wxUser *models.WxUse
wxUser, err = models.GetWxUserItemByUserId(userId)
} else {
userId = wxUser.UserId
+ err = models.BindUserOutboundMobile(mobile, countryCode, userId)
+ if err != nil {
+ }
if wxUser.IsRegister == 0 {
models.ModifyWxUserRegisterStatus(userId)