- 注释掉老user与auth相关的代码

This commit is contained in:
gazebo
2019-09-24 16:39:50 +08:00
parent 72c9889d10
commit 412b11396a
18 changed files with 1172 additions and 1442 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/base64"
"fmt"
"net/http"
"strings"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/auth2"
@@ -11,12 +12,28 @@ import (
_ "git.rosy.net.cn/jx-callback/business/auth2/authprovider/mobile" // 强制导入mobile认证方式
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/password"
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
"git.rosy.net.cn/jx-callback/business/jxcallback/auth"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
"github.com/astaxie/beego"
)
func GetComposedCode(c *beego.Controller, code string) (composedCode string) {
composedCode = code
referer := c.Ctx.Request.Referer()
globals.SugarLogger.Debugf("GetComposedCode referer:%s", referer)
index := strings.Index(referer, "//")
if index > 0 {
list := strings.Split(referer[index+2:], "/")
if len(list) >= 2 {
composedCode = strings.Join([]string{
list[1],
code,
}, ",")
}
}
return composedCode
}
type Auth2Controller struct {
beego.Controller
}
@@ -84,10 +101,10 @@ func (c *Auth2Controller) Login() {
// @router /GetTokenInfo [get]
func (c *Auth2Controller) GetTokenInfo() {
c.callGetTokenInfo(func(params *tAuth2GetTokenInfoParams) (retVal interface{}, errCode string, err error) {
if auth2.IsV2Token(params.Token) {
if true { //auth2.IsV2Token(params.Token) {
retVal, err = auth2.GetTokenInfo(params.Token)
} else {
retVal, err = auth.GetUserInfo(params.Token)
// retVal, err = auth.GetUserInfo(params.Token)
}
if err == model.ErrTokenIsInvalid {
errCode = model.ErrCodeTokenIsInvalid
@@ -214,7 +231,7 @@ func (c *Auth2Controller) Logout() {
if authInfo, ok := params.Ctx.GetLoginInfo().(*auth2.AuthInfo); ok {
err = auth2.Logout(authInfo)
} else {
err = auth.Logout(params.Token)
// err = auth.Logout(params.Token)
}
return nil, "", err
})

View File

@@ -1,238 +1,205 @@
package controllers
import (
"encoding/base64"
"fmt"
"net/http"
"strings"
// type WeixinCallbackResult struct {
// Code int `json:"code"`
// Msg string `json:"msg"`
// Data interface{} `json:"data"`
// }
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxcallback/auth"
"git.rosy.net.cn/jx-callback/business/jxcallback/auth/mobile"
"git.rosy.net.cn/jx-callback/business/jxcallback/auth/weixin"
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
"github.com/astaxie/beego"
)
// // 认证相关API
// type AuthController struct {
// beego.Controller
// }
type WeixinCallbackResult struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
// var (
// ErrParameterIsIllegal = "参数不全或不合法"
// )
// 认证相关API
type AuthController struct {
beego.Controller
}
// // @Title 给微信用的回调接口
// // @Description 给微信用的回调接口,自己不能直接调用
// // @Param code query string true "客户同意后得到的code"
// // @Param block query string true "回调地址"
// // @Param state query string false "微信回调的登录状态"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /GetWeiXinUserInfo [get]
// func (c *AuthController) GetWeiXinUserInfo() {
// retVal := &WeixinCallbackResult{}
// var err error
// code := c.GetString("code")
// block := c.GetString("block")
// state := c.GetString("state")
// if block != "" {
// if code != "" {
// result, err2 := weixin.GetWeiXinUserInfo(code, state)
// if err = err2; err == nil {
// retVal.Code = 1
// retVal.Msg = "微信登录成功"
// retVal.Data = result
// } else {
// retVal.Msg = err.Error()
// }
// } else {
// retVal.Msg = "code为空"
// }
// } else {
// retVal.Msg = "没有block"
// }
// redirectURL := fmt.Sprintf("%s?info=%s", block, base64.StdEncoding.EncodeToString(utils.MustMarshal(retVal)))
// globals.SugarLogger.Debugf("auth GetWeiXinUserInfo retVal:%s, redirectURL:%s", utils.Format4Output(retVal, true), redirectURL)
// c.Redirect(redirectURL, http.StatusTemporaryRedirect)
// }
var (
ErrParameterIsIllegal = "参数不全或不合法"
)
// // @Title 登录接口
// // @Description 登录接口
// // @Param id formData string false "登录ID"
// // @Param type formData string true "登录类型,当前支持[weixinsns微信公众号登录localpass本地账号密码mobile手机短信weixinmini小程序code登录]"
// // @Param secret formData string true "不同登录类型的登录秘密"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /Login [post]
// func (c *AuthController) Login() {
// c.callLogin(func(params *tAuthLoginParams) (retVal interface{}, errCode string, err error) {
// if params.Type == weixin.LoginTypeMiniProgram {
// params.Secret = GetComposedCode(&c.Controller, params.Secret)
// }
// retVal, err = auth.Login(params.Id, params.Type, params.Secret)
// if err == auth.ErrUserNotExist {
// return retVal, model.ErrCodeUserNotExist, err
// }
// return retVal, "", err
// })
// }
// @Title 给微信用的回调接口
// @Description 给微信用的回调接口,自己不能直接调用
// @Param code query string true "客户同意后得到的code"
// @Param block query string true "回调地址"
// @Param state query string false "微信回调的登录状态"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetWeiXinUserInfo [get]
func (c *AuthController) GetWeiXinUserInfo() {
retVal := &WeixinCallbackResult{}
var err error
code := c.GetString("code")
block := c.GetString("block")
state := c.GetString("state")
if block != "" {
if code != "" {
result, err2 := weixin.GetWeiXinUserInfo(code, state)
if err = err2; err == nil {
retVal.Code = 1
retVal.Msg = "微信登录成功"
retVal.Data = result
} else {
retVal.Msg = err.Error()
}
} else {
retVal.Msg = "code为空"
}
} else {
retVal.Msg = "没有block"
}
redirectURL := fmt.Sprintf("%s?info=%s", block, base64.StdEncoding.EncodeToString(utils.MustMarshal(retVal)))
globals.SugarLogger.Debugf("auth GetWeiXinUserInfo retVal:%s, redirectURL:%s", utils.Format4Output(retVal, true), redirectURL)
c.Redirect(redirectURL, http.StatusTemporaryRedirect)
}
// // @Title 登出接口
// // @Description 登出接口
// // @Param token header string true "认证token"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /Logout [delete]
// func (c *AuthController) Logout() {
// c.callLogout(func(params *tAuthLogoutParams) (retVal interface{}, errCode string, err error) {
// err = auth.Logout(params.Token)
// globals.SugarLogger.Debug(err)
// return nil, "", err
// })
// }
// @Title 登录接口
// @Description 登录接口
// @Param id formData string false "登录ID"
// @Param type formData string true "登录类型,当前支持[weixinsns微信公众号登录localpass本地账号密码mobile手机短信weixinmini小程序code登录]"
// @Param secret formData string true "不同登录类型的登录秘密"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /Login [post]
func (c *AuthController) Login() {
c.callLogin(func(params *tAuthLoginParams) (retVal interface{}, errCode string, err error) {
if params.Type == weixin.LoginTypeMiniProgram {
params.Secret = GetComposedCode(&c.Controller, params.Secret)
}
retVal, err = auth.Login(params.Id, params.Type, params.Secret)
if err == auth.ErrUserNotExist {
return retVal, model.ErrCodeUserNotExist, err
}
return retVal, "", err
})
}
// // @Title 得到用户信息
// // @Description 得到用户信息从token中
// // @Param token header string true "认证token"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /GetUserInfo [get]
// func (c *AuthController) GetUserInfo() {
// c.callGetUserInfo(func(params *tAuthGetUserInfoParams) (retVal interface{}, errCode string, err error) {
// retVal, err = auth.GetUserInfo(params.Token)
// return retVal, "", err
// })
// }
// @Title 登出接口
// @Description 登出接口
// @Param token header string true "认证token"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /Logout [delete]
func (c *AuthController) Logout() {
c.callLogout(func(params *tAuthLogoutParams) (retVal interface{}, errCode string, err error) {
err = auth.Logout(params.Token)
globals.SugarLogger.Debug(err)
return nil, "", err
})
}
// // @Title 发送验证码
// // @Description 发送验证码
// // @Param mobile formData string true "手机号"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /SendMobileVerifyCode [post]
// func (c *AuthController) SendMobileVerifyCode() {
// c.callSendMobileVerifyCode(func(params *tAuthSendMobileVerifyCodeParams) (retVal interface{}, errCode string, err error) {
// err = mobile.SendVerifyCode(params.Mobile)
// return retVal, "", err
// })
// }
// @Title 得到用户信息
// @Description 得到用户信息从token中
// @Param token header string true "认证token"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetUserInfo [get]
func (c *AuthController) GetUserInfo() {
c.callGetUserInfo(func(params *tAuthGetUserInfoParams) (retVal interface{}, errCode string, err error) {
retVal, err = auth.GetUserInfo(params.Token)
return retVal, "", err
})
}
// // @Title 绑定手机
// // @Description 绑定手机,待删除
// // @Param token header string true "认证token"
// // @Param mobile formData string true "手机号"
// // @Param code formData string true "验证码"
// // @Param nickname formData string false "用户名"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /BindMobile [post]
// func (c *AuthController) BindMobile() {
// c.callBindMobile(func(params *tAuthBindMobileParams) (retVal interface{}, errCode string, err error) {
// err = weixin.BindMobile(params.Token, params.Mobile, params.Code, params.Nickname)
// if err == auth.ErrUserNotExist {
// return retVal, model.ErrCodeUserNotExist, err
// }
// return retVal, "", err
// })
// }
// @Title 发送验证码
// @Description 发送验证码
// @Param mobile formData string true "手机号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /SendMobileVerifyCode [post]
func (c *AuthController) SendMobileVerifyCode() {
c.callSendMobileVerifyCode(func(params *tAuthSendMobileVerifyCodeParams) (retVal interface{}, errCode string, err error) {
err = mobile.SendVerifyCode(params.Mobile)
return retVal, "", err
})
}
// // @Title 微信公众号绑定手机2
// // @Description 微信公众号绑定手机2
// // @Param openID formData string true "微信公众号ID"
// // @Param secret formData string true "后台之前返回的secret"
// // @Param nickname formData string false "用户名"
// // @Param mobile formData string true "手机号"
// // @Param verifyCode formData string true "手机验证码"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /BindMobile2 [post]
// func (c *AuthController) BindMobile2() {
// c.callBindMobile2(func(params *tAuthBindMobile2Params) (retVal interface{}, errCode string, err error) {
// if retVal, err = weixin.BindMobile2(params.OpenID, params.Secret, params.Mobile, params.VerifyCode, params.Nickname); err == nil {
// cms.TransferLegacyWeixins(params.Mobile)
// } else if err == auth.ErrUserNotExist {
// return retVal, model.ErrCodeUserNotExist, err
// }
// return retVal, "", err
// })
// }
// @Title 绑定手机
// @Description 绑定手机,待删除
// @Param token header string true "认证token"
// @Param mobile formData string true "手机号"
// @Param code formData string true "验证码"
// @Param nickname formData string false "用户名"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /BindMobile [post]
func (c *AuthController) BindMobile() {
c.callBindMobile(func(params *tAuthBindMobileParams) (retVal interface{}, errCode string, err error) {
err = weixin.BindMobile(params.Token, params.Mobile, params.Code, params.Nickname)
if err == auth.ErrUserNotExist {
return retVal, model.ErrCodeUserNotExist, err
}
return retVal, "", err
})
}
// // @Title 绑定手机
// // @Description 绑定手机(调用此方法前先需要以短信方式登录),待删除
// // @Param token header string true "认证token"
// // @Param code formData string true "小程序用户code"
// // @Param nickname formData string false "用户名"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /MiniBindWeiXin [post]
// func (c *AuthController) MiniBindWeiXin() {
// c.callMiniBindWeiXin(func(params *tAuthMiniBindWeiXinParams) (retVal interface{}, errCode string, err error) {
// err = weixin.AutherMini.BindWeiXin(params.Ctx, GetComposedCode(&c.Controller, params.Code), params.Nickname)
// if err == auth.ErrUserNotExist {
// return retVal, model.ErrCodeUserNotExist, err
// }
// return retVal, "", err
// })
// }
// @Title 微信公众号绑定手机2
// @Description 微信公众号绑定手机2
// @Param openID formData string true "微信公众号ID"
// @Param secret formData string true "后台之前返回的secret"
// @Param nickname formData string false "用户名"
// @Param mobile formData string true "手机号"
// @Param verifyCode formData string true "手机验证码"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /BindMobile2 [post]
func (c *AuthController) BindMobile2() {
c.callBindMobile2(func(params *tAuthBindMobile2Params) (retVal interface{}, errCode string, err error) {
if retVal, err = weixin.BindMobile2(params.OpenID, params.Secret, params.Mobile, params.VerifyCode, params.Nickname); err == nil {
cms.TransferLegacyWeixins(params.Mobile)
} else if err == auth.ErrUserNotExist {
return retVal, model.ErrCodeUserNotExist, err
}
return retVal, "", err
})
}
// // @Title 绑定小程序
// // @Description 绑定小程序
// // @Param token header string true "认证token"
// // @Param code formData string true "小程序用户code"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /BindMiniProgram [post]
// func (c *AuthController) BindMiniProgram() {
// c.callBindMiniProgram(func(params *tAuthBindMiniProgramParams) (retVal interface{}, errCode string, err error) {
// err = weixin.AutherMini.BindMiniProgram(params.Ctx, GetComposedCode(&c.Controller, params.Code))
// if err == nil {
// cms.TransferLegacyWeixins(params.Ctx.GetLoginID())
// }
// if err == auth.ErrUserNotExist {
// return retVal, model.ErrCodeUserNotExist, err
// }
// return retVal, "", err
// })
// }
// @Title 绑定手机
// @Description 绑定手机(调用此方法前先需要以短信方式登录),待删除
// @Param token header string true "认证token"
// @Param code formData string true "小程序用户code"
// @Param nickname formData string false "用户名"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /MiniBindWeiXin [post]
func (c *AuthController) MiniBindWeiXin() {
c.callMiniBindWeiXin(func(params *tAuthMiniBindWeiXinParams) (retVal interface{}, errCode string, err error) {
err = weixin.AutherMini.BindWeiXin(params.Ctx, GetComposedCode(&c.Controller, params.Code), params.Nickname)
if err == auth.ErrUserNotExist {
return retVal, model.ErrCodeUserNotExist, err
}
return retVal, "", err
})
}
// @Title 绑定小程序
// @Description 绑定小程序
// @Param token header string true "认证token"
// @Param code formData string true "小程序用户code"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /BindMiniProgram [post]
func (c *AuthController) BindMiniProgram() {
c.callBindMiniProgram(func(params *tAuthBindMiniProgramParams) (retVal interface{}, errCode string, err error) {
err = weixin.AutherMini.BindMiniProgram(params.Ctx, GetComposedCode(&c.Controller, params.Code))
if err == nil {
cms.TransferLegacyWeixins(params.Ctx.GetLoginID())
}
if err == auth.ErrUserNotExist {
return retVal, model.ErrCodeUserNotExist, err
}
return retVal, "", err
})
}
// @Title 解密小程序数据
// @Description 解密小程序数据
// @Param token header string true "认证token"
// @Param data formData string true "加密数据"
// @Param iv formData string true "iv"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /MiniDecryptData [post]
func (c *AuthController) MiniDecryptData() {
c.callMiniDecryptData(func(params *tAuthMiniDecryptDataParams) (retVal interface{}, errCode string, err error) {
retVal, err = weixin.AutherMini.DecryptData(params.Ctx, params.Data, params.Iv)
return retVal, "", err
})
}
func GetComposedCode(c *beego.Controller, code string) (composedCode string) {
composedCode = code
referer := c.Ctx.Request.Referer()
globals.SugarLogger.Debugf("GetComposedCode referer:%s", referer)
index := strings.Index(referer, "//")
if index > 0 {
list := strings.Split(referer[index+2:], "/")
if len(list) >= 2 {
composedCode = strings.Join([]string{
list[1],
code,
}, ",")
}
}
return composedCode
}
// // @Title 解密小程序数据
// // @Description 解密小程序数据
// // @Param token header string true "认证token"
// // @Param data formData string true "加密数据"
// // @Param iv formData string true "iv"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /MiniDecryptData [post]
// func (c *AuthController) MiniDecryptData() {
// c.callMiniDecryptData(func(params *tAuthMiniDecryptDataParams) (retVal interface{}, errCode string, err error) {
// retVal, err = weixin.AutherMini.DecryptData(params.Ctx, params.Data, params.Iv)
// return retVal, "", err
// })
// }

View File

@@ -1,123 +1,118 @@
package controllers
import (
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"github.com/astaxie/beego"
)
// type UserController struct {
// beego.Controller
// }
type UserController struct {
beego.Controller
}
// // @Title 得到门店用户信息
// // @Description 得到门店用户信息
// // @Param token header string true "认证token"
// // @Param storeID query int true "门店号"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /TmpGetStoreUsers [get]
// func (c *UserController) TmpGetStoreUsers() {
// c.callTmpGetStoreUsers(func(params *tUserTmpGetStoreUsersParams) (retVal interface{}, errCode string, err error) {
// retVal, err = cms.GetStoreUsers(params.Ctx, params.StoreID)
// return retVal, "", err
// })
// }
// @Title 得到门店用户信息
// @Description 得到门店用户信息
// @Param token header string true "认证token"
// @Param storeID query int true "门店号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpGetStoreUsers [get]
func (c *UserController) TmpGetStoreUsers() {
c.callTmpGetStoreUsers(func(params *tUserTmpGetStoreUsersParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetStoreUsers(params.Ctx, params.StoreID)
return retVal, "", err
})
}
// // @Title 得到用户门店及成员信息
// // @Description 得到用户门店及成员信息
// // @Param token header string true "认证token"
// // @Param mobile query string true "手机号"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /TmpGetUserInfo [get]
// func (c *UserController) TmpGetUserInfo() {
// c.callTmpGetUserInfo(func(params *tUserTmpGetUserInfoParams) (retVal interface{}, errCode string, err error) {
// retVal, err = cms.GetUserInfo(params.Ctx, params.Mobile)
// return retVal, "", err
// })
// }
// @Title 得到用户门店及成员信息
// @Description 得到用户门店及成员信息
// @Param token header string true "认证token"
// @Param mobile query string true "手机号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpGetUserInfo [get]
func (c *UserController) TmpGetUserInfo() {
c.callTmpGetUserInfo(func(params *tUserTmpGetUserInfoParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetUserInfo(params.Ctx, params.Mobile)
return retVal, "", err
})
}
// // @Title 得到用户自己的门店及成员信息
// // @Description 得到用户自己的门店及成员信息
// // @Param token header string true "认证token"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /TmpGetSelfInfo [get]
// func (c *UserController) TmpGetSelfInfo() {
// c.callTmpGetSelfInfo(func(params *tUserTmpGetSelfInfoParams) (retVal interface{}, errCode string, err error) {
// retVal, err = cms.GetSelfInfo(params.Ctx)
// return retVal, "", err
// })
// }
// @Title 得到用户自己的门店及成员信息
// @Description 得到用户自己的门店及成员信息
// @Param token header string true "认证token"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpGetSelfInfo [get]
func (c *UserController) TmpGetSelfInfo() {
c.callTmpGetSelfInfo(func(params *tUserTmpGetSelfInfoParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetSelfInfo(params.Ctx)
return retVal, "", err
})
}
// // @Title 得到用户自己的门店列表
// // @Description 得到用户自己的门店列表
// // @Param token header string true "认证token"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /TmpGetMyStoreList [get]
// func (c *UserController) TmpGetMyStoreList() {
// c.callTmpGetSelfInfo(func(params *tUserTmpGetSelfInfoParams) (retVal interface{}, errCode string, err error) {
// retVal, err = cms.GetMyStoreList(params.Ctx)
// return retVal, "", err
// })
// }
// @Title 得到用户自己的门店列表
// @Description 得到用户自己的门店列表
// @Param token header string true "认证token"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpGetMyStoreList [get]
func (c *UserController) TmpGetMyStoreList() {
c.callTmpGetSelfInfo(func(params *tUserTmpGetSelfInfoParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetMyStoreList(params.Ctx)
return retVal, "", err
})
}
// // @Title 取消手机门店绑定
// // @Description 此操作会将此手机关联的所有门店信息清除(取消组长,取消自己为他组组员),如果此人为组长,取消后组员也相应会取消门店绑定(但组员的成员关系还在)
// // @Param token header string true "认证token"
// // @Param mobile formData string true "手机号"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /TmpUnbindMobile [put]
// func (c *UserController) TmpUnbindMobile() {
// c.callTmpUnbindMobile(func(params *tUserTmpUnbindMobileParams) (retVal interface{}, errCode string, err error) {
// retVal, err = cms.UnbindMobile(params.Ctx, params.Mobile)
// return retVal, "", err
// })
// }
// @Title 取消手机门店绑定
// @Description 此操作会将此手机关联的所有门店信息清除(取消组长,取消自己为他组组员),如果此人为组长,取消后组员也相应会取消门店绑定(但组员的成员关系还在)
// @Param token header string true "认证token"
// @Param mobile formData string true "手机号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpUnbindMobile [put]
func (c *UserController) TmpUnbindMobile() {
c.callTmpUnbindMobile(func(params *tUserTmpUnbindMobileParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.UnbindMobile(params.Ctx, params.Mobile)
return retVal, "", err
})
}
// // @Title 手机门店绑定
// // @Description 此操作会将此手机设置成为相应门的组长,如果之前有组员关系,则此操作后,组员也会自动与门店绑定
// // @Param token header string true "认证token"
// // @Param mobile formData string true "手机号"
// // @Param storeID formData int true "门店ID"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /TmpBindMobile2Store [put]
// func (c *UserController) TmpBindMobile2Store() {
// c.callTmpBindMobile2Store(func(params *tUserTmpBindMobile2StoreParams) (retVal interface{}, errCode string, err error) {
// retVal, err = cms.BindMobile2Store(params.Ctx, params.Mobile, params.StoreID)
// return retVal, "", err
// })
// }
// @Title 手机门店绑定
// @Description 此操作会将此手机设置成为相应门的组长,如果之前有组员关系,则此操作后,组员也会自动与门店绑定
// @Param token header string true "认证token"
// @Param mobile formData string true "手机号"
// @Param storeID formData int true "门店ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpBindMobile2Store [put]
func (c *UserController) TmpBindMobile2Store() {
c.callTmpBindMobile2Store(func(params *tUserTmpBindMobile2StoreParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.BindMobile2Store(params.Ctx, params.Mobile, params.StoreID)
return retVal, "", err
})
}
// // @Title 手机加到另一手机上
// // @Description 将手机加到另一手机上
// // @Param token header string true "认证token"
// // @Param parentMobile formData string true "手机号"
// // @Param mobile formData string true "手机号"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /TmpAddMobile2Mobile [put]
// func (c *UserController) TmpAddMobile2Mobile() {
// c.callTmpAddMobile2Mobile(func(params *tUserTmpAddMobile2MobileParams) (retVal interface{}, errCode string, err error) {
// retVal, err = cms.AddMobile2Mobile(params.Ctx, params.ParentMobile, params.Mobile)
// return retVal, "", err
// })
// }
// @Title 将手机加到另一手机
// @Description 将手机加到另一手机上
// @Param token header string true "认证token"
// @Param parentMobile formData string true "手机号"
// @Param mobile formData string true "手机号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpAddMobile2Mobile [put]
func (c *UserController) TmpAddMobile2Mobile() {
c.callTmpAddMobile2Mobile(func(params *tUserTmpAddMobile2MobileParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.AddMobile2Mobile(params.Ctx, params.ParentMobile, params.Mobile)
return retVal, "", err
})
}
// @Title 变更手机号
// @Description 变更手机号
// @Param token header string true "认证token"
// @Param curMobile formData string true "当前手机号"
// @Param expectedMobile formData string true "手机号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /TmpChangeMobile [put]
func (c *UserController) TmpChangeMobile() {
c.callTmpChangeMobile(func(params *tUserTmpChangeMobileParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.ChangeMobile(params.Ctx, params.CurMobile, params.ExpectedMobile)
return retVal, "", err
})
}
// // @Title 变更手机
// // @Description 变更手机号
// // @Param token header string true "认证token"
// // @Param curMobile formData string true "当前手机号"
// // @Param expectedMobile formData string true "手机号"
// // @Success 200 {object} controllers.CallResult
// // @Failure 200 {object} controllers.CallResult
// // @router /TmpChangeMobile [put]
// func (c *UserController) TmpChangeMobile() {
// c.callTmpChangeMobile(func(params *tUserTmpChangeMobileParams) (retVal interface{}, errCode string, err error) {
// retVal, err = cms.ChangeMobile(params.Ctx, params.CurMobile, params.ExpectedMobile)
// return retVal, "", err
// })
// }