<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\App\OpenApi\Util; use ModStart\Core\Input\Response; use ModStart\Core\Util\CurlUtil; use ModStart\Core\Util\SignUtil; class ModStartOpenApi { private $apiBase; private $key; private $secret; public static function create($aGZ6Z, $HQKqq = null, $Jxb45 = null) { $pDrCH = new ModStartOpenApi(); return $pDrCH->setApiBase($aGZ6Z)->setKey($HQKqq)->setSecret($Jxb45); } public function setApiBase($aGZ6Z) { $this->apiBase = $aGZ6Z; return $this; } public function setKey($HQKqq) { $this->key = $HQKqq; return $this; } public function setSecret($Jxb45) { $this->secret = $Jxb45; return $this; } public function post($iERFh, $Sj05q) { goto RrvRo; GYqXX: $pFM9U['key'] = $this->key; goto qXjx3; RrvRo: $pFM9U = array(); goto GYqXX; kKZUc: if (Response::isError($N2Xaa)) { return Response::generateError($N2Xaa['msg']); } goto TgFF5; qXjx3: $pFM9U['timestamp'] = time(); goto vX92n; TgFF5: return $N2Xaa['data']; goto pr8bF; vX92n: $pFM9U['sign'] = SignUtil::common($pFM9U, $this->secret); goto w9jTS; w9jTS: $N2Xaa = CurlUtil::postJSON($this->apiBase . $iERFh, json_encode(array_merge($pFM9U, $Sj05q)), array('header' => array('Content-Type' => 'application/json', 'Accept' => 'application/json'))); goto kKZUc; pr8bF: } }