冲突
This commit is contained in:
@@ -92,6 +92,9 @@ func getWxApp(appID string) (miniApi *weixinapi.API) {
|
||||
if len(appID) > 0 && appID == api.WeixinMiniAppID2 {
|
||||
miniApi = api.WeixinMiniAPI2
|
||||
}
|
||||
if len(appID) > 0 && appID == api.WeixinMiniAppID3 {
|
||||
miniApi = api.WeixinMiniAPI3
|
||||
}
|
||||
return miniApi
|
||||
}
|
||||
|
||||
|
||||
@@ -199,29 +199,34 @@ func (c *OrderManager) OnOrderStatusChanged(vendorOrgCode string, orderStatus *m
|
||||
waybill, _ := c.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID)
|
||||
store, _ := c.LoadStoreDetail(jxutils.GetSaleStoreIDFromOrder(order), order.VendorID)
|
||||
if waybill == nil {
|
||||
if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX {
|
||||
if order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-store.PayPercentage)/int64(100) {
|
||||
order.NewEarningPrice = order.TotalShopMoney * int64(100-store.PayPercentage) / int64(100)
|
||||
}
|
||||
} else {
|
||||
if order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-store.PayPercentage/2)/int64(100) {
|
||||
order.NewEarningPrice = order.TotalShopMoney * int64(100-store.PayPercentage/2) / int64(100)
|
||||
}
|
||||
// if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX {
|
||||
// if order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-store.PayPercentage)/int64(100) {
|
||||
// order.NewEarningPrice = order.TotalShopMoney * int64(100-store.PayPercentage) / int64(100)
|
||||
// }
|
||||
// } else {
|
||||
if order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-store.PayPercentage/2)/int64(100) {
|
||||
order.NewEarningPrice = order.TotalShopMoney * int64(100-store.PayPercentage/2) / int64(100)
|
||||
}
|
||||
// }
|
||||
} else {
|
||||
if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX {
|
||||
if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage)/int64(100) {
|
||||
order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage) / int64(100)
|
||||
}
|
||||
} else {
|
||||
if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage/2)/int64(100) {
|
||||
order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage/2) / int64(100)
|
||||
}
|
||||
// if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX {
|
||||
// if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage)/int64(100) {
|
||||
// order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage) / int64(100)
|
||||
// }
|
||||
// } else {
|
||||
if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage/2)/int64(100) {
|
||||
order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage/2) / int64(100)
|
||||
}
|
||||
// }
|
||||
}
|
||||
dao.UpdateEntity(db, order, "NewEarningPrice")
|
||||
}
|
||||
}
|
||||
} else if orderStatus.Status == model.OrderStatusCanceled {
|
||||
//如果取消订单则要把库存加回去
|
||||
if order, err2 := c.LoadOrder(orderStatus.VendorOrderID, orderStatus.VendorID); err2 == nil {
|
||||
ModifyOrderSkusStock(db, order, true)
|
||||
}
|
||||
}
|
||||
if !isDuplicated {
|
||||
if order != nil {
|
||||
@@ -338,6 +343,10 @@ func (c *OrderManager) SaveOrder(order *model.GoodsOrder, isAdjust bool, db *dao
|
||||
baseapi.SugarLogger.Infof("saveOrder duplicated orderid:%s msg received", order.VendorOrderID)
|
||||
}
|
||||
}
|
||||
//修改商品库存
|
||||
if err == nil {
|
||||
err = ModifyOrderSkusStock(db, order, false)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Warnf("saveOrder create order:%v, error:%v", order, err)
|
||||
}
|
||||
@@ -347,6 +356,43 @@ func (c *OrderManager) SaveOrder(order *model.GoodsOrder, isAdjust bool, db *dao
|
||||
return isDuplicated, err
|
||||
}
|
||||
|
||||
func ModifyOrderSkusStock(db *dao.DaoDB, order *model.GoodsOrder, isAdd bool) (err error) {
|
||||
skus := order.Skus
|
||||
for _, sku := range skus {
|
||||
storeSkus, _ := dao.GetStoresSkusInfo(db, []int{jxutils.GetSaleStoreIDFromOrder(order)}, []int{sku.SkuID})
|
||||
if len(storeSkus) == 0 {
|
||||
globals.SugarLogger.Warnf("此订单商品没得storsku,%v,%v", order.VendorOrderID, sku.SkuID)
|
||||
continue
|
||||
}
|
||||
storeSku, stock := storeSkus[0], 0
|
||||
if storeSku.Stock == 0 {
|
||||
globals.SugarLogger.Warnf("此订单商品库存为0,%v,%v", order.VendorOrderID, sku.SkuID)
|
||||
continue
|
||||
}
|
||||
if isAdd {
|
||||
stock = storeSku.Stock + sku.Count
|
||||
} else {
|
||||
stock = storeSku.Stock - sku.Count
|
||||
//如果是进货的订单,进货方门店对应商品要加上这么多库存
|
||||
if order.OrderType == model.OrderTypeSupplyGoods {
|
||||
storeSkus2, _ := dao.GetStoresSkusInfo(db, []int{order.FromStoreID}, []int{sku.SkuID})
|
||||
if len(storeSkus) > 0 {
|
||||
storeSku2 := storeSkus2[0]
|
||||
storeSku2.Stock = storeSku2.Stock + sku.Count
|
||||
dao.UpdateEntity(db, storeSku2, "Stock")
|
||||
dao.SetStoreSkuSyncStatus(db, order.VendorID, []int{order.FromStoreID}, []int{sku.SkuID}, model.SyncFlagStockMask)
|
||||
}
|
||||
}
|
||||
}
|
||||
storeSku.Stock = stock
|
||||
dao.UpdateEntity(db, storeSku, "Stock")
|
||||
if order.VendorID != model.VendorIDJX {
|
||||
dao.SetStoreSkuSyncStatus(db, order.VendorID, []int{jxutils.GetSaleStoreIDFromOrder(order)}, []int{sku.SkuID}, model.SyncFlagStockMask)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func filterOrderInfo(order *model.GoodsOrder) {
|
||||
order.ConsigneeName = utils.LimitUTF8StringLen2(order.ConsigneeName, 32)
|
||||
order.ConsigneeAddress = utils.LimitUTF8StringLen2(order.ConsigneeAddress, 255)
|
||||
@@ -1490,3 +1536,35 @@ func AdjustJdsOrderSimple(ctx *jxcontext.Context, vendorOrderID string, skuID in
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func UpdateWaybillDesiredFee(ctx *jxcontext.Context, vendorOrderID string, desiredFee int) (err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
order, _ := dao.GetSimpleOrder(db, vendorOrderID)
|
||||
if order == nil {
|
||||
return fmt.Errorf("未找到该订单!orderID: %v", vendorOrderID)
|
||||
}
|
||||
bill, _ := partner.CurOrderManager.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID)
|
||||
if bill == nil {
|
||||
waybill := &model.Waybill{
|
||||
VendorOrderID: order.VendorOrderID,
|
||||
OrderVendorID: order.VendorID,
|
||||
VendorWaybillID: "-1",
|
||||
WaybillVendorID: -1,
|
||||
Status: model.WaybillStatusDelivered,
|
||||
WaybillCreatedAt: time.Now(),
|
||||
StatusTime: time.Now(),
|
||||
WaybillFinishedAt: utils.DefaultTimeValue,
|
||||
DeliveryFlag: model.OrderDeliveryFlagMaskScheduleDisabled,
|
||||
DesiredFee: int64(desiredFee),
|
||||
}
|
||||
dao.CreateEntity(db, waybill)
|
||||
order.VendorWaybillID = "-1"
|
||||
dao.UpdateEntity(db, order, "VendorWaybillID")
|
||||
} else {
|
||||
bill.DesiredFee = int64(desiredFee)
|
||||
_, err = dao.UpdateEntity(db, bill, "DesiredFee")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ const (
|
||||
func (c *BaseScheduler) CreateWaybillOnProviders(ctx *jxcontext.Context, order *model.GoodsOrder, courierVendorIDs, excludeCourierVendorIDs []int, maxDeliveryFee int64, createOnlyOne bool) (bills []*model.Waybill, err error) {
|
||||
userName := ctx.GetUserName()
|
||||
globals.SugarLogger.Infof("CreateWaybillOnProviders orderID:%s userName:%s, courierVendorIDs:%v, excludeCourierVendorIDs:%v", order.VendorOrderID, userName, courierVendorIDs, excludeCourierVendorIDs)
|
||||
storeCourierList, err := dao.GetStoreCourierList(dao.GetDB(), []int{jxutils.GetSaleStoreIDFromOrder(order)}, model.StoreStatusOpened, model.StoreAuditStatusOnline)
|
||||
storeCourierList, err := dao.GetStoreCourierList(dao.GetDB(), []int{jxutils.GetSaleStoreIDFromOrder(order)}, nil, model.StoreStatusOpened, model.StoreAuditStatusOnline)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ func (s *DefScheduler) QueryOrderWaybillFeeInfoEx(ctx *jxcontext.Context, vendor
|
||||
if order.DeliveryType == model.OrderDeliveryTypeSelfTake {
|
||||
return nil, fmt.Errorf("订单:%s是自提单", vendorOrderID)
|
||||
}
|
||||
storeCourierList, err := dao.GetStoreCourierList(db, []int{jxutils.GetSaleStoreIDFromOrder(order)}, model.StoreStatusAll, model.StoreAuditStatusOnline)
|
||||
storeCourierList, err := dao.GetStoreCourierList(db, []int{jxutils.GetSaleStoreIDFromOrder(order)}, nil, model.StoreStatusAll, model.StoreAuditStatusOnline)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -672,6 +672,7 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric
|
||||
'","eclpID":"', t2.eclp_id,
|
||||
'","weight":', t2.weight, ',"categoryID":', t2.category_id, ',"nameID":', t2.name_id,
|
||||
', "seq":', t2.seq,
|
||||
', "minOrderCount":', t2.min_order_count,
|
||||
"}")), "]") skus_str,
|
||||
CONCAT("[", GROUP_CONCAT(DISTINCT t3.place_code), "]") places_str
|
||||
` + sql + `
|
||||
|
||||
@@ -412,7 +412,7 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
storeCourierList, err := dao.GetStoreCourierList(db, storeIDs, model.StoreStatusAll, model.StoreAuditStatusAll)
|
||||
storeCourierList, err := dao.GetStoreCourierList(db, storeIDs, nil, model.StoreStatusAll, model.StoreAuditStatusAll)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ type ExcelParam struct {
|
||||
|
||||
// UpdateStoreSku用,API调用时
|
||||
type StoreSkuBindSkuInfo struct {
|
||||
SkuID int `json:"skuID"`
|
||||
IsSale int `json:"isSale,omitempty"` // -1:不可售,0:忽略,1:可售
|
||||
Stock int `json:"stock,omitempty"`
|
||||
SkuID int `json:"skuID"`
|
||||
IsSale int `json:"isSale,omitempty"` // -1:不可售,0:忽略,1:可售
|
||||
Stock *int `json:"stock"`
|
||||
// ElmID int64 `json:"elmID,omitempty"`
|
||||
// EbaiID int64 `json:"ebaiID,omitempty"`
|
||||
}
|
||||
@@ -583,7 +583,7 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus, i
|
||||
t4.jd_sync_status, t4.ebai_sync_status, t4.mtwm_sync_status, t4.yb_sync_status, t4.jds_sync_status,
|
||||
t4.jd_price, t4.ebai_price, t4.mtwm_price, t4.jx_price, t4.yb_price, t4.jds_price,
|
||||
t4.jd_lock_time, t4.ebai_lock_time, t4.mtwm_lock_time, t4.jx_lock_time, t4.yb_lock_time, t4.jds_lock_time,
|
||||
t4.status_sale_begin, t4.status_sale_end,
|
||||
t4.status_sale_begin, t4.status_sale_end, t4.stock,
|
||||
t6.mid_unit_price real_mid_unit_price,
|
||||
t7.unit_price audit_unit_price
|
||||
` + sql
|
||||
@@ -1161,6 +1161,23 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
skuBind.JxPrice = jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage), skuBind.Price)
|
||||
if tmpStatus := getSkuSaleStatus(inSkuBind, skuBindInfo); tmpStatus != model.StoreSkuBindStatusNA {
|
||||
skuBind.Status = tmpStatus
|
||||
if inSkuBind != nil {
|
||||
if inSkuBind.Stock != nil {
|
||||
skuBind.Stock = *inSkuBind.Stock
|
||||
} else {
|
||||
if tmpStatus == model.StoreSkuBindStatusNormal {
|
||||
skuBind.Stock = model.MaxStoreSkuStockQty
|
||||
} else {
|
||||
skuBind.Stock = 0
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if tmpStatus == model.StoreSkuBindStatusNormal {
|
||||
skuBind.Stock = model.MaxStoreSkuStockQty
|
||||
} else {
|
||||
skuBind.Stock = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
if globals.IsAddEvent {
|
||||
err = AddEventDetail(db, ctx, model.OperateAdd, v.RealSkuID, model.ThingTypeSku, storeID, "", utils.Int2Str(skuBind.UnitPrice))
|
||||
@@ -1241,6 +1258,19 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
}
|
||||
skuBind.Status = tmpStatus
|
||||
setStoreSkuBindStatus(skuBind, model.SyncFlagSaleMask)
|
||||
setStoreSkuBindStatus(skuBind, model.SyncFlagStockMask)
|
||||
if tmpStatus == model.StoreSkuBindStatusNormal {
|
||||
skuBind.Stock = model.MaxStoreSkuStockQty
|
||||
} else {
|
||||
skuBind.Stock = 0
|
||||
}
|
||||
}
|
||||
if inSkuBind != nil {
|
||||
if inSkuBind.Stock != nil {
|
||||
updateFieldMap["Stock"] = 1
|
||||
skuBind.Stock = *inSkuBind.Stock
|
||||
setStoreSkuBindStatus(skuBind, model.SyncFlagStockMask)
|
||||
}
|
||||
}
|
||||
if skuBindInfo.UnitPrice != 0 && isCanChangePrice { // 这里是否需要加此条件限制
|
||||
price := jxutils.CaculateSkuPrice(unitPrice, v.SpecQuality, v.SpecUnit, v.SkuNameUnit)
|
||||
|
||||
@@ -1379,7 +1379,7 @@ func SetMTPSStatus(ctx *jxcontext.Context, storeId, courierStatus int) {
|
||||
db := dao.GetDB()
|
||||
/*比较营业状态*/
|
||||
/*把获取的京西状态和名称存一下*/
|
||||
StoreCourierList, _ := dao.GetStoreCourierList(db, []int{}, model.StoreStatusAll, model.StoreStatusAll)
|
||||
StoreCourierList, _ := dao.GetStoreCourierList(db, []int{}, nil, model.StoreStatusAll, model.StoreStatusAll)
|
||||
/*循环美团*/
|
||||
for _, StoreInfoList1 := range StoreInfoList {
|
||||
for _, StoreInfoList11 := range StoreInfoList1.DataList {
|
||||
|
||||
@@ -253,10 +253,11 @@ func storeSkuSyncInfo2Bare(inSku *dao.StoreSkuSyncInfo) (outSku *partner.StoreSk
|
||||
VendorSkuID2: utils.Int64ToStr(inSku.JdsWareID),
|
||||
JdsStockSwitch: inSku.JdsStockSwitch,
|
||||
IsDeletedBySku: inSku.IsDeletedBySku,
|
||||
Stock: inSku.Stock,
|
||||
}
|
||||
if !isStoreSkuSyncNeedDelete(inSku) {
|
||||
outSku.Stock = model.MaxStoreSkuStockQty
|
||||
}
|
||||
// if !isStoreSkuSyncNeedDelete(inSku) {
|
||||
// outSku.Stock = model.MaxStoreSkuStockQty
|
||||
// }
|
||||
return outSku
|
||||
}
|
||||
|
||||
@@ -480,6 +481,7 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
if !dao.IsVendorThingIDEmpty(sku.VendorSkuID) {
|
||||
bareSku = storeSkuSyncInfo2Bare(sku)
|
||||
if singleStoreHandler == nil {
|
||||
bareSku.Stock = 0
|
||||
stockList = append(stockList, bareSku)
|
||||
} else {
|
||||
deleteList = append(deleteList, bareSku)
|
||||
@@ -555,15 +557,21 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
|
||||
}
|
||||
if sku.MergedStatus == model.SkuStatusNormal {
|
||||
onlineList = append(onlineList, bareSku)
|
||||
stockList = append(stockList, bareSku)
|
||||
// stockList = append(stockList, bareSku)
|
||||
} else {
|
||||
offlineList = append(offlineList, bareSku)
|
||||
// 因为京东平台以是否有库存表示是否关注,所以不论是否可售,都要设置库存
|
||||
if singleStoreHandler == nil {
|
||||
stockList = append(stockList, bareSku)
|
||||
}
|
||||
// if singleStoreHandler == nil {
|
||||
// stockList = append(stockList, bareSku)
|
||||
// }
|
||||
}
|
||||
}
|
||||
if model.IsSyncStatusStock(sku.SkuSyncStatus) {
|
||||
if bareSku == nil {
|
||||
bareSku = storeSkuSyncInfo2Bare(sku)
|
||||
}
|
||||
stockList = append(stockList, bareSku)
|
||||
}
|
||||
}
|
||||
isNeedReorder = model.IsSyncStatusSeq(sku.SkuSyncStatus)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
@@ -61,6 +62,53 @@ func (x Store4UserList) Swap(i, j int) {
|
||||
x[i], x[j] = x[j], x[i]
|
||||
}
|
||||
|
||||
func GetNearSupplyGoodsStoreByStoreID(ctx *jxcontext.Context, storeID int) (store *model.Store, err error) {
|
||||
var (
|
||||
stores []*model.Store
|
||||
db = dao.GetDB()
|
||||
)
|
||||
store2, _ := dao.GetStoreDetail(db, storeID, model.VendorIDJX)
|
||||
if store2 == nil {
|
||||
return nil, fmt.Errorf("该门店未绑定京西平台!storeID: %v", storeID)
|
||||
}
|
||||
if store2.IsSupplyGoods == model.YES {
|
||||
return nil, fmt.Errorf("该门店已经是货源门店,无法从其他货源门店进货!storeID: %v", storeID)
|
||||
}
|
||||
sql := `
|
||||
SELECT a.*
|
||||
FROM store a
|
||||
JOIN store_map b ON b.store_id = a.id
|
||||
JOIN store c ON c.city_code = a.city_code AND c.id = ?
|
||||
WHERE a.deleted_at = ?
|
||||
AND b.deleted_at = ?
|
||||
AND b.vendor_id = ?
|
||||
AND b.is_supply_goods = ?
|
||||
AND a.status = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
storeID,
|
||||
utils.DefaultTimeValue, utils.DefaultTimeValue,
|
||||
model.VendorIDJX, model.YES, model.StoreStatusOpened,
|
||||
}
|
||||
err = dao.GetRows(db, &stores, sql, sqlParams)
|
||||
if len(stores) > 0 {
|
||||
realDistance := float64(0)
|
||||
for _, v := range stores {
|
||||
distance := jxutils.EarthDistance(jxutils.IntCoordinate2Standard(v.Lng), jxutils.IntCoordinate2Standard(v.Lat), jxutils.IntCoordinate2Standard(store2.Lng), jxutils.IntCoordinate2Standard(store2.Lat))
|
||||
if realDistance == 0 {
|
||||
realDistance = distance
|
||||
store = v
|
||||
} else {
|
||||
if realDistance > distance {
|
||||
realDistance = distance
|
||||
store = v
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return store, err
|
||||
}
|
||||
|
||||
func GetStoreListByLocation(ctx *jxcontext.Context, lng, lat float64, maxRadius int, needWalkDistance, isJds bool) (storeList []*Store4User, err error) {
|
||||
const (
|
||||
maxStoreCount4User = 5
|
||||
|
||||
@@ -8,13 +8,12 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/act"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/delivery"
|
||||
"github.com/360EntSecGroup-Skylar/excelize"
|
||||
"github.com/qiniu/api.v7/storage"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/dadaapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -1585,76 +1584,18 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
// fmt.Println("addList2", addList)
|
||||
// fmt.Println("updateList2", utils.Format4Output(updateList, false))
|
||||
// fmt.Println("deleteList2", deleteList)
|
||||
db := dao.GetDB()
|
||||
storeIDs := []int{
|
||||
667335,
|
||||
667321,
|
||||
667319,
|
||||
667260,
|
||||
667227,
|
||||
667167,
|
||||
667109,
|
||||
667094,
|
||||
667050,
|
||||
666898,
|
||||
666852,
|
||||
666815,
|
||||
666763,
|
||||
666761,
|
||||
666760,
|
||||
666759,
|
||||
666714,
|
||||
666708,
|
||||
666705,
|
||||
666669,
|
||||
103437,
|
||||
103425,
|
||||
103349,
|
||||
103123,
|
||||
103116,
|
||||
103107,
|
||||
103069,
|
||||
103019,
|
||||
102940,
|
||||
102890,
|
||||
102831,
|
||||
102772,
|
||||
102751,
|
||||
101870,
|
||||
101755,
|
||||
101176,
|
||||
100767,
|
||||
100754,
|
||||
100726,
|
||||
100699,
|
||||
100476,
|
||||
100369,
|
||||
100366,
|
||||
100361,
|
||||
100351,
|
||||
100350,
|
||||
}
|
||||
for _, storeID := range storeIDs {
|
||||
acts, _ := dao.QueryActs(db, 0, 0, 50, 0, "", -1, []int{1}, []int{0, 3, 4}, nil, storeID, nil, 0, utils.ZeroTimeValue, utils.ZeroTimeValue, utils.Str2Time("2020-05-30 00:00:00"), utils.Str2Time("2020-07-30 00:00:00"))
|
||||
for _, v := range acts.Data {
|
||||
var actStoreSkuParam []*act.ActStoreSkuParam
|
||||
_, actStoreSkus, _ := dao.GetActStoreSkuVendorList(db, v.ID, []int{0}, nil, nil, "", 0, 99999)
|
||||
for _, actStoreSku := range actStoreSkus {
|
||||
if actStoreSku.StoreID == storeID {
|
||||
aa := &act.ActStoreSkuParam{
|
||||
ActStoreSku: model.ActStoreSku{
|
||||
StoreID: storeID,
|
||||
SkuID: actStoreSku.SkuID,
|
||||
ActID: v.ID,
|
||||
},
|
||||
}
|
||||
actStoreSkuParam = append(actStoreSkuParam, aa)
|
||||
}
|
||||
}
|
||||
_, err = act.DeleteActStoreSkuBind(ctx, db, v.ID, actStoreSkuParam)
|
||||
if err == nil {
|
||||
_, err = act.SyncAct(ctx, nil, v.ID, nil, true)
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
list, err := dao.GetStoreCourierList(db, nil, []int{model.VendorIDDada}, model.StoreStatusAll, model.StoreAuditStatusAll)
|
||||
for _, v := range list {
|
||||
sd, _ := api.DadaAPI.ShopDetail(v.VendorStoreID)
|
||||
if !strings.Contains(sd.StationName, globals.StoreName) {
|
||||
shopInfo := &dadaapi.ShopInfo{
|
||||
OriginShopID: v.VendorStoreID,
|
||||
StationName: globals.StoreName + "-" + sd.StationName,
|
||||
}
|
||||
api.DadaAPI.ShopUpdate(shopInfo)
|
||||
}
|
||||
}
|
||||
return err
|
||||
|
||||
@@ -15,6 +15,7 @@ const (
|
||||
|
||||
EventTypeWXToken = "wxToken"
|
||||
EventTypeWX2Token = "wx2Token"
|
||||
EventTypeWX3Token = "wx3Token"
|
||||
|
||||
EventTypeYLYToken = "ylyToken"
|
||||
EventTypeWeimobToken = "weimobToken"
|
||||
@@ -66,6 +67,13 @@ func (h *Hub) OnNewWX2Token(token string) {
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Hub) OnNewWX3Token(token string) {
|
||||
h.eventHub.PostNewEvent(EventCategory, &eventhub.EventInfo{
|
||||
Type: EventTypeWX3Token,
|
||||
Data: token,
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Hub) OnNewYLYToken(token string) {
|
||||
h.eventHub.PostNewEvent(EventCategory, &eventhub.EventInfo{
|
||||
Type: EventTypeYLYToken,
|
||||
|
||||
@@ -590,11 +590,11 @@ func RefreshOrderSkuRelated(order *model.GoodsOrder) *model.GoodsOrder {
|
||||
|
||||
func RefreshOrderEarningPrice2(order *model.GoodsOrder, payPercentage int) *model.GoodsOrder {
|
||||
if order.EarningType == model.EarningTypePoints {
|
||||
if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX {
|
||||
order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage)) / 100
|
||||
} else {
|
||||
order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage/2)) / 100
|
||||
}
|
||||
// if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX {
|
||||
// order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage)) / 100
|
||||
// } else {
|
||||
order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage/2)) / 100
|
||||
// }
|
||||
} else {
|
||||
order.NewEarningPrice = order.EarningPrice
|
||||
}
|
||||
@@ -603,11 +603,11 @@ func RefreshOrderEarningPrice2(order *model.GoodsOrder, payPercentage int) *mode
|
||||
|
||||
func RefreshOrderEarningPrice3(order *model.GoodsOrder, payPercentage int, bill *model.Waybill) *model.GoodsOrder {
|
||||
if order.EarningType == model.EarningTypePoints {
|
||||
if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX {
|
||||
order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - payPercentage)) / 100
|
||||
} else {
|
||||
order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - payPercentage/2)) / 100
|
||||
}
|
||||
// if order.VendorID == model.VendorIDJDShop || order.VendorID == model.VendorIDJX {
|
||||
// order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - payPercentage)) / 100
|
||||
// } else {
|
||||
order.NewEarningPrice = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - payPercentage/2)) / 100
|
||||
// }
|
||||
} else {
|
||||
order.NewEarningPrice = order.EarningPrice
|
||||
}
|
||||
|
||||
@@ -165,6 +165,33 @@ func RefreshWeixin2Token() (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func RefreshWeixin3Token() (err error) {
|
||||
if api.WeixinMiniAPI3 != nil {
|
||||
err = RefreshConfig("wechat3", weixinTokenExpires, func() (token string, expireTimeStr string) {
|
||||
globals.SugarLogger.Debugf("RefreshWeixin3Token RunMode:%s", beego.BConfig.RunMode)
|
||||
if globals.IsMainProductEnv() {
|
||||
if tokenInfo, err := api.WeixinMiniAPI3.CBRetrieveToken(); err == nil {
|
||||
globals.SugarLogger.Debugf("RefreshWeixin3Token tokenInfo:%s", utils.Format4Output(tokenInfo, true))
|
||||
token = tokenInfo.AccessToken
|
||||
} else {
|
||||
globals.SugarLogger.Errorf("RefreshWeixin3Token RefreshToken failed with error:%v", err)
|
||||
}
|
||||
} else {
|
||||
if tokenInfo := getWX3TokenFromRemote(api.WeixinMiniAPI3.CBGetToken()); tokenInfo != nil {
|
||||
expireTimeStr = utils.Time2Str(time.Now().Add(-weixinTokenExpires))
|
||||
token = tokenInfo.Token
|
||||
}
|
||||
}
|
||||
return token, expireTimeStr
|
||||
}, func(value string) {
|
||||
globals.SugarLogger.Debugf("RefreshWeixinToken setter value:%s", value)
|
||||
syseventhub.SysEventHub.OnNewWX3Token(value)
|
||||
api.WeixinMiniAPI3.CBSetToken(value)
|
||||
})
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func RefreshWeimobToken() (err error) {
|
||||
if api.WeimobAPI != nil {
|
||||
err = RefreshConfig("weimob", weimobTokenExpires, func() (token string, expireTimeStr string) {
|
||||
@@ -315,6 +342,15 @@ func getWX2TokenFromRemote(oldToken string) (tokenInfo *syseventhub.TokenInfo) {
|
||||
return tokenInfo
|
||||
}
|
||||
|
||||
func getWX3TokenFromRemote(oldToken string) (tokenInfo *syseventhub.TokenInfo) {
|
||||
if !globals.IsMainProductEnv() && globals.GetWeixinTokenKey != "" && globals.GetWeixinTokenURL != "" {
|
||||
tokenInfo = PollingRemotEvent(globals.GetWeixinTokenURL, 0, map[string]interface{}{
|
||||
"oldToken": oldToken,
|
||||
})
|
||||
}
|
||||
return tokenInfo
|
||||
}
|
||||
|
||||
func getYLYTokenFromRemote(oldToken string) (tokenInfo *syseventhub.TokenInfo) {
|
||||
if !globals.IsMainProductEnv() && globals.GetWeixinTokenKey != "" && globals.GetYLYTokenURL != "" {
|
||||
tokenInfo = PollingRemotEvent(globals.GetYLYTokenURL, 0, map[string]interface{}{
|
||||
|
||||
@@ -1367,3 +1367,32 @@ func GetOrderStoreSkusCount(db *DaoDB, storeID, skuID int, fromTime, toTime time
|
||||
}
|
||||
return count, err
|
||||
}
|
||||
func GetSupplySupportStoreSkus(db *DaoDB, fromDate, toDate time.Time, fromStoreID, storeID int, percentage float64) (orderSkus []*model.OrderSku, err error) {
|
||||
sql := `
|
||||
SELECT c.sku_id,CEIL(c.count) count,CEIL(c.count) * d.jx_price sale_price
|
||||
FROM
|
||||
(
|
||||
SELECT a.sku_id,SUM(a.count * ? ) count FROM order_sku a
|
||||
JOIN goods_order b ON b.vendor_order_id = a.vendor_order_id AND a.vendor_id = b.vendor_id
|
||||
WHERE b.order_created_at > ?
|
||||
AND b.order_created_at < ?
|
||||
AND a.sku_id <> ?
|
||||
AND IF(b.store_id = 0,b.jx_store_id,b.store_id) = ?
|
||||
GROUP BY 1
|
||||
)c
|
||||
JOIN store_sku_bind d ON d.store_id = ? AND d.sku_id = c.sku_id AND d.deleted_at = ?
|
||||
ORDER BY c.count desc
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
percentage,
|
||||
fromDate,
|
||||
toDate,
|
||||
6039481, //葱姜蒜
|
||||
fromStoreID,
|
||||
storeID, utils.DefaultTimeValue,
|
||||
}
|
||||
if err = GetRows(db, &orderSkus, sql, sqlParams); err == nil {
|
||||
return orderSkus, err
|
||||
}
|
||||
return orderSkus, err
|
||||
}
|
||||
|
||||
@@ -49,8 +49,9 @@ type StoreDetail struct {
|
||||
OperatorName2 string `json:"operatorName2"`
|
||||
OperatorName3 string `json:"operatorName3"`
|
||||
|
||||
JdStoreLevel string `json:"jdStoreLevel"` //京东门店等级
|
||||
IsOrder int `json:"isOrder"` //是否是下预订单门店
|
||||
JdStoreLevel string `json:"jdStoreLevel"` //京东门店等级
|
||||
IsOrder int `json:"isOrder"` //是否是下预订单门店
|
||||
IsSupplyGoods int `json:"isSupplyGoods"`
|
||||
|
||||
YbAppID string `orm:"column(yb_app_id)" json:"ybAppID"`
|
||||
YbAppKey string `json:"ybAppKey"`
|
||||
@@ -99,7 +100,7 @@ func getStoreDetail(db *DaoDB, storeID, vendorID int, vendorStoreID string) (sto
|
||||
SELECT t1.*,
|
||||
t2.vendor_store_id, t2.status vendor_status, t2.delivery_fee_deduction_sill, t2.delivery_fee_deduction_fee, t2.sync_status, t2.vendor_org_code,
|
||||
t2.price_percentage, t2.auto_pickup, t2.delivery_type, t2.delivery_competition, t2.is_sync, t2.vendor_store_name, t2.is_order, t2.yb_app_id, t2.yb_app_key, t2.yb_store_prefix,
|
||||
t2.jds_street_code, t2.jds_street_name,
|
||||
t2.jds_street_code, t2.jds_street_name, t2.is_supply_goods,
|
||||
t3.value price_percentage_pack_str,
|
||||
t4.value freight_deduction_pack_str,
|
||||
province.name province_name,
|
||||
@@ -204,7 +205,7 @@ func GetStoreDetail2(db *DaoDB, storeID int, vendorStoreID string, vendorID int)
|
||||
return storeDetail, err
|
||||
}
|
||||
|
||||
func GetStoreCourierList(db *DaoDB, storeIDs []int, status, auditStatus int) (courierStoreList []*model.StoreCourierMap, err error) {
|
||||
func GetStoreCourierList(db *DaoDB, storeIDs, vendorIDs []int, status, auditStatus int) (courierStoreList []*model.StoreCourierMap, err error) {
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM store_courier_map t1
|
||||
@@ -217,6 +218,10 @@ func GetStoreCourierList(db *DaoDB, storeIDs []int, status, auditStatus int) (co
|
||||
sql += " AND t1.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
}
|
||||
if len(vendorIDs) > 0 {
|
||||
sql += " AND t1.vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")"
|
||||
sqlParams = append(sqlParams, vendorIDs)
|
||||
}
|
||||
if status != model.StoreStatusAll {
|
||||
sql += " AND t1.status = ?"
|
||||
sqlParams = append(sqlParams, status)
|
||||
|
||||
@@ -62,6 +62,7 @@ type StoreSkuSyncInfo struct {
|
||||
|
||||
Price int64
|
||||
UnitPrice int64
|
||||
Stock int
|
||||
|
||||
// 平台相关的store sku信息
|
||||
StoreSkuStatus int
|
||||
@@ -212,6 +213,7 @@ type StoreSkuExt struct {
|
||||
SkuSpecUnit string `orm:"size(8)" json:"specUnit"` // 质量或容量
|
||||
Weight int `json:"weight"` // 重量/质量,单位为克,当相应的SkuName的SpecUnit为g或kg时,必须等于SpecQuality
|
||||
SkuStatus int `json:"status"`
|
||||
Stock int `json:"stock"`
|
||||
|
||||
BindCreatedAt time.Time `orm:"auto_now_add;type(datetime)" json:"createdAt"`
|
||||
BindUpdatedAt time.Time `orm:"auto_now;type(datetime)" json:"updatedAt"`
|
||||
@@ -429,7 +431,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo
|
||||
t14.vendor_id, t14.vendor_org_code,
|
||||
t1.id bind_id, t1.sku_id, t1.price, t1.unit_price, t1.status store_sku_status,
|
||||
%s vendor_sku_id, t1.%s_sync_status sku_sync_status, t1.%s_price vendor_price, t1.%s_lock_time lock_time,
|
||||
t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id,
|
||||
t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id, t1.stock,
|
||||
t2.*,
|
||||
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.category_id name_category_id, t3.yb_name_suffix,
|
||||
t3.jds_stock_switch, t3.preparation_time, t3.img_watermark, t3.ex_vendor_id, t3.img img_origin,
|
||||
@@ -1106,7 +1108,8 @@ func GetTopSkusByStoreIDs(db *DaoDB, storeIDs []int) (storeSkuNameExt []*StoreSk
|
||||
t4.sub_store_id, t4.price bind_price, IF(t4.unit_price IS NOT NULL, t4.unit_price, t1.price) unit_price, t4.status store_sku_status, t4.auto_sale_at,
|
||||
t4.ebai_id, t4.mtwm_id,
|
||||
t4.ebai_sync_status, t4.mtwm_sync_status,
|
||||
t4.jd_price, t4.ebai_price, t4.mtwm_price, t4.jx_price, a.spec_quality sku_spec_quality, a.spec_unit sku_spec_unit
|
||||
t4.jd_price, t4.ebai_price, t4.mtwm_price, t4.jx_price, t4.stock,
|
||||
a.spec_quality sku_spec_quality, a.spec_unit sku_spec_unit
|
||||
FROM sku a
|
||||
JOIN sku_name t1 ON a.name_id = t1.id AND t1.deleted_at = ?
|
||||
JOIN store_sku_bind t4 ON t4.sku_id = a.id AND t4.deleted_at = ?
|
||||
|
||||
@@ -17,7 +17,7 @@ func TestGetStoreDetail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetStoreCourierList(t *testing.T) {
|
||||
storeCourierList, err := GetStoreCourierList(GetDB(), []int{100119}, model.StoreStatusOpened, model.StoreAuditStatusOnline)
|
||||
storeCourierList, err := GetStoreCourierList(GetDB(), []int{100119}, nil, model.StoreStatusOpened, model.StoreAuditStatusOnline)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -117,6 +117,10 @@ func IsSyncStatusPrice(syncStatus int8) bool {
|
||||
return (syncStatus & SyncFlagPriceMask) != 0
|
||||
}
|
||||
|
||||
func IsSyncStatusStock(syncStatus int8) bool {
|
||||
return (syncStatus & SyncFlagStockMask) != 0
|
||||
}
|
||||
|
||||
func IsSyncStatusSeq(syncStatus int8) bool {
|
||||
return (syncStatus & SyncFlagSeqMask) != 0
|
||||
}
|
||||
|
||||
@@ -26,6 +26,12 @@ const (
|
||||
EarningTypePoints = 2 //扣点模式
|
||||
)
|
||||
|
||||
const (
|
||||
OrderTypeNormal = 0 //普通订单
|
||||
OrderTypeMatter = 0 //物料订单
|
||||
OrderTypeSupplyGoods = 2 //进货订单
|
||||
)
|
||||
|
||||
var (
|
||||
PayStatusName = map[int]string{
|
||||
PayStatusNo: "待支付",
|
||||
@@ -111,6 +117,7 @@ type GoodsOrder struct {
|
||||
EclpOutID string `orm:"column(eclp_out_id)" json:"eclpOutID"` //物料配送的出库单号
|
||||
AddressID int64 `orm:"column(address_id)" json:"addressID"` //配送地址ID
|
||||
EarningType int `json:"earningType"` //订单结算方式,2为扣点,1为报价
|
||||
OrderType int `json:"orderType"` //订单类型,0为普通订单,1为物料订单,2为进货订单
|
||||
|
||||
// 以下只是用于传递数据
|
||||
OriginalData string `orm:"-" json:"-"`
|
||||
|
||||
@@ -438,13 +438,13 @@ type StoreMap struct {
|
||||
JdsStreetCode int `orm:"default(0)" json:"jdsStreetCode"` //京东商城直辖市街道code
|
||||
JdsStreetName string `orm:"size(32)" json:"jdsStreetName"` //京东商城直辖市街道
|
||||
|
||||
IsOrder int `orm:"default(0)" json:"isOrder"` //是否是下预订单门店
|
||||
IsOrder int `orm:"default(0)" json:"isOrder"` //是否是下预订单门店
|
||||
IsSysCat int `orm:"default(0)" json:"isSysCat"` //是否使用京西分类
|
||||
IsSupplyGoods int `orm:"default(0)" json:"isSupplyGoods"` // 是否是货源门店
|
||||
|
||||
YbAppID string `orm:"column(yb_app_id);size(255)" json:"ybAppID"`
|
||||
YbAppKey string `orm:"size(255)" json:"ybAppKey"`
|
||||
YbStorePrefix string `orm:"size(255)" json:"ybStorePrefix"`
|
||||
|
||||
IsSysCat int `orm:"default(0)" json:"isSysCat"` //是否使用京西分类
|
||||
}
|
||||
|
||||
func (*StoreMap) TableUnique() [][]string {
|
||||
|
||||
@@ -126,7 +126,7 @@ func StoreDetail2ShopInfo(storeDetail *dao.StoreDetail2) (shopInfo *dadaapi.Shop
|
||||
}
|
||||
shopInfo = &dadaapi.ShopInfo{
|
||||
OriginShopID: storeDetail.VendorStoreID,
|
||||
StationName: storeDetail.Name,
|
||||
StationName: globals.StoreName + "-" + storeDetail.Name,
|
||||
Business: dadaapi.BusinessTypeConvStore, // 故意设置成这个的
|
||||
CityName: cityName,
|
||||
AreaName: districtName,
|
||||
|
||||
@@ -59,7 +59,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
|
||||
|
||||
<BR>
|
||||
商品明细: <BR>
|
||||
品名 数量 <BR>
|
||||
品名 数量 单价 小计<BR>
|
||||
--------------------------------<BR>`
|
||||
// <BOLD>实际支付:</BOLD>%s<BR>
|
||||
orderParams := []interface{}{
|
||||
@@ -79,9 +79,8 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
|
||||
|
||||
for _, sku := range order.Skus {
|
||||
orderFmt += `%s<BR>`
|
||||
orderFmt += `%8s<BR>`
|
||||
orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count))
|
||||
//jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))
|
||||
orderFmt += `%8s%10s%10s<BR>`
|
||||
orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)))
|
||||
}
|
||||
orderFmt += `<BR>
|
||||
<BOLD>共%d种%d件商品</BOLD>
|
||||
@@ -134,7 +133,7 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
|
||||
|
||||
<BR>
|
||||
<B>商品明细: <BR></B>
|
||||
<B>品名 数量<BR></B>
|
||||
<B>品名数量单价小计<BR></B>
|
||||
--------------------------------<BR>`
|
||||
// <B><BOLD>实际支付:</BOLD></B><B>%s<BR></B>
|
||||
orderParams := []interface{}{
|
||||
@@ -154,9 +153,8 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
|
||||
|
||||
for _, sku := range order.Skus {
|
||||
orderFmt += `<B>%s<BR></B>`
|
||||
orderFmt += `<B>%s<BR><BR></B>`
|
||||
orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count))
|
||||
//jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))
|
||||
orderFmt += `<B>%s %s %s<BR><BR></B>`
|
||||
orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)))
|
||||
}
|
||||
orderFmt += `<BR>
|
||||
<B><BOLD>共%d种%d件商品</BOLD></B>
|
||||
|
||||
@@ -60,7 +60,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
|
||||
客户备注: *
|
||||
<big>%s*
|
||||
商品明细: *
|
||||
品名 数量
|
||||
品名 数量 单价 小计
|
||||
--------------------------------*
|
||||
`
|
||||
// <S011>实际支付: %s*
|
||||
@@ -81,8 +81,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
|
||||
for _, sku := range order.Skus {
|
||||
orderFmt += `%s*`
|
||||
orderFmt += `%8s%10s%10s*`
|
||||
orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count))
|
||||
// jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))
|
||||
orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)))
|
||||
}
|
||||
orderFmt += `
|
||||
*
|
||||
@@ -136,7 +135,7 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
|
||||
<big>客户备注: *
|
||||
<big>%s*
|
||||
<big>商品明细: *
|
||||
<big>品名 数量*
|
||||
<big>品名数量单价小计*
|
||||
--------------------------------*
|
||||
`
|
||||
// <big>实际支付: %s*
|
||||
@@ -156,9 +155,8 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
|
||||
}
|
||||
for _, sku := range order.Skus {
|
||||
orderFmt += `<big>%s*`
|
||||
orderFmt += `<big>%s*`
|
||||
orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count))
|
||||
// jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))
|
||||
orderFmt += `<big>%s %s %s*`
|
||||
orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)))
|
||||
}
|
||||
orderFmt += `
|
||||
<big>共%d种%d件商品*
|
||||
|
||||
@@ -58,7 +58,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
|
||||
\n
|
||||
\n
|
||||
商品明细: \n
|
||||
品名 数量 \n
|
||||
品名 数量 单价 小计\n
|
||||
--------------------------------\n`
|
||||
// <FB>实际支付:</FB>%s\n
|
||||
orderParams := []interface{}{
|
||||
@@ -78,9 +78,8 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
|
||||
|
||||
for _, sku := range order.Skus {
|
||||
orderFmt += `%s\n`
|
||||
orderFmt += `%8s\n`
|
||||
orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count))
|
||||
//jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))
|
||||
orderFmt += `%8s%10s%10s\n`
|
||||
orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)))
|
||||
}
|
||||
orderFmt += `\n
|
||||
<FB>共%d种%d件商品</FB>
|
||||
@@ -127,7 +126,7 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
|
||||
\n
|
||||
\n
|
||||
<FS2>商品明细: \n</FS2>
|
||||
<FS2>品名 数量\n</FS2>
|
||||
<FS2>品名数量单价小计\n</FS2>
|
||||
--------------------------------\n`
|
||||
// <FS2><FB>实际支付:</FB>%s\n</FS2>
|
||||
orderParams := []interface{}{
|
||||
@@ -147,9 +146,8 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
|
||||
|
||||
for _, sku := range order.Skus {
|
||||
orderFmt += `<FS2>%s\n</FS2>`
|
||||
orderFmt += `<FS2>%s\n\n</FS2>`
|
||||
orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count))
|
||||
//jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count))
|
||||
orderFmt += `<FS2>%s %s %s\n\n</FS2>`
|
||||
orderParams = append(orderParams, sku.SkuName, "x"+utils.Int2Str(sku.Count), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice), jxutils.IntPrice2StandardCurrencyString(sku.SalePrice*int64(sku.Count)))
|
||||
}
|
||||
orderFmt += `\n
|
||||
<FS2><FB>共%d种%d件商品</FB></FS2>
|
||||
|
||||
@@ -123,7 +123,7 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err
|
||||
order.ExpectedDeliveredTime = order.OrderCreatedAt.Add(time.Hour)
|
||||
order.BusinessType = model.BusinessTypeImmediate
|
||||
} else {
|
||||
globals.SugarLogger.Warnf("暂不支持的京东商城订单类型!type: %v", msg.OrderState)
|
||||
globals.SugarLogger.Debugf("暂不支持的京东商城订单类型!type: %v", msg.OrderState)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"math"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -33,7 +32,6 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/delivery"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -113,6 +111,7 @@ type JxOrderInfo struct {
|
||||
Weight int `json:"weight"`
|
||||
FromStoreID int `json:"fromStoreID"`
|
||||
EarningType int `json:"earningType"`
|
||||
OrderType int `json:"orderType"`
|
||||
}
|
||||
|
||||
type DeliveryTimeItem struct {
|
||||
@@ -220,7 +219,7 @@ func GetMyOrderCountInfo(ctx *jxcontext.Context, fromDate, toDate time.Time, sta
|
||||
}
|
||||
|
||||
//fromStoreID 为0 表示非物料订单(京西商城订单等)
|
||||
//fromStoreID 为 门店ID ,表示是物料订单,fromStoreID表示是哪个门店申请的物料
|
||||
//fromStoreID 为 门店ID ,表示是物料订单,fromStoreID表示是哪个门店申请的物料,或者进货方门店
|
||||
//fromStoreID 为-1 表示也是物料订单,但是不是门店申请,是个人申请的
|
||||
//fromStoreID 在后面 generateOrder中有用
|
||||
func CreateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64, createType int, fromStoreID int, IsDeliverySelf bool) (outJxOrder *JxOrderInfo, err error) {
|
||||
@@ -373,10 +372,12 @@ func OnPayFinished(orderPay *model.OrderPay) (err error) {
|
||||
order.StatusTime = *orderPay.PayFinishedAt
|
||||
err = callNewOrder(order)
|
||||
//如果是物料的订单,直接到拣货完成,配送中的状态
|
||||
// if order.OrderType != model.OrderTypeNormal {
|
||||
if order.FromStoreID != 0 {
|
||||
netprinter.PrintOrderByOrder(jxcontext.AdminCtx, order)
|
||||
PickupGoods(order, false, "jxadmin")
|
||||
}
|
||||
// }
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -509,10 +510,6 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
||||
return nil, nil, fmt.Errorf("预订单只能预定当天或第二天")
|
||||
}
|
||||
}
|
||||
// if !isTimeInOpTime(storeDetail.OpenTime1, storeDetail.CloseTime1, storeDetail.OpenTime2, storeDetail.CloseTime2, checkTime) {
|
||||
// return nil, nil, fmt.Errorf("门店:%s不在营业时间范围", storeDetail.Name)
|
||||
// }
|
||||
|
||||
outJxOrder2 := *jxOrder
|
||||
outJxOrder2.Skus = nil
|
||||
outJxOrder2.OrderPrice = 0
|
||||
@@ -549,7 +546,7 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
||||
}
|
||||
skuMap := make(map[int]*model.SkuAndName)
|
||||
for _, v := range skuList {
|
||||
if fromStoreID != 0 {
|
||||
if jxOrder.OrderType == model.OrderTypeMatter {
|
||||
if v.EclpID == "" {
|
||||
return nil, nil, fmt.Errorf("此商品物料编码为空,请联系管理员!skuID:[%v]", v.ID)
|
||||
}
|
||||
@@ -561,7 +558,7 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
||||
sum int //申请物料的店的最近销量,以下会根据销量计算具体袋子的价格
|
||||
flag = false //新店袋子拆分当个参数
|
||||
)
|
||||
if fromStoreID != 0 && fromStoreID != -1 {
|
||||
if jxOrder.OrderType == model.OrderTypeMatter && fromStoreID != -1 {
|
||||
result, _ = orderman.GetMatterStoreOrderCount(nil, fromStoreID)
|
||||
sum = result.Count
|
||||
}
|
||||
@@ -573,7 +570,7 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
||||
}
|
||||
for _, v := range skus {
|
||||
if storeSkuBind := storeSkuMap[v.SkuID]; storeSkuBind != nil {
|
||||
if fromStoreID != 0 {
|
||||
if jxOrder.OrderType == model.OrderTypeMatter {
|
||||
result2, _ := api.JdEclpAPI.QueryStock(storeSkuBind.EclpID)
|
||||
if len(result2) > 0 {
|
||||
if result2[0].UsableNum < v.Count {
|
||||
@@ -611,7 +608,7 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
||||
}
|
||||
}
|
||||
if jxSku != nil {
|
||||
if fromStoreID == 0 || fromStoreID == -1 {
|
||||
if jxOrder.OrderType != model.OrderTypeMatter || (jxOrder.OrderType == model.OrderTypeMatter && fromStoreID == -1) {
|
||||
outJxOrder.Skus = append(outJxOrder.Skus, jxSku)
|
||||
outJxOrder.OrderPrice += int64(jxSku.Count) * jxSku.SalePrice
|
||||
} else { //以下else为物料订单袋子金额和数量处理
|
||||
@@ -710,15 +707,13 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
||||
}
|
||||
}
|
||||
}
|
||||
//物料订单的配送费另算,所以排除了免得多算一次
|
||||
if fromStoreID == 0 {
|
||||
sort.Sort(JxSkuInfoList(outJxOrder.Skus))
|
||||
outJxOrder.FreightPrice, _, err = delivery.CalculateDeliveryFee(dao.GetDB(), jxOrder.StoreID, "",
|
||||
jxutils.StandardCoordinate2Int(deliveryAddress.Lng), jxutils.StandardCoordinate2Int(deliveryAddress.Lat),
|
||||
model.CoordinateTypeMars, outJxOrder.Weight, checkTime)
|
||||
}
|
||||
// if jxOrder.StoreID == specialStoreID {
|
||||
// outJxOrder.FreightPrice = 0
|
||||
// if fromStoreID == 0 {
|
||||
// sort.Sort(JxSkuInfoList(outJxOrder.Skus))
|
||||
// outJxOrder.FreightPrice, _, err = delivery.CalculateDeliveryFee(dao.GetDB(), jxOrder.StoreID, "",
|
||||
// jxutils.StandardCoordinate2Int(deliveryAddress.Lng), jxutils.StandardCoordinate2Int(deliveryAddress.Lat),
|
||||
// model.CoordinateTypeMars, outJxOrder.Weight, checkTime)
|
||||
//TODO 2020-08-06 配送费固定5元
|
||||
outJxOrder.FreightPrice = 500
|
||||
// }
|
||||
} else {
|
||||
outJxOrder.FreightPrice = 0
|
||||
@@ -729,28 +724,24 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
||||
if err = err2; err != nil {
|
||||
return nil, nil, fmt.Errorf("fromStoreID有误,[%v]", fromStoreID)
|
||||
}
|
||||
outJxOrder.FromStoreID = fromStoreID
|
||||
if jxOrder.OrderType == model.OrderTypeMatter {
|
||||
//TODO 修改配送费规则,2020-04-28
|
||||
//3kg 5元,每多1kg加2元
|
||||
//配送费要按分包规则计算
|
||||
if outJxOrder.Weight <= 3000 {
|
||||
outJxOrder.FreightPrice = 500
|
||||
} else if outJxOrder.Weight > 3000 && outJxOrder.Weight <= splitMatterOrderMinWeight {
|
||||
outJxOrder.FreightPrice = utils.Float64TwoInt64(500 + math.Ceil((utils.Int2Float64(outJxOrder.Weight)-3000)/1000)*200)
|
||||
} else {
|
||||
_, freightPrice, _ := tryToSplitMatterOrder(jxOrder)
|
||||
outJxOrder.FreightPrice = freightPrice
|
||||
}
|
||||
}
|
||||
//要求配送人姓名填门店名
|
||||
if fromStoreID != -1 {
|
||||
deliveryAddress.ConsigneeName = storeDetail2.Name
|
||||
}
|
||||
outJxOrder.FromStoreID = fromStoreID
|
||||
//TODO 修改配送费规则,2020-04-28
|
||||
//3kg 5元,每多1kg加2元
|
||||
//配送费要按分包规则计算
|
||||
if outJxOrder.Weight <= 3000 {
|
||||
outJxOrder.FreightPrice = 500
|
||||
} else if outJxOrder.Weight > 3000 && outJxOrder.Weight <= splitMatterOrderMinWeight {
|
||||
outJxOrder.FreightPrice = utils.Float64TwoInt64(500 + math.Ceil((utils.Int2Float64(outJxOrder.Weight)-3000)/1000)*200)
|
||||
} else {
|
||||
_, freightPrice, _ := tryToSplitMatterOrder(jxOrder)
|
||||
outJxOrder.FreightPrice = freightPrice
|
||||
}
|
||||
///规则为: 配送费用规则。起价5元(含2kg),之后每kg+2元,不足1kg按1kg计算。
|
||||
// if outJxOrder.Weight <= 2000 {
|
||||
// outJxOrder.FreightPrice = 500
|
||||
// } else {
|
||||
// outJxOrder.FreightPrice = utils.Float64TwoInt64(500 + math.Ceil((utils.Int2Float64(outJxOrder.Weight)-2000)/1000)*200)
|
||||
// }
|
||||
} else {
|
||||
if outJxOrder.FreightPrice > specialFreightPrice {
|
||||
outJxOrder.FreightPrice = specialFreightPrice
|
||||
@@ -831,6 +822,7 @@ func jxOrder2GoodsOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, deliveryAd
|
||||
DeliveryType: model.OrderDeliveryTypeStoreSelf,
|
||||
StatusTime: time.Now(),
|
||||
EarningType: jxOrder.EarningType,
|
||||
OrderType: jxOrder.OrderType,
|
||||
}
|
||||
if userID == "" {
|
||||
order.UserID = ctx.GetUserID()
|
||||
@@ -862,10 +854,12 @@ func jxOrder2GoodsOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, deliveryAd
|
||||
order.TotalShopMoney = utils.Float64TwoInt64(float64(order.TotalShopMoney) * jdshopapi.JdsPayPercentage)
|
||||
if jxOrder.FromStoreID != 0 {
|
||||
order.FromStoreID = jxOrder.FromStoreID
|
||||
order.WaybillVendorID = model.VendorIDJDWL
|
||||
order.DeliveryFlag = model.OrderDeliveryFlagMaskScheduleDisabled
|
||||
order.ConsigneeAddress = deliveryAddress.Address
|
||||
order.Flag = 1
|
||||
if jxOrder.OrderType == model.OrderTypeMatter {
|
||||
order.WaybillVendorID = model.VendorIDJDWL
|
||||
order.ConsigneeAddress = deliveryAddress.Address
|
||||
}
|
||||
}
|
||||
//如果是自提单就设置
|
||||
if IsDeliverySelf {
|
||||
@@ -891,16 +885,17 @@ func AdjustOrder(ctx *jxcontext.Context, order *model.GoodsOrder, removedSkuList
|
||||
func PickupGoods(order *model.GoodsOrder, isSelfDelivery bool, userName string) (err error) {
|
||||
err = changeOrderStatus(order.VendorOrderID, model.OrderStatusFinishedPickup, "")
|
||||
//如果是物料订单则直接进行京东物流的发单,并且状态直接变为配送中
|
||||
//如果是进货的订单,直接变为配送中
|
||||
err = orderSolutionForWuLiao(order)
|
||||
return err
|
||||
}
|
||||
|
||||
func orderSolutionForWuLiao(order *model.GoodsOrder) (err error) {
|
||||
if order.FromStoreID != 0 {
|
||||
err = changeOrderStatus(order.VendorOrderID, model.OrderStatusDelivering, "")
|
||||
if order.OrderType == model.OrderTypeMatter {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
err = changeOrderStatus(order.VendorOrderID, model.OrderStatusDelivering, "")
|
||||
goods, err := dao.QueryOrders(db, order.VendorOrderID, -1, []int{model.VendorIDJX}, -1, utils.ZeroTimeValue, utils.ZeroTimeValue)
|
||||
if err != nil || len(goods) == 0 {
|
||||
return err
|
||||
@@ -1080,7 +1075,7 @@ func CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string)
|
||||
}
|
||||
|
||||
func CancelMatterOrder(db *dao.DaoDB, order *model.GoodsOrder, reason string) (err error) {
|
||||
if order.FromStoreID != 0 {
|
||||
if order.OrderType == model.OrderTypeMatter {
|
||||
if order.EclpOutID != "" {
|
||||
//表示是京西的物料订单的子订单(拆分后的订单)
|
||||
if len(order.VendorOrderID) == 16 && order.VendorID == model.VendorIDJX {
|
||||
@@ -1814,5 +1809,14 @@ func buildJxOrderInfo(order *model.GoodsOrder, orderSkus []*model.OrderSku) (jxO
|
||||
}
|
||||
jxOrder.Skus = skus
|
||||
jxOrder.Weight = weight
|
||||
jxOrder.OrderType = model.OrderTypeMatter
|
||||
return jxOrder
|
||||
}
|
||||
|
||||
func GetSupplySupportStoreSkus(ctx *jxcontext.Context, fromDate, toDate string, fromStoreID, storeID int, percentage string) (orderSkus []*model.OrderSku, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
orderSkus, err = dao.GetSupplySupportStoreSkus(db, utils.Str2Time(fromDate), utils.Str2Time(toDate), fromStoreID, storeID, utils.Str2Float64(percentage))
|
||||
return orderSkus, err
|
||||
}
|
||||
|
||||
@@ -209,6 +209,8 @@ weixinAppID = "wx2bb99eb5d2c9b82c"
|
||||
weixinSecret = "6bbbed1443cc062c20a015a64c07a531"
|
||||
weixinMiniAppID2 = "wx4b5930c13f8b1170"
|
||||
weixinMiniSecret2 = "2a57228a716ce991a52739f0ff41111d"
|
||||
weixinMiniAppID3 = "wx18111a41fd17f24f"
|
||||
weixinMiniSecret3 = "c79ac6e1b2d6d7968e72a9658a8b6715"
|
||||
|
||||
yinbaoAppKey = "682628966212343269"
|
||||
yinbaoAppID = "18C0E0867E467DBC26EFF5E957B02EC4"
|
||||
|
||||
@@ -794,3 +794,17 @@ func (c *StoreController) UpdateStorePricePack() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 根据门店获取距离最近的货源店铺
|
||||
// @Description 修根据门店获取距离最近的货源店铺
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeID query int true "门店ID"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetNearSupplyGoodsStoreByStoreID [get]
|
||||
func (c *StoreController) GetNearSupplyGoodsStoreByStoreID() {
|
||||
c.callGetNearSupplyGoodsStoreByStoreID(func(params *tStoreGetNearSupplyGoodsStoreByStoreIDParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = common.GetNearSupplyGoodsStoreByStoreID(params.Ctx, params.StoreID)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1119,3 +1119,18 @@ func (c *OrderController) AdjustJdsOrderSimple() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 修改订单运费
|
||||
// @Description 修改订单运费
|
||||
// @Param token header string true "认证token"
|
||||
// @Param vendorOrderID formData string true "订单号"
|
||||
// @Param desiredFee formData int true "运费"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /UpdateWaybillDesiredFee [put]
|
||||
func (c *OrderController) UpdateWaybillDesiredFee() {
|
||||
c.callUpdateWaybillDesiredFee(func(params *tOrderUpdateWaybillDesiredFeeParams) (retVal interface{}, errCode string, err error) {
|
||||
err = orderman.UpdateWaybillDesiredFee(params.Ctx, params.VendorOrderID, params.DesiredFee)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -222,3 +222,21 @@ func (c *JxOrderController) SendFailedMatterOrder() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 根据时间获取进货辅助工具里的商品,用于加入购物车
|
||||
// @Description 根据时间获取进货辅助工具里的商品,用于加入购物车
|
||||
// @Param token header string true "认证token"
|
||||
// @Param fromDate query string false "开始日期(包含),格式(2006-01-02),如果订单号为空此项必须要求"
|
||||
// @Param toDate query string false "结束日期(包含),格式(2006-01-02),如果订单号为空此项必须要求"
|
||||
// @Param fromStoreID query int false "进货门店ID"
|
||||
// @Param storeID query int false "货源门店ID"
|
||||
// @Param percentage query string false "销量比例,1,1.05,1.1"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetSupplySupportStoreSkus [get]
|
||||
func (c *JxOrderController) GetSupplySupportStoreSkus() {
|
||||
c.callGetSupplySupportStoreSkus(func(params *tJxorderGetSupplySupportStoreSkusParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = localjx.GetSupplySupportStoreSkus(params.Ctx, params.FromDate, params.ToDate, params.FromStoreID, params.StoreID, params.Percentage)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -60,7 +60,9 @@ var (
|
||||
WeixinAPI *weixinapi.API // 微信公众号
|
||||
WeixinMiniAPI *weixinapi.API // 小程序
|
||||
WeixinMiniAPI2 *weixinapi.API // 小程序2
|
||||
WeixinMiniAPI3 *weixinapi.API // 小程序3
|
||||
WeixinMiniAppID2 string
|
||||
WeixinMiniAppID3 string
|
||||
WxpayAPI *wxpayapi.API // 微信支付API
|
||||
TLpayAPI *tonglianpayapi.API //通联收银宝api
|
||||
|
||||
@@ -210,6 +212,9 @@ func Init() {
|
||||
WeixinMiniAPI2 = weixinapi.New(WeixinMiniAppID2, beego.AppConfig.String("weixinMiniSecret2"))
|
||||
}
|
||||
WeixinPageAPI = weixinapi.New(beego.AppConfig.String("weixinPageAppID"), beego.AppConfig.String("weixinPageSecret"))
|
||||
if WeixinMiniAppID3 = beego.AppConfig.String("weixinMiniAppID3"); WeixinMiniAppID3 != "" {
|
||||
WeixinMiniAPI3 = weixinapi.New(WeixinMiniAppID3, beego.AppConfig.String("weixinMiniSecret3"))
|
||||
}
|
||||
if globals.WxpayNotifyURL != "" {
|
||||
// WxpayAPI = wxpayapi.New(beego.AppConfig.String("wxpayAppID"), beego.AppConfig.String("wxpayAppKey"), beego.AppConfig.String("wxpayAppMchID"))
|
||||
WxpayAPI = wxpayapi.NewWithCertificate(beego.AppConfig.String("wxpayAppID"), beego.AppConfig.String("wxpayAppKey"), beego.AppConfig.String("wxpayAppMchID"),
|
||||
|
||||
4
main.go
4
main.go
@@ -136,6 +136,10 @@ func main() {
|
||||
globals.SugarLogger.Errorf("RefreshWeixin2Token failed with error:%s", err)
|
||||
return
|
||||
}
|
||||
if err := tasks.RefreshWeixin3Token(); err != nil {
|
||||
globals.SugarLogger.Errorf("RefreshWeixin3Token failed with error:%s", err)
|
||||
return
|
||||
}
|
||||
// if err := tasks.RefreshWeimobToken(); err != nil {
|
||||
// globals.SugarLogger.Errorf("RefreshWeimobToken failed with error:%s", err)
|
||||
// return
|
||||
|
||||
@@ -718,6 +718,15 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetSupplySupportStoreSkus",
|
||||
Router: `/GetSupplySupportStoreSkus`,
|
||||
AllowHTTPMethods: []string{"get"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JxOrderController"],
|
||||
beego.ControllerComments{
|
||||
Method: "Pay4Order",
|
||||
@@ -1314,6 +1323,15 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||
beego.ControllerComments{
|
||||
Method: "UpdateWaybillDesiredFee",
|
||||
Router: `/UpdateWaybillDesiredFee`,
|
||||
AllowHTTPMethods: []string{"put"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ReportController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:ReportController"],
|
||||
beego.ControllerComments{
|
||||
Method: "AutoFocusStoreSkus",
|
||||
@@ -1755,6 +1773,15 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetNearSupplyGoodsStoreByStoreID",
|
||||
Router: `/GetNearSupplyGoodsStoreByStoreID`,
|
||||
AllowHTTPMethods: []string{"get"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetStoreAlertList",
|
||||
|
||||
Reference in New Issue
Block a user