All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netease.yidun.sdk.antispam.videosolution.callback.v2.VideoSolutionActiveCallbackDemo Maven / Gradle / Ivy

The newest version!
package com.netease.yidun.sdk.antispam.videosolution.callback.v2;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.netease.yidun.sdk.antispam.callback.ActiveCallbackResp;
import com.netease.yidun.sdk.antispam.videosolution.callback.v2.request.VideoSolutionV2ActiveCallbackRequest;
import com.netease.yidun.sdk.antispam.videosolution.callback.v2.response.VideoSolutionCallbackV2Result;
import com.netease.yidun.sdk.core.utils.SignatureUtils;

/**
 * 主动回调解析结果demo
 */
@RestController
@RequestMapping("callback/receive")
public class VideoSolutionActiveCallbackDemo {

    private static final String SECRET_KEY = "SECRET_KEY";

    @RequestMapping("videoSolution")
    public ActiveCallbackResp receiveCallback(HttpServletRequest request,
            VideoSolutionV2ActiveCallbackRequest callbackResp) {
        try {
            if (!SignatureUtils.verifySignature(request.getParameterMap(), SECRET_KEY)) {
                return ActiveCallbackResp.fail(ActiveCallbackResp.SIGN_ERROR);
            }
            VideoSolutionCallbackV2Result videoSolutionCallbackV2Result = callbackResp.parseCallbackData();
            // 根据需要解析字段,具体返回字段的说明,请参考官方接口文档中字段说明
            // https://support.dun.163.com/documents/594247746924453888?docId=605248448360099840

            return ActiveCallbackResp.ok();
        } catch (Exception e) {
            e.printStackTrace();
            return ActiveCallbackResp.fail(ActiveCallbackResp.SERVER_ERROR);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy