- 将GetStoreOrderCountInfo的实现换成GetStoreOrderCountInfo2一致的(准备之后去掉GetStoreOrderCountInfo2)
- 添加GetStoreAfsOrderCountInfo
This commit is contained in:
@@ -37,33 +37,8 @@ type StoresOrderSaleInfo struct {
|
||||
ActualPayPrice int64 `json:"actualPayPrice"`
|
||||
}
|
||||
|
||||
//此函数会被GetStoreOrderCountInfo2取代
|
||||
func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID string, lastHours int) (countInfo []*model.GoodsOrderCountInfo, err error) {
|
||||
globals.SugarLogger.Debugf("GetStoreOrderCountInfo storeID:%s", storeID)
|
||||
if lastHours > maxLastHours {
|
||||
lastHours = maxLastHours
|
||||
} else if lastHours == 0 {
|
||||
lastHours = defLastHours
|
||||
}
|
||||
|
||||
db := orm.NewOrm()
|
||||
_, err = db.Raw(`
|
||||
SELECT t1.status, COUNT(*) count
|
||||
FROM goods_order t1
|
||||
WHERE t1.vendor_id <> 2 AND IF(t1.vendor_id = ?, t1.store_id, IF(t1.jx_store_id != 0, t1.jx_store_id, t1.store_id) ) = ?
|
||||
AND t1.order_created_at >= ? AND t1.lock_status = ?
|
||||
GROUP BY 1
|
||||
ORDER BY 1
|
||||
`, model.VendorIDWSC, storeID, time.Now().Add(-time.Duration(lastHours)*time.Hour), model.OrderStatusUnknown).QueryRows(&countInfo)
|
||||
if err == nil {
|
||||
return countInfo, nil
|
||||
}
|
||||
globals.SugarLogger.Infof("GetStoreOrderCountInfo storeID:%s failed with error:%v", storeID, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (c *OrderManager) GetStoreOrderCountInfo2(ctx *jxcontext.Context, storeID, lastHours int) (countInfo []*model.GoodsOrderCountInfo2, err error) {
|
||||
globals.SugarLogger.Debugf("GetStoreOrderCountInfo2 storeID:%d", storeID)
|
||||
func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID, lastHours int) (countInfo []*model.GoodsOrderCountInfo, err error) {
|
||||
globals.SugarLogger.Debugf("GetStoreOrderCountInfo storeID:%d", storeID)
|
||||
if lastHours > maxLastHours {
|
||||
lastHours = maxLastHours
|
||||
} else if lastHours == 0 {
|
||||
@@ -82,7 +57,7 @@ func (c *OrderManager) GetStoreOrderCountInfo2(ctx *jxcontext.Context, storeID,
|
||||
if err == nil {
|
||||
return countInfo, nil
|
||||
}
|
||||
globals.SugarLogger.Infof("GetStoreOrderCountInfo2 storeID:%d failed with error:%v", storeID, err)
|
||||
globals.SugarLogger.Infof("GetStoreOrderCountInfo storeID:%d failed with error:%v", storeID, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -770,3 +745,27 @@ func (c *OrderManager) GetAfsOrderSkuInfo(ctx *jxcontext.Context, afsOrderID str
|
||||
err = dao.GetRows(dao.GetDB(), &skus, sql, sqlParams...)
|
||||
return skus, err
|
||||
}
|
||||
|
||||
func (c *OrderManager) GetStoreAfsOrderCountInfo(ctx *jxcontext.Context, storeID, lastHours int) (countInfo []*model.GoodsOrderCountInfo, err error) {
|
||||
globals.SugarLogger.Debugf("GetStoreAfsOrderCountInfo storeID:%d", storeID)
|
||||
if lastHours > maxLastHours {
|
||||
lastHours = maxLastHours
|
||||
} else if lastHours == 0 {
|
||||
lastHours = defLastHours
|
||||
}
|
||||
|
||||
db := dao.GetDB()
|
||||
err = dao.GetRows(db, &countInfo, `
|
||||
SELECT 0 lock_status, t1.status, COUNT(*) count
|
||||
FROM afs_order t1
|
||||
WHERE t1.vendor_id <> 2 AND IF(t1.vendor_id = ?, t1.store_id, IF(t1.jx_store_id != 0, t1.jx_store_id, t1.store_id) ) = ?
|
||||
AND t1.afs_created_at >= ?
|
||||
GROUP BY 1,2
|
||||
ORDER BY 1,2
|
||||
`, model.VendorIDWSC, storeID, time.Now().Add(-time.Duration(lastHours)*time.Hour))
|
||||
if err == nil {
|
||||
return countInfo, nil
|
||||
}
|
||||
globals.SugarLogger.Infof("GetStoreAfsOrderCountInfo storeID:%d failed with error:%v", storeID, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -30,11 +30,6 @@ type OrderSkuExt struct {
|
||||
}
|
||||
|
||||
type GoodsOrderCountInfo struct {
|
||||
Status int `json:"status"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type GoodsOrderCountInfo2 struct {
|
||||
LockStatus int `json:"lockStatus"`
|
||||
Status int `json:"status"`
|
||||
Count int `json:"count"`
|
||||
|
||||
@@ -155,7 +155,7 @@ func (c *OrderController) CancelWaybill() {
|
||||
// @Title 得到门店订单信息
|
||||
// @Description 得到门店订单信息
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeID query string true "京西门店ID"
|
||||
// @Param storeID query int true "京西门店ID"
|
||||
// @Param lastHours query int false "最近多少小时的信息(缺省为两天)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
@@ -177,7 +177,7 @@ func (c *OrderController) GetStoreOrderCountInfo() {
|
||||
// @router /GetStoreOrderCountInfo2 [get]
|
||||
func (c *OrderController) GetStoreOrderCountInfo2() {
|
||||
c.callGetStoreOrderCountInfo2(func(params *tOrderGetStoreOrderCountInfo2Params) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = orderman.FixedOrderManager.GetStoreOrderCountInfo2(params.Ctx, params.StoreID, params.LastHours)
|
||||
retVal, err = orderman.FixedOrderManager.GetStoreOrderCountInfo(params.Ctx, params.StoreID, params.LastHours)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
@@ -646,3 +646,18 @@ func (c *OrderController) ConfirmReceivedReturnGoods() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 得到门店售后单信息
|
||||
// @Description 得到门店售后单信息
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeID query int true "京西门店ID"
|
||||
// @Param lastHours query int false "最近多少小时的信息(缺省为两天)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetStoreAfsOrderCountInfo [get]
|
||||
func (c *OrderController) GetStoreAfsOrderCountInfo() {
|
||||
c.callGetStoreAfsOrderCountInfo(func(params *tOrderGetStoreAfsOrderCountInfoParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = orderman.FixedOrderManager.GetStoreAfsOrderCountInfo(params.Ctx, params.StoreID, params.LastHours)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -700,6 +700,15 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetStoreAfsOrderCountInfo",
|
||||
Router: `/GetStoreAfsOrderCountInfo`,
|
||||
AllowHTTPMethods: []string{"get"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetStoreOrderCountInfo",
|
||||
|
||||
Reference in New Issue
Block a user