自动关注
This commit is contained in:
@@ -1052,7 +1052,7 @@ func GetWayBillByOrderID(db *DaoDB, orderStatus, vendorID, waybillVendorID int,
|
||||
return wayBillList, err
|
||||
}
|
||||
|
||||
func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs []int, vendorOrderID string, fromTime, toTime time.Time, status, stype, offset, pageSize int) (orderSupplementFee []*model.OrderSupplementFee, totalCount int, err error) {
|
||||
func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs []int, vendorOrderID string, fromTime, toTime time.Time, status, stype, IsReverse, offset, pageSize int) (orderSupplementFee []*model.OrderSupplementFee, totalCount int, err error) {
|
||||
sql := `
|
||||
SELECT SQL_CALC_FOUND_ROWS *
|
||||
FROM order_supplement_fee
|
||||
@@ -1075,7 +1075,7 @@ func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs []int, vendorOrderID stri
|
||||
sqlParams = append(sqlParams, storIDs)
|
||||
}
|
||||
if len(vendorIDs) > 0 {
|
||||
sql += " AND store_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")"
|
||||
sql += " AND vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")"
|
||||
sqlParams = append(sqlParams, vendorIDs)
|
||||
}
|
||||
if vendorOrderID != "" {
|
||||
@@ -1090,6 +1090,11 @@ func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs []int, vendorOrderID stri
|
||||
sql += " AND type = ?"
|
||||
sqlParams = append(sqlParams, stype)
|
||||
}
|
||||
if IsReverse == -1 {
|
||||
sql += " AND link_id = 0"
|
||||
} else if IsReverse == 1 {
|
||||
sql += " AND link_id <> 0"
|
||||
}
|
||||
sql += `
|
||||
LIMIT ? OFFSET ?`
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
|
||||
@@ -1188,7 +1188,7 @@ func RefershStoreSkusMidPrice(db *DaoDB, storeIDs []int) (count int64, err error
|
||||
UPDATE store_sku_bind a
|
||||
JOIN store d ON d.id = a.store_id
|
||||
JOIN price_refer_snapshot b ON a.sku_id = b.sku_id AND b.snapshot_at = ? AND d.city_code = b.city_code
|
||||
SET a.price = (b.mid_price*IF(d.pay_percentage=0,100,d.pay_percentage))/100
|
||||
SET a.unit_price = (b.mid_unit_price*IF(d.pay_percentage < 50,70,d.pay_percentage))/100
|
||||
WHERE 1=1
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
@@ -1199,7 +1199,7 @@ func RefershStoreSkusMidPrice(db *DaoDB, storeIDs []int) (count int64, err error
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
}
|
||||
sql += `
|
||||
AND (a.price/IF(d.pay_percentage=0,100,d.pay_percentage))*100 > b.mid_price
|
||||
AND (a.price/IF(d.pay_percentage < 50,70,d.pay_percentage))*100 > b.mid_price
|
||||
AND a.deleted_at = ?
|
||||
AND a.status = ?
|
||||
`
|
||||
@@ -1370,6 +1370,7 @@ func GetStoreSkuBindByNameID(db *DaoDB, storeID, nameID, status int) (storeSkuBi
|
||||
func GetPriceReferUnitPrice(db *DaoDB, cityCode int, nameID int, snapDate time.Time) (result *PriceReferSnapshotExt, err error) {
|
||||
var (
|
||||
pRefer []*PriceReferSnapshotExt
|
||||
priceRefer = &PriceReferSnapshotExt{}
|
||||
minUnitPrice int
|
||||
maxUnitPrice int
|
||||
midUnitPrice int
|
||||
@@ -1426,10 +1427,35 @@ func GetPriceReferUnitPrice(db *DaoDB, cityCode int, nameID int, snapDate time.T
|
||||
midUnitPrice += midPrice
|
||||
avgUnitPrice += avgPrice
|
||||
}
|
||||
result.MinUnitPrice = minUnitPrice / len(pRefer)
|
||||
result.MaxUnitPrice = maxUnitPrice / len(pRefer)
|
||||
result.AvgUnitPrice = avgUnitPrice / len(pRefer)
|
||||
result.MidUnitPrice = midUnitPrice / len(pRefer)
|
||||
priceRefer.MinUnitPrice = minUnitPrice / len(pRefer)
|
||||
priceRefer.MaxUnitPrice = maxUnitPrice / len(pRefer)
|
||||
priceRefer.AvgUnitPrice = avgUnitPrice / len(pRefer)
|
||||
priceRefer.MidUnitPrice = midUnitPrice / len(pRefer)
|
||||
}
|
||||
return result, err
|
||||
return priceRefer, err
|
||||
}
|
||||
|
||||
func GetStoreSkusAndSkuName(db *DaoDB, storeIDs, skuIDs []int) (storeSkuNameExt []*StoreSkuNameExt, err error) {
|
||||
sql := `
|
||||
SELECT a.*,c.id
|
||||
FROM store_sku_bind a
|
||||
JOIN sku b ON b.id = a.sku_id AND b.deleted_at = ?
|
||||
JOIN sku_name c ON c.id = b.name_id AND c.deleted_at = ?
|
||||
WHERE a.deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
utils.DefaultTimeValue,
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if len(storeIDs) > 0 {
|
||||
sql += " AND a.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
}
|
||||
if len(skuIDs) > 0 {
|
||||
sql += " AND a.sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")"
|
||||
sqlParams = append(sqlParams, skuIDs)
|
||||
}
|
||||
err = GetRows(db, &storeSkuNameExt, sql, sqlParams...)
|
||||
return storeSkuNameExt, err
|
||||
}
|
||||
|
||||
35
business/model/event.go
Normal file
35
business/model/event.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type OperateEvent struct {
|
||||
ID int64 `orm:"column(id)" json:"id"`
|
||||
CreatedAt time.Time `orm:"auto_now_add;type(datetime)" json:"createdAt"`
|
||||
LastOperator string `orm:"size(32)" json:"lastOperator"` // 最后操作员
|
||||
AccessUUID string `orm:"column(access_uuid)" json:"accessUUID"`
|
||||
UserID string `orm:"column(user_id)" json:"userID"`
|
||||
APIFunction string `orm:"column(api_function)" json:"apiFunction"`
|
||||
}
|
||||
|
||||
func (v *OperateEvent) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"AccessUUID", "UserID"},
|
||||
}
|
||||
}
|
||||
|
||||
type OperateEventDetail struct {
|
||||
ID int64 `orm:"column(id)" json:"id"`
|
||||
OperateType int `json:"operateType"` // 1为修改,2为新增,4为删除
|
||||
ThingID int `orm:"column(thing_id)" json:"thingID"`
|
||||
ThingType int `json:"thingType"` //各字段类型
|
||||
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||||
AccessUUID string `orm:"column(access_uuid)" json:"accessUUID"`
|
||||
BeforeData string `orm:"size(32)" json:"beforeData"`
|
||||
AfterData string `orm:"size(32)" json:"afterData"`
|
||||
}
|
||||
|
||||
func (v *OperateEventDetail) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
[]string{"AccessUUID", "ThingID", "StoreID"},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user