京东商城建店
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
25
controllers/jds_callback.go
Normal file
25
controllers/jds_callback.go
Normal file
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user