<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\App\OpenApi\Util; use ModStart\Core\Input\Response; use ModStart\Core\Util\CurlUtil; use ModStart\Core\Util\SerializeUtil; use ModStart\Core\Util\SignUtil; class ModStartOpenApi { private $apiBase; private $key; private $secret; public static function create($nTcu0, $VFU9l = null, $mGD19 = null) { $DGIBX = new ModStartOpenApi(); return $DGIBX->setApiBase($nTcu0)->setKey($VFU9l)->setSecret($mGD19); } public function setApiBase($nTcu0) { $this->apiBase = $nTcu0; return $this; } public function setKey($VFU9l) { $this->key = $VFU9l; return $this; } public function setSecret($mGD19) { $this->secret = $mGD19; return $this; } public function post($tpgiq, $zonFp) { goto tgmaO; SsYvJ: $Z5nZL = CurlUtil::postJSON($this->apiBase . $tpgiq, SerializeUtil::jsonEncode(array_merge($AXgEz, $zonFp)), array('header' => array('Content-Type' => 'application/json', 'Accept' => 'application/json'))); goto xjXgS; nIyDL: $AXgEz['key'] = $this->key; goto qeaGK; tgmaO: $AXgEz = array(); goto nIyDL; xjXgS: if (Response::isError($Z5nZL)) { return Response::generateError($Z5nZL['msg']); } goto jTrHS; qeaGK: $AXgEz['timestamp'] = time(); goto IwL4m; IwL4m: $AXgEz['sign'] = SignUtil::common($AXgEz, $this->secret); goto SsYvJ; jTrHS: return $Z5nZL['data']; goto Pe6yn; Pe6yn: } }