Files
jx-callback/controllers/jx_report.go
2020-01-02 15:30:36 +08:00

99 lines
4.6 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package controllers
import (
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/jxstore/report"
"git.rosy.net.cn/jx-callback/business/jxutils"
"github.com/astaxie/beego"
)
// 统计相关API
type ReportController struct {
beego.Controller
}
// @Title 查询订单统计信息
// @Description 根据门店idlist和时间范围查询
// @Param token header string true "认证token"
// @Param storeIDs formData string true "京西门店ID列表[1,2,3]"
// @Param fromDate formData string true "开始日期包含格式2006-01-02 00:00:00)"
// @Param toDate formData string true "结束日期包含格式2006-01-02 00:00:00)"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /StatisticsReportForOrders [post]
func (c *ReportController) StatisticsReportForOrders() {
c.callStatisticsReportForOrders(func(params *tReportStatisticsReportForOrdersParams) (retVal interface{}, errCode string, err error) {
var storeIDList []int
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
retVal, err = report.GetStatisticsReportForOrders(params.Ctx, storeIDList, params.FromDate, params.ToDate)
}
return retVal, "", err
})
}
// @Title 查询售后单统计信息
// @Description 根据门店idlist和时间范围查询
// @Param token header string true "认证token"
// @Param storeIDs formData string true "京西门店ID列表[1,2,3]"
// @Param fromDate formData string true "开始日期包含格式2006-01-02 00:00:00)"
// @Param toDate formData string true "结束日期包含格式2006-01-02 00:00:00)"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /StatisticsReportForAfsOrders [post]
func (c *ReportController) StatisticsReportForAfsOrders() {
c.callStatisticsReportForAfsOrders(func(params *tReportStatisticsReportForAfsOrdersParams) (retVal interface{}, errCode string, err error) {
var storeIDList []int
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDList); err == nil {
retVal, err = report.GetStatisticsReportForAfsOrders(params.Ctx, storeIDList, params.FromDate, params.ToDate)
}
return retVal, "", err
})
}
// @Title 查询京西门店商品价格统计相关信息
// @Description 查询京西门店商品价格统计相关信息
// @Param token header string true "认证token"
// @Param cityCodes formData string true "城市ID列表[1,2,3]"
// @Param skuIDs formData string false "skuID列表[1,2,3]"
// @Param snapDate formData string true "某天的参考价格 格式2006-01-02,默认前一天"
// @Param offset formData int false "门店列表起始序号以0开始缺省为0"
// @Param pageSize formData int false "门店列表页大小缺省为50-1表示全部"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /StatisticsReportForStoreSkusPrice [post]
func (c *ReportController) StatisticsReportForStoreSkusPrice() {
c.callStatisticsReportForStoreSkusPrice(func(params *tReportStatisticsReportForStoreSkusPriceParams) (retVal interface{}, errCode string, err error) {
var cityCodeList, skuIDList []int
if err = jxutils.Strings2Objs(params.CityCodes, &cityCodeList, params.SkuIDs, &skuIDList); err == nil {
retVal, err = report.StatisticsReportForStoreSkusPrice(params.Ctx, cityCodeList, skuIDList, params.SnapDate, params.Offset, params.PageSize)
}
return retVal, "", err
})
}
// @Title 生成价格参考数据
// @Description 生成价格参考数据
// @Param token header string true "认证token"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /PriceRefer [post]
func (c *ReportController) PriceRefer() {
c.callPriceRefer(func(params *tReportPriceReferParams) (retVal interface{}, errCode string, err error) {
report.BeginSavePriceRefer(params.Ctx, nil, nil, true, true)
return retVal, "", err
})
}
// @Title 自动关注商品(针对后加的商品规格未关注)
// @Description 自动关注商品(针对后加的商品规格未关注)
// @Param token header string true "认证token"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /AutoFocusStoreSkus [post]
func (c *ReportController) AutoFocusStoreSkus() {
c.callAutoFocusStoreSkus(func(params *tReportAutoFocusStoreSkusParams) (retVal interface{}, errCode string, err error) {
cms.AutoFocusStoreSkusWithoutFocus(params.Ctx, nil, false)
return retVal, "", err
})
}