<?php
/**
 * 第三方接口
 * User: solu
 * Date: 2018/12/10
 * Time: 4:40 PM
 */

class ThirdApi {

    /**
     * 上报游戏结果
     * @author solu
     * @param $gameId
     * @param $betAmount
     * @param $winAmount
     * @param string $appid
     * @return mixed
     */
    public static function reportGameResult($gameId, $betAmount, $winAmount, $appid = 'baccarat') {
        $api = URL_SICBO . 'eos/gameResult';
        $data = [
            'gameid' => $gameId,
            'game_name' => $appid,
            'bet_amount' => $betAmount,
            'win_amount' => $winAmount,
        ];
        $objEosAES = new EosAES($GLOBALS['codeGtAdmin']);
        $objHttp = new dwHttp();

        $seed = "{$appid}|{$gameId}";
        $data['sign'] = $objEosAES->encode($seed);

        $resp = $objHttp->post2($api, $data);
        return json_decode($resp, true);
    }
}