district_controller.go 540B

123456789101112131415161718192021222324252627
  1. package global
  2. import (
  3. base_ctl "SCRM/controllers"
  4. "SCRM/service/district_service"
  5. "github.com/astaxie/beego"
  6. )
  7. type DistrictApiController struct {
  8. base_ctl.BaseAPIController
  9. }
  10. func DistrictCtlRegistRouters() {
  11. beego.Router("/api/district/getdistrictsbyupid", &DistrictApiController{}, "get:GetDistrictsByUpid")
  12. }
  13. func (c *DistrictApiController) GetDistrictsByUpid() {
  14. id, _ := c.GetInt64("id", 0)
  15. citys, _ := district_service.GetDistrictsByUpid(id)
  16. c.ServeSuccessJSON(map[string]interface{}{
  17. "citys": citys,
  18. })
  19. return
  20. }