package com.ruoyi.web.controller.aliexpress;

import com.global.iop.api.IopClient;
import com.global.iop.api.IopClientImpl;
import com.global.iop.api.IopRequest;
import com.global.iop.api.IopResponse;
import com.global.iop.domain.Protocol;
import com.global.iop.util.ApiException;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户信息
 * 
 * @author ruoyi
 */
@RestController
@Api("对接速卖通图片演示")
@RequestMapping("/aliexpress/img")
public class AliexpressDemoController extends BaseController
{

    /**
     * 获取图片银行分页查询
     */
    @Log(title = "查询图片", businessType = BusinessType.SELECT)
    @ApiOperation("获取用户列表")
    @GetMapping("/list")
    public String list(SysUser user) throws ApiException {
        IopClient iopClient = new IopClientImpl("https://api-sg.aliexpress.com", "500516", "5KD1nXaPxADnXUxISAImi1gcgPqbKMN4");;
        IopRequest request = new IopRequest();
        request.setApiName("aliexpress.photobank.redefining.listimagepagination");
        request.addApiParameter("aeop_image_pagination_request", "{\"group_id\":\"0\", \"current_page\":\"1\",\"location_type\":\"0\",\"page_size\":\"10\"}");
        IopResponse response = iopClient.execute(request, "50000100810eAzdp7j9nwt11e7586aQDBYn1hnSitvhdCbyemVxjhEPKZHhuGq44F3KQ", Protocol.TOP);
        System.out.println("list:" + response.getGopResponseBody());
        return response.getGopResponseBody();
    }
}
