添加抖音授权登录,国美测试接口,修改运单重复骑手,添加推送骑手信息
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package localjx
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"regexp"
|
||||
@@ -98,7 +99,7 @@ func (l JxSkuInfoList) Swap(i, j int) {
|
||||
}
|
||||
|
||||
type JxOrderInfo struct {
|
||||
BuyerComment string `json:"buyerComment"`
|
||||
BuyerComment string `json:"buyerComment"` // 备注
|
||||
StoreID int `json:"storeID"`
|
||||
Skus []*JxSkuInfo `json:"skus"`
|
||||
|
||||
@@ -112,7 +113,7 @@ type JxOrderInfo struct {
|
||||
OrderID int64 `json:"orderID"`
|
||||
StoreName string `json:"storeName"`
|
||||
Weight int `json:"weight"`
|
||||
FromStoreID int `json:"fromStoreID"`
|
||||
FromStoreID int `json:"fromStoreID"` //
|
||||
EarningType int `json:"earningType"`
|
||||
OrderType int `json:"orderType"`
|
||||
IsBuyNowPrice int `json:"isBuyNowPrice"`
|
||||
@@ -530,6 +531,7 @@ func GetAvailableDeliverTime(ctx *jxcontext.Context, storeID int) (deliverTimerL
|
||||
}
|
||||
|
||||
func OnPayFinished(orderPay *model.OrderPay) (err error) {
|
||||
// 查询订单是购物订单还是充值订单
|
||||
order, err := partner.CurOrderManager.LoadOrder(orderPay.VendorOrderID, orderPay.VendorID)
|
||||
if err == nil {
|
||||
db := dao.GetDB()
|
||||
@@ -584,10 +586,12 @@ func OnPayFinished(orderPay *model.OrderPay) (err error) {
|
||||
storeOrder.OrderFinishedAt = time.Now()
|
||||
storeOrder.Status = model.OrderStatusFinished
|
||||
if _, err = dao.UpdateEntity(dao.GetDB(), storeOrder, "OrderFinishedAt", "Status"); err == nil {
|
||||
if storeOrder.StoreID == 668357 {
|
||||
storeOrder.StoreID = 131
|
||||
// 获取门店的品牌ID
|
||||
storeBrandId, err := GetStoreAcctOrderByVendorId(orderPay.VendorOrderID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, 131, storeOrder.ActualPayPrice, 1, 1, "")
|
||||
partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, storeBrandId, storeOrder.ActualPayPrice, model.BrandBillFeeTypeSys, model.BrandBillFeeTypeSys, "")
|
||||
}
|
||||
}
|
||||
case model.PayTypeTL_BrandBillCharge:
|
||||
@@ -822,7 +826,7 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
||||
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为物料订单袋子金额和数量处理
|
||||
} else { //以下else为物料订单袋子金额和数量处理
|
||||
if !result.Flag { //只要flag是false就按原价申请,是true再按订单量
|
||||
outJxOrder.Skus = append(outJxOrder.Skus, jxSku)
|
||||
outJxOrder.OrderPrice += int64(jxSku.Count) * jxSku.SalePrice
|
||||
@@ -993,6 +997,10 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
||||
outJxOrder.FreightPrice = 0
|
||||
}
|
||||
}
|
||||
if strings.Contains(storeDetail.BrandName, model.B2BTag) {
|
||||
outJxOrder.FreightPrice = 10000 // b2b运费一百元
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
if jxOrder.OrderType == model.OrderTypeNormal {
|
||||
outJxOrder.TotalPrice = outJxOrder.OrderPrice + outJxOrder.FreightPrice
|
||||
@@ -2490,6 +2498,7 @@ func RefreshCouponsStatus(ctx *jxcontext.Context) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
// 创建门店充值订单
|
||||
func CreateStoreAcctOrder(ctx *jxcontext.Context, orderType, storeID, price int, goodsVendorOrderID string) (vendorOrderID string, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
@@ -2528,6 +2537,34 @@ func CreateStoreAcctOrder(ctx *jxcontext.Context, orderType, storeID, price int,
|
||||
return order.VendorOrderID, err
|
||||
}
|
||||
|
||||
// 根据订单号获取门店充值记录
|
||||
func GetStoreAcctOrderByVendorId(vendorOrderID string) (int, error) {
|
||||
if vendorOrderID == "" {
|
||||
return 0, errors.New("参数vendorOrderID 不能为空")
|
||||
}
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM store_acct_order t1
|
||||
WHERE 1 = 1
|
||||
AND t1.vendor_order_id = ?
|
||||
`
|
||||
var sqlParams []interface{}
|
||||
sqlParams = append(sqlParams, vendorOrderID)
|
||||
|
||||
data := &model.StoreAcctOrder{}
|
||||
err := dao.GetRow(dao.GetDB(), &data, sql, sqlParams...)
|
||||
if data.StoreID == 0 {
|
||||
return 0, errors.New("充值订单为异常订单,无门店信息")
|
||||
}
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// 获取门店所属品牌
|
||||
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), data.StoreID, -1, "")
|
||||
return storeDetail.BrandID, nil
|
||||
}
|
||||
|
||||
func CreateBrandOrder(ctx *jxcontext.Context, brandID, price int) (vendorOrderID string, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
|
||||
Reference in New Issue
Block a user