| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package base
- import (
- "context"
- "dashoo.cn/common_definition/comm_def"
- "dashoo.cn/opms_libary/myerrors"
- "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 {
- return err
- }
- list, err := districtServer.ListToTree(req.Id)
- _, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
- if err != nil {
- return err
- }
- rsp.Data = g.Map{"list": list}
- return nil
- }
- //GetRegionList 区域下所有的省份
- func (s *DistrictHandler) GetRegionList(ctx context.Context, req *comm_def.IdReq, rsp *comm_def.CommonMsg) error {
- districtServer, err := server.NewDistrictService(ctx)
- if err != nil {
- return err
- }
- list, err := districtServer.ListToRegions()
- _, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
- if err != nil {
- return err
- }
- rsp.Data = g.Map{"list": list}
- return nil
- }
- // GetProvinceList 返回所有省份的
- func (d *DistrictHandler) GetProvinceList(ctx context.Context, null, rsp *comm_def.CommonMsg) error {
- districtServer, err := server.NewDistrictService(ctx)
- if err != nil {
- return err
- }
- list, err := districtServer.GetProvinceList()
- _, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
- if err != nil {
- return err
- }
- rsp.Data = g.Map{"list": list}
- return nil
- }
|