package smdl import ( "admin/apps/game/domain/entity" "admin/internal/errcode" "admin/internal/model/dto" "admin/lib/httpclient" ) type Items struct { } func (items *Items) GetItems(projectInfo *entity.Project) ([]*dto.CommonDtoFieldChoice, error) { //return []*dto.CommonDtoFieldChoice{ // {Desc: "黄金战甲", Value: 123, Type: 1}, // {Desc: "黄金头盔", Value: 234, Type: 1}, // {Desc: "黄金大刀", Value: 346, Type: 1}, // {Desc: "白银大刀", Value: 346, Type: 1}, //}, nil alisrvAddr := projectInfo.GetApiAddr() if alisrvAddr == "" { return nil, errcode.New(errcode.ServerError, "项目%v没有配置api服务器地址", projectInfo.Po.Name) } type RspData struct { Code int `json:"code"` Msg string `json:"msg"` Data struct { List []*dto.CommonDtoFieldChoice `json:"list"` } `json:"data"` } rsp := &RspData{} err := httpclient.Request(alisrvAddr+"/items", "get", nil, rsp) if err != nil { return make([]*dto.CommonDtoFieldChoice, 0), nil } return rsp.Data.List, nil }