200 lines
5.0 KiB
Go
200 lines
5.0 KiB
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
service "github.com/fonchain_enterprise/fonchain-main/api"
|
|
"github.com/fonchain_enterprise/fonchain-main/api/buy"
|
|
"github.com/fonchain_enterprise/fonchain-main/pkg/serializer"
|
|
|
|
"dubbo.apache.org/dubbo-go/v3/common/logger"
|
|
"github.com/fonchain_enterprise/fonchain-main/api/prebook"
|
|
"github.com/fonchain_enterprise/fonchain-main/pkg/e"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// 管理系统预约列表
|
|
func PrebookList(c *gin.Context) {
|
|
|
|
//声明一个变量
|
|
var req prebook.PrebookListreq
|
|
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
logger.Errorf("PrebookList ShouldBind err", err)
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
//管理系统预约列表
|
|
resp, err := GrpcPrebookImpl.PrebookList(context.Background(), &req)
|
|
if err != nil {
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
ResponseQuickMsg(c, e.Ok, resp.Msg, resp)
|
|
return
|
|
}
|
|
|
|
// 查看对应预约下的人员资料
|
|
func CustomerList(c *gin.Context) {
|
|
|
|
//声明一个变量
|
|
var req prebook.CustomerListreq
|
|
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
logger.Errorf("CustomerList ShouldBind err", err)
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
//查看对应预约下的人员资料
|
|
resp, err := GrpcPrebookImpl.CustomerList(context.Background(), &req)
|
|
if err != nil {
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
ResponseQuickMsg(c, e.Ok, resp.Msg, resp.Data)
|
|
return
|
|
}
|
|
|
|
// 新预约列表
|
|
func NewList(c *gin.Context) {
|
|
//声明一个变量
|
|
var req prebook.NewListreq
|
|
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
logger.Errorf("CustomerList ShouldBind err", err)
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
//查看对应预约下的人员资料
|
|
resp, err := GrpcPrebookImpl.NewList(context.Background(), &req)
|
|
if err != nil {
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
for i := 0; i < len(resp.Data); i++ {
|
|
if resp.Data[i].Detail == nil || len(resp.Data[i].Detail) == 0 {
|
|
resp.Data[i].Detail = make([]*prebook.NewListres_Info_BaseInfo, 0)
|
|
}
|
|
}
|
|
ResponseQuickMsg(c, e.Ok, resp.Msg, resp)
|
|
return
|
|
}
|
|
|
|
// 私宴列表
|
|
func FeastList(c *gin.Context) {
|
|
//声明一个变量
|
|
var req prebook.FeastListreq
|
|
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
logger.Errorf("CustomerList ShouldBind err", err)
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
//查看对应预约下的人员资料
|
|
resp, err := GrpcPrebookImpl.FeastList(context.Background(), &req)
|
|
if err != nil {
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
|
|
ResponseQuickMsg(c, e.Ok, resp.Msg, resp)
|
|
return
|
|
}
|
|
|
|
// 添加团队备注和团队实际人数
|
|
func Addpulg(c *gin.Context) {
|
|
var req prebook.Addpulgreq
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
logger.Errorf("Addpulg ShouldBind err", err)
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
resp, err := GrpcPrebookImpl.Addpulg(context.Background(), &req)
|
|
if err != nil {
|
|
ResponseQuickMsg(c, e.Ok, resp.Msg, nil)
|
|
return
|
|
}
|
|
ResponseQuickMsg(c, e.Ok, resp.Msg, nil)
|
|
return
|
|
}
|
|
|
|
// 确认团队预约
|
|
func SureNo(c *gin.Context) {
|
|
var req prebook.SureNoreq
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
logger.Errorf("SureNo ShouldBind err", err)
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
resp, err := GrpcPrebookImpl.SureNo(context.Background(), &req)
|
|
if err != nil {
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
ResponseQuickMsg(c, e.Ok, resp.Msg, nil)
|
|
return
|
|
}
|
|
|
|
// 修改私宴金额
|
|
func AlterPrice(c *gin.Context) {
|
|
var req prebook.AlterPricereq
|
|
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
logger.Errorf("SureNo ShouldBind err", err)
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
resp, err := GrpcPrebookImpl.AlterPrice(context.Background(), &req)
|
|
if err != nil {
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
ResponseQuickMsg(c, e.Ok, resp.Msg, nil)
|
|
return
|
|
|
|
}
|
|
|
|
// 删除私宴列表
|
|
func DelFeast(c *gin.Context) {
|
|
var req prebook.DelFeastreq
|
|
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
logger.Errorf("SureNo ShouldBind err", err)
|
|
ResponseQuickMsg(c, e.Failed, err.Error(), nil)
|
|
return
|
|
}
|
|
resp, err := GrpcPrebookImpl.DelFeast(context.Background(), &req)
|
|
if err != nil {
|
|
ResponseQuickMsg(c, e.Ok, resp.Msg, nil)
|
|
return
|
|
}
|
|
ResponseQuickMsg(c, e.Ok, resp.Msg, nil)
|
|
return
|
|
}
|
|
|
|
func GetAllFeastInfo(c *gin.Context) {
|
|
var getAllFeastInfoRequest buy.GetAllFeastInfoRequest
|
|
if err := c.ShouldBind(&getAllFeastInfoRequest); err != nil {
|
|
logger.Errorf("getAllFeastInfoRequest ShouldBind err", err)
|
|
service.ResponseMsg(c, e.SUCCESS, serializer.Response{
|
|
Data: nil,
|
|
Msg: err.Error(),
|
|
Status: e.Failed,
|
|
})
|
|
return
|
|
}
|
|
rep, err := BuyProvider.GetAllFeastInfo(context.Background(), &getAllFeastInfoRequest)
|
|
if err != nil {
|
|
service.ResponseMsg(c, e.SUCCESS, serializer.Response{
|
|
Msg: err.Error(),
|
|
Status: e.Failed,
|
|
})
|
|
return
|
|
}
|
|
|
|
service.ResponseMsg(c, e.SUCCESS, serializer.Response{
|
|
Msg: rep.Msg,
|
|
Status: e.Ok,
|
|
Data: rep,
|
|
})
|
|
}
|