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.

45 lines
1.1 KiB

package task
import (
"base/app/common"
"base/app/lib/bean"
"base/app/logic/broker/task"
"base/app/logic/broker/user"
"github.com/gin-gonic/gin"
)
type Invite struct {
}
type argsInviteLists struct {
InviteType uint `binding:"oneof=0 1 2" label:"类型"` // 1=看车 2=检车
bean.Page
}
// Lists @Title 客户邀约列表
func (i *Invite) Lists(c *gin.Context) {
args := argsInviteLists{}
if err := c.ShouldBind(&args); err != nil {
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
return
}
lists, total := task.InviteLogic.Lists(user.UserLogic.GetBrokerId(c), args.InviteType, args.Page)
bean.Response.ResultSuc(c, "操作成功", bean.ResultLists{
List: lists,
Total: total,
})
}
// Add @Title 看车邀约
func (i *Invite) Add(c *gin.Context) {
args := task.InviteAdd{}
if err := c.ShouldBind(&args); err != nil {
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
return
}
if err := task.InviteLogic.Add(user.UserLogic.GetBrokerId(c), args); err != nil {
bean.Response.ResultFail(c, 10002, err.Error())
return
}
bean.Response.ResultSuc(c, "操作成功", nil)
}