1
This commit is contained in:
@@ -66,16 +66,16 @@ func CreateWayOrder(ctx *jxcontext.Context, param *model.MakeOrderParamReq, user
|
||||
}
|
||||
|
||||
// 创建三方订单
|
||||
otherId, err := createOtherOrder(param)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
//otherId, err := createOtherOrder(param)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
|
||||
// 第三方数据创建成功,则创建本地数据
|
||||
vendorOrder := &model.UserVendorOrder{
|
||||
UserId: userId,
|
||||
LocalWayBill: utils.Int64ToStr(time.Now().Unix()) + userId[:4], // 当前时间秒数加用户ID前四位
|
||||
OtherWayBill: otherId,
|
||||
OtherWayBill: utils.Int64ToStr(time.Now().Unix()) + userId[:4],
|
||||
PromiseTimeType: param.PromiseTimeType,
|
||||
DeliveryType: param.DeliveryType,
|
||||
Goods: param.Goods,
|
||||
@@ -99,12 +99,54 @@ func CreateWayOrder(ctx *jxcontext.Context, param *model.MakeOrderParamReq, user
|
||||
Bulk: param.Bulk,
|
||||
Increment: param.Increment,
|
||||
ChannelType: param.ChannelType,
|
||||
OrderStatus: model.YES, // 创建
|
||||
OrderStatus: 2, // 创建待支付
|
||||
Img: param.Images,
|
||||
IsForward: model.YES,
|
||||
IsForward: model.YES, //
|
||||
}
|
||||
|
||||
// 事务创建待支付运单,和待支付order
|
||||
db := dao.GetDB()
|
||||
tdb, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, tdb)
|
||||
panic(r)
|
||||
}
|
||||
}()
|
||||
|
||||
// 添加运单表
|
||||
dao.WrapAddIDCULEntity(vendorOrder, ctx.GetUserName())
|
||||
return dao.CreateEntity(dao.GetDB(), vendorOrder)
|
||||
if err := dao.CreateEntity(db, vendorOrder); err != nil {
|
||||
dao.Rollback(db, tdb)
|
||||
return err
|
||||
}
|
||||
// 添加待支付订单表
|
||||
orderPayStatus := &model.Order{
|
||||
OrderID: vendorOrder.LocalWayBill,
|
||||
UserID: vendorOrder.UserId,
|
||||
Type: model.OrderTypePay,
|
||||
OrderType: model.PayType4Express,
|
||||
Way: "",
|
||||
Status: model.OrderTypeCash, // 待支付状态
|
||||
PayPrice: int(vendorOrder.ChannelFee * 100),
|
||||
TransactionID: "",
|
||||
PayFinishedAt: time.Time{},
|
||||
PrepayID: "",
|
||||
OriginalData: "",
|
||||
Comment: "",
|
||||
Lng: 0,
|
||||
Lat: 0,
|
||||
CityCode: 0,
|
||||
DistrictCode: 0,
|
||||
Address: "",
|
||||
}
|
||||
if err := dao.CreateEntity(db, orderPayStatus); err != nil {
|
||||
dao.Rollback(db, tdb)
|
||||
return err
|
||||
}
|
||||
dao.Commit(db, tdb)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CancelWayOrder 取消运单 todo
|
||||
@@ -175,3 +217,9 @@ func QueryUserOrderList(userId string, expressType, orderStatus int, pageNum, pa
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// CreateOrder2QBiDa 订单回调成功,且为运费支付时使用该接口
|
||||
func CreateOrder2QBiDa(orderId string) {
|
||||
// 加载订单
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user