package officialWebsiteser import "91porn-server/models/v/officialWebsitemod" type PartnerListReq struct{} type PartnerListResp struct { Total int64 `json:"total"` List []PartnerResp `json:"list"` } type PartnerResp struct { Name string `json:"name"` Description string `json:"description"` Logo string `json:"logo"` Url string `json:"url"` } func PartnerList(req *PartnerListReq) (resp PartnerListResp, err error) { data, err := (&officialWebsitemod.Partner{}).FindMany(nil) if err != nil { return } resp = PartnerListResp{ Total: int64(len(data)), List: make([]PartnerResp, 0), } for _, v := range data { resp.List = append(resp.List, PartnerResp{ Name: v.Name, Description: v.Description, Logo: v.Logo, Url: v.Url, }) } return resp, nil }