You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
2.8 KiB
113 lines
2.8 KiB
8 months ago
|
package business
|
||
|
|
||
|
import (
|
||
|
"base/app/common"
|
||
|
"base/app/lib/bean"
|
||
|
"base/app/logic/manage/business"
|
||
|
"base/app/logic/manage/user"
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
type Store struct {
|
||
|
}
|
||
|
|
||
|
type argsStoreLists struct {
|
||
|
business.StoreSearch
|
||
|
bean.Page
|
||
|
}
|
||
|
|
||
|
// Lists @Title 门店列表
|
||
|
func (s *Store) Lists(c *gin.Context) {
|
||
|
args := argsStoreLists{}
|
||
|
if err := c.ShouldBind(&args); err != nil {
|
||
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
||
|
return
|
||
|
}
|
||
|
lists, total := business.StoreLogic.Lists(args.StoreSearch, args.Page)
|
||
|
bean.Response.ResultSuc(c, "操作成功", bean.ResultLists{
|
||
|
List: lists,
|
||
|
Total: total,
|
||
|
})
|
||
|
}
|
||
|
|
||
|
type argsStoreAuditLists struct {
|
||
|
business.StoreAuditSearch
|
||
|
bean.Page
|
||
|
}
|
||
|
|
||
|
// AuditLists @Title 审核列表
|
||
|
func (s *Store) AuditLists(c *gin.Context) {
|
||
|
args := argsStoreAuditLists{}
|
||
|
if err := c.ShouldBind(&args); err != nil {
|
||
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
||
|
return
|
||
|
}
|
||
|
lists, total := business.StoreLogic.AuditLists(args.StoreAuditSearch, args.Page)
|
||
|
bean.Response.ResultSuc(c, "操作成功", bean.ResultLists{
|
||
|
List: lists,
|
||
|
Total: total,
|
||
|
})
|
||
|
}
|
||
|
|
||
|
type argsStoreInfo struct {
|
||
|
StoreId uint `binding:"required" label:"门店id"`
|
||
|
}
|
||
|
|
||
|
// Info @Title 详情
|
||
|
func (s *Store) Info(c *gin.Context) {
|
||
|
args := argsStoreInfo{}
|
||
|
if err := c.ShouldBind(&args); err != nil {
|
||
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
||
|
return
|
||
|
}
|
||
|
info, err := business.StoreLogic.Info(args.StoreId)
|
||
|
if err != nil {
|
||
|
bean.Response.ResultFail(c, 10002, err.Error())
|
||
|
return
|
||
|
}
|
||
|
bean.Response.ResultSuc(c, "操作成功", info)
|
||
|
}
|
||
|
|
||
|
type argsStoreAdopt struct {
|
||
|
StoreId uint `binding:"required" label:"门店id"`
|
||
|
}
|
||
|
|
||
|
// Adopt @Title 审核通过
|
||
|
func (s *Store) Adopt(c *gin.Context) {
|
||
|
args := argsStoreAdopt{}
|
||
|
if err := c.ShouldBind(&args); err != nil {
|
||
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
||
|
return
|
||
|
}
|
||
|
if err := business.StoreLogic.Adopt(user.ManageLogic.GetManageId(c), args.StoreId); err != nil {
|
||
|
bean.Response.ResultFail(c, 10002, err.Error())
|
||
|
return
|
||
|
}
|
||
|
bean.Response.ResultSuc(c, "操作成功", nil)
|
||
|
}
|
||
|
|
||
|
type argsStoreReject struct {
|
||
|
StoreId uint `binding:"required" label:"门店id"`
|
||
|
Reason string `binding:"required" label:"驳回理由"`
|
||
|
}
|
||
|
|
||
|
// Reject @Title 审核驳回
|
||
|
func (s *Store) Reject(c *gin.Context) {
|
||
|
args := argsStoreReject{}
|
||
|
if err := c.ShouldBind(&args); err != nil {
|
||
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
||
|
return
|
||
|
}
|
||
|
if err := business.StoreLogic.Reject(user.ManageLogic.GetManageId(c), args.StoreId, args.Reason); err != nil {
|
||
|
bean.Response.ResultFail(c, 10002, err.Error())
|
||
|
return
|
||
|
}
|
||
|
bean.Response.ResultSuc(c, "操作成功", nil)
|
||
|
}
|
||
|
|
||
|
type argsAssessRecharge struct {
|
||
|
DealerId uint `binding:"required" label:"门店id"`
|
||
|
Count int `binding:"required" label:"充值次数"`
|
||
|
Kind uint `binding:"required,oneof=1 2" label:"余量种类(1=评估;2=合同)"`
|
||
|
}
|