Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop

This commit is contained in:
邹宗楠
2022-08-19 11:38:57 +08:00
13 changed files with 107 additions and 59 deletions

View File

@@ -160,6 +160,8 @@ func getFixedTokenName(token string) *AuthInfo {
func createAuthInfo(user IUser, authBindInfo *AuthBindEx) (authInfo *AuthInfo) { func createAuthInfo(user IUser, authBindInfo *AuthBindEx) (authInfo *AuthInfo) {
token, tokenType := createToken(user, authBindInfo) token, tokenType := createToken(user, authBindInfo)
//user为空 tokenType=2
globals.SugarLogger.Debug("tokentokenType,user============", token, tokenType, user)
expireDuration := DefTokenDuration expireDuration := DefTokenDuration
authInfo = &AuthInfo{ authInfo = &AuthInfo{
AuthBindInfo: authBindInfo, AuthBindInfo: authBindInfo,
@@ -247,6 +249,7 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string
} }
realAuthID = user.GetID() realAuthID = user.GetID()
} }
globals.SugarLogger.Debug("打印realAuthID检测是否为空==================", realAuthID)
if authBindEx, err = handler.VerifySecret(realAuthID, authSecret); err == nil { if authBindEx, err = handler.VerifySecret(realAuthID, authSecret); err == nil {
globals.SugarLogger.Debugf("Login authBindEx", utils.Format4Output(authBindEx, false)) globals.SugarLogger.Debugf("Login authBindEx", utils.Format4Output(authBindEx, false))
if authBindEx == nil { // mobile, email会返回nil表示不会新建AuthBind实体 if authBindEx == nil { // mobile, email会返回nil表示不会新建AuthBind实体
@@ -262,15 +265,15 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string
// 返回authBind中UserID为空表示只是认证但本地没有记录这种情况会返回临时TOKEN // 返回authBind中UserID为空表示只是认证但本地没有记录这种情况会返回临时TOKEN
if authBindEx.UserHint != nil && authBindEx.UserID == "" { if authBindEx.UserHint != nil && authBindEx.UserID == "" {
// 利用得到受信任的信息查找用户 // 利用得到受信任的信息查找用户
// if authBindEx.UserHint.Mobile != "" { if authBindEx.UserHint.Mobile != "" {
// user = userProvider.GetUser(authBindEx.UserHint.Mobile, UserIDMobile) user = userProvider.GetUser(authBindEx.UserHint.Mobile, UserIDMobile)
// } }
// if user == nil && authBindEx.UserHint.Email != "" { if user == nil && authBindEx.UserHint.Email != "" {
// user = userProvider.GetUser(authBindEx.UserHint.Email, UserIDEmail) user = userProvider.GetUser(authBindEx.UserHint.Email, UserIDEmail)
// } }
// if user != nil { if user != nil {
// authBindEx.UserID = user.GetID() authBindEx.UserID = user.GetID()
// } }
if user2 := userProvider.GetUser(authBindEx.UserHint.Email, UserIDMobile); user2 != nil { if user2 := userProvider.GetUser(authBindEx.UserHint.Email, UserIDMobile); user2 != nil {
user = user2 user = user2
} }
@@ -303,6 +306,7 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string
} }
} }
} }
} }
} else { } else {
err = ErrIllegalAuthType err = ErrIllegalAuthType
@@ -379,6 +383,7 @@ func AddAuthBind(user IUser, newAuthInfo *AuthInfo) (err error) {
} else { } else {
if handler := authers[newAuthInfo.AuthBindInfo.Type]; handler != nil { if handler := authers[newAuthInfo.AuthBindInfo.Type]; handler != nil {
newAuthInfo.AuthBindInfo.UserID = user.GetID() newAuthInfo.AuthBindInfo.UserID = user.GetID()
globals.SugarLogger.Debug("进入AddAuthBind获取userID", newAuthInfo.AuthBindInfo.UserID)
handler.UnbindAuth(user.GetID(), newAuthInfo.GetAuthType(), newAuthInfo.GetAuthTypeID(), user.GetName()) handler.UnbindAuth(user.GetID(), newAuthInfo.GetAuthType(), newAuthInfo.GetAuthTypeID(), user.GetName())
err = handler.AddAuthBind(newAuthInfo.AuthBindInfo, user.GetName()) err = handler.AddAuthBind(newAuthInfo.AuthBindInfo, user.GetName())
} else { } else {

View File

@@ -75,9 +75,6 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType, curAuthTypeID string, unionAu
if authDetail != nil { if authDetail != nil {
authBindEx.DetailData = string(utils.MustMarshal(authDetail)) authBindEx.DetailData = string(utils.MustMarshal(authDetail))
} }
globals.SugarLogger.Debug("检查一下数据样式===================", authBindEx)
globals.SugarLogger.Debug("检查一下数据样式===================", authDetail)
globals.SugarLogger.Debug("检查一下数据样式===================", authBindEx.DetailData)
if authBind.TypeID == "" { if authBind.TypeID == "" {
authBind.TypeID = curAuthTypeID authBind.TypeID = curAuthTypeID
dao.UpdateEntity(db, authBind, "TypeID") dao.UpdateEntity(db, authBind, "TypeID")
@@ -85,16 +82,11 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType, curAuthTypeID string, unionAu
} else if dao.IsNoRowsError(err) { // 直接找不到尝试unionID } else if dao.IsNoRowsError(err) { // 直接找不到尝试unionID
if unionID != "" || openID != "" { // 且有unionID if unionID != "" || openID != "" { // 且有unionID
var authBindList []*model.AuthBind var authBindList []*model.AuthBind
globals.SugarLogger.Debug("输出一下", unionAuthTypeList)
globals.SugarLogger.Debug("=====================输出一下model.AuthBindTypeAuth,openID,unionID", model.AuthBindTypeAuth, unionAuthTypeList, openID, unionID)
authBindList, err = dao.GetUserBindAuthInfo(db, "", model.AuthBindTypeAuth, unionAuthTypeList, openID, unionID, nil) authBindList, err = dao.GetUserBindAuthInfo(db, "", model.AuthBindTypeAuth, unionAuthTypeList, openID, unionID, nil)
if err != nil { if err != nil {
globals.SugarLogger.Debug("authBindList输出错误", err)
return nil, err return nil, err
} }
globals.SugarLogger.Debug("检测这个authBindList", authBindList)
if len(authBindList) > 0 { // 通过unionID找到至少一个认证方式 if len(authBindList) > 0 { // 通过unionID找到至少一个认证方式
globals.SugarLogger.Debug("进入authBindList, err = dao.GetUserBindAuthInfo 这里了")
authBind = authBindList[0] authBind = authBindList[0]
authBind.Type = curAuthType authBind.Type = curAuthType
authBind.TypeID = curAuthTypeID authBind.TypeID = curAuthTypeID
@@ -105,20 +97,16 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType, curAuthTypeID string, unionAu
authBindEx = &auth2.AuthBindEx{ authBindEx = &auth2.AuthBindEx{
AuthBind: *authBind, AuthBind: *authBind,
} }
globals.SugarLogger.Debug("输出赋值后的authBind.DetailData", authBind.DetailData)
globals.SugarLogger.Debug("输出赋值后的authBindEx", authBindEx)
a.UnbindAuth(authBind.UserID, curAuthType, curAuthTypeID, model.AdminName) a.UnbindAuth(authBind.UserID, curAuthType, curAuthTypeID, model.AdminName)
err = a.AddAuthBind(authBindEx, model.AdminName) // 自动绑定 err = a.AddAuthBind(authBindEx, model.AdminName) // 自动绑定
} else if dao.IsNoRowsError(err) { } else if dao.IsNoRowsError(err) {
err = nil err = nil
} }
globals.SugarLogger.Debug("输出一下authBindList", authBindList) //空的
} else { } else {
err = nil err = nil
} }
} }
if err == nil && authBindEx == nil { //如果没有报错且没有找到一个认证方式创建无用户UserID为空的认证方式 if err == nil && authBindEx == nil { //如果没有报错且没有找到一个认证方式创建无用户UserID为空的认证方式
globals.SugarLogger.Debug("没有找到一个认证方式")
authBindEx = &auth2.AuthBindEx{ authBindEx = &auth2.AuthBindEx{
AuthBind: model.AuthBind{ AuthBind: model.AuthBind{
Type: curAuthType, Type: curAuthType,
@@ -127,8 +115,6 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType, curAuthTypeID string, unionAu
AuthID2: unionID, AuthID2: unionID,
}, },
} }
globals.SugarLogger.Debug("输出一下authBindEx", authBindEx)
globals.SugarLogger.Debug("===================再输出一下authBind", authBind)
if authDetail != nil { if authDetail != nil {
authBindEx.DetailData = string(utils.MustMarshal(authDetail)) authBindEx.DetailData = string(utils.MustMarshal(authDetail))
} }

View File

@@ -21,18 +21,30 @@ func init() {
auth2.RegisterAuther(AuthTypeQRCode, AutherObjQRCode) auth2.RegisterAuther(AuthTypeQRCode, AutherObjQRCode)
} }
func (a *QRCodeAuther) VerifySecret(dummy, code string) (authBindEx *auth2.AuthBindEx, err error) { func (a *QRCodeAuther) VerifySecret(dummy, code string) (*auth2.AuthBindEx, error) {
globals.SugarLogger.Debugf("dingding qrcode VerifySecret code:%s", code) globals.SugarLogger.Debugf("dingding qrcode VerifySecret code:%s", code)
userQRInfo, err := api.DingDingQRCodeAPI.GetUserInfoByCode(code) userQRInfo, err := api.DingDingQRCodeAPI.GetUserInfoByCode(code)
if err == nil { if err != nil {
return nil, err
}
tmp_userID, err := api.DingDingAPI.GetByUnionID(userQRInfo.UnionID)
if err != nil {
return nil, err
}
userInfo, err := api.DingDingAPI.GetUser(tmp_userID.UserID)
if err != nil {
return nil, err
}
globals.SugarLogger.Debugf("dingding qrcode VerifySecret code:%s, userQRInfo:%s", code, utils.Format4Output(userQRInfo, false)) globals.SugarLogger.Debugf("dingding qrcode VerifySecret code:%s, userQRInfo:%s", code, utils.Format4Output(userQRInfo, false))
if authBindEx, err = a.UnionFindAuthBind(AuthTypeQRCode, api.DingDingQRCodeAPI.GetAppID(), []string{AuthTypeStaff, AuthTypeQRCode}, userQRInfo.OpenID, userQRInfo.UnionID, userQRInfo); err == nil { authBindEx, err := a.UnionFindAuthBind(AuthTypeQRCode, api.DingDingQRCodeAPI.GetAppID(), []string{AuthTypeStaff, AuthTypeQRCode}, userQRInfo.OpenID, userQRInfo.UnionID, userQRInfo)
if err != nil {
return nil, err
}
authBindEx.UserHint = &auth2.UserBasic{ authBindEx.UserHint = &auth2.UserBasic{
Name: userQRInfo.Nickname, UserID2: tmp_userID.UserID,
//UserID: userQRInfo., Mobile: utils.Interface2String(userInfo["mobile"]),
} Email: utils.Interface2String(userInfo["email"]),
} Name: utils.Interface2String(userInfo["name"]),
} }
return authBindEx, err return authBindEx, err
} }

View File

@@ -1,14 +1,15 @@
package douyin package douyin
import ( import (
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin" "git.rosy.net.cn/baseapi/platformapi/tiktok"
"git.rosy.net.cn/baseapi/platformapi/weixinapi" "git.rosy.net.cn/baseapi/platformapi/weixinapi"
"git.rosy.net.cn/jx-callback/business/auth2" "git.rosy.net.cn/jx-callback/business/auth2"
"git.rosy.net.cn/jx-callback/business/auth2/authprovider" "git.rosy.net.cn/jx-callback/business/auth2/authprovider"
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
"git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals" "git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/globals/api" "git.rosy.net.cn/jx-callback/globals/api"
"strings"
) )
const ( const (
@@ -30,15 +31,18 @@ func init() {
func (a *TiktopMiniAuther) VerifySecret(dummy, code string) (authBindEx *auth2.AuthBindEx, err error) { func (a *TiktopMiniAuther) VerifySecret(dummy, code string) (authBindEx *auth2.AuthBindEx, err error) {
globals.SugarLogger.Debugf("toktok mini VerifySecret jsCode:%s", code) globals.SugarLogger.Debugf("toktok mini VerifySecret jsCode:%s", code)
appID, realCode := splitCode(code)
sessionInfo, err := api.TiktokApi.GetTiktokOauth(code) globals.SugarLogger.Debug("appID============", appID)
globals.SugarLogger.Debug("realCode============", realCode)
sessionInfo, err := getTikTokApp(appID).GetTiktokOauth(realCode)
if err != nil {
return nil, err
}
globals.SugarLogger.Debug("toktok mini VerifySecret sessionInfo:", sessionInfo) globals.SugarLogger.Debug("toktok mini VerifySecret sessionInfo:", sessionInfo)
if err == nil {
sessionKey := sessionInfo.Data.SessionKey sessionKey := sessionInfo.Data.SessionKey
if authBindEx, err = a.UnionFindAuthBind(AuthTypeTiktokMini, api.TiktokApi.GetAppID(), []string{AuthTypeTiktokMini}, sessionInfo.Data.OpenId, sessionInfo.Data.Unionid, sessionInfo); err == nil { if authBindEx, err = a.UnionFindAuthBind(AuthTypeTiktokMini, api.TiktokApi.GetAppID(), []string{AuthTypeTiktokMini}, sessionInfo.Data.OpenId, sessionInfo.Data.Unionid, sessionInfo); err == nil {
authBindEx.UserData = sessionKey authBindEx.UserData = sessionKey
} }
}
return authBindEx, err return authBindEx, err
} }
@@ -88,3 +92,24 @@ func getWxApp(appID string) (miniApi *weixinapi.API) {
} }
return miniApi return miniApi
} }
func getTikTokApp(appID string) (TikTokMini *tiktok.API) {
TikTokMini = api.TiktokApi
if len(appID) > 0 && appID == api.TiktokJXDJApiID {
globals.SugarLogger.Debug("我进入这里了")
TikTokMini = api.TiktokJXDJApi
}
globals.SugarLogger.Debug("输出一下TikTokMini", TikTokMini)
return TikTokMini
}
func splitCode(code string) (appID, realCode string) {
str := strings.Split(code, "&")
if len(str) == 2 {
appID = str[1]
realCode = str[0]
} else {
globals.SugarLogger.Warnf("splitCode abnormal code:%s", code)
}
globals.SugarLogger.Debug("dayin realCode", realCode)
return appID, realCode
}

View File

@@ -2,8 +2,6 @@ package dao
import ( import (
"errors" "errors"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model"
) )
@@ -64,10 +62,5 @@ func GetUserBindAuthInfo(db *DaoDB, userID string, bindType int, typeList []stri
} }
sql += " ORDER BY t1.type" sql += " ORDER BY t1.type"
err = GetRows(db, &authList, sql, sqlParams...) err = GetRows(db, &authList, sql, sqlParams...)
globals.SugarLogger.Debug("输出一下sql", sql)
globals.SugarLogger.Debug("authList==================", authList)
globals.SugarLogger.Debug("param==================", sqlParams)
globals.SugarLogger.Debug("err==================", err)
globals.SugarLogger.Debug("err==================", err)
return authList, err return authList, err
} }

View File

@@ -2,7 +2,6 @@ package dao
import ( import (
"fmt" "fmt"
"git.rosy.net.cn/jx-callback/globals"
"reflect" "reflect"
"strings" "strings"
"time" "time"
@@ -98,8 +97,6 @@ func GenQuestionMarks(count int) (marks string) {
marks = builder.String() marks = builder.String()
} }
} }
result := string(marks)
globals.SugarLogger.Debug("输出一下marks", result)
return marks return marks
} }

View File

@@ -638,9 +638,9 @@ func (c *PurchaseHandler) GetOrderRealMobile(ctx *jxcontext.Context, order *mode
return mobile, err return mobile, err
} }
func (c *PurchaseHandler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *model.GoodsOrder, isAgree bool, reason string) (err error) { func (c *PurchaseHandler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *model.GoodsOrder, isAcceptIt bool, reason string) (err error) {
if globals.EnableEbaiStoreWrite { if globals.EnableEbaiStoreWrite {
if isAgree { if isAcceptIt {
err = api.EbaiAPI.OrderAgreeRefund(order.VendorOrderID) err = api.EbaiAPI.OrderAgreeRefund(order.VendorOrderID)
} else { } else {
err = api.EbaiAPI.OrderDisagreeRefund(order.VendorOrderID, reason) err = api.EbaiAPI.OrderDisagreeRefund(order.VendorOrderID, reason)

View File

@@ -326,7 +326,7 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType
err = dao.CreateEntity(dao.GetDB(), orderPay) err = dao.CreateEntity(dao.GetDB(), orderPay)
} }
case model.PayTypeTL: case model.PayTypeTL:
if subAppID == tiktok.TiktokAppId { if subAppID == tiktok.TiktokAppId || subAppID == tiktok.TiktokJXDJAppID {
subAppID = model.JXC4AppId // 京西商城 subAppID = model.JXC4AppId // 京西商城
} }
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil { if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil {

View File

@@ -45,6 +45,8 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int,
if err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini && authInfo.GetAuthTypeID() == subAppID { if err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini && authInfo.GetAuthTypeID() == subAppID {
param.Acct = authInfo.GetAuthID() param.Acct = authInfo.GetAuthID()
} }
globals.SugarLogger.Debug("authInfo=======================", authInfo)
globals.SugarLogger.Debug("param.Acc=======================", param.Acct)
} }
if vendorPayType == tonglianpayapi.PayTypeZfbJS || vendorPayType == tonglianpayapi.PayTypeZfbApp { if vendorPayType == tonglianpayapi.PayTypeZfbJS || vendorPayType == tonglianpayapi.PayTypeZfbApp {
if authInfo, err := ctx.GetV2AuthInfo(); err == nil { if authInfo, err := ctx.GetV2AuthInfo(); err == nil {

View File

@@ -209,6 +209,10 @@ getYLYTokenURL = "http://www.jxc4.com/v2/sys/GetYLYToken"
tiktokAppKey = "tta6a1d01c399f264201" tiktokAppKey = "tta6a1d01c399f264201"
tiktokAppSecret = "5c08a0465cf0f996af254a03b6c2548defef87ad" tiktokAppSecret = "5c08a0465cf0f996af254a03b6c2548defef87ad"
tiktokJXDJKey="ttaceeda5333d7a7ab01" #京西到家抖音小程序
TiktokJXDJApiID="ttaceeda5333d7a7ab01"
tiktokJXDJSecret="5c8492ec2744fb72bb6cc356983f3cfc317f85d4"
#国美 #国美
gomeiAppKey = "N0R033L2QQFR53" gomeiAppKey = "N0R033L2QQFR53"
gomeiAppSecret = "686ffc3e31c24594838baed045563790" gomeiAppSecret = "686ffc3e31c24594838baed045563790"
@@ -331,6 +335,10 @@ jxPrintAppKey = "rfBd56ti2SMtYvSg"
tiktokAppKey = "tta6a1d01c399f264201" tiktokAppKey = "tta6a1d01c399f264201"
tiktokAppSecret = "5c08a0465cf0f996af254a03b6c2548defef87ad" tiktokAppSecret = "5c08a0465cf0f996af254a03b6c2548defef87ad"
tiktokJXDJKey="ttaceeda5333d7a7ab01" #京西到家抖音小程序
TiktokJXDJApiID="ttaceeda5333d7a7ab01"
tiktokJXDJSecret="5c8492ec2744fb72bb6cc356983f3cfc317f85d4"
#国美 #国美
gomeiAppKey = "N0R033L2QQFR53" gomeiAppKey = "N0R033L2QQFR53"
gomeiAppSecret = "686ffc3e31c24594838baed045563790" gomeiAppSecret = "686ffc3e31c24594838baed045563790"
@@ -433,6 +441,10 @@ jxPrintAppKey = "rfBd56ti2SMtYvSg"
storeName = "京西果园" storeName = "京西果园"
tiktokAppKey = "tta6a1d01c399f264201" tiktokAppKey = "tta6a1d01c399f264201"
tiktokAppSecret = "5c08a0465cf0f996af254a03b6c2548defef87ad" tiktokAppSecret = "5c08a0465cf0f996af254a03b6c2548defef87ad"
tiktokJXDJKey="ttaceeda5333d7a7ab01" #京西到家抖音小程序
TiktokJXDJApiID="ttaceeda5333d7a7ab01"
tiktokJXDJSecret="5c8492ec2744fb72bb6cc356983f3cfc317f85d4"
#国美 #国美
gomeiAppKey = "N0R033L2QQFR53" gomeiAppKey = "N0R033L2QQFR53"
gomeiAppSecret = "686ffc3e31c24594838baed045563790" gomeiAppSecret = "686ffc3e31c24594838baed045563790"
@@ -618,6 +630,10 @@ jxPrintAppKey = "rfBd56ti2SMtYvSg"
tiktokAppKey = "tta6a1d01c399f264201" tiktokAppKey = "tta6a1d01c399f264201"
tiktokAppSecret = "5c08a0465cf0f996af254a03b6c2548defef87ad" tiktokAppSecret = "5c08a0465cf0f996af254a03b6c2548defef87ad"
tiktokJXDJKey="ttaceeda5333d7a7ab01" #京西到家抖音小程序
TiktokJXDJApiID="ttaceeda5333d7a7ab01"
tiktokJXDJSecret="5c8492ec2744fb72bb6cc356983f3cfc317f85d4"
#国美 #国美
gomeiAppKey = "N0R033L2QQFR53" gomeiAppKey = "N0R033L2QQFR53"
gomeiAppSecret = "686ffc3e31c24594838baed045563790" gomeiAppSecret = "686ffc3e31c24594838baed045563790"

View File

@@ -269,6 +269,7 @@ func (c *Auth2Controller) DingDingOAuth2() {
} }
ctx := auth2.NewContext(c.Ctx.ResponseWriter, c.Ctx.Request) ctx := auth2.NewContext(c.Ctx.ResponseWriter, c.Ctx.Request)
authInfo, err := auth2.Login(ctx, dingding.AuthTypeQRCode, params.State, "", params.Code) authInfo, err := auth2.Login(ctx, dingding.AuthTypeQRCode, params.State, "", params.Code)
globals.SugarLogger.Debug("DingDingOAuth2 输出authInfo", authInfo)
if err == nil { if err == nil {
callResult = &CallResult{ callResult = &CallResult{
Code: model.ErrCodeSuccess, Code: model.ErrCodeSuccess,

View File

@@ -12,6 +12,7 @@ import (
"git.rosy.net.cn/jx-callback/business/jxutils/netprinter" "git.rosy.net.cn/jx-callback/business/jxutils/netprinter"
"git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao" "git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/globals/api" "git.rosy.net.cn/jx-callback/globals/api"
"github.com/astaxie/beego/server/web" "github.com/astaxie/beego/server/web"
) )
@@ -594,7 +595,9 @@ func (c *StoreController) SyncStoresCourierInfo() {
func (c *StoreController) GetStoreListByLocation() { func (c *StoreController) GetStoreListByLocation() {
c.callGetStoreListByLocation(func(params *tStoreGetStoreListByLocationParams) (retVal interface{}, errCode string, err error) { c.callGetStoreListByLocation(func(params *tStoreGetStoreListByLocationParams) (retVal interface{}, errCode string, err error) {
locationList, err := common.GetStoreListByLocation(params.Ctx, params.Lng, params.Lat, 20000, params.NeedWalkDistance, false, params.BrandID) locationList, err := common.GetStoreListByLocation(params.Ctx, params.Lng, params.Lat, 20000, params.NeedWalkDistance, false, params.BrandID)
//if params.Token == "tempToken" {
// return locationList, "", nil
//}
if params.Token != "" { if params.Token != "" {
// 获取用户权限如果是普通用户不展示b2b相关目录如果是门店老板或者管理则展示全部 // 获取用户权限如果是普通用户不展示b2b相关目录如果是门店老板或者管理则展示全部
userAuth, err := auth2.GetTokenInfo(params.Token) userAuth, err := auth2.GetTokenInfo(params.Token)
@@ -605,12 +608,13 @@ func (c *StoreController) GetStoreListByLocation() {
if err != nil { if err != nil {
return nil, "", err return nil, "", err
} }
globals.SugarLogger.Debug("检测数据userAuth,user,total==============", userAuth, user, total)
// 获取位置附近门店列表 // 获取位置附近门店列表
storeIDs := make([]int, 0, len(locationList)) storeIDs := make([]int, 0, len(locationList))
for _, v := range locationList { for _, v := range locationList {
storeIDs = append(storeIDs, v.ID) storeIDs = append(storeIDs, v.ID)
} }
globals.SugarLogger.Debug("检测数据locationList,storeIDs==============", locationList, storeIDs)
// 判断门店是不是b2b门店如果是用户必须为系统管理员门店老板和运营人员 // 判断门店是不是b2b门店如果是用户必须为系统管理员门店老板和运营人员
store, err := dao.GetStoreList(dao.GetDB(), storeIDs, nil, nil, nil, nil, "") store, err := dao.GetStoreList(dao.GetDB(), storeIDs, nil, nil, nil, nil, "")
if err != nil { if err != nil {

View File

@@ -113,6 +113,9 @@ var (
SMSClient *aliyunsmsclient.SmsClient SMSClient *aliyunsmsclient.SmsClient
TiktokApi *tiktok.API // 抖音api TiktokApi *tiktok.API // 抖音api
TiktokJXDJApi *tiktok.API //抖音京西到家api
TiktokApiID string //抖音商城ID
TiktokJXDJApiID string //抖音京西到家ID
GuoMeiApi *gomei.API // 国美api GuoMeiApi *gomei.API // 国美api
EnterpriseChatHeadApi *enterprise.API // 企业微信api EnterpriseChatHeadApi *enterprise.API // 企业微信api
@@ -301,6 +304,10 @@ func Init() {
QywxAPI = qywxapi.New(beego.AppConfig.DefaultString("qywxID", ""), beego.AppConfig.DefaultString("qywxSecret", ""), "") QywxAPI = qywxapi.New(beego.AppConfig.DefaultString("qywxID", ""), beego.AppConfig.DefaultString("qywxSecret", ""), "")
TiktokApi = tiktok.New(beego.AppConfig.DefaultString("tiktokAppSecret", ""), beego.AppConfig.DefaultString("tiktokAppKey", "")) TiktokApi = tiktok.New(beego.AppConfig.DefaultString("tiktokAppSecret", ""), beego.AppConfig.DefaultString("tiktokAppKey", ""))
//TiktokJXDJApi = tiktok.New(beego.AppConfig.DefaultString("tiktokJXDJSecret", ""), beego.AppConfig.DefaultString("tiktokJXDJKey", ""))
if TiktokJXDJApiID = beego.AppConfig.DefaultString("TiktokJXDJApiID", ""); TiktokJXDJApiID != "" {
TiktokJXDJApi = tiktok.New(beego.AppConfig.DefaultString("tiktokJXDJSecret", ""), beego.AppConfig.DefaultString("TiktokJXDJApiID", ""))
}
// 国美aip // 国美aip
GuoMeiApi = gomei.New(beego.AppConfig.DefaultString("gomeiAppKey", ""), beego.AppConfig.DefaultString("gomeiAppSecret", ""), "") GuoMeiApi = gomei.New(beego.AppConfig.DefaultString("gomeiAppKey", ""), beego.AppConfig.DefaultString("gomeiAppSecret", ""), "")
EnterpriseChatHeadApi = enterprise.New("ww9a156bfa070e1857", "0jBdCjSmoFiOoHIXyeCK9VbGQ82fVNJZ8uMl6JNN7X4") // 通讯录 EnterpriseChatHeadApi = enterprise.New("ww9a156bfa070e1857", "0jBdCjSmoFiOoHIXyeCK9VbGQ82fVNJZ8uMl6JNN7X4") // 通讯录