| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package base
- import (
- "context"
- "dashoo.cn/common_definition/comm_def"
- "github.com/gogf/gf/frame/g"
- server "dashoo.cn/micro/app/service/base"
- )
- type DistrictHandler struct{}
- //GetList 所属区域列表
- func (d *DistrictHandler) GetList(ctx context.Context, req *comm_def.IdReq, rsp *comm_def.CommonMsg) error {
- districtServer, err := server.NewDistrictService(ctx)
- if err != nil {
- g.Log().Error(err)
- return err
- }
- //list := districtServer.ListToRegions()
- list := districtServer.ListToTree(req.Id)
- g.Log().Info("ID", req.Id)
- rsp.Data = g.Map{"list": list}
- return nil
- }
- //区域下所有的省份
- func (d *DistrictHandler) GetRegionList(ctx context.Context, req *comm_def.IdReq, rsp *comm_def.CommonMsg) error {
- districtServer, err := server.NewDistrictService(ctx)
- if err != nil {
- g.Log().Error(err)
- return err
- }
- list := districtServer.ListToRegions()
- //list := districtServer.ListToTree(req.Id)
- g.Log().Info("ID", req.Id)
- rsp.Data = g.Map{"list": list}
- return nil
- }
- //返回所有省份的
- func (d *DistrictHandler) GetProvinceInfo(ctx context.Context, null, rsp *comm_def.CommonMsg) error {
- districtServer, err := server.NewDistrictService(ctx)
- if err != nil {
- g.Log().Error(err)
- return err
- }
- list := districtServer.GetProvinceInfo()
- rsp.Data = g.Map{"list": list}
- return nil
- }
|