This commit is contained in:
yan.y 2024-04-08 12:02:09 +08:00
parent d1d8c89976
commit 5421ae8a87
8 changed files with 19 additions and 19 deletions

View File

@ -34,7 +34,7 @@ var defaultHeadImgUrl = "http://" + web.CONFIG.System.Addr + "/static/img/202403
// 登录 // 登录
func (p DefParty) login() web_iris.Party { func (p DefParty) login() web_iris.Party {
return web_iris.Party{ return web_iris.Party{
Perfix: p.Prefix, Prefix: p.Prefix,
PartyFunc: func(index iris.Party) { PartyFunc: func(index iris.Party) {
index.Post(AuthBase+"/login", func(ctx *context.Context) { index.Post(AuthBase+"/login", func(ctx *context.Context) {
body, _ := io.ReadAll(ctx.Request().Body) body, _ := io.ReadAll(ctx.Request().Body)
@ -103,7 +103,7 @@ type GetUserInfoResponse struct {
// 获取用户信息 // 获取用户信息
func (p DefParty) getUserInfo() web_iris.Party { func (p DefParty) getUserInfo() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(AuthBase+"/getUserInfo", func(ctx *context.Context) { index.Post(AuthBase+"/getUserInfo", func(ctx *context.Context) {
headerInfo := GetHeaderBaseInfo(ctx) headerInfo := GetHeaderBaseInfo(ctx)
var userInfo *models.User var userInfo *models.User

View File

@ -32,7 +32,7 @@ type GoodsListResponse struct {
// 商品列表 // 商品列表
func (p DefParty) goodsList() web_iris.Party { func (p DefParty) goodsList() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(GoodsBase+"/goodsList", func(ctx *context.Context) { index.Post(GoodsBase+"/goodsList", func(ctx *context.Context) {
headerBaseInfo := GetHeaderBaseInfo(ctx) headerBaseInfo := GetHeaderBaseInfo(ctx)
body, _ := io.ReadAll(ctx.Request().Body) body, _ := io.ReadAll(ctx.Request().Body)
@ -90,7 +90,7 @@ func getPetGoodsList(key string) []GoodsDetail {
// 商品详情 // 商品详情
func (p DefParty) goodsDetail() web_iris.Party { func (p DefParty) goodsDetail() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(GoodsBase+"/goodsDetail", func(ctx *context.Context) { index.Post(GoodsBase+"/goodsDetail", func(ctx *context.Context) {
//暂留 //暂留
Success(ctx, nil, nil) Success(ctx, nil, nil)

View File

@ -84,7 +84,7 @@ func FrontAuth(ctx *context.Context) {
} }
func (p DefParty) index() web_iris.Party { func (p DefParty) index() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Get("/", func(c *context.Context) { index.Get("/", func(c *context.Context) {
_, _ = c.WriteString("successful") _, _ = c.WriteString("successful")
}) })

View File

@ -30,7 +30,7 @@ type OrderCreateResponse struct {
// 创建 // 创建
func (p DefParty) orderCreate() web_iris.Party { func (p DefParty) orderCreate() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(OrderBase+"/orderCreate", func(ctx *context.Context) { index.Post(OrderBase+"/orderCreate", func(ctx *context.Context) {
headerBaseInfo := GetHeaderBaseInfo(ctx) headerBaseInfo := GetHeaderBaseInfo(ctx)
body, _ := io.ReadAll(ctx.Request().Body) body, _ := io.ReadAll(ctx.Request().Body)
@ -159,7 +159,7 @@ type OrderListResponse struct {
// 订单列表 // 订单列表
func (p DefParty) orderList() web_iris.Party { func (p DefParty) orderList() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(OrderBase+"/orderList", func(ctx *context.Context) { index.Post(OrderBase+"/orderList", func(ctx *context.Context) {
headerBaseInfo := GetHeaderBaseInfo(ctx) headerBaseInfo := GetHeaderBaseInfo(ctx)
body, _ := io.ReadAll(ctx.Request().Body) body, _ := io.ReadAll(ctx.Request().Body)
@ -223,7 +223,7 @@ func (p DefParty) orderList() web_iris.Party {
// 获取订单可预约时间 // 获取订单可预约时间
func (p DefParty) orderServiceTime() web_iris.Party { func (p DefParty) orderServiceTime() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(OrderBase+"/orderServiceTime", func(ctx *context.Context) { index.Post(OrderBase+"/orderServiceTime", func(ctx *context.Context) {
}) })
@ -232,7 +232,7 @@ func (p DefParty) orderServiceTime() web_iris.Party {
// 支付 // 支付
func (p DefParty) orderPay() web_iris.Party { func (p DefParty) orderPay() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(OrderBase+"/orderPay", func(ctx *context.Context) { index.Post(OrderBase+"/orderPay", func(ctx *context.Context) {
}) })

View File

@ -39,7 +39,7 @@ type PetListResponse struct {
// 宠物列表 // 宠物列表
func (p DefParty) petList() web_iris.Party { func (p DefParty) petList() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(PetBase+"/petList", func(ctx *context.Context) { index.Post(PetBase+"/petList", func(ctx *context.Context) {
headerBaseInfo := GetHeaderBaseInfo(ctx) headerBaseInfo := GetHeaderBaseInfo(ctx)
userPets := GetUserPets(headerBaseInfo.Uid) userPets := GetUserPets(headerBaseInfo.Uid)
@ -59,7 +59,7 @@ type PetInfoResponse struct {
} }
func (p DefParty) petInfo() web_iris.Party { func (p DefParty) petInfo() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(PetBase+"/petInfo", func(ctx *context.Context) { index.Post(PetBase+"/petInfo", func(ctx *context.Context) {
headerBaseInfo := GetHeaderBaseInfo(ctx) headerBaseInfo := GetHeaderBaseInfo(ctx)
body, _ := io.ReadAll(ctx.Request().Body) body, _ := io.ReadAll(ctx.Request().Body)
@ -90,7 +90,7 @@ type PetAddOrEditResponse struct {
// 宠物添加或编辑 // 宠物添加或编辑
func (p DefParty) petAddOrEdit() web_iris.Party { func (p DefParty) petAddOrEdit() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(PetBase+"/petAddOrEdit", func(ctx *context.Context) { index.Post(PetBase+"/petAddOrEdit", func(ctx *context.Context) {
headerBaseInfo := GetHeaderBaseInfo(ctx) headerBaseInfo := GetHeaderBaseInfo(ctx)
body, _ := io.ReadAll(ctx.Request().Body) body, _ := io.ReadAll(ctx.Request().Body)
@ -147,7 +147,7 @@ type PetTypeListResponse struct {
// 宠物基础信息列表 // 宠物基础信息列表
func (p DefParty) petTypeList() web_iris.Party { func (p DefParty) petTypeList() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(PetBase+"/petTypeList", func(ctx *context.Context) { index.Post(PetBase+"/petTypeList", func(ctx *context.Context) {
var petBaseInfoList []models.PetBaseInfo var petBaseInfoList []models.PetBaseInfo
for _, petBaseInfo := range PetBaseInfoMap { for _, petBaseInfo := range PetBaseInfoMap {
@ -163,7 +163,7 @@ type DelPetRequest struct {
} }
func (p DefParty) delPet() web_iris.Party { func (p DefParty) delPet() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(PetBase+"/delPet", func(ctx *context.Context) { index.Post(PetBase+"/delPet", func(ctx *context.Context) {
headerBaseInfo := GetHeaderBaseInfo(ctx) headerBaseInfo := GetHeaderBaseInfo(ctx)
body, _ := io.ReadAll(ctx.Request().Body) body, _ := io.ReadAll(ctx.Request().Body)

View File

@ -21,7 +21,7 @@ type ServiceAddrListResponse struct {
// 我的服务地址列表 // 我的服务地址列表
func (p DefParty) serviceAddrList() web_iris.Party { func (p DefParty) serviceAddrList() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(ServiceBase+"/serviceAddrList", func(ctx *context.Context) { index.Post(ServiceBase+"/serviceAddrList", func(ctx *context.Context) {
headerBaseInfo := GetHeaderBaseInfo(ctx) headerBaseInfo := GetHeaderBaseInfo(ctx)
var userServiceAddrList []*models.UserServiceAddr var userServiceAddrList []*models.UserServiceAddr
@ -50,7 +50,7 @@ type ServiceAddOrEditResponse struct {
// 服务地址添加或编辑 // 服务地址添加或编辑
func (p DefParty) serviceAddOrEdit() web_iris.Party { func (p DefParty) serviceAddOrEdit() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(ServiceBase+"/serviceAddOrEdit", func(ctx *context.Context) { index.Post(ServiceBase+"/serviceAddOrEdit", func(ctx *context.Context) {
headerBaseInfo := GetHeaderBaseInfo(ctx) headerBaseInfo := GetHeaderBaseInfo(ctx)
body, _ := io.ReadAll(ctx.Request().Body) body, _ := io.ReadAll(ctx.Request().Body)
@ -129,7 +129,7 @@ type ServiceAreaAddrListResponse struct {
// 服务区域列表 // 服务区域列表
func (p DefParty) serviceAreaAddrList() web_iris.Party { func (p DefParty) serviceAreaAddrList() web_iris.Party {
return web_iris.Party{Perfix: p.Prefix, PartyFunc: func(index iris.Party) { return web_iris.Party{Prefix: p.Prefix, PartyFunc: func(index iris.Party) {
index.Post(ServiceBase+"/serviceAreaAddrList", func(ctx *context.Context) { index.Post(ServiceBase+"/serviceAreaAddrList", func(ctx *context.Context) {
var serviceAddrList []models.ServiceAddr var serviceAddrList []models.ServiceAddr
database.Instance().Model(&models.ServiceAddr{}).Find(&serviceAddrList) database.Instance().Model(&models.ServiceAddr{}).Find(&serviceAddrList)

View File

@ -37,7 +37,7 @@ type WebServer struct {
// - perfix // - perfix
// - partyFunc // - partyFunc
type Party struct { type Party struct {
Perfix string Prefix string
PartyFunc func(index iris.Party) PartyFunc func(index iris.Party)
} }

View File

@ -40,7 +40,7 @@ func (ws *WebServer) InitRouter() error {
} }
for _, party := range ws.parties { for _, party := range ws.parties {
app.PartyFunc(party.Perfix, party.PartyFunc) app.PartyFunc(party.Prefix, party.PartyFunc)
} }
} }