From f6ef25160b6aa15ab72a89ad3dc00225a51dcb7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 25 May 2020 18:19:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E=E5=BB=BA?= =?UTF-8?q?=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduler/basesch/basesch_ext.go | 2 +- business/jxstore/tempop/tempop.go | 43 +++++++++---------- controllers/jds_callback.go | 25 +++++++++++ 3 files changed, 46 insertions(+), 24 deletions(-) create mode 100644 controllers/jds_callback.go diff --git a/business/jxcallback/scheduler/basesch/basesch_ext.go b/business/jxcallback/scheduler/basesch/basesch_ext.go index 73531d641..556879844 100644 --- a/business/jxcallback/scheduler/basesch/basesch_ext.go +++ b/business/jxcallback/scheduler/basesch/basesch_ext.go @@ -44,7 +44,7 @@ func (c *BaseScheduler) CreateWaybillOnProviders(ctx *jxcontext.Context, order * stores, _ := dao.GetStoreList(dao.GetDB(), []int{order.StoreID}, nil, nil, nil, "") if len(stores) > 0 { if stores[0].PayPercentage <= 50 { - order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - stores[0].PayPercentage/2)) / 10000 + order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - stores[0].PayPercentage/2)) / 100 dao.UpdateEntity(dao.GetDB(), order, "NewEarningPrice") } } diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index b7063bbc8..0419576b5 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1585,31 +1585,28 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { var stores []*model.Store sql := ` - SELECT b.* - FROM store_map a, store b - WHERE a.store_id = b.id - AND a.vendor_store_id = '' AND a.vendor_id = 5 AND a.deleted_at = ? - AND b.deleted_at = ? - and a.jds_street_code = 0 + SELECT a.* + FROM store a + LEFT JOIN store_map b ON a.id = b.store_id AND b.vendor_id = 5 AND b.deleted_at = '1970-01-01 00:00:00' + WHERE 1=1 + AND (a.status = 1 OR a.status = 0) + AND b.id IS NULL + AND a.deleted_at = '1970-01-01 00:00:00' ` - sqlParams := []interface{}{utils.DefaultTimeValue, utils.DefaultTimeValue} - err = dao.GetRows(db, &stores, sql, sqlParams) - result1, _ := api.JdShopAPI.GetProvince() + err = dao.GetRows(db, &stores, sql, nil) for _, v := range stores { - place, _ := dao.GetPlaceByCode(db, v.DistrictCode) - for _, vv := range result1 { - result2, _ := api.JdShopAPI.GetCity(vv.AreaID) - for _, vvv := range result2 { - result3, _ := api.JdShopAPI.GetCounty(vvv.AreaID) - for _, vvvv := range result3 { - if vvvv.AreaName == place.Name { - place.JdsCode = vvvv.AreaID - dao.UpdateEntity(db, place, "JdsCode") - break - } - } - - } + storeMap := &model.StoreMap{ + Status: 1, + VendorID: model.VendorIDJDShop, + AutoPickup: 1, + DeliveryCompetition: 1, + PricePercentage: 100, + IsSync: 1, + SyncRule: 1, + } + _, err = cms.AddStoreVendorMap(ctx, db, model.VendorIDJDShop, "", v.ID, storeMap) + if err != nil { + continue } } return err diff --git a/controllers/jds_callback.go b/controllers/jds_callback.go new file mode 100644 index 000000000..28d407538 --- /dev/null +++ b/controllers/jds_callback.go @@ -0,0 +1,25 @@ +package controllers + +import ( + "git.rosy.net.cn/baseapi/platformapi/mtwmapi" + "git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm" + "git.rosy.net.cn/jx-callback/globals/api" + "github.com/astaxie/beego" +) + +type JdsController struct { + beego.Controller +} + +func (c *JdsController) Msg(msgType string) { + c.Data["json"] = mtwmapi.Err2CallbackResponse(nil, "") + msg, callbackResponse := api.MtwmAPI.GetCallbackMsg(c.Ctx.Request) + if callbackResponse == nil { + callbackResponse = mtwm.OnCallbackMsg(msg) + if callbackResponse == nil { + callbackResponse = mtwmapi.Err2CallbackResponse(nil, "") + } + } + c.Data["json"] = callbackResponse + c.ServeJSON() +}