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) {
|
||||
token, tokenType := createToken(user, authBindInfo)
|
||||
//user为空 tokenType=2
|
||||
globals.SugarLogger.Debug("token,tokenType,user============", token, tokenType, user)
|
||||
expireDuration := DefTokenDuration
|
||||
authInfo = &AuthInfo{
|
||||
AuthBindInfo: authBindInfo,
|
||||
@@ -249,7 +248,6 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string
|
||||
}
|
||||
realAuthID = user.GetID()
|
||||
}
|
||||
globals.SugarLogger.Debug("打印realAuthID检测是否为空==================", realAuthID)
|
||||
if authBindEx, err = handler.VerifySecret(realAuthID, authSecret); err == nil {
|
||||
globals.SugarLogger.Debugf("Login authBindEx", utils.Format4Output(authBindEx, false))
|
||||
if authBindEx == nil { // mobile, email会返回nil(表示不会新建AuthBind实体)
|
||||
@@ -383,7 +381,6 @@ func AddAuthBind(user IUser, newAuthInfo *AuthInfo) (err error) {
|
||||
} else {
|
||||
if handler := authers[newAuthInfo.AuthBindInfo.Type]; handler != nil {
|
||||
newAuthInfo.AuthBindInfo.UserID = user.GetID()
|
||||
globals.SugarLogger.Debug("进入AddAuthBind获取userID", newAuthInfo.AuthBindInfo.UserID)
|
||||
handler.UnbindAuth(user.GetID(), newAuthInfo.GetAuthType(), newAuthInfo.GetAuthTypeID(), user.GetName())
|
||||
err = handler.AddAuthBind(newAuthInfo.AuthBindInfo, user.GetName())
|
||||
} else {
|
||||
|
||||
@@ -96,10 +96,8 @@ func getWxApp(appID string) (miniApi *weixinapi.API) {
|
||||
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) {
|
||||
|
||||
@@ -1041,6 +1041,7 @@ func (s *DefScheduler) swtich2SelfDeliverWithRetry(savedOrderInfo *WatchOrderInf
|
||||
if retryCount > 0 {
|
||||
utils.AfterFuncWithRecover(duration, func() {
|
||||
jxutils.CallMsgHandlerAsync(func() {
|
||||
s.SelfDeliverDelivering(order, "非专送、快送、混合送订单,转自送失败,调用deriving转自送")
|
||||
s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, retryCount-1, duration)
|
||||
}, jxutils.ComposeUniversalOrderID(order.VendorOrderID, order.VendorID))
|
||||
})
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/common"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/event"
|
||||
"io"
|
||||
"math"
|
||||
@@ -120,6 +121,32 @@ type VendorStoreExcel struct {
|
||||
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 {
|
||||
Level string `json:"level`
|
||||
PageNo int `json:"pageNo"`
|
||||
@@ -518,6 +545,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
var storeIDs []int
|
||||
if err = utils.UnmarshalUseNumber([]byte(params["storeIDs"].(string)), &storeIDs); err == nil {
|
||||
for _, v := range storeIDs {
|
||||
globals.SugarLogger.Debug("storeIDs===============", v)
|
||||
if storeIDsMap[v] != 0 {
|
||||
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")
|
||||
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 (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tiktok"
|
||||
"math"
|
||||
"regexp"
|
||||
"strings"
|
||||
@@ -326,15 +325,15 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType
|
||||
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
||||
}
|
||||
case model.PayTypeTL:
|
||||
if subAppID == tiktok.TiktokAppId || subAppID == tiktok.TiktokJXDJAppID {
|
||||
subAppID = model.JXC4AppId // 京西商城
|
||||
}
|
||||
//if subAppID == tiktok.TiktokAppId || subAppID == tiktok.TiktokJXDJAppID {
|
||||
// subAppID = model.JXC4AppId // 京西商城
|
||||
//}
|
||||
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil {
|
||||
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
||||
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
||||
}
|
||||
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())
|
||||
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)
|
||||
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 {
|
||||
@@ -1553,6 +1556,7 @@ func changeOrderStatus(vendorOrderID string, status int, remark string) (err err
|
||||
StatusTime: time.Now(),
|
||||
Remark: remark,
|
||||
}
|
||||
globals.SugarLogger.Debug("检测数据orderStatus.Status", status, orderStatus.Status)
|
||||
jxutils.CallMsgHandlerAsync(func() {
|
||||
err = partner.CurOrderManager.OnOrderStatusChanged("", orderStatus)
|
||||
}, jxutils.ComposeUniversalOrderID(vendorOrderID, model.VendorIDJX))
|
||||
|
||||
@@ -17,8 +17,8 @@ func init() {
|
||||
func TestGenOrderNo(t *testing.T) {
|
||||
loc, _ := time.LoadLocation("Local")
|
||||
|
||||
t1, _ := time.ParseInLocation("20060102150405", time.Unix(1654510539,0).Format("20060102150405"), loc)
|
||||
fmt.Println("t1",t1)
|
||||
t1, _ := time.ParseInLocation("20060102150405", time.Unix(1654510539, 0).Format("20060102150405"), loc)
|
||||
fmt.Println("t1", t1)
|
||||
}
|
||||
|
||||
func TestGetAvailableDeliverTime(t *testing.T) {
|
||||
@@ -28,3 +28,7 @@ func TestGetAvailableDeliverTime(t *testing.T) {
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
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{
|
||||
AppID: api.TiktokApi.GetAppID(),
|
||||
//AppID: api.TiktokApi.GetAppID(),
|
||||
OutOrderNo: utils.Int64ToStr(GenPayOrderID(order)),
|
||||
TotalAmount: int(order.ActualPayPrice),
|
||||
Subject: "蔬菜水果日用品",
|
||||
@@ -29,14 +29,18 @@ func pay4OrderByTT(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
||||
CpExtra: "msg",
|
||||
NotifyURL: globals.TictokpayNotifyURL,
|
||||
}
|
||||
|
||||
ttOrderId, orderToken, err := api.TiktokApi.CreateOrderByTicktock(param)
|
||||
if subAppID == tiktok.TiktokJXDJAppID {
|
||||
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 {
|
||||
orderPay = &model.OrderPay{
|
||||
PayOrderID: ttOrderId, // 抖音订单id
|
||||
PayType: model.PayTypeTicTok,
|
||||
VendorPayType: vendorPayType,
|
||||
|
||||
VendorOrderID: order.VendorOrderID,
|
||||
VendorID: order.VendorID,
|
||||
Status: 0,
|
||||
@@ -48,7 +52,14 @@ func pay4OrderByTT(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
||||
}
|
||||
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) {
|
||||
globals.SugarLogger.Debugf("OnTTPayCallback msg:%s", utils.Format4Output(msg, true))
|
||||
switch payType {
|
||||
|
||||
Reference in New Issue
Block a user