修改回调
This commit is contained in:
@@ -249,7 +249,7 @@ func (s *DefScheduler) CheckStoreBalance(ctx *jxcontext.Context, order *model.Go
|
|||||||
//京西后台则是点一下发3个,len courierVendorIDs 是0
|
//京西后台则是点一下发3个,len courierVendorIDs 是0
|
||||||
//如果是小程序上点哪个扣哪个平台的钱
|
//如果是小程序上点哪个扣哪个平台的钱
|
||||||
//如果是后台,则选最高的那个扣
|
//如果是后台,则选最高的那个扣
|
||||||
storeAcct, err := cms.GetStoreAcctBalance(ctx, jxutils.GetSaleStoreIDFromOrder(order))
|
storeAcct, err := cms.GetStoreAcctBalance(ctx, jxutils.GetSaleStoreIDFromOrder(order)) // 0.0
|
||||||
deliveryFeeMap, _ := s.QueryOrderWaybillFeeInfoEx(ctx, order.VendorOrderID, order.VendorID)
|
deliveryFeeMap, _ := s.QueryOrderWaybillFeeInfoEx(ctx, order.VendorOrderID, order.VendorID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errCode, fmt.Errorf("获取账户余额失败!")
|
return errCode, fmt.Errorf("获取账户余额失败!")
|
||||||
@@ -286,6 +286,12 @@ func (s *DefScheduler) CheckStoreBalance(ctx *jxcontext.Context, order *model.Go
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if storeAcct.AccountBalance < partner.MinCreateWaybillBalance {
|
if storeAcct.AccountBalance < partner.MinCreateWaybillBalance {
|
||||||
|
//// 如果门店没钱,查看品牌
|
||||||
|
//if storeAcct.AccountBalance == 0 {
|
||||||
|
// // 查询门店品牌id
|
||||||
|
// dao.GetStoreList(dao.GetDB(), []int{order.JxStoreID}, nil, nil, nil, nil, "")
|
||||||
|
// dao.GetBrandBalance(dao.GetDB(),brandId)
|
||||||
|
//}
|
||||||
return model.ErrCodeAccountBalanceNotEnough, fmt.Errorf("门店账户余额小于[%v]元,不能发配送!", jxutils.IntPrice2Standard(partner.MinCreateWaybillBalance))
|
return model.ErrCodeAccountBalanceNotEnough, fmt.Errorf("门店账户余额小于[%v]元,不能发配送!", jxutils.IntPrice2Standard(partner.MinCreateWaybillBalance))
|
||||||
}
|
}
|
||||||
if len(courierVendorIDs) == 1 {
|
if len(courierVendorIDs) == 1 {
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ func (s *StoreAcctManager) InsertStoreAcctIncomeAndUpdateStoreAcctBalance(ctx *j
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查单子运费收入支出差
|
// 检查当前订单的状态以及支出收入比
|
||||||
func (s *StoreAcctManager) CheckStoreAcctExpendExist(vendorOrderID string) (isEqual, isZero bool, err error) {
|
func (s *StoreAcctManager) CheckStoreAcctExpendExist(vendorOrderID string) (isEqual, isZero bool, err error) {
|
||||||
var (
|
var (
|
||||||
expends, incomes int
|
expends, incomes int
|
||||||
|
|||||||
@@ -1173,7 +1173,7 @@ func GetStoreAcctExpendLastCreateWayBillFee(db *DaoDB, vendorOrderID string) (ex
|
|||||||
20,
|
20,
|
||||||
}
|
}
|
||||||
if vendorOrderID != "" {
|
if vendorOrderID != "" {
|
||||||
sql += " AND vendor_order_id = ?"
|
sql += " AND a.vendor_order_id = ?"
|
||||||
sqlParams = append(sqlParams, vendorOrderID)
|
sqlParams = append(sqlParams, vendorOrderID)
|
||||||
}
|
}
|
||||||
sql += `
|
sql += `
|
||||||
|
|||||||
@@ -12,6 +12,28 @@ type FnController struct {
|
|||||||
web.Controller
|
web.Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 门店回掉
|
||||||
|
func (c *FnController) FnStore() {
|
||||||
|
if c.Ctx.Input.Method() == http.MethodPost {
|
||||||
|
fmt.Println("开始回调门店回掉==========================")
|
||||||
|
msg, callbackResponse := api.FnAPI.GetChainstoreStatusNotify(c.Ctx.Request)
|
||||||
|
fmt.Println("开始回调门店回掉==========================msg", msg)
|
||||||
|
fmt.Println("开始回调门店回掉==========================callbackResponse", callbackResponse)
|
||||||
|
if callbackResponse.Code == -1 {
|
||||||
|
c.Data["code"] = callbackResponse
|
||||||
|
c.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
callbackResponse = fn.OnStoreStatus(msg)
|
||||||
|
c.Data["code"] = callbackResponse
|
||||||
|
c.ServeJSON()
|
||||||
|
} else {
|
||||||
|
c.Abort("404")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 订单状态
|
// 订单状态
|
||||||
func (c *FnController) FnOrder() {
|
func (c *FnController) FnOrder() {
|
||||||
if c.Ctx.Input.Method() == http.MethodPost {
|
if c.Ctx.Input.Method() == http.MethodPost {
|
||||||
@@ -20,14 +42,14 @@ func (c *FnController) FnOrder() {
|
|||||||
fmt.Println("开始回调订单状态==========================msg", msg)
|
fmt.Println("开始回调订单状态==========================msg", msg)
|
||||||
fmt.Println("开始回调订单状态==========================callbackResponse", callbackResponse)
|
fmt.Println("开始回调订单状态==========================callbackResponse", callbackResponse)
|
||||||
if callbackResponse.Code == -1 {
|
if callbackResponse.Code == -1 {
|
||||||
c.Data["json"] = callbackResponse
|
c.Data["code"] = callbackResponse
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 订单回调
|
// 订单回调
|
||||||
callbackResponse = fn.OnWaybillMsg(msg)
|
callbackResponse = fn.OnWaybillMsg(msg)
|
||||||
c.Data["json"] = callbackResponse
|
c.Data["code"] = callbackResponse
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
} else {
|
} else {
|
||||||
c.Abort("404")
|
c.Abort("404")
|
||||||
@@ -48,56 +70,10 @@ func (c *FnController) FnAbnormal() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
callbackResponse = fn.OnWaybillExceptFn(msg.Param)
|
callbackResponse = fn.OnWaybillExceptFn(msg.Param)
|
||||||
c.Data["json"] = callbackResponse
|
c.Data["code"] = callbackResponse
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
} else {
|
} else {
|
||||||
c.Abort("404")
|
c.Abort("404")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 门店回掉
|
|
||||||
func (c *FnController) FnStore() {
|
|
||||||
if c.Ctx.Input.Method() == http.MethodPost {
|
|
||||||
fmt.Println("开始回调门店回掉==========================")
|
|
||||||
msg, callbackResponse := api.FnAPI.GetChainstoreStatusNotify(c.Ctx.Request)
|
|
||||||
fmt.Println("开始回调门店回掉==========================msg", msg)
|
|
||||||
fmt.Println("开始回调门店回掉==========================callbackResponse", callbackResponse)
|
|
||||||
if callbackResponse.Code == -1 {
|
|
||||||
c.Data["json"] = callbackResponse
|
|
||||||
c.ServeJSON()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
callbackResponse = fn.OnStoreStatus(msg)
|
|
||||||
c.Data["json"] = callbackResponse
|
|
||||||
c.ServeJSON()
|
|
||||||
} else {
|
|
||||||
c.Abort("404")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
//switch msg["callback_business_type"] {
|
|
||||||
//case fnpsapi.ChainstoreStatus: // 门店状态变更回调
|
|
||||||
//callbackResponse = fn.OnStoreStatus(msg)
|
|
||||||
//break
|
|
||||||
//case fnpsapi.AbnormalStatus: // 异常报备回调
|
|
||||||
//data := &fnpsapi.AbnormalReportNotify{}
|
|
||||||
//if err := utils.Map2StructByJson(msg, data, true); err != nil {
|
|
||||||
//callbackResponse = &fnpsapi.CallbackResponse{Code: -1}
|
|
||||||
//break
|
|
||||||
//}
|
|
||||||
//callbackResponse = fn.OnWaybillExceptFn(data)
|
|
||||||
//break
|
|
||||||
//case fnpsapi.CookingFinishStatus: // 商户出餐回调
|
|
||||||
//break
|
|
||||||
//case fnpsapi.ChainstoreServiceStatus: // 门店采购服务变更回调
|
|
||||||
//break
|
|
||||||
//case fnpsapi.NoServiceStatus: // 城市屏蔽区域调整回调通知
|
|
||||||
//break
|
|
||||||
//case fnpsapi.OrderStatus: // 订单状态回调
|
|
||||||
//callbackResponse = fn.OnWaybillMsg(msg)
|
|
||||||
//break
|
|
||||||
//default:
|
|
||||||
//break
|
|
||||||
//}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user