package com.zanxiang.game.back.serve.controller.api;

import com.zanxiang.game.back.serve.pojo.dto.GameOceanengineAppCallbackDTO;
import com.zanxiang.game.back.serve.service.IGameOceanengineAppCallbackService;
import com.zanxiang.module.util.JsonUtil;
import com.zanxiang.module.util.pojo.ResultVO;
import lombok.extern.slf4j.Slf4j;
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;

/**
 * 头条监测链接
 */
@Slf4j
@RestController
@RequestMapping("/api/oceanengineCallback")
public class OceanengineCallbackApi {

    @Autowired
    private IGameOceanengineAppCallbackService gameOceanengineAppCallbackService;

    // https://api.zanxiangwl.com/gameBack/api/oceanengineCallback/callback?promotionid=__PROMOTION_ID__&projectId=__PROJECT_ID__&mid1=__MID1__&mid2=__MID2__&mid3=__MID3__&mid4=__MID4__&mid5=__MID5__&mid6=__MID6__
    // &aid=__AID__&cid=__CID__&campaignId=__CAMPAIGN_ID__&ctype=__CTYPE__&advertiserId=__ADVERTISER_ID__&csite=__CSITE__&convertId=__CONVERT_ID__&requestId=__REQUEST_ID__&trackId=__TRACK_ID__&sl=__SL__
    // &imei=__imei__&idfa=__IDFA__&idfaMd5=__IDFA_MD5__&androidid=__ANDROIDID__&oaid=__OAID__&oaidMd5=__OAID_MD5__&os=__OS__&mac=__MAC__&mac1=MAC1&ipv4=__IPV4__&ipv6=__ipv6__&ip=__IP__
    // &ua=__UA__&geo=__GEO__&ts=__TS__&callbackParam=__CALLBACK_PARAM__&callbackUrl=__CALLBACK_URL__&model=__MODEL__&unionSite=__UNION_SITE__&caid=__CAID__&productid=__PRODUCTID__&outerid=__OUTERID__
    @GetMapping("/callback")
    public ResultVO<Boolean> callback(GameOceanengineAppCallbackDTO dto) {
        log.info("头条监测链接：{}", JsonUtil.toString(dto));
        return ResultVO.ok(gameOceanengineAppCallbackService.callback(dto));
    }
}
