From 84a2921cfaa444ded985de2dc6e1895d379977b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 30 Dec 2021 15:54:43 +0800 Subject: [PATCH] 123 --- business/jxstore/cms/store.go | 3 +++ business/model/dao/store.go | 13 +++++++++++++ business/model/order.go | 3 +-- business/model/store.go | 1 + business/partner/purchase/jx/localjx/order.go | 7 +++---- controllers/jx_order2.go | 2 +- 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 8586fc310..6269034f9 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5472,3 +5472,6 @@ func UpdateStoreTemplate(ctx *jxcontext.Context, storeID int, content, sound str _, err = dao.UpdateEntity(db, store, "PrinterTemplate", "PrinterSound") return err } +func GetStoreBrandID(ctx *jxcontext.Context, storeID int) (brandID int, err error) { + return dao.GetStoreBrandID(dao.GetDB(), storeID) +} diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 27119cd39..4d38ba836 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -68,6 +68,9 @@ type StoreDetail struct { BrandIsOpen int `json:"brandIsOpen"` BrandIsPrint int `json:"brandIsPrint"` } +type BrandID struct { + BrandID int `orm:"column(brand_id)" json:"brandID"` +} // 带快递门店信息的 type StoreDetail2 struct { @@ -1486,3 +1489,13 @@ func InsertBrandCategories(db *DaoDB, userName string, brandID int) (err error) _, err = ExecuteSQL(db, sql, sqlParams) return err } +func GetStoreBrandID(db *DaoDB, storeID int) (brandID int, err error) { + sql := ` + SELECT * + FROM store + WHERE store_id = ? + ` + sqlparams := []interface{}{utils.DefaultTimeValue, storeID} + err = GetRows(db, &brandID, sql, sqlparams) + return brandID, err +} diff --git a/business/model/order.go b/business/model/order.go index e18a9424c..77b737b9c 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -501,8 +501,7 @@ 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 - BrandID int `orm:"column(brand_id)" json:"brandID"` - ActualPayPrice int `json:"actualPayPrice"` // 单位为分 顾客实际支付 + ActualPayPrice int `json:"actualPayPrice"` // 单位为分 顾客实际支付 UserID string `orm:"column(user_id);size(48);index" json:"userID"` OrderType int `json:"orderType"` Status int `json:"status"` // 参见OrderStatus*相关的常量定义 diff --git a/business/model/store.go b/business/model/store.go index 9b4411590..2cce628d6 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -815,6 +815,7 @@ func (*StoreAudit) TableIndex() [][]string { type Brand struct { ModelIDCULD + ID int `json:"Brand_id"` Name string `orm:"size(255)" json:"name"` //品牌名 Logo string `orm:"size(255)" json:"logo"` //品牌logo BrandType int `json:"brandType"` //品牌类型 diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index 76e28f69d..f936251df 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -584,7 +584,8 @@ 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 { - partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, storeOrder.BrandID, storeOrder.ActualPayPrice, 1, 1, "") + brandID, _ := dao.GetStoreBrandID(dao.GetDB(), storeOrder.StoreID) + partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, brandID, storeOrder.ActualPayPrice, 1, 1, "") } } case model.PayTypeTL_BrandBillCharge: @@ -2485,12 +2486,11 @@ func RefreshCouponsStatus(ctx *jxcontext.Context) (err error) { return err } -func CreateStoreAcctOrder(ctx *jxcontext.Context, orderType, storeID, price int, goodsVendorOrderID string, brandID int) (vendorOrderID string, err error) { +func CreateStoreAcctOrder(ctx *jxcontext.Context, orderType, storeID, price int, goodsVendorOrderID string) (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) { @@ -2503,7 +2503,6 @@ 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, diff --git a/controllers/jx_order2.go b/controllers/jx_order2.go index 2b0ddb7a2..f1c27be8b 100644 --- a/controllers/jx_order2.go +++ b/controllers/jx_order2.go @@ -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, params.brandID) + retVal, err = localjx.CreateStoreAcctOrder(params.Ctx, params.OrderType, params.StoreID, params.Price, params.VendorOrderID) return retVal, "", err }) }