This commit is contained in:
苏尹岚
2021-03-10 10:10:55 +08:00
parent 89d722c729
commit 493f2ba97b
5 changed files with 37 additions and 9 deletions

View File

@@ -12,10 +12,9 @@ import (
"github.com/astaxie/beego" "github.com/astaxie/beego"
"git.rosy.net.cn/jx-callback/globals/api"
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch" "git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
"git.rosy.net.cn/baseapi/platformapi/jdapi"
"git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils" "git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/excel" "git.rosy.net.cn/jx-callback/business/jxutils/excel"
@@ -1400,8 +1399,15 @@ func GetMatterStoreOrderCount(ctx *jxcontext.Context, storeID int) (result *Orde
func RefreshJdShopOrdersEarningPrice(ctx *jxcontext.Context, orderStartTime, orderEndTime string) (err error) { func RefreshJdShopOrdersEarningPrice(ctx *jxcontext.Context, orderStartTime, orderEndTime string) (err error) {
var ( var (
db = dao.GetDB() db = dao.GetDB()
appOrgCode string
) )
results, err := api.JdAPI.GetJdShopOrders(utils.Str2Time(orderStartTime).Format("20060102"), utils.Str2Time(orderEndTime).Format("20060102"), globals.JdOrgCode, globals.JdLoginName) if beego.BConfig.RunMode == "jxgy" {
appOrgCode = "339032"
} else {
appOrgCode = "320406"
}
jdapi := partner.CurAPIManager.GetAPI(model.VendorIDJD, appOrgCode).(*jdapi.API)
results, err := jdapi.GetJdShopOrders(utils.Str2Time(orderStartTime).Format("20060102"), utils.Str2Time(orderEndTime).Format("20060102"), globals.JdOrgCode, globals.JdLoginName)
if err != nil { if err != nil {
return err return err
} }

View File

@@ -348,9 +348,6 @@ func Init() {
jdsCookie = configs[0].Value jdsCookie = configs[0].Value
api.JdShopAPI.SetCookieWithStr(jdsCookie) api.JdShopAPI.SetCookieWithStr(jdsCookie)
} }
// if configs, err := dao.QueryConfigs(dao.GetDB(), "jdsCookie2", model.ConfigTypeCookie, ""); err == nil {
// api.JdShop2API.SetCookieWithStr(configs[0].Value)
// }
if configs, err := dao.QueryConfigs(dao.GetDB(), "yinbaoCookie", model.ConfigTypeCookie, ""); err == nil { if configs, err := dao.QueryConfigs(dao.GetDB(), "yinbaoCookie", model.ConfigTypeCookie, ""); err == nil {
yinbaoCookie := configs[0].Value yinbaoCookie := configs[0].Value
api.YinBaoAPI.SetCookie(".POSPALAUTH30220", yinbaoCookie) api.YinBaoAPI.SetCookie(".POSPALAUTH30220", yinbaoCookie)

View File

@@ -403,6 +403,7 @@ type GetStoreManageStateResult struct {
ActAmple int `json:"actAmple"` //活动丰富的 ActAmple int `json:"actAmple"` //活动丰富的
NullOrderCount int `json:"nullOrderCount"` //无效订单数 NullOrderCount int `json:"nullOrderCount"` //无效订单数
RefuseOrderCount int `json:"refuseOrderCount"` //拒绝订单数 RefuseOrderCount int `json:"refuseOrderCount"` //拒绝订单数
StoreScore int `json:"storeScore"` //门店评分
RepurchaseRate int `json:"repurchaseRate"` //复购率(转化率) RepurchaseRate int `json:"repurchaseRate"` //复购率(转化率)
} }
@@ -468,12 +469,27 @@ func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, f
} }
} }
} }
result.SkuCount = skuCount result.SkuCount, result.HighSkuCount = skuCount, highSkuCount
result.HighSkuCount = highSkuCount
//活动丰富度 //活动丰富度
handler := partner.GetPurchasePlatformFromVendorID(vendorID) handler := partner.GetPurchasePlatformFromVendorID(vendorID)
ample, _ := handler.GetActAmple(ctx, storeDetail.VendorStoreID, storeDetail.VendorStoreID) ample, _ := handler.GetActAmple(ctx, storeDetail.VendorStoreID, storeDetail.VendorStoreID)
result.ActAmple = ample result.ActAmple = ample
//订单
nullOrderCount, refuseOrderCount := 0, 0
if orderList, err := dao.QueryOrders(db, "", 0, []int{vendorID}, v, fromTimeT, toTimeT); err == nil {
for _, v := range orderList {
if v.Status == model.OrderStatusCanceled {
nullOrderCount++
}
if waybills, err2 := dao.GetWayBillByOrderID(db, 0, vendorID, 0, v.VendorOrderID); err2 == nil {
if len(waybills) > 0 {
refuseOrderCount++
}
}
}
}
result.NullOrderCount, result.RefuseOrderCount = nullOrderCount, refuseOrderCount
//转化率
getStoreManageStateResult = append(getStoreManageStateResult, result) getStoreManageStateResult = append(getStoreManageStateResult, result)
} }
return getStoreManageStateResult, err return getStoreManageStateResult, err

View File

@@ -340,5 +340,10 @@ func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITa
} }
func (c *PurchaseHandler) GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error) { func (c *PurchaseHandler) GetActAmple(ctx *jxcontext.Context, vendorStoreID, vendorOrgCode string) (ample int, err error) {
for _, v := range ebaiapi.ActivityTypeList {
if actIDs, err := api.EbaiAPI.ActMultiChannelQueryIDs("", utils.Str2Int64(vendorStoreID), v); err == nil && len(actIDs) > 0 {
ample++
}
}
return ample, err return ample, err
} }

View File

@@ -50,6 +50,10 @@ func (a *APIManager) GetAPI(vendorID int, appOrgCode string) (pfAPI interface{})
JdStorePageCookie := configs[0].Value JdStorePageCookie := configs[0].Value
api.JdAPI.SetJdCookie(JdStorePageCookie) api.JdAPI.SetJdCookie(JdStorePageCookie)
} }
if configs, err := dao.QueryConfigs(dao.GetDB(), "jdStorePageEarning", model.ConfigTypeCookie, ""); err == nil {
jdStorePageEarning := configs[0].Value
api.JdAPI.SetCookie("user", jdStorePageEarning)
}
} }
case model.VendorIDMTWM: case model.VendorIDMTWM:
pfAPI = api.MtwmAPI pfAPI = api.MtwmAPI