package com.union.ai.api.controller.face;

import com.alibaba.fastjson.JSON;
import com.union.ai.api.consts.ResultCodeEnum;
import com.union.ai.api.dto.H5LivenessParamDto;
import com.union.ai.api.util.Config;
import com.union.ai.api.util.HttpClientUtil;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by IntelliJ IDEA.
 * Author: xingxin.jing
 * Date: 2019/3/30
 * Time: 下午6:29
 */
@RestController
@RequestMapping(value = "/face-api/face/", method = RequestMethod.POST)
public class FaceController {


    @RequestMapping("liveness")
    public String liveness(@RequestBody String video_base64) {
        if (video_base64 == null) {
            return JSON.toJSONString(ResultCodeEnum.RESULT_222001);
        }
        String url = Config.getInstance().getFaceUrl() + "liveness";
        return HttpClientUtil.sendPostJSON(url, video_base64);
    }
}
