This commit is contained in:
richboo111
2022-08-23 14:12:58 +08:00
parent cce72fe054
commit 5b86b9d6b0
3 changed files with 88 additions and 56 deletions

View File

@@ -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"
@@ -5626,3 +5627,56 @@ 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 interface{}, 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
}
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 {
return result, "", err
}
}

View File

@@ -3,7 +3,6 @@ package localjx
import (
"errors"
"fmt"
"git.rosy.net.cn/baseapi/platformapi/tiktok"
"math"
"regexp"
"strings"
@@ -326,9 +325,9 @@ 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)