customer.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package aftersale
  2. import (
  3. "zhiyuan/controllers/admin"
  4. "zhiyuan/controllers/aftersale/customer"
  5. "zhiyuan/middlewares"
  6. "zhiyuan/models"
  7. "zhiyuan/models/budget"
  8. "zhiyuan/pkg/db"
  9. "github.com/gin-gonic/gin"
  10. )
  11. func InitCustomerRouters(r *gin.Engine, router *gin.RouterGroup) {
  12. r.Static("/aftersale/customer", "public/aftersale/customer")
  13. r.Static("/aftersale/customerimitate", "public/aftersale/customerimitate")
  14. router = router.Group("/customer")
  15. router.POST("/login", customer.Login)
  16. router.POST("/send_verify_code", customer.SendVerifyCode)
  17. router.Use(middlewares.Auth("user"))
  18. {
  19. router.POST("/orders/:id/revoke", customer.OrderRevoke)
  20. router.POST("/orders/:id/comment", customer.OrderComment)
  21. router.POST("/orders/:id/confirm", customer.OrderConfirm)
  22. router.POST("/orders", customer.OrderAdd)
  23. router.GET("/orders", customer.OrderList)
  24. router.GET("/orders/:id", customer.OrderInfo)
  25. router.GET("/houses", customer.HouseList)
  26. router.PUT("/houses/:id", customer.HouseEdit)
  27. router.POST("/houses", customer.HouseAdd)
  28. router.GET("/params", admin.ParamList)
  29. router.GET("/params/:param", admin.ParamInfo)
  30. router.GET("/regions", admin.RegionList)
  31. router.GET("/qas", customer.QaList)
  32. router.GET("/qas/:id", customer.QaInfo)
  33. router.GET("/qiniu/token", admin.QiniuToken)
  34. router.GET("/info", customer.Info)
  35. router.PUT("/info", customer.InfoEdit)
  36. router.POST("/logout", customer.Logout)
  37. router.POST("/unbind_weixin", customer.UnBindWeixin)
  38. router.GET("/check_book", customer.CheckBook)
  39. router.POST("/integrals", func(c *gin.Context) {
  40. db.ModelList(db.Type(&models.UserIntegral{}), map[string]interface{}{"user_id": c.GetInt("userID"), "deleted_at": 0}, c)
  41. })
  42. router.GET("/check", customer.CheckCourse)
  43. router.GET("/checks", customer.CheckList)
  44. router.GET("/checks/:id", customer.CheckInfo)
  45. router.POST("/checks", customer.SelectChecks)
  46. router.PUT("/check/:id", customer.SubmitCheck)
  47. router.POST("/mycustomers", func(c *gin.Context) {
  48. db.ModelList(db.Type(&budget.CustomerUser{}), map[string]interface{}{"deleted_at": 0}, c)
  49. })
  50. router.POST("/checkcontract/:id", customer.CheckContract)
  51. router.POST("/checkstart/:id", customer.CheckStart)
  52. }
  53. }