updated image
This commit is contained in:
parent
214f596ba9
commit
937b73cc16
|
@ -4,8 +4,8 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
"gitlink.org.cn/JointCloud/pcm-openi/common"
|
||||
"gitlink.org.cn/JointCloud/pcm-openi/model"
|
||||
"gitlink.org.cn/JointCloud/pcm-openi/service"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func GetImageRecommended(ctx *gin.Context) {
|
||||
|
@ -17,22 +17,10 @@ func GetImageRecommended(ctx *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
reqUrl := common.OPENIPREFIX + common.IMAGERECOMMENDED
|
||||
|
||||
var resp model.ImageRecommended
|
||||
|
||||
req := common.GetRestyRequest(common.TIMEOUT)
|
||||
_, err := req.
|
||||
SetQueryParam(common.ACCESSTOKEN, token).
|
||||
SetQueryParam("computeResource", param.ComputeResource).
|
||||
SetQueryParam("cloudbrainType", strconv.Itoa(param.CloudbrainType)).
|
||||
SetQueryParam("q", param.Q).
|
||||
SetQueryParam("spec", strconv.Itoa(param.Spec)).
|
||||
SetQueryParam("trainType", param.TrainType).
|
||||
SetQueryParam("page", strconv.Itoa(param.Page)).
|
||||
SetQueryParam("pageSize", strconv.Itoa(param.PageSize)).
|
||||
SetResult(&resp).
|
||||
Get(reqUrl)
|
||||
resp, err := service.GetImageRecommended(token, ¶m)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
model.Response(ctx, 500, common.INVOKEERROR, err)
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"github.com/go-resty/resty/v2"
|
||||
"gitlink.org.cn/JointCloud/pcm-openi/common"
|
||||
"gitlink.org.cn/JointCloud/pcm-openi/model"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func GetImageRecommended(token string, param *model.ImageRecommendedParam) (resp *model.ImageRecommended, err error) {
|
||||
respErr := &model.RespErr{}
|
||||
_, err = common.Request(common.IMAGERECOMMENDED, http.MethodGet, func(req *resty.Request) {
|
||||
req.SetQueryParam(common.ACCESSTOKEN, token).
|
||||
SetQueryParam("computeResource", param.ComputeResource).
|
||||
SetQueryParam("cloudbrainType", strconv.Itoa(param.CloudbrainType)).
|
||||
SetQueryParam("q", param.Q).
|
||||
SetQueryParam("spec", strconv.Itoa(param.Spec)).
|
||||
SetQueryParam("trainType", param.TrainType).
|
||||
SetQueryParam("page", strconv.Itoa(param.Page)).
|
||||
SetQueryParam("pageSize", strconv.Itoa(param.PageSize)).
|
||||
SetError(&respErr).
|
||||
SetResult(&resp)
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue