package com.jeequan.jeepay.agent.ctrl.merchant;

import com.jeequan.jeepay.agent.ctrl.CommonCtrl;
import com.jeequan.jeepay.core.model.ApiRes;
import com.jeequan.jeepay.core.model.OCRImgParams;
import com.jeequan.jeepay.service.impl.ImgInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 图片信息OCR
 *
 * @author xiaoyu
 *
 * @date 2022/1/12 15:15
 */
@RestController
@RequestMapping("/api/imgInfo")
public class ImgInfoOCRController extends CommonCtrl {

    @Autowired private ImgInfoService imgInfoService;

    /** 图片信息 **/
    @PreAuthorize("hasAuthority('ENT_MCH_IMG_OCR_DETAIL')")
    @PostMapping("/detail")
    public ApiRes detail() {
        String imgUrl = getValStringRequired("imgUrl");
        String type = getValStringRequired("type");
        // 调用ocr接口
        OCRImgParams imgParams = imgInfoService.getImgInfo(imgUrl, type);
        return ApiRes.ok(imgParams);
    }


}
