刷新京东商城订单结算价

This commit is contained in:
苏尹岚
2020-05-08 11:00:13 +08:00
parent a247c24a08
commit 29065aa419
6 changed files with 60 additions and 3 deletions

View File

@@ -7,6 +7,8 @@ import (
"strings"
"time"
"git.rosy.net.cn/jx-callback/globals/api"
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
"git.rosy.net.cn/baseapi/utils"
@@ -1345,3 +1347,23 @@ func GetMatterStoreOrderCount(ctx *jxcontext.Context, storeID int) (result *Orde
// orderCount.Count = 1000
return orderCount, err
}
func RefreshJdShopOrdersEarningPrice(ctx *jxcontext.Context, orderStartTime, orderEndTime string) (err error) {
var (
db = dao.GetDB()
)
results, err := api.JdAPI.GetJdShopOrders(orderStartTime, orderEndTime, globals.JdOrgCode, globals.JdLoginName)
if err != nil {
return err
}
for _, v := range results.BillList.Result {
if v.DueAmount != 0 {
order := &model.GoodsOrder{}
order.VendorOrderID = utils.Int64ToStr(v.OrderID)
order.EarningPrice = utils.Float64TwoInt64(v.DueAmount * 100)
order.NewEarningPrice = utils.Float64TwoInt64(v.DueAmount * 100)
dao.UpdateEntity(db, order, "EarningPrice", "NewEarningPrice")
}
}
return err
}

View File

@@ -129,6 +129,7 @@ var (
JdStorePageCookie string
yinbaoCookie string
feiePageCookie string
jdStorePageEarning string
)
func GetImportantTaskID(taskName string) string {
@@ -281,6 +282,9 @@ func Init() {
if configs, err := dao.QueryConfigs(dao.GetDB(), "jdStorePageCookie", model.ConfigTypeCookie, ""); err == nil {
JdStorePageCookie = configs[0].Value
}
if configs, err := dao.QueryConfigs(dao.GetDB(), "jdStorePageEarning", model.ConfigTypeCookie, ""); err == nil {
jdStorePageEarning = configs[0].Value
}
if configs, err := dao.QueryConfigs(dao.GetDB(), "jd2StorePageCookie", model.ConfigTypeCookie, ""); err == nil {
jd2StorePageCookie = configs[0].Value
}
@@ -303,6 +307,7 @@ func Init() {
api.MtwmAPI.SetCookieWithStr(mtwmCookieStr)
api.MtpsAPI.SetCookie("token", mtpsStoreToken)
api.JdAPI.SetJdCookie(JdStorePageCookie)
api.JdAPI.SetCookie("user", jdStorePageEarning)
api.JdPageAPI.SetCookie(jdapi.AccessStorePageCookieName, JdStorePageCookie)
api.JdPageAPI.SetCookie(jdapi.AccessStorePageCookieName2, JdStorePageCookie)
api.FeieAPI.SetCookieWithStr(feiePageCookie)
@@ -386,6 +391,8 @@ func doDailyWork() {
localjx.RefreshAllMatterOrderStatus(jxcontext.AdminCtx)
//同步银豹到京西
cms.CurVendorSync.SyncStoreSkusFromYb(jxcontext.AdminCtx, nil, true, true)
//刷新京东商城订单结算价
orderman.RefreshJdShopOrdersEarningPrice(jxcontext.AdminCtx, time.Now().AddDate(0, 0, -3).Format("20060102"), time.Now().Format("20060102"))
}
func RefreshRealMobile(ctx *jxcontext.Context, vendorID int, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {