根据时间,日期,比例返回要加入购物车的商品
This commit is contained in:
@@ -1346,9 +1346,32 @@ func GetAfsOrdersByPage(db *DaoDB, vendorOrderID, afsOrderID, userID string, fro
|
||||
return afsOrderList, totalCount, err
|
||||
}
|
||||
|
||||
func GetSupplySupportStoreSkus(db *DaoDB, fromDate, toDate time.Time, fromStoreID, storeID int) (storeSkuBind []*model.StoreSkuBind, err error) {
|
||||
// sql := `
|
||||
|
||||
// `
|
||||
return storeSkuBind, err
|
||||
func GetSupplySupportStoreSkus(db *DaoDB, fromDate, toDate time.Time, fromStoreID, storeID int, percentage float64) (orderSkus []*model.OrderSku, err error) {
|
||||
sql := `
|
||||
SELECT c.sku_id,CEIL(c.count) count,CEIL(c.count) * d.jx_price sale_price
|
||||
FROM
|
||||
(
|
||||
SELECT a.sku_id,SUM(a.count * ? ) count FROM order_sku a
|
||||
JOIN goods_order b ON b.vendor_order_id = a.vendor_order_id AND a.vendor_id = b.vendor_id
|
||||
WHERE b.order_created_at > ?
|
||||
AND b.order_created_at < ?
|
||||
AND a.sku_id <> ?
|
||||
AND IF(b.store_id = 0,b.jx_store_id,b.store_id) = ?
|
||||
GROUP BY 1
|
||||
)c
|
||||
JOIN store_sku_bind d ON d.store_id = ? AND d.sku_id = c.sku_id AND d.deleted_at = ?
|
||||
ORDER BY c.count desc
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
percentage,
|
||||
fromDate,
|
||||
toDate,
|
||||
6039481, //葱姜蒜
|
||||
fromStoreID,
|
||||
storeID, utils.DefaultTimeValue,
|
||||
}
|
||||
if err = GetRows(db, &orderSkus, sql, sqlParams); err == nil {
|
||||
return orderSkus, err
|
||||
}
|
||||
return orderSkus, err
|
||||
}
|
||||
|
||||
@@ -1788,10 +1788,10 @@ func buildJxOrderInfo(order *model.GoodsOrder, orderSkus []*model.OrderSku) (jxO
|
||||
return jxOrder
|
||||
}
|
||||
|
||||
func GetSupplySupportStoreSkus(ctx *jxcontext.Context, fromDate, toDate string, fromStoreID, storeID int) (storeSkuBinds []*model.StoreSkuBind, err error) {
|
||||
func GetSupplySupportStoreSkus(ctx *jxcontext.Context, fromDate, toDate string, fromStoreID, storeID int, percentage string) (orderSkus []*model.OrderSku, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
storeSkuBinds, err = dao.GetSupplySupportStoreSkus(db, utils.Str2Time(fromDate), utils.Str2Time(toDate), fromStoreID, storeID)
|
||||
return storeSkuBinds, err
|
||||
orderSkus, err = dao.GetSupplySupportStoreSkus(db, utils.Str2Time(fromDate), utils.Str2Time(toDate), fromStoreID, storeID, utils.Str2Float64(percentage))
|
||||
return orderSkus, err
|
||||
}
|
||||
|
||||
@@ -230,12 +230,13 @@ func (c *JxOrderController) SendFailedMatterOrder() {
|
||||
// @Param toDate query string false "结束日期(包含),格式(2006-01-02),如果订单号为空此项必须要求"
|
||||
// @Param fromStoreID query int false "进货门店ID"
|
||||
// @Param storeID query int false "货源门店ID"
|
||||
// @Param percentage query string false "销量比例,1,1.05,1.1"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetSupplySupportStoreSkus [get]
|
||||
func (c *JxOrderController) GetSupplySupportStoreSkus() {
|
||||
c.callGetSupplySupportStoreSkus(func(params *tJxorderGetSupplySupportStoreSkusParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = localjx.GetSupplySupportStoreSkus(params.Ctx, params.FromDate, params.ToDate, params.FromStoreID, params.StoreID)
|
||||
retVal, err = localjx.GetSupplySupportStoreSkus(params.Ctx, params.FromDate, params.ToDate, params.FromStoreID, params.StoreID, params.Percentage)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user