mh_server/router/router_app.go
2022-01-26 16:02:21 +08:00

175 lines
7.3 KiB
Go

package router
import (
"mh-server/controller"
"mh-server/lib/auth"
//"mh-server/lib/auth"
"github.com/gin-gonic/gin"
)
func ConfigAppRouter(r gin.IRouter) {
r.Use(CORSMiddleware)
r.Use(WrapHandle)
r.Use(gin.Recovery())
r.GET("wx_msg", controller.WxMsg)
api := r.Group("/api/" + API_VERSION_V1)
{
// //if config.AppConfig.Env == "test" || config.AppConfig.Env == "dev" {
// // api.POST("test", controller.Test)
// // api.GET("test/:uid", controller.TestLogin)
// //}
//
// api.POST("is_check", controller.IsCheck) // 审核状态
// api.POST("share_img/list", controller.ShareImgList) // 分享图片
// api.GET("charge/notify", controller.MobileChargeNotify) // 话费多接口回调
// //api.POST("sys/config", controller.SysConfig) // 配置
// api.POST("step/config", controller.StepConfig) // 步数配置
// //api.POST("upload_user_info", controller.UploadUserInfo) // 上传用户信息
api.POST("wxpay/notice", controller.PushWXPayNotice) // 微信推送支付通知
api.POST("aliyun/sts_token", controller.AliyunStsTokenGet) // 阿里云上传图片token
// api.GET("wx_cs/message", controller.CustomerServiceMessageCheck) // 客服校验
// api.POST("wx_cs/message", controller.CustomerServiceMessage) // 客服
//
}
// 用户鉴权
authGroup := api.Group("auth")
{
authGroup.POST("login", controller.AuthLogin) // 登录
authGroup.POST("token/refresh", controller.TokenRefresh) // 刷新AccessToken
//authGroup.POST("login/app", controller.AuthLoginApp) // APP登录
//authGroup.POST("token/refresh/app", controller.TokenRefresh) // APP刷新Token
}
gameCard := api.Group("game_card")
{
gameCard.POST("list", controller.GameCardList) // 游戏卡列表
gameCard.POST("banner", controller.HomeCarouselList) // 轮播图
gameCard.POST("game_type", controller.GameCardTypes) // 游戏标签
gameCard.POST("type/list", controller.GameCardTypeList) // 游戏类型列表
gameCard.Use(auth.UserAccessAuth)
gameCard.POST("info", controller.GameCardInfo) // 游戏卡详情
}
search := gameCard.Group("search")
{
search.POST("list", controller.GameCardSearch) // 游戏卡搜索列表
search.POST("hot", controller.GameCardHotSearch) // 游戏卡搜索列表
search.Use(auth.UserAccessAuth)
search.POST("history", controller.GameCardSearchHistory) // 游戏卡搜索历史
}
user := api.Group("user")
{
user.Use(auth.UserAccessAuth) // TODO
user.POST("data", controller.UserData) // 用户数据
user.POST("user_info/upload", controller.UserInfoUpload) // 上传用户信息
user.POST("user_info/tel", controller.UserTel) // 获取用户手机号
user.POST("user_info/update", controller.UserInfoUpdate) // 修改用户信息
user.POST("open_member", controller.OpenMember) // 开通会员
user.POST("upgrade_member", controller.UpgradeMember) // 开通会员
user.POST("pay_deposit", controller.PayDeposit) // 支付押金
user.POST("refund_deposit", controller.RefundDeposit) // 退押金
user.POST("refund_deposit_record", controller.UserDepositRefundRecordList) // 押金记录
user.POST("member_config", controller.MemberConfigList) // 开通会员配置
user.POST("common_problem/list", controller.CommonProblemList) // 常见问题列表
//user.POST("service/wechat_id", controller.GetCustomerServiceWechatId) // 获取客服微信号
user.POST("invite_applet_code", controller.UserInviteAppletQRCode) // 小程序分享二维码
user.POST("invite_list", controller.UserInviteList) // 小程序分享二维码
}
store := api.Group("store")
{
store.POST("list", controller.StoreList) // 门店列表
store.POST("info", controller.StoreInfo) // 门店详情
}
address := api.Group("user/address")
{
address.POST("detail", controller.UserAddressDetail) // 地址详情
address.Use(auth.UserAccessAuth) // TODO
address.POST("add", controller.UserAddressAdd) // 新增地址
address.POST("update", controller.UserAddressUpdate) // 更新地址
address.POST("list", controller.UserAddressList) // 地址列表
address.POST("delete", controller.UserAddressDelete) // 删除地址
address.POST("set_default", controller.UserAddressSetDefault) // 设为默认地址
}
my := api.Group("user/my")
{
my.Use(auth.UserAccessAuth) // TODO
my.POST("history_browsing", controller.HistoryBrowsingList) // 浏览记录
my.POST("history_browsing/del", controller.HistoryBrowsingDel) // 浏览记录删除
my.POST("collection", controller.CollectionList) // 收藏
my.POST("collection/add", controller.CollectionAdd) // 收藏添加
my.POST("collection/cancel", controller.CollectionCancel) // 收藏删除
}
// TODO 订单
order := api.Group("order")
{
order.POST("amount", controller.OrderAmount) // 订单金额
order.POST("info", controller.OrderInfo) // 订单详情
order.POST("express", controller.OrderExpress) // 订单物流
order.POST("express_company/list", controller.ExpressCompanyList) // 物流公司列表
order.POST("order/wx_pay/success", controller.WXPaySuccess) // 微信支付成功
order.POST("cancel", controller.OrderCancel) // 订单取消
order.Use(auth.UserAccessAuth) // TODO
order.POST("create", controller.RentCardOrderCreate) // 创建租卡
order.POST("pay", controller.OrderPay) // 租卡订单支付
order.POST("list", controller.RentCardOrderList) // 租卡订单列表
order.POST("revert", controller.OrderRevert) // 租卡订单归还
order.POST("revert/cancel", controller.OrderRevertCancel) // 租卡订单取消归还
//order.POST("express_fee/refund", controller.ExpressFeeRefund) // 物流费退款
order.POST("confirm_receipt", controller.ConfirmReceipt) // 订单确认收货
}
article := api.Group("article")
{
article.POST("thumbs", controller.ArticleThumbs) //
article.POST("list", controller.ArticleList) // 列表
article.POST("title_panel/list", controller.ArticleTitlePanelList) //
article.Use(auth.UserAccessAuth)
article.POST("info", controller.ArticleInfo) // 详情
article.POST("collect/add", controller.ArticleCollectAdd) //
article.POST("collect/cancel", controller.ArticleCollectCancel) //
article.POST("collect/list", controller.ArticleCollectList) //
}
activity := api.Group("activity")
{
activity.Use(auth.UserAccessAuth)
activity.POST("redeem_code/user_redeem_code/list", controller.UserRedeemCodeList) // 详情
activity.POST("redeem_code/user/convert", controller.UserConvertRedeemCode) // 会员兑换码
}
shoppingCart := api.Group("shopping_cart")
{
shoppingCart.Use(auth.UserAccessAuth)
shoppingCart.POST("list", controller.ShoppingCartList) // 详情
shoppingCart.POST("add", controller.ShoppingCartAdd) //
shoppingCart.POST("del", controller.ShoppingCartDel) //
}
}