123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- package routes
- import (
- "go-nc/internal/router/admin/alert"
- "go-nc/internal/router/admin/platform"
- "go-nc/internal/router/admin/simApi"
- systemRouter "go-nc/internal/router/admin/system"
- "go-nc/internal/router/app"
- "go-nc/internal/router/log"
- "go-nc/internal/router/metadata"
- "go-nc/internal/router/sdk"
- "go-nc/pkg/gogs"
- "go-nc/pkg/stripe"
- "github.com/gin-gonic/gin"
- )
- // 不需要校验token权限的api
- var NoAuthApi = []string{
- "/api/admin/system/setPwd", // 数据加密
- "/api/admin/system/login", // 登录
- "/api/admin/system/register", // 注册
- "/api/hooks/gogs/getMessage", // gogs 事件推送 企微
- "/api/admin/system/getEnu", // 字典列表-业务-获取
- // APP
- "/api/app/walletCard", // 客户余额看版
- "/api/app/pay", // 支付
- "/api/hooks/stripe/webhook", // Stripe Webhook
- "/api/app/orderList", // 订单
- "/api/admin/platform/tariffProductList", // 资费商品
- //SDK-v1
- "/scc/v1/getAccessToken", // 获取token
- }
- // 设置 api 分组路由
- func SetApiGroupRoutes(router *gin.RouterGroup) {
- // sdk
- v1 := router.Group("/scc/v1/")
- {
- v1.POST("getAccessToken", sdk.AgentToken) // 获取token
- v1.GET("sim", sdk.CardInfo) // 查询卡信息
- v1.GET("simPackage", sdk.CardTraffic) // 查询卡流量包信息
- v1.GET("simStop", sdk.StopCard) // 停卡
- v1.GET("simRun", sdk.RunCard) // 恢复卡
- v1.GET("packages", sdk.Tariff) // 套餐列表
- v1.POST("bindPackage", sdk.BindTariff) // 订购套餐
- v1.POST("cdrDaily", sdk.SimCDR) // CDR统计
- }
- hooks := router.Group("/api/hooks/")
- {
- hooks.POST("gogs/getMessage", gogs.GetMessage)
- }
- system := router.Group("/api/admin/system/")
- {
- // 系统
- system.GET("setPwd", systemRouter.EncryptDataAPi) // 数据加密
- system.GET("userInfoMenu", systemRouter.GetUserMenu) // 获取用户菜单
- system.POST("login", systemRouter.SysLogin) // 登录
- system.POST("finMenuAll", systemRouter.GetMenu) // 获取菜单
- system.POST("deleteMenu", systemRouter.DeleteMenu) // 删除菜单
- system.POST("setMenu", systemRouter.AddMenu) // 添加菜单
- system.POST("updateMenu", systemRouter.UpdateMenu) // 更新菜单
- system.GET("getSTSInfo", systemRouter.GetSTSInfo) // 获取临时凭证
- // 角色
- system.POST("findRoleList", systemRouter.GetRole) // 获取角色
- system.POST("findRoleOrUser", systemRouter.GetRoleUser) // 获取角色下的用户
- system.POST("updateRole", systemRouter.UpdateRole) // 更新角色
- system.POST("relieveRoleUserById", systemRouter.UnbindRole) // 解绑角色
- system.POST("setRole", systemRouter.AddRole) // 添加角色
- system.POST("deleteRole", systemRouter.DeleteRole) // 删除角色
- // 用户
- system.POST("user/updateUserState", systemRouter.ChangeUserStatus) // 修改用户状态
- system.POST("user/list", systemRouter.GetUserList) // 获取用户
- system.POST("user/register", systemRouter.SysRegister) // 创建用户
- system.POST("user/deleteUser", systemRouter.DeleteUser) // 删除用户
- system.POST("user/updateUser", systemRouter.UpdateUser) // 更新用户
- // 字典
- system.POST("dicList", systemRouter.DictionaryList) // 字典列表
- system.POST("addDic", systemRouter.CreateDictionary) // 添加字典
- system.POST("updateDic", systemRouter.UpdateDictionary) // 更新字典
- system.GET("deleteDic", systemRouter.DeleteDictionary) // 删除字典
- system.GET("getEnu", systemRouter.GetEnu) // 字典列表-业务-获取
- }
- // 日志
- logs := router.Group("/api/logs/")
- {
- logs.POST("logCardOperation", log.LogCardOperation) // 查询卡操作日志
- }
- // 原数据
- metadataRouter := router.Group("/api/metadata/")
- {
- // 原数据
- metadataRouter.POST("getDataPlanList", metadata.GetDataPlanList) // 获取流量包数据 OrderLogsList
- // metadataRouter.POST("getOrderLogsList", metadata.OrderLogsList) // 查询订单日志
- }
- // 卡信息
- simApiRouter := router.Group("/api/admin/sim/")
- {
- simApiRouter.POST("cardInfoList", simApi.CardInfoList) // 查询所有卡信息
- simApiRouter.POST("cardInfoUpdate", simApi.CardInfoUpdate) // 修改卡信息
- simApiRouter.POST("stopSim", simApi.StopSim) // 暂停 SIM 卡服务
- simApiRouter.POST("runeSim", simApi.RuneSim) // 恢复 SIM 卡服务
- simApiRouter.POST("closeSim", simApi.CloseSim) // 关闭 SIM 卡
- simApiRouter.POST("simCDR", simApi.SimCDR) // CDR 使用查询
- // 卡采购订单
- simApiRouter.POST("apply", simApi.SimApply) // 客户端:购卡申请
- simApiRouter.POST("applyList", simApi.SimApplyList) // 购卡申请列表
- simApiRouter.POST("applyAudit", simApi.SimApplyModeration) // 订单审批
- simApiRouter.POST("uploadContract", simApi.SimUploadContract) // 上传合同
- simApiRouter.POST("assignSim", simApi.SimAssignSim) // 购卡:导入-分配卡号
- simApiRouter.GET("orderCard", simApi.SimOrderCard) // 查看购卡订单的卡
- // 退卡
- simApiRouter.POST("returnCardList", simApi.SimReturnCardList) // 退卡列表
- simApiRouter.POST("returnCard", simApi.SimReturnCard) // 退卡
- simApiRouter.POST("setAmount", simApi.SimSetAmount) // 设置采购或退卡金额
- }
- // 平台
- platformRouter := router.Group("/api/admin/platform/")
- {
- // 客户管理
- platformRouter.POST("customerList", platform.GetCustomerList) // 查询客户
- platformRouter.POST("addCustomer", platform.AddCustomer) // 添加客户
- platformRouter.POST("updateCustomer", platform.UpdateCustomer) // 更新客户
- platformRouter.GET("deleteCustomer", platform.DeleteCustomer) // 删除客户
- platformRouter.GET("customerInfo", platform.GetCustomerInfo) // 客户详情
- // 资费
- platformRouter.POST("tariffList", platform.GetTariffList) // 查询资费计划
- platformRouter.POST("addTariff", platform.AddTariff) // 添加资费计划
- platformRouter.POST("updateTariff", platform.UpdateTariff) // 更新资费计划
- platformRouter.GET("deleteTariff", platform.DeleteTariff) // 删除资费计划
- platformRouter.GET("getTariffCard", platform.GetTariffCard) // 获取资费下的卡
- platformRouter.GET("getTariffById", platform.GetTariffById) // id换取资费信息
- platformRouter.POST("renewTariff", platform.RenewTariff) // 续费有效期
- platformRouter.POST("getTrafficOrderList", platform.GetTrafficOrderList) // 自费续费订单信息
- // 资费商品
- platformRouter.GET("tariffProductList", platform.GetTariffProductList) // 查询资费商品
- platformRouter.POST("addTariffProduct", platform.AddTariffProduct) // 添加资费商品
- platformRouter.POST("updateTariffProduct", platform.UpdateTariffProduct) // 更新资费商品
- platformRouter.GET("deleteTariffProduct", platform.DeleteTariffProduct) // 删除资费商品
- // 流量池
- platformRouter.POST("trafficPoolList", platform.GetTrafficPoolList) // 查询流量池
- platformRouter.POST("addTrafficPool", platform.AddTrafficPool) // 添加流量池
- platformRouter.POST("updateTrafficPool", platform.UpdateTrafficPool) // 更新流量池
- platformRouter.GET("deleteTrafficPool", platform.DeleteTrafficPool) // 删除流量池
- platformRouter.GET("customerTrafficPool", platform.GetCustomerTrafficPool) // 查询客户下的流量池
- // 充值记录
- platformRouter.POST("topUpRecord", platform.TopUpRecord) // 查询充值记录
- platformRouter.POST("topUp", platform.TopUp) // 充值
- platformRouter.POST("simConsumptionDetails", platform.SimTraffic) // 查看流量消耗明细
- platformRouter.GET("userSimInfo", platform.SimCardInfo) // 查询用户下的卡详情
- }
- // 预警
- warning := router.Group("/api/admin/alert/")
- {
- warning.POST("warningCreate", alert.AlertPoolCreate) // 创建预警
- warning.POST("warningUpdate", alert.AlertPoolUpdate) // 更新预警
- }
- // 客户
- client := router.Group("/api/admin/client/")
- {
- client.GET("walletCard", platform.WalletCard) //客户余额看版
- }
- // App
- appApi := router.Group("/api/app/")
- {
- appApi.GET("walletCard", app.GetSelfPayByIccid) //客户余额看版
- appApi.POST("pay", app.PayOrder) // 支付
- appApi.POST("orderList", app.OrderList) // 充值订单列表
- }
- // hook
- hook := router.Group("/api/hooks/")
- {
- hook.POST("stripe/webhook", stripe.WebhookHandler)
- }
- }
|