Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -161,7 +161,6 @@ 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
|
//user为空 tokenType=2
|
||||||
globals.SugarLogger.Debug("token,tokenType,user============", token, tokenType, user)
|
|
||||||
expireDuration := DefTokenDuration
|
expireDuration := DefTokenDuration
|
||||||
authInfo = &AuthInfo{
|
authInfo = &AuthInfo{
|
||||||
AuthBindInfo: authBindInfo,
|
AuthBindInfo: authBindInfo,
|
||||||
@@ -249,7 +248,6 @@ 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实体)
|
||||||
@@ -383,7 +381,6 @@ 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 {
|
||||||
|
|||||||
@@ -96,10 +96,8 @@ func getWxApp(appID string) (miniApi *weixinapi.API) {
|
|||||||
func getTikTokApp(appID string) (TikTokMini *tiktok.API) {
|
func getTikTokApp(appID string) (TikTokMini *tiktok.API) {
|
||||||
TikTokMini = api.TiktokApi
|
TikTokMini = api.TiktokApi
|
||||||
if len(appID) > 0 && appID == api.TiktokJXDJApiID {
|
if len(appID) > 0 && appID == api.TiktokJXDJApiID {
|
||||||
globals.SugarLogger.Debug("我进入这里了")
|
|
||||||
TikTokMini = api.TiktokJXDJApi
|
TikTokMini = api.TiktokJXDJApi
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debug("输出一下TikTokMini", TikTokMini)
|
|
||||||
return TikTokMini
|
return TikTokMini
|
||||||
}
|
}
|
||||||
func splitCode(code string) (appID, realCode string) {
|
func splitCode(code string) (appID, realCode string) {
|
||||||
|
|||||||
@@ -1041,6 +1041,7 @@ func (s *DefScheduler) swtich2SelfDeliverWithRetry(savedOrderInfo *WatchOrderInf
|
|||||||
if retryCount > 0 {
|
if retryCount > 0 {
|
||||||
utils.AfterFuncWithRecover(duration, func() {
|
utils.AfterFuncWithRecover(duration, func() {
|
||||||
jxutils.CallMsgHandlerAsync(func() {
|
jxutils.CallMsgHandlerAsync(func() {
|
||||||
|
s.SelfDeliverDelivering(order, "非专送、快送、混合送订单,转自送失败,调用deriving转自送")
|
||||||
s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, retryCount-1, duration)
|
s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, retryCount-1, duration)
|
||||||
}, jxutils.ComposeUniversalOrderID(order.VendorOrderID, order.VendorID))
|
}, jxutils.ComposeUniversalOrderID(order.VendorOrderID, order.VendorID))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxstore/common"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxstore/event"
|
"git.rosy.net.cn/jx-callback/business/jxstore/event"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
@@ -120,6 +121,32 @@ type VendorStoreExcel struct {
|
|||||||
OperatorName3 string `json:"运营负责人3"`
|
OperatorName3 string `json:"运营负责人3"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//首页展示信息
|
||||||
|
type HomePageInfos struct {
|
||||||
|
StoreID int `json:"storeID"` //门店ID
|
||||||
|
StoreName string `json:"storeName"` //门店名字
|
||||||
|
OpenTime1 int16 `json:"openTime1"` // 930就表示9点半,用两个的原因是为了支持中午休息,1与2的时间段不能交叉,为0表示没有
|
||||||
|
CloseTime1 int16 `json:"closeTime1"` // 营业时间 1
|
||||||
|
OpenTime2 int16 `json:"openTime2"` // 营业时间2
|
||||||
|
CloseTime2 int16 `json:"closeTime2"`
|
||||||
|
Status int `json:"status"` //门店是否营业
|
||||||
|
Distance int `json:"distance"` //店铺与定位 直线距离
|
||||||
|
BrandID int `orm:"column(brand_id)" json:"brandID"` //品牌ID
|
||||||
|
BrandName string `json:"brandName"` //品牌名字
|
||||||
|
BrandLogo string `json:"brandLogo"` //品牌logo
|
||||||
|
//热销商品信息
|
||||||
|
SkuID int `json:"skuID"` //商品ID
|
||||||
|
SkuName string `json:"skuName"` //商品名字
|
||||||
|
SkuStatus int `json:"skuStatus"` //商品是否可售状态 1可售 0不可售
|
||||||
|
BestSeller int `json:"bestSeller"` //畅销品 0不是 1是
|
||||||
|
Img string `json:"img"` //商品第一张图片
|
||||||
|
Price int `json:"price"` // 单位为分,标准价,不为份的就为实际标准价,为份的为每市斤价,实际还要乘质量
|
||||||
|
Unit string `json:"unit"` //商品售卖单位 份/kg等
|
||||||
|
//减运策略
|
||||||
|
DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"` //订单满减金额
|
||||||
|
DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"` //订单减免金额
|
||||||
|
}
|
||||||
|
|
||||||
type JdStoreLevelExt struct {
|
type JdStoreLevelExt struct {
|
||||||
Level string `json:"level`
|
Level string `json:"level`
|
||||||
PageNo int `json:"pageNo"`
|
PageNo int `json:"pageNo"`
|
||||||
@@ -518,6 +545,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
|||||||
var storeIDs []int
|
var storeIDs []int
|
||||||
if err = utils.UnmarshalUseNumber([]byte(params["storeIDs"].(string)), &storeIDs); err == nil {
|
if err = utils.UnmarshalUseNumber([]byte(params["storeIDs"].(string)), &storeIDs); err == nil {
|
||||||
for _, v := range storeIDs {
|
for _, v := range storeIDs {
|
||||||
|
globals.SugarLogger.Debug("storeIDs===============", v)
|
||||||
if storeIDsMap[v] != 0 {
|
if storeIDsMap[v] != 0 {
|
||||||
storeIDs2 = append(storeIDs2, v)
|
storeIDs2 = append(storeIDs2, v)
|
||||||
}
|
}
|
||||||
@@ -5626,3 +5654,69 @@ func UpdateStoreTemplate(ctx *jxcontext.Context, storeID int, content, sound str
|
|||||||
_, err = dao.UpdateEntity(db, store, "PrinterTemplate", "PrinterSound")
|
_, err = dao.UpdateEntity(db, store, "PrinterTemplate", "PrinterSound")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//条件过滤 B2B、物料店
|
||||||
|
func FilterByB2B(locationList []*common.Store4User, token string) (retVal []*common.Store4User, errCode string, err error) {
|
||||||
|
userAuth, err := auth2.GetTokenInfo(token)
|
||||||
|
if err != nil {
|
||||||
|
return nil, "", err
|
||||||
|
}
|
||||||
|
user, total, err := dao.GetUsers(dao.GetDB(), 1, "", []string{userAuth.UserID}, nil, nil, 0, 1)
|
||||||
|
if err != nil {
|
||||||
|
return nil, "", err
|
||||||
|
}
|
||||||
|
// 获取位置附近门店列表
|
||||||
|
storeIDs := make([]int, 0, len(locationList))
|
||||||
|
for _, v := range locationList {
|
||||||
|
storeIDs = append(storeIDs, v.ID)
|
||||||
|
}
|
||||||
|
// 判断门店是不是b2b门店,如果是,用户必须为系统管理员(门店老板和运营人员)
|
||||||
|
store, err := dao.GetStoreList(dao.GetDB(), storeIDs, nil, nil, nil, nil, "")
|
||||||
|
if err != nil {
|
||||||
|
return nil, "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
isMatterStore := false
|
||||||
|
for _, v := range storeIDs {
|
||||||
|
if v == model.MatterStoreID {
|
||||||
|
isMatterStore = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make([]*common.Store4User, 0, 0)
|
||||||
|
for _, v := range store {
|
||||||
|
for _, s := range locationList {
|
||||||
|
if v.ID == s.ID {
|
||||||
|
if (v.BrandID == model.B2BNumberId || isMatterStore) && user[0].Type == model.YES { // 普通用户进入物料店和b2b店
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
result = append(result, s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if total != model.YES {
|
||||||
|
return result, "", errors.New("")
|
||||||
|
}
|
||||||
|
if user[0].Type != model.YES {
|
||||||
|
return locationList, "", nil
|
||||||
|
} else {
|
||||||
|
return result, "", err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//首页信息展示
|
||||||
|
//func GetHomePageByLocation(ctx *jxcontext.Context, params map[string]interface{}) (interface{}, string, error) {
|
||||||
|
// //获取门店信息
|
||||||
|
// timeList, err := jxutils.BatchStr2Time("1970-01-01 00:00:00 +0800 CST", "1970-01-01 00:00:00 +0800 CST")
|
||||||
|
// if err != nil {
|
||||||
|
// return nil, "", err
|
||||||
|
// }
|
||||||
|
// store, err := GetStores(ctx, "", params, 0, 0, timeList[0], timeList[1], 0, 0)
|
||||||
|
// //获取热销商品
|
||||||
|
//
|
||||||
|
// //获取满减策略
|
||||||
|
//
|
||||||
|
// return nil, "", nil
|
||||||
|
//}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package localjx
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/tiktok"
|
|
||||||
"math"
|
"math"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -326,15 +325,15 @@ 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 || subAppID == tiktok.TiktokJXDJAppID {
|
//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 {
|
||||||
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
||||||
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
||||||
}
|
}
|
||||||
case model.PayTypeTicTok:
|
case model.PayTypeTicTok:
|
||||||
if orderPay, err = pay4OrderByTT(ctx, order, vendorPayType); err == nil && orderPay != nil {
|
if orderPay, err = pay4OrderByTT(ctx, order, vendorPayType, subAppID); err == nil && orderPay != nil {
|
||||||
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
||||||
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
||||||
}
|
}
|
||||||
@@ -1017,7 +1016,11 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
|||||||
// 订单超过一千配送费优惠(门店运费)
|
// 订单超过一千配送费优惠(门店运费)
|
||||||
discountPrice, err := cms.GetStoreVendorMaps(ctx, nil, jxOrder.StoreID, -1)
|
discountPrice, err := cms.GetStoreVendorMaps(ctx, nil, jxOrder.StoreID, -1)
|
||||||
if len(discountPrice) == 1 && outJxOrder.OrderPrice >= int64(discountPrice[0].DeliveryFeeDeductionSill) {
|
if len(discountPrice) == 1 && outJxOrder.OrderPrice >= int64(discountPrice[0].DeliveryFeeDeductionSill) {
|
||||||
outJxOrder.FreightPrice = outJxOrder.FreightPrice - int64(discountPrice[0].DeliveryFeeDeductionFee)
|
if outJxOrder.FreightPrice-int64(discountPrice[0].DeliveryFeeDeductionFee) >= 0 {
|
||||||
|
outJxOrder.FreightPrice = outJxOrder.FreightPrice - int64(discountPrice[0].DeliveryFeeDeductionFee)
|
||||||
|
} else {
|
||||||
|
outJxOrder.FreightPrice = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ?????????????????????? 测试
|
// ?????????????????????? 测试
|
||||||
if storeDetail.ID == 668470 || storeDetail.ID == 668469 {
|
if storeDetail.ID == 668470 || storeDetail.ID == 668469 {
|
||||||
@@ -1553,6 +1556,7 @@ func changeOrderStatus(vendorOrderID string, status int, remark string) (err err
|
|||||||
StatusTime: time.Now(),
|
StatusTime: time.Now(),
|
||||||
Remark: remark,
|
Remark: remark,
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debug("检测数据orderStatus.Status", status, orderStatus.Status)
|
||||||
jxutils.CallMsgHandlerAsync(func() {
|
jxutils.CallMsgHandlerAsync(func() {
|
||||||
err = partner.CurOrderManager.OnOrderStatusChanged("", orderStatus)
|
err = partner.CurOrderManager.OnOrderStatusChanged("", orderStatus)
|
||||||
}, jxutils.ComposeUniversalOrderID(vendorOrderID, model.VendorIDJX))
|
}, jxutils.ComposeUniversalOrderID(vendorOrderID, model.VendorIDJX))
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ func init() {
|
|||||||
func TestGenOrderNo(t *testing.T) {
|
func TestGenOrderNo(t *testing.T) {
|
||||||
loc, _ := time.LoadLocation("Local")
|
loc, _ := time.LoadLocation("Local")
|
||||||
|
|
||||||
t1, _ := time.ParseInLocation("20060102150405", time.Unix(1654510539,0).Format("20060102150405"), loc)
|
t1, _ := time.ParseInLocation("20060102150405", time.Unix(1654510539, 0).Format("20060102150405"), loc)
|
||||||
fmt.Println("t1",t1)
|
fmt.Println("t1", t1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetAvailableDeliverTime(t *testing.T) {
|
func TestGetAvailableDeliverTime(t *testing.T) {
|
||||||
@@ -28,3 +28,7 @@ func TestGetAvailableDeliverTime(t *testing.T) {
|
|||||||
}
|
}
|
||||||
t.Log(utils.Format4Output(timeInfo, false))
|
t.Log(utils.Format4Output(timeInfo, false))
|
||||||
}
|
}
|
||||||
|
func TestChangeStatus(t *testing.T) {
|
||||||
|
err := changeOrderStatus("88398619646640", 115, "")
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ func getOrderBriefTt(order *model.GoodsOrder) string {
|
|||||||
return fmt.Sprintf("%s等共%d件商品", order.Skus[0].SkuName, order.GoodsCount)
|
return fmt.Sprintf("%s等共%d件商品", order.Skus[0].SkuName, order.GoodsCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
func pay4OrderByTT(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayType string) (orderPay *model.OrderPay, err error) {
|
func pay4OrderByTT(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayType, subAppID string) (orderPay *model.OrderPay, err error) {
|
||||||
param := &tiktok.TickTokCreateOrder{
|
param := &tiktok.TickTokCreateOrder{
|
||||||
AppID: api.TiktokApi.GetAppID(),
|
//AppID: api.TiktokApi.GetAppID(),
|
||||||
OutOrderNo: utils.Int64ToStr(GenPayOrderID(order)),
|
OutOrderNo: utils.Int64ToStr(GenPayOrderID(order)),
|
||||||
TotalAmount: int(order.ActualPayPrice),
|
TotalAmount: int(order.ActualPayPrice),
|
||||||
Subject: "蔬菜水果日用品",
|
Subject: "蔬菜水果日用品",
|
||||||
@@ -29,14 +29,18 @@ func pay4OrderByTT(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
|||||||
CpExtra: "msg",
|
CpExtra: "msg",
|
||||||
NotifyURL: globals.TictokpayNotifyURL,
|
NotifyURL: globals.TictokpayNotifyURL,
|
||||||
}
|
}
|
||||||
|
if subAppID == tiktok.TiktokJXDJAppID {
|
||||||
ttOrderId, orderToken, err := api.TiktokApi.CreateOrderByTicktock(param)
|
param.AppID = api.TiktokJXDJApi.GetAppID()
|
||||||
|
} else {
|
||||||
|
param.AppID = api.TiktokApi.GetAppID()
|
||||||
|
}
|
||||||
|
globals.SugarLogger.Debug("打印param", param)
|
||||||
|
ttOrderId, orderToken, err := getTikTok(subAppID).CreateOrderByTicktock(param)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
orderPay = &model.OrderPay{
|
orderPay = &model.OrderPay{
|
||||||
PayOrderID: ttOrderId, // 抖音订单id
|
PayOrderID: ttOrderId, // 抖音订单id
|
||||||
PayType: model.PayTypeTicTok,
|
PayType: model.PayTypeTicTok,
|
||||||
VendorPayType: vendorPayType,
|
VendorPayType: vendorPayType,
|
||||||
|
|
||||||
VendorOrderID: order.VendorOrderID,
|
VendorOrderID: order.VendorOrderID,
|
||||||
VendorID: order.VendorID,
|
VendorID: order.VendorID,
|
||||||
Status: 0,
|
Status: 0,
|
||||||
@@ -48,7 +52,14 @@ func pay4OrderByTT(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
|||||||
}
|
}
|
||||||
return orderPay, err
|
return orderPay, err
|
||||||
}
|
}
|
||||||
|
func getTikTok(appID string) (TikTokMini *tiktok.API) {
|
||||||
|
TikTokMini = api.TiktokApi
|
||||||
|
if len(appID) > 0 && appID == api.TiktokJXDJApiID {
|
||||||
|
TikTokMini = api.TiktokJXDJApi
|
||||||
|
}
|
||||||
|
globals.SugarLogger.Debug("输出TikTokMini", TikTokMini)
|
||||||
|
return TikTokMini
|
||||||
|
}
|
||||||
func OnTTPayCallback(msg *tiktok.DetailCallBackMessage, refund *tiktok.DetailCallBackMessage2Refund, payType string) (err error) {
|
func OnTTPayCallback(msg *tiktok.DetailCallBackMessage, refund *tiktok.DetailCallBackMessage2Refund, payType string) (err error) {
|
||||||
globals.SugarLogger.Debugf("OnTTPayCallback msg:%s", utils.Format4Output(msg, true))
|
globals.SugarLogger.Debugf("OnTTPayCallback msg:%s", utils.Format4Output(msg, true))
|
||||||
switch payType {
|
switch payType {
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ func (c *Auth2Controller) TiktokDecrypt() {
|
|||||||
// @router /Login [post]
|
// @router /Login [post]
|
||||||
func (c *Auth2Controller) Login() {
|
func (c *Auth2Controller) Login() {
|
||||||
c.callLogin(func(params *tAuth2LoginParams) (retVal interface{}, errCode string, err error) {
|
c.callLogin(func(params *tAuth2LoginParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
globals.SugarLogger.Debug("params.AuthType==============", params.AuthType)
|
||||||
if params.AuthType == auth2.AuthTypeMobile {
|
if params.AuthType == auth2.AuthTypeMobile {
|
||||||
params.AuthIDType = auth2.UserIDMobile
|
params.AuthIDType = auth2.UserIDMobile
|
||||||
} else if params.AuthType == auth2.AuthTypeEmail {
|
} else if params.AuthType == auth2.AuthTypeEmail {
|
||||||
@@ -133,14 +134,18 @@ func (c *Auth2Controller) Login() {
|
|||||||
params.AuthSecret = GetComposedCode2(&c.Controller, params.AuthSecret)
|
params.AuthSecret = GetComposedCode2(&c.Controller, params.AuthSecret)
|
||||||
}
|
}
|
||||||
ctx := auth2.NewContext(c.Ctx.ResponseWriter, c.Ctx.Request)
|
ctx := auth2.NewContext(c.Ctx.ResponseWriter, c.Ctx.Request)
|
||||||
|
globals.SugarLogger.Debug("params.AuthType, params.AuthID, params.AuthIDType, params.AuthSecret==============", params.AuthType, params.AuthID, params.AuthIDType, params.AuthSecret)
|
||||||
authInfo, err := auth2.Login(ctx, params.AuthType, params.AuthID, params.AuthIDType, params.AuthSecret)
|
authInfo, err := auth2.Login(ctx, params.AuthType, params.AuthID, params.AuthIDType, params.AuthSecret)
|
||||||
|
globals.SugarLogger.Debug("authInfo==============", authInfo)
|
||||||
// TODO 兼容没有取到authid2的错误
|
// TODO 兼容没有取到authid2的错误
|
||||||
if err == nil && authInfo.AuthBindInfo != nil {
|
if err == nil && authInfo.AuthBindInfo != nil {
|
||||||
if authInfo.AuthBindInfo.AuthID2 == "" {
|
if authInfo.AuthBindInfo.AuthID2 == "" {
|
||||||
|
globals.SugarLogger.Debug("fgfggggggg")
|
||||||
authInfo.AuthBindInfo.AuthID2 = authInfo.AuthBindInfo.AuthID
|
authInfo.AuthBindInfo.AuthID2 = authInfo.AuthBindInfo.AuthID
|
||||||
}
|
}
|
||||||
retVal = authInfo
|
retVal = authInfo
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debug("retVal==============", retVal)
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -343,6 +348,7 @@ func (c *Auth2Controller) AddAuthBindWithMobile() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debug("打印newAuthInfo==============", newAuthInfo)
|
||||||
err = auth2.AddAuthBindWithMobile(newAuthInfo, params.Mobile)
|
err = auth2.AddAuthBindWithMobile(newAuthInfo, params.Mobile)
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
|
||||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxstore/common"
|
"git.rosy.net.cn/jx-callback/business/jxstore/common"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxstore/misc"
|
"git.rosy.net.cn/jx-callback/business/jxstore/misc"
|
||||||
@@ -11,8 +9,6 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
"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/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"
|
||||||
)
|
)
|
||||||
@@ -595,57 +591,10 @@ 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相关目录,如果是门店老板或者管理则展示全部
|
result, _, err := cms.FilterByB2B(locationList, params.Token)
|
||||||
userAuth, err := auth2.GetTokenInfo(params.Token)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
|
||||||
user, total, err := dao.GetUsers(dao.GetDB(), 1, "", []string{userAuth.UserID}, nil, nil, 0, 1)
|
|
||||||
if err != nil {
|
|
||||||
return nil, "", err
|
|
||||||
}
|
|
||||||
globals.SugarLogger.Debug("检测数据userAuth,user,total==============", userAuth, user, total)
|
|
||||||
// 获取位置附近门店列表
|
|
||||||
storeIDs := make([]int, 0, len(locationList))
|
|
||||||
for _, v := range locationList {
|
|
||||||
storeIDs = append(storeIDs, v.ID)
|
|
||||||
}
|
|
||||||
globals.SugarLogger.Debug("检测数据locationList,storeIDs==============", locationList, storeIDs)
|
|
||||||
// 判断门店是不是b2b门店,如果是,用户必须为系统管理员(门店老板和运营人员)
|
|
||||||
store, err := dao.GetStoreList(dao.GetDB(), storeIDs, nil, nil, nil, nil, "")
|
|
||||||
if err != nil {
|
|
||||||
return nil, "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
isMatterStore := false
|
|
||||||
for _, v := range storeIDs {
|
|
||||||
if v == model.MatterStoreID {
|
|
||||||
isMatterStore = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result := make([]*common.Store4User, 0, 0)
|
|
||||||
for _, v := range store {
|
|
||||||
for _, s := range locationList {
|
|
||||||
if v.ID == s.ID {
|
|
||||||
if (v.BrandID == model.B2BNumberId || isMatterStore) && user[0].Type == model.YES { // 普通用户进入物料店和b2b店
|
|
||||||
continue
|
|
||||||
} else {
|
|
||||||
result = append(result, s)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if total != model.YES {
|
|
||||||
return result, "", errors.New("")
|
|
||||||
}
|
|
||||||
if user[0].Type != model.YES {
|
|
||||||
return locationList, "", nil
|
|
||||||
} else {
|
} else {
|
||||||
return result, "", err
|
return result, "", err
|
||||||
}
|
}
|
||||||
@@ -654,6 +603,34 @@ func (c *StoreController) GetStoreListByLocation() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 根据位置得到首页商店详细信息
|
||||||
|
// @Description 根据位置得到首页商店详细信息
|
||||||
|
// @Param token header string false "认证token"
|
||||||
|
// @Param lng query float64 true "经度"
|
||||||
|
// @Param lat query float64 true "纬度"
|
||||||
|
//@Param storeID query string false "门店ID"
|
||||||
|
// @Param needWalkDistance query bool false "是否需要返回步行距离(且以步行距离排序)"
|
||||||
|
// @Param brandID query int false "品牌ID"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /GetHomePageByLocation [get]
|
||||||
|
//func (c *StoreController) GetHomePageByLocation() {
|
||||||
|
// c.callGetHomePageByLocation(func(params *tStoreGetHomePageByLocationParams) (interface{}, string, error) {
|
||||||
|
// details, _, err := cms.GetHomePageByLocation(params.Ctx, params.MapData)
|
||||||
|
// if err != nil {
|
||||||
|
// return nil, "根据经纬度获取门店详细信息失败", err
|
||||||
|
// }
|
||||||
|
// if params.Token != "" {
|
||||||
|
// utils.Str2Int()
|
||||||
|
// //获取店铺基本信息
|
||||||
|
// //storeDetail := cms.GetStores(params.Ctx, params.Keyword, params.MapData, params.Offset, params.PageSize, timeList[0], timeList[1], params.OrderCountFrom, params.OrderCountTo)
|
||||||
|
// //retVal, err = cms.GetStoreVendorMaps(params.Ctx, nil, utils.Interface2String(), params.VendorID)
|
||||||
|
// }
|
||||||
|
// //return locationList, "", err
|
||||||
|
// return nil, "", err
|
||||||
|
// })
|
||||||
|
//}
|
||||||
|
|
||||||
// @Title 老格恢复拓店进度
|
// @Title 老格恢复拓店进度
|
||||||
// @Description 老格恢复拓店进度
|
// @Description 老格恢复拓店进度
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
|
||||||
|
|
||||||
"errors"
|
"errors"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
|
|||||||
Reference in New Issue
Block a user