From e17042afd01db29c14fdee9d7192994fe2fde4ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 14 Oct 2024 12:41:49 +0800 Subject: [PATCH] 1 --- business/jxcallback/orderman/order.go | 2 +- business/jxcallback/orderman/orderman_ext.go | 4 +- .../jxcallback/scheduler/defsch/defsch.go | 16 +- business/jxstore/cms/sku.go | 37 +---- business/jxstore/cms/store_sku.go | 2 +- business/jxstore/cms/sync_store_sku.go | 1 + business/jxutils/tasks/configrefresh.go | 3 + business/model/store_score.go | 6 + business/partner/purchase/mtwm/order.go | 6 +- conf/app.conf | 140 +++++++++++++++++- main.go | 2 +- 11 files changed, 166 insertions(+), 53 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index b36a9b5de..21d8db6c1 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -2153,7 +2153,7 @@ func RefreshOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID, } storeSku := storeSkus[0] //if v.ShopPrice == v.EarningPrice { - if beego.BConfig.RunMode == "jxgy" { + if beego.BConfig.RunMode == "jxgy" || beego.BConfig.RunMode == "jxpet" { if v.SalePrice > v.ShopPrice { v.EarningPrice = int64(math.Round(float64(storeSku.Price) * float64(order.OrderPayPercentage) / 100)) } else { diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index fb249a9e6..5cfe7fcff 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -471,7 +471,7 @@ func (c *OrderManager) ExportOrders(ctx *jxcontext.Context, fromDateStr, toDateS } if v.SkuCount2 > 0 { var skuStr string - if beego.BConfig.RunMode == "jxgy" { + if beego.BConfig.RunMode == "jxgy" || beego.BConfig.RunMode == "jxpet" { skuStr = strings.Join([]string{ utils.Int2Str(v.SkuID), utils.Int2Str(v.SkuCount2), @@ -1678,6 +1678,8 @@ func RefreshJdShopOrdersEarningPrice(ctx *jxcontext.Context, orderStartTime, ord ) if beego.BConfig.RunMode == "jxgy" { appOrgCode = "339032" + } else if beego.BConfig.RunMode == "jxpet" { + appOrgCode = "jxpet_apporg_code" } else { appOrgCode = "320406" } diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 73523ceaa..f666dbb3a 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -20,8 +20,6 @@ import ( push "git.rosy.net.cn/jx-callback/business/jxutils/unipush" - beego "github.com/astaxie/beego/server/web" - "git.rosy.net.cn/jx-callback/business/jxstore/cms" "git.rosy.net.cn/jx-callback/business/authz" @@ -1806,18 +1804,10 @@ func OrderProfitWarning(order *model.GoodsOrder) { } else { payPercentage = storeDetail.PayPercentage } - if beego.BConfig.RunMode == "jxgy" { - if payPercentage >= 50 { - profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney-order.EarningPrice)) / 100 - } else { - profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney*int64(payPercentage)/200)) / 100 - } + if payPercentage >= 50 { + profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney-order.EarningPrice)) / 100 } else { - if payPercentage >= 50 { - profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney-order.EarningPrice)) / 100 - } else { - profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney*int64(payPercentage)/200)) / 100 - } + profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney*int64(payPercentage)/200)) / 100 } if profit < 0 { operatorPhone, operatorName := getOrderOperatorInfo(order, storeDetail) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 3e17d84c4..cffaa3fd6 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -865,23 +865,6 @@ func AddSkuName(ctx *jxcontext.Context, skuNameExt *model.SkuNameExt, userName s } } - //picType := true - //for _, imgName := range []string{skuNameExt.Img, skuNameExt.Img2, skuNameExt.Img3, skuNameExt.Img4, skuNameExt.Img5} { - // if imgName != "" { - // dataRes, err2 := datares.TryRegisterDataResource(ctx, skuNameExt.Name, imgName, model.ImgTypeMain, false) - // if err = err2; err != nil { - // return nil, err - // } - // if dataRes.ResourceType == model.MimeTypeJpeg || dataRes.ResourceType == model.MimeTypePng { - // picType = false - // } - // } - //} - - //if picType { - // return nil, fmt.Errorf("商品图片应至少包含一张非gif格式的图片!") - //} - if skuNameExt.DescImg != "" { dataRes, err2 := datares.TryRegisterDataResource(ctx, skuNameExt.Name+"desc", skuNameExt.DescImg, model.ImgTypeDesc, false) if err = err2; err != nil { @@ -912,12 +895,8 @@ func AddSkuName(ctx *jxcontext.Context, skuNameExt *model.SkuNameExt, userName s sku := v.Sku dao.WrapAddIDCULDEntity(sku, userName) sku.NameID = skuNameExt.ID - if beego.BConfig.RunMode == "jxgy" { - sku.LadderBoxPrice = 0 - } else if beego.BConfig.RunMode == "prod" { - sku.LadderBoxPrice = 10 - } - sku.LadderBoxNum = 1 + sku.LadderBoxPrice = 0 + sku.LadderBoxNum = 0 if err = dao.CreateEntity(db, sku); err != nil { dao.Rollback(db, txDB) return nil, err @@ -1176,6 +1155,8 @@ func getCategoryByName(name string) string { vendorOrgCode := "" if beego.BConfig.RunMode == "jxgy" { vendorOrgCode = "339032" + } else if beego.BConfig.RunMode == "jxpet" { + vendorOrgCode = "jxpet_apporg_code" } else { vendorOrgCode = "320406" } @@ -1196,6 +1177,8 @@ func getCategoryByImg(img ...string) string { vendorOrgCode := "" if beego.BConfig.RunMode == "jxgy" { vendorOrgCode = "57939570" + } else if beego.BConfig.RunMode == "jxpet" { + vendorOrgCode = "57939570" } else { vendorOrgCode = "57939570" } @@ -1536,12 +1519,8 @@ func AddSku(ctx *jxcontext.Context, nameID int, sku *model.Sku, userName string) // sku.JdSyncStatus = model.SyncFlagNewMask // sku.JdID = 0 sku.NameID = nameID - if beego.BConfig.RunMode == "jxgy" { - sku.LadderBoxPrice = 0 - } else if beego.BConfig.RunMode == "prod" { - sku.LadderBoxPrice = 10 - } - sku.LadderBoxNum = 1 + sku.LadderBoxPrice = 0 + sku.LadderBoxNum = 0 txDB, _ := dao.Begin(db) defer func() { if r := recover(); r != nil { diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index cb9c562af..26d759769 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1726,7 +1726,7 @@ func UpdateStoreSkus(ctx *jxcontext.Context, causeFlag, storeID int, skuBindInfo } func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isScale, isRefreshHigh, isAsync, isContinueWhenError bool) (hint string, err error) { - if beego.BConfig.RunMode == "jxgy" { + if beego.BConfig.RunMode == "jxgy" || beego.BConfig.RunMode == "jxpet" { doStoreSkuAuditForGy(ctx, storeIDs, skuBindInfos) var num int64 db := dao.GetDB() diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 4891e6a03..145609ea4 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -79,6 +79,7 @@ func SyncStoreCategories(ctx *jxcontext.Context, parentTask tasksch.ITask, vendo case "dev": totalCategory, _ = dao.GetDetailStoreSkuCategoryMap(db, 668469) case "jxgy": + case "jxpet": default: totalCategory, _ = dao.GetDetailStoreSkuCategoryMap(db, 668594) diff --git a/business/jxutils/tasks/configrefresh.go b/business/jxutils/tasks/configrefresh.go index b827c305a..7fc9f1cdc 100644 --- a/business/jxutils/tasks/configrefresh.go +++ b/business/jxutils/tasks/configrefresh.go @@ -187,6 +187,9 @@ func RefreshFnToken() (err error) { if _, err = fnpsapi.HttpToGuoYuanFN(map[string]interface{}{"token": curConfig.Token, "refresh_token": curConfig.RefreshToken}, fnpsapi.FengNiaoCallbackTypeToken); err != nil { globals.SugarLogger.Debugf("菜市token通知到果园错误:%v", err) } + if _, err = fnpsapi.HttpToPetFN(map[string]interface{}{"token": curConfig.Token, "refresh_token": curConfig.RefreshToken}, fnpsapi.FengNiaoCallbackTypeToken); err != nil { + globals.SugarLogger.Debugf("菜市token通知到宠物错误:%v", err) + } return token, expireTimeStr, refreshToken }, func(value, v2 string) { diff --git a/business/model/store_score.go b/business/model/store_score.go index b9e10857a..9fedba442 100644 --- a/business/model/store_score.go +++ b/business/model/store_score.go @@ -35,6 +35,12 @@ type StoreScore struct { SaleSkuPrice int `orm:"column(sale_sku_price)" json:"saleSkuPrice"` } +func (*StoreScore) TableIndex() [][]string { + return [][]string{ + []string{"StoreID"}, + } +} + type StoreScoreEx struct { StoreScore StoreName string `json:"storeName"` diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index 0ee72b627..7d4507bdf 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -354,6 +354,10 @@ func (c *PurchaseHandler) onOrderMsg(msg *mtwmapi.CallbackMsg) (response *mtwmap if msg.Cmd == mtwmapi.MsgTypeNewOrder { order, orderMap, err2 := c.getOrder(msg.AppID, GetOrderIDFromMsg(msg), GetVendorStoreIDFromMsg(msg)) if err = err2; err == nil { + // 存在新订单用户未支付推送,导致订单取消,但是订单又会被送出 + if order.OrderSeq == 0 && msg.Cmd == mtwmapi.MsgTypeOrderFinancial { + return mtwmapi.Err2CallbackResponse(err, "") + } err = partner.CurOrderManager.OnOrderNew(order, c.callbackMsg2Status(msg)) if err == nil { utils.CallFuncAsync(func() { @@ -369,7 +373,7 @@ func (c *PurchaseHandler) onOrderMsg(msg *mtwmapi.CallbackMsg) (response *mtwmap order, orderObj, err2 := c.getOrder(msg.AppID, GetOrderIDFromMsg(msg), GetVendorStoreIDFromMsg(msg)) localOrder, _ := partner.CurOrderManager.LoadOrder(GetOrderIDFromMsg(msg), model.VendorIDMTWM) if localOrder == nil { - return nil + return mtwmapi.Err2CallbackResponse(err, "") // 会存在用户没支付订单,但是订单已经创建了,这个时候有可能会取消订单,所以这个地方直接退出不管了 // 等到美团推送新订单的时候再创建订单 /* localOrder = order diff --git a/conf/app.conf b/conf/app.conf index 488428ed2..5bedf12dc 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -538,30 +538,158 @@ tiktokJXDJSecret="5c8492ec2744fb72bb6cc356983f3cfc317f85d4" aliLogisticsAppKey = "23537670" aliLogisticsAppSecret = "4a77a431c0bf01f6dfa63d1a1ec9ecd2" aliLogisticsAppCode = "00a6eefba0204d3fa310ac0ee7a6fc54" + +[jxpet] +httpport = 8088 +EnableDocs = false + +dbConnectStr = "root:WebServer@1@tcp(127.0.0.1:3306)/jxpet?charset=utf8mb4&loc=Local&parseTime=true" +# 下面应该没用 +jdOrgCode = "339032" +jdLoginName = "jd_jxgy" +jdToken = "b1138139-9610-4b80-9a63-a63da4773885" +jdAppKey = "5d5577a2506f41b8b4ec520ba83490f5" +jdSecret = "0b01b9eeb15b41dab1c3d05d95c17a26" +jdStorePageCookie = "YDYCWYUGKSROMV3MKJQIFINJ5CLPYH6IRVFUMFJD3JI6VQKHX3YPHTWDIDBNMCBUKSY3P7SKAHHKR7PHQDSFRXZEWXA4XOUTALIQDGDYIEUCMDPWSYGDVT42DJ27CD27QKCR3UN7KF7EPIHGPR7GCRTBD5YGNZW4AIACY4HXDMCETEWCPFKOTM4HRJBSMMQJ77SR62PYMP6RCG33IRQGP6PRCKAO4M7FUA7G2ZM2SFQ6F6WUNO5GXDJSVUELLBJT" + +# 未使用 +ebaiSource = "35957" +ebaiSecret = "10013fbb7c2ddad7" +ebaiStorePageCookieWMUSS = "AIgAAABBA3NOWA8IckAGYixvPUR0K1s5EhVyCwsoVlRxCFlPSFtCFzRQHiYRIwg9BRPgwAAE0UBCHBcQQJwMw17WmJQTGoqGzMGXEo5LWhePQxmeR4reiYcV2YdSBkqRHMNFD92PVkqQjZze2JbWR9mQBkFaxMrB2kRBCmHC1FNXg6wdesOxNgDAAGs9ZB0A" +ebaiStorePageCookieWMSTOKEN = "QAAGALAAAFd2VaeBVCNBtlDTJUL2NXW2YFIiBzMWksCWFWQRCGlESI_2QAABmRgRwSFsGfRsPhJLuCgHL_g6HUAAAUuy3E2_vQhVHAQAAdPYKHHEB0Rpg_foY_bcAAgB" +# 要用 +mtwmAppID = "4123" +mtwmSecret = "df2c88338b85f830cebce2a9eab56628" +mtwmCallbackURL = "http://callback-jxpet.jxc4.com" +mtwmCookieStr = "_lxsdk_cuid=16f413bd94fc8-0daccb808f461b-1d336b5a-13c680-16f413bd94fc8; _lxsdk=16f413bd94fc8-0daccb808f461b-1d336b5a-13c680-16f413bd94fc8; uuid=d1e8adb3d2774b89fe6e.1577347439.1.0.0; uuid_update=true; wpush_server_url=wss://wpush.meituan.com; acctId=62884810; token=0LhaIAAgrL1Hy0DDATjZqt4lRHauN_bBL3q0AvxUFUWo*; brandId=-1; wmPoiId=-1; isOfflineSelfOpen=0; city_id=0; isChain=1; existBrandPoi=true; ignore_set_router_proxy=true; region_id=; region_version=0; newCategory=false; bsid=SUVq2IfzZ53EHaTVoCE3UsmKkH5ZevxTjkwpNcaLKkbUOBkEyuZp8mPFwhgqkxsCGNjZILNj5aV8uVSQc888bg; device_uuid=!625e0297-431a-49ad-8b18-a0562c38a8eb; cityId=510100; provinceId=510000; city_location_id=0; location_id=0; pushToken=0LhaIAAgrL1Hy0DDATjZqt4lRHauN_bBL3q0AvxUFUWo*; set_info=%7B%22wmPoiId%22%3A-1%2C%22ignoreSetRouterProxy%22%3Atrue%7D; igateApp=shangouepc; LX_SC_CONSTANT=c_nehoktcu; shopCategory=food; JSESSIONID=unlrbu07lvm2s734eyedxr0j; _lxsdk_s=16f413bd950-189-8bb-8df%7C%7C33" + +enableStoreWrite = true +enableJdStoreWrite = true +enableEbaiStoreWrite = true +enableMtwmStoreWrite = true +enableDdStoreWrite = true +enableYbStoreWrite = true +enableJdShopWrite = true + +mtpsAppKey = "3c0a05d464c247c19d7ec13accc78605" +mtpsSecret = "b1M}9?:sTbsB[OF2gNORnN(|(iy9rB8(`7]|[wGLnbmt`evfM>E:A90DjHAW:UPE" + +dadaIsProd = true +dadaCallbackURL = "http://callback-jxpet.jxc4.com/dadadelivery/msg" +dadaSourceID = "6660" + +weixinAppID = "wx2bb99eb5d2c9b82c" +weixinSecret = "6bbbed1443cc062c20a015a64c07a531" + +weixinMiniAppID = "wx2d6949f724b2541d" +weixinMiniSecret = "11f3c380551c4683c149990b004d6df9" + +weixinMiniAppID2 = "wx4b5930c13f8b1170" +weixinMiniSecret2 = "2a57228a716ce991a52739f0ff41111d" + +weixinAppIdPrint = "wx2bfbc02e6251b71b" +weixinAppSecretPrint = "ff4128908947cfb71002f74599c0dbf9" + +wxpayNotifyURL = "http://callback-jxpet.jxc4.com/wxpay/msg/" + +# 抖音支付回调地址 +tiktokNotifyUrl = "https://callback-jxpet.jxc4.com/tictoc/tiktokMsg" + +tonglianPayAppID = "00183083" +tonglianPayKey = "18048531223" +tonglianPayCusID = "56065105499TVAH" +tonglianPayNotifyURL = "http://callback-jxpet.jxc4.com/tonglian/msg/" + +backstageHost = "http://www-jxpet.jxc4.com" +wxBackstageHost = "http://wx-jxpet.jxc4.com" + +dingdingAgentID = 258707199 +dingdingAppKey = "dingtozhutfr98qgwc7d" +dingdingSecret = "7EJ0HDbkxQri-O2RSaYUu7_ZwvvMKtRVHT8cpyfvIvK6A9n9HRwPNCNRJFuEDeT_" + +dingdingQRCodeAppKey = "dingoaw990o1jm9jswvwib" +dingdingQRCodeSecret = "N9dyC9qB84sauQPs4_JYrILMsG5Krqm9-PSSVJ8t9hb87rrHiFUirISxGF5G57RV" + +dingdingCallbackURL = "http://callback-jxpet.jxc4.com/dingding/msg" + +getWeixinTokenURL = "http://www.jxc4.com/v2/sys/GetWXToken" +getWeixin2TokenURL = "http://www.jxc4.com/v2/sys/GetWX2Token" +getYLYTokenURL = "http://www.jxc4.com/v2/sys/GetYLYToken" +getPushTokenURL = "http://www.jxc4.com/v2/sys/GetPushToken" + +jdEclpAccessToken = "161eff890f2f4fbda942447f85843377wzmo" +jdEclpAppKey = "0D397F05CF11C51BCDCC81744680EBC3" +jdEclpAppSecret = "f16a5e57ff4f4f428b702c40d2d4b933" + +# jdShopAccessToken = "de8157b447584885910f429011e49cb93yjq" +# jdShopAppKey = "E1D746D42474D5F1F1A10CECE75D99F6" +# jdShopAppSecret = "efa7e1d1a22640fa990e6cf164b28608" + +jdShopAccessToken2 = "9ad9cf5fc8b140b19a1dbbb700b47676kown" +jdShopAppKey2 = "D5E8352BE0786ED16F77B4548F62F09A" +jdShopAppSecret2 = "71e1061ac2f246f6ac27efb900edba12" + +fnAppID = "6705486294797503379" +fnAppSecret = "c1e6c280-e618-4103-9d0a-673bc54fb22e" +fnMerchantId= "51658" +fnCallbackURL = "http://callback-jxpet.jxc4.com/fn/msg" + +#顺丰派送 +sfpsAppID = 1663705444 +sfpsAppKey = "600e22db5deb6402e527e58f0d6636a0" +sfpsTestAppID = 1663705378 +sfpsTestAppKey = "0838426b310fd2530c57dd6e770ddff1" + +# 快手授权地址 +kuaiShouAppId = "ks680887971696897880" +kuaiShouAppSecret = "1wShCPqUzhg8W1vcb8OdvA" + +# uniApp 消息推送授权 +uniAppAppKey = "Iogz63Q1HL7R4dB8F4Kbn5" +uniAppMasterSecret = "J7pU14SwCC7SoUntXJghj8" +uniAppAppId = "dqxDP9HwHc5B1dd2db4ek2" +uniAppAppSecret = "wX4n8IusDn7PfxkGmypzp5" + +#uu跑腿 +uuAppID="55c4542ae60e4d348edcfc93b06dd302" +uuAppKey="76b362c06b1b4baa9e47bab6387a5356" +uuOpenID="8d8464e7c9354c1e88a3f5afa2a7922e" + +jxPrintAppID = "1000" +jxPrintAppKey = "rfBd56ti2SMtYvSg" + +# 没用 +storeName = "京西果园" +tiktokAppKey = "ttaceeda5333d7a7ab01" +tiktokAppSecret = "020c0aa40371cd112eecc034bb3dc094907ff925" + +tiktokJXDJKey="ttaceeda5333d7a7ab01" #京西到家抖音小程序 +TiktokJXDJApiID="ttaceeda5333d7a7ab01" +tiktokJXDJSecret="5c8492ec2744fb72bb6cc356983f3cfc317f85d4" + +# 阿里云更物料新订单物流信息 +aliLogisticsAppKey = "23537670" +aliLogisticsAppSecret = "4a77a431c0bf01f6dfa63d1a1ec9ecd2" +aliLogisticsAppCode = "00a6eefba0204d3fa310ac0ee7a6fc54" + [test] jdOrgCode = "82029" jdToken = "594ab45a-9a73-4a43-82b0-a64cbd55d883" jdAppKey = "06692746f7224695ad4788ce340bc854" jdSecret = "d6b42a35a7414a5490d811654d745c84" - elmIsProd = false elmToken = "2d2b583447b04b6bba5a6f3faed3559b" elmAppKey = "RwT214gAsS" elmSecret = "56afff4b9ebd8a7eb532d18fa33f17be57f9b9db" - ebaiSource = "62923" ebaiSecret = "aa4cdc6c1108486b" - mtpsAppKey = "25e816550bc9484480642f19a95f13fd" mtpsSecret = "r4$HqrKx9~=7?2Jfo,$Z~a7%~k!Au&pEdI2)oPJvSbH2ao@2N0[8wSIvtuumh_J^" - dadaIsProd = false dadaCallbackURL = "http://callback.test.jxc4.com/dadadelivery/msg" dadaSourceID = "73753" - weixinAppID = "wxbf235770edaabc5c" weixinSecret = "ba32b269a068a5b72486a0beafd171e8" - dbConnectStr = "root:WebServer@1@tcp(127.0.0.1:3306)/jxd_dev_0?charset=utf8mb4&loc=Local&parseTime=true" [alpha] diff --git a/main.go b/main.go index 71594ebee..99d00ae06 100644 --- a/main.go +++ b/main.go @@ -154,7 +154,7 @@ func main() { return } - if web.BConfig.RunMode != "jxgy" { + if web.BConfig.RunMode != "jxgy" && web.BConfig.RunMode != "jxpet" { if err := tasks.RefreshFnToken(); err != nil { globals.SugarLogger.Errorf("RefreshFnToken failed with error:%s", err) return