65 lines
2.1 KiB
Go
65 lines
2.1 KiB
Go
package productctrl
|
|
|
|
import (
|
|
"91porn-server/common"
|
|
"91porn-server/common/stderr"
|
|
"91porn-server/models/v/export_task_mod"
|
|
"91porn-server/models/v/prdcthsomod"
|
|
"91porn-server/web/service/productser"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// ProductLog doc
|
|
// @Summary 会员卡购买记录
|
|
// @Description 会员卡购买记录
|
|
// @Tags product
|
|
// @Accept mpfd,json
|
|
// @Produce json,html
|
|
// @Param q query prdcthsomod.ProductHistoryQueryReq false "请求参数"
|
|
// @Success 200 object prdcthsomod.ProductHistoryQueryResp "成功"
|
|
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
|
// @Router /api/web/admin/business/product/order [get]
|
|
func ProductLog(ctx *gin.Context) {
|
|
arg := &prdcthsomod.ProductHistoryQueryReq{}
|
|
if err := ctx.ShouldBind(arg); err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
resp, err := productser.GetBuyHistoryList(arg)
|
|
if err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
|
|
return
|
|
}
|
|
common.ServeJSON(ctx, stderr.Success, resp)
|
|
}
|
|
|
|
// ProductLogExport doc
|
|
// @Summary 会员卡购买记录导出
|
|
// @Description 会员卡购买记录
|
|
// @Tags product
|
|
// @Accept mpfd,json
|
|
// @Produce json,html
|
|
// @Param q query prdcthsomod.ProductHistoryQueryReq false "请求参数"
|
|
// @Success 200 {string} string "{"msg": "操作成功"}"
|
|
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
|
// @Router /api/web/admin/business/product/order/export [post]
|
|
func ProductLogExport(ctx *gin.Context) {
|
|
manager, err := common.GetAdminAct(ctx)
|
|
if err != nil {
|
|
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
|
return
|
|
}
|
|
arg := &prdcthsomod.ProductHistoryQueryReq{}
|
|
if err := ctx.ShouldBind(arg); err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
err = export_task_mod.CreateTask(export_task_mod.ExportProductHistoryTask, manager, arg)
|
|
if err != nil {
|
|
common.ServeJSON(ctx, stderr.ErrExportFileFail, err)
|
|
return
|
|
}
|
|
common.ServeJSON(ctx, stderr.Success, "success")
|
|
}
|