1213
This commit is contained in:
@@ -501,7 +501,8 @@ type StoreAcctOrder struct {
|
||||
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
||||
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||
StoreID int `orm:"column(store_id)" json:"storeID"` // 外部系统里记录的 jxstoreid
|
||||
ActualPayPrice int `json:"actualPayPrice"` // 单位为分 顾客实际支付
|
||||
BrandID int `orm:"column(brand_id)" json:"brandID"`
|
||||
ActualPayPrice int `json:"actualPayPrice"` // 单位为分 顾客实际支付
|
||||
UserID string `orm:"column(user_id);size(48);index" json:"userID"`
|
||||
OrderType int `json:"orderType"`
|
||||
Status int `json:"status"` // 参见OrderStatus*相关的常量定义
|
||||
|
||||
@@ -915,6 +915,7 @@ type StoreAcct struct {
|
||||
|
||||
StoreID int `orm:"column(store_id)" json:"storeID"` //门店ID
|
||||
AccountBalance int `json:"accountBalance"` //账户余额
|
||||
BrandID int `orm:"column(brand_id)" json:"brandID"`
|
||||
}
|
||||
|
||||
func (v *StoreAcct) TableUnique() [][]string {
|
||||
|
||||
@@ -580,14 +580,11 @@ func OnPayFinished(orderPay *model.OrderPay) (err error) {
|
||||
storeOrder := &model.StoreAcctOrder{
|
||||
VendorOrderID: orderPay.VendorOrderID,
|
||||
}
|
||||
Storebrand := &model.BrandOrder{
|
||||
VendorOrderID: orderPay.VendorOrderID,
|
||||
}
|
||||
if err = dao.GetEntity(dao.GetDB(), storeOrder, "VendorOrderID"); err == nil && storeOrder.ID != 0 {
|
||||
storeOrder.OrderFinishedAt = time.Now()
|
||||
storeOrder.Status = model.OrderStatusFinished
|
||||
if _, err = dao.UpdateEntity(dao.GetDB(), storeOrder, "OrderFinishedAt", "Status"); err == nil {
|
||||
partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, Storebrand.BrandID, storeOrder.ActualPayPrice, 1, 1, "")
|
||||
partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, storeOrder.BrandID, storeOrder.ActualPayPrice, 1, 1, "")
|
||||
}
|
||||
}
|
||||
case model.PayTypeTL_BrandBillCharge:
|
||||
@@ -2488,11 +2485,12 @@ func RefreshCouponsStatus(ctx *jxcontext.Context) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func CreateStoreAcctOrder(ctx *jxcontext.Context, orderType, storeID, price int, goodsVendorOrderID string) (vendorOrderID string, err error) {
|
||||
func CreateStoreAcctOrder(ctx *jxcontext.Context, orderType, storeID, price int, goodsVendorOrderID string, brandID int) (vendorOrderID string, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
storeAcct = &model.StoreAcct{
|
||||
StoreID: storeID,
|
||||
BrandID: brandID,
|
||||
}
|
||||
)
|
||||
if err = dao.GetEntity(db, storeAcct, "StoreID"); err != nil && dao.IsNoRowsError(err) {
|
||||
@@ -2505,6 +2503,7 @@ func CreateStoreAcctOrder(ctx *jxcontext.Context, orderType, storeID, price int,
|
||||
VendorOrderID: utils.Int64ToStr(jxutils.GenOrderNo()),
|
||||
UserID: ctx.GetUserID(),
|
||||
StoreID: storeID,
|
||||
BrandID: brandID,
|
||||
OrderType: orderType,
|
||||
Status: model.OrderStatusWait4Pay,
|
||||
ActualPayPrice: price,
|
||||
|
||||
@@ -383,7 +383,7 @@ func (c *JxOrderController) ReceiveCoupons() {
|
||||
// @router /CreateStoreAcctOrder [post]
|
||||
func (c *JxOrderController) CreateStoreAcctOrder() {
|
||||
c.callCreateStoreAcctOrder(func(params *tJxorderCreateStoreAcctOrderParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = localjx.CreateStoreAcctOrder(params.Ctx, params.OrderType, params.StoreID, params.Price, params.VendorOrderID)
|
||||
retVal, err = localjx.CreateStoreAcctOrder(params.Ctx, params.OrderType, params.StoreID, params.Price, params.VendorOrderID, params.brandID)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user