修改骑手位置同步
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
|
||||
"errors"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
@@ -99,7 +101,53 @@ func (c *StoreSkuController) GetStoresSkus() {
|
||||
var storeIDs, skuIDs []int
|
||||
var upcs []string
|
||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.SkuIDs, &skuIDs, params.Upcs, &upcs); err == nil {
|
||||
retVal, err = cms.GetStoresSkus(params.Ctx, storeIDs, skuIDs, upcs, params.IsFocus, params.IsHighPrice, params.PriceType, params.Keyword, params.IsBySku, params.IsAct, params.MapData, params.Offset, params.PageSize)
|
||||
|
||||
// 判断门店是不是b2b门店,如果是,用户必须为系统管理员(门店老板和运营人员)
|
||||
store, err := dao.GetStoreList(dao.GetDB(), storeIDs, nil, nil, nil, nil, "")
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
// 获取商品列表
|
||||
storeSku, err := cms.GetStoresSkus(params.Ctx, storeIDs, skuIDs, upcs, params.IsFocus, params.IsHighPrice, params.PriceType, params.Keyword, params.IsBySku, params.IsAct, params.MapData, params.Offset, params.PageSize)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
isMatterStore := false
|
||||
for _, v := range storeIDs {
|
||||
if v == model.MatterStoreID {
|
||||
isMatterStore = true
|
||||
}
|
||||
}
|
||||
|
||||
// 获取人员信息
|
||||
// 获取用户权限,如果是普通用户不展示b2b相关目录,如果是门店老板或者管理则展示全部
|
||||
userAuth, err := auth2.GetTokenInfo(params.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
|
||||
}
|
||||
if total != model.YES {
|
||||
return nil, "", errors.New("未注册用户")
|
||||
}
|
||||
|
||||
result := &dao.StoreSkuNamesInfo{}
|
||||
result.TotalCount = storeSku.TotalCount
|
||||
for _, v := range store {
|
||||
for _, s := range storeSku.SkuNames {
|
||||
if v.ID == s.StoreID && (v.BrandID == model.B2BNumberId || isMatterStore) && user[0].Type == model.YES { // 物料店和b2b店
|
||||
result.TotalCount -= len(s.Skus)
|
||||
continue
|
||||
}
|
||||
result.SkuNames = append(result.SkuNames, s)
|
||||
}
|
||||
}
|
||||
|
||||
return result, "", nil
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user