+ TmpGetMyStoreList
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
"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"
|
||||
@@ -65,6 +66,33 @@ func GetSelfInfo(ctx *jxcontext.Context) (storeUserInfo *dao.StoreUserInfo, err
|
||||
return storeUserInfo, err
|
||||
}
|
||||
|
||||
func getMobileFromCtx(ctx *jxcontext.Context) (mobile string) {
|
||||
token := ctx.GetToken()
|
||||
if auth2.IsV2Token(token) {
|
||||
authInfo, err2 := auth2.GetTokenInfo(token)
|
||||
if err2 == nil {
|
||||
if authInfo.TokenType == auth2.TokenTypeNormal {
|
||||
mobile = authInfo.GetMobile()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
userInfo, err2 := auth.GetUserInfo(token)
|
||||
if err2 == nil {
|
||||
mobile = userInfo.GetAuthID()
|
||||
}
|
||||
}
|
||||
return mobile
|
||||
}
|
||||
|
||||
func GetMyStoreList(ctx *jxcontext.Context) (storeList []*model.Store, err error) {
|
||||
mobileNum := getMobileFromCtx(ctx)
|
||||
if mobileNum == "" {
|
||||
return nil, fmt.Errorf("不能得到用户手机号")
|
||||
}
|
||||
storeList, err = dao.GetStoreListByMobile(dao.GetDB(), mobileNum)
|
||||
return storeList, err
|
||||
}
|
||||
|
||||
func UnbindMobile(ctx *jxcontext.Context, mobile string) (num int64, err error) {
|
||||
db := dao.GetDB()
|
||||
num, err = dao.UpdateEntityByKV(db, &legacymodel.WeiXins{}, map[string]interface{}{
|
||||
|
||||
Reference in New Issue
Block a user