$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); } /** * 推送事件 * @author solu * @param $channel * @param $data * @param null $objRedis * @return int */ public static function event($channel, $data, $objRedis = null) { !$objRedis && $objRedis = dwRedis::initNewOne(); if (is_array($data)) { $data = json_encode($data); } return $objRedis->publish($channel, $data); } public static function pushPersonEvent($to, array $data) { $channel = "chat:person:{$to}"; !$data['timestamp'] && $data['timestamp'] = Session::getMS(); return self::event($channel, $data); } public static function pushGroupEvent($groupId, array $data) { $channel = 'chat:group'; // 全局 !$data['timestamp'] && $data['timestamp'] = Session::getMS(); $data['group_id'] = (int) $groupId; $groupId > 0 && $channel .= ":{$groupId}"; return self::event($channel, $data); } }