<?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($vTdhW, $dwwIV = null, $IJu4T = null) { $GmvQf = new ModStartOpenApi(); return $GmvQf->setApiBase($vTdhW)->setKey($dwwIV)->setSecret($IJu4T); } public function setApiBase($vTdhW) { $this->apiBase = $vTdhW; return $this; } public function setKey($dwwIV) { $this->key = $dwwIV; return $this; } public function setSecret($IJu4T) { $this->secret = $IJu4T; return $this; } public function post($VzVt9, $SjN8A) { goto Q4f6w; ckDg1: $oK4I3['timestamp'] = time(); goto P2zCC; zP2Np: $pTwJr = CurlUtil::postJSON($this->apiBase . $VzVt9, json_encode(array_merge($oK4I3, $SjN8A)), array('header' => array('Content-Type' => 'application/json', 'Accept' => 'application/json'))); goto FGFzL; uv700: return $pTwJr['data']; goto IrFp0; FGFzL: if (Response::isError($pTwJr)) { return Response::generateError($pTwJr['msg']); } goto uv700; P2zCC: $oK4I3['sign'] = SignUtil::common($oK4I3, $this->secret); goto zP2Np; Q4f6w: $oK4I3 = array(); goto dSCmy; dSCmy: $oK4I3['key'] = $this->key; goto ckDg1; IrFp0: } }