Files

89 lines
3.1 KiB
Go
Raw Permalink Normal View History

2022-11-28 16:38:30 +08:00
package initialize
import (
"crm/api"
"crm/global"
"crm/middleware"
"fmt"
"github.com/gin-gonic/gin"
)
func Router() {
engine := gin.Default()
// 开启跨域
engine.Use(middleware.Cors())
route := engine.Group("/api")
2022-12-27 19:18:58 +08:00
{
2022-12-16 20:39:36 +08:00
// 用户模块,订阅模块
2022-11-28 16:38:30 +08:00
route.GET("/user/verifycode", api.NewUserApi().GetVerifyCode)
route.GET("/user/info", api.NewUserApi().GetInfo)
route.POST("/user/login", api.NewUserApi().Login)
route.POST("/user/register", api.NewUserApi().Register)
route.POST("/user/pass", api.NewUserApi().ForgotPass)
route.DELETE("/user/delete", api.NewUserApi().Delete)
2023-01-27 11:05:24 +08:00
route.POST("/subscribe/payback", api.NewSubscribeApi().PayBack)
2022-11-28 16:38:30 +08:00
2023-01-28 21:17:31 +08:00
// 通用接口
route.POST("/common/database/init", api.NewCommonApi().InitDatabase)
2023-01-30 15:48:42 +08:00
route.POST("/common/file/upload", api.NewCommonApi().FileUpload)
route.DELETE("/common/file/remove", api.NewCommonApi().FileRemove)
2022-12-17 20:47:35 +08:00
2022-11-28 16:38:30 +08:00
// Jwt中间件
route.Use(middleware.JwtAuth())
// 客户模块
2023-01-25 16:10:16 +08:00
route.GET("/customer/list", api.NewCustomerApi().GetList)
route.GET("/customer/info", api.NewCustomerApi().GetInfo)
route.GET("/customer/option", api.NewCustomerApi().GetOption)
2022-12-27 19:18:58 +08:00
route.GET("/customer/export", api.NewCustomerApi().Export)
2022-11-28 16:38:30 +08:00
route.POST("/customer/create", api.NewCustomerApi().Create)
2023-01-24 20:03:35 +08:00
route.POST("/customer/send", api.NewCustomerApi().SendMail)
2022-11-28 16:38:30 +08:00
route.PUT("/customer/update", api.NewCustomerApi().Update)
route.DELETE("/customer/delete", api.NewCustomerApi().Delete)
// 合同模块
2023-01-25 16:10:16 +08:00
route.GET("/contract/list", api.NewContractApi().GetList)
route.GET("/contract/info", api.NewContractApi().GetInfo)
2022-12-27 19:18:58 +08:00
route.GET("/contract/export", api.NewContractApi().Export)
2023-01-25 16:10:16 +08:00
route.POST("/contract/plist", api.NewContractApi().GetProductList)
2022-11-28 16:38:30 +08:00
route.PUT("/contract/update", api.NewContractApi().Update)
route.POST("/contract/create", api.NewContractApi().Create)
route.DELETE("/contract/delete", api.NewContractApi().Delete)
// 产品模块
2023-01-25 16:10:16 +08:00
route.GET("/product/list", api.NewProductApi().GetList)
route.GET("/product/info", api.NewProductApi().GetInfo)
2022-12-27 19:18:58 +08:00
route.GET("/product/export", api.NewProductApi().Export)
2022-11-28 16:38:30 +08:00
route.POST("/product/create", api.NewProductApi().Create)
route.PUT("/product/update", api.NewProductApi().Update)
route.DELETE("/product/delete", api.NewProductApi().Delete)
// 仪表盘模块
route.GET("/dashboard/sum", api.NewDashboardApi().Summary)
2022-12-16 20:39:36 +08:00
2023-01-24 20:03:35 +08:00
// 配置模块
route.GET("/config/info", api.NewMailConfigApi().GetInfo)
route.GET("/config/check", api.NewMailConfigApi().Check)
route.PUT("/config/save", api.NewMailConfigApi().Save)
route.PUT("/config/status", api.NewMailConfigApi().UpdateStatus)
2023-01-26 11:25:49 +08:00
route.DELETE("/config/delete", api.NewMailConfigApi().Delete)
2023-01-24 20:03:35 +08:00
2022-12-16 20:39:36 +08:00
// 订阅模块
route.GET("/subscribe/info", api.NewSubscribeApi().GetInfo)
route.POST("/subscribe/pay", api.NewSubscribeApi().Pay)
2023-01-02 11:00:29 +08:00
// 通知模块
route.GET("/notice/list", api.NewNoticeApi().GetList)
2023-01-25 16:10:16 +08:00
route.GET("/notice/count", api.NewNoticeApi().GetUnReadCount)
2023-01-02 11:00:29 +08:00
route.PUT("/notice/update", api.NewNoticeApi().Update)
route.DELETE("/notice/delete", api.NewNoticeApi().Delete)
2022-11-28 16:38:30 +08:00
}
// 启动、监听端口
_ = engine.Run(fmt.Sprintf(":%v", global.Config.Server.Port))
}