Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -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
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user