aa
This commit is contained in:
@@ -397,7 +397,7 @@ type GetStoreManageStateResult struct {
|
||||
StoreName string `json:"storeName"`
|
||||
CoverArea float64 `json:"coverArea"`
|
||||
MarketScale int `json:"marketScale"` //市场规模
|
||||
OpenTime int `json:"openTime"` //营业时长
|
||||
OpenTime float64 `json:"openTime"` //营业时长
|
||||
SkuCount int `json:"skuCount"` //商品数
|
||||
HighSkuCount int `json:"highSkuCount"` //虚高商品数
|
||||
ActAmple int `json:"actAmple"` //活动丰富的
|
||||
@@ -409,6 +409,8 @@ type GetStoreManageStateResult struct {
|
||||
func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, fromTime, toTime string) (getStoreManageStateResult []*GetStoreManageStateResult, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
fromTimeT, toTimeT = utils.Str2Time(fromTime), utils.Str2Time(toTime)
|
||||
dayCount = int(fromTimeT.Sub(toTimeT).Hours())/24 + 1 //查的几天
|
||||
)
|
||||
//权限
|
||||
if permission.IsRoled(ctx) {
|
||||
@@ -437,6 +439,7 @@ func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, f
|
||||
MarketScale: storeDetail.MarketScale,
|
||||
CoverArea: storeDetail.CoverArea,
|
||||
}
|
||||
//覆盖范围
|
||||
if result.CoverArea == 0 {
|
||||
handler := partner.GetPurchasePlatformFromVendorID(vendorID)
|
||||
store, _ := handler.ReadStore(ctx, storeDetail.VendorOrgCode, storeDetail.VendorStoreID)
|
||||
@@ -446,12 +449,37 @@ func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, f
|
||||
result.CoverArea = storeMaps[0].CoverArea
|
||||
}
|
||||
}
|
||||
//营业时长
|
||||
optime := jxutils.JxOperationTime2TimeByDate(storeDetail.CloseTime1, time.Now()).Sub(jxutils.JxOperationTime2TimeByDate(storeDetail.OpenTime1, time.Now())).Hours()
|
||||
if storeDetail.CloseTime2 != 0 && storeDetail.OpenTime2 != 0 {
|
||||
optime += jxutils.JxOperationTime2TimeByDate(storeDetail.CloseTime2, time.Now()).Sub(jxutils.JxOperationTime2TimeByDate(storeDetail.OpenTime2, time.Now())).Hours()
|
||||
}
|
||||
result.OpenTime = optime * float64(dayCount)
|
||||
//商品数
|
||||
skuCount, highSkuCount := 0, 0
|
||||
storeSkus, _ := dao.GetStoresSkusInfo(db, []int{v}, nil)
|
||||
for _, v := range storeSkus {
|
||||
if v.Status == model.StoreSkuBindStatusNormal && v.Stock > 0 {
|
||||
skuCount++
|
||||
}
|
||||
if priceRefer, err := dao.GetPriceReferPrice(db, 0, v.SkuID, utils.Time2Date(time.Now().AddDate(0, 0, -1))); err == nil && priceRefer != nil {
|
||||
if v.UnitPrice > priceRefer.MidUnitPrice {
|
||||
highSkuCount++
|
||||
}
|
||||
}
|
||||
}
|
||||
result.SkuCount = skuCount
|
||||
result.HighSkuCount = highSkuCount
|
||||
//活动丰富度
|
||||
|
||||
getStoreManageStateResult = append(getStoreManageStateResult, result)
|
||||
}
|
||||
return getStoreManageStateResult, err
|
||||
}
|
||||
|
||||
func CalculateCoverArea(coordinate []string, vendorID int) (area float64) {
|
||||
//我先把地理坐标转成了平面坐标(百度的方法)
|
||||
//然后按多个坐标求面积公式求的面积(百度的方法)
|
||||
if len(coordinate) == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ type IPurchasePlatformActHandler interface {
|
||||
// CancelAct(ctx *jxcontext.Context, parentTask tasksch.ITask, act *model.Act2, actStoreSku []*model.ActStoreSku2) (err error)
|
||||
|
||||
SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITask, act *model.Act2, actOrderRules []*model.ActOrderRule, actStoreSkuList []*model.ActStoreSku2) (err error)
|
||||
|
||||
//活动丰富度
|
||||
GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error)
|
||||
}
|
||||
|
||||
type IPurchasePlatformPageActHandler interface {
|
||||
|
||||
@@ -338,3 +338,7 @@ func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITa
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error) {
|
||||
return ample, err
|
||||
}
|
||||
|
||||
@@ -420,3 +420,7 @@ func getActFromJD(vendorOrgCode, promotionID string) (act *model.Act2, actStoreS
|
||||
}
|
||||
return act, actStoreSkuList, err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error) {
|
||||
return ample, err
|
||||
}
|
||||
|
||||
@@ -9,3 +9,7 @@ import (
|
||||
func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITask, act *model.Act2, actOrderRules []*model.ActOrderRule, actStoreSkuList []*model.ActStoreSku2) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error) {
|
||||
return ample, err
|
||||
}
|
||||
|
||||
@@ -258,3 +258,15 @@ func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITa
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error) {
|
||||
// for _, v := range mtwmapi.ActTypeList {
|
||||
// //1表示进行中
|
||||
// if actList, err := getAPI(vendorOrgCode, 0, vendorStoreID).GetByAppPoiCodeAndType(vendorOrgCode, 1, v); err == nil {
|
||||
// for _, vv := range actList {
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return ample, err
|
||||
}
|
||||
|
||||
@@ -9,3 +9,7 @@ import (
|
||||
func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITask, act *model.Act2, actOrderRules []*model.ActOrderRule, actStoreSkuList []*model.ActStoreSku2) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error) {
|
||||
return ample, err
|
||||
}
|
||||
|
||||
@@ -72,7 +72,10 @@ func (a *APIManager) GetAPI(vendorID int, appOrgCode string) (pfAPI interface{})
|
||||
func (a *APIManager) GetAppOrgCodeList(vendorID int) (appOrgCodeList []string) {
|
||||
switch vendorID {
|
||||
case model.VendorIDJD:
|
||||
appOrgCodeList = jxutils.BatchString2Slice(globals.JdOrgCode, globals.Jd2OrgCode, globals.Jd3OrgCode, globals.JdcsOrgCode, globals.JdydOrgCode)
|
||||
vendorOrgCodes, _ := dao.GetVendorOrgCode(dao.GetDB(), model.VendorIDJD, "", model.VendorOrgTypePlatform)
|
||||
for _, v := range vendorOrgCodes {
|
||||
appOrgCodeList = append(appOrgCodeList, v.VendorOrgCode)
|
||||
}
|
||||
case model.VendorIDMTWM:
|
||||
appOrgCodeList = []string{api.MtwmAPI.GetAppID(), api.Mtwm2API.GetAppID()}
|
||||
case model.VendorIDEBAI:
|
||||
|
||||
Reference in New Issue
Block a user