package aftersale import ( "zhiyuan/controllers/admin" "zhiyuan/controllers/aftersale/customer" "zhiyuan/middlewares" "zhiyuan/models" "zhiyuan/models/budget" "zhiyuan/pkg/db" "github.com/gin-gonic/gin" ) func InitCustomerRouters(r *gin.Engine, router *gin.RouterGroup) { r.Static("/aftersale/customer", "public/aftersale/customer") r.Static("/aftersale/customerimitate", "public/aftersale/customerimitate") router = router.Group("/customer") router.POST("/login", customer.Login) router.POST("/send_verify_code", customer.SendVerifyCode) router.Use(middlewares.Auth("user")) { router.POST("/orders/:id/revoke", customer.OrderRevoke) router.POST("/orders/:id/comment", customer.OrderComment) router.POST("/orders/:id/confirm", customer.OrderConfirm) router.POST("/orders", customer.OrderAdd) router.GET("/orders", customer.OrderList) router.GET("/orders/:id", customer.OrderInfo) router.GET("/houses", customer.HouseList) router.PUT("/houses/:id", customer.HouseEdit) router.POST("/houses", customer.HouseAdd) router.GET("/params", admin.ParamList) router.GET("/params/:param", admin.ParamInfo) router.GET("/regions", admin.RegionList) router.GET("/qas", customer.QaList) router.GET("/qas/:id", customer.QaInfo) router.GET("/qiniu/token", admin.QiniuToken) router.GET("/info", customer.Info) router.PUT("/info", customer.InfoEdit) router.POST("/logout", customer.Logout) router.POST("/unbind_weixin", customer.UnBindWeixin) router.GET("/check_book", customer.CheckBook) router.POST("/integrals", func(c *gin.Context) { db.ModelList(db.Type(&models.UserIntegral{}), map[string]interface{}{"user_id": c.GetInt("userID"), "deleted_at": 0}, c) }) router.GET("/check", customer.CheckCourse) router.GET("/checks", customer.CheckList) router.GET("/checks/:id", customer.CheckInfo) router.POST("/checks", customer.SelectChecks) router.PUT("/check/:id", customer.SubmitCheck) router.POST("/mycustomers", func(c *gin.Context) { db.ModelList(db.Type(&budget.CustomerUser{}), map[string]interface{}{"deleted_at": 0}, c) }) router.POST("/checkcontract/:id", customer.CheckContract) router.POST("/checkstart/:id", customer.CheckStart) } }