<?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($GKqJY, $l6tBV = null, $DH19U = null) { $m4Vvp = new ModStartOpenApi(); return $m4Vvp->setApiBase($GKqJY)->setKey($l6tBV)->setSecret($DH19U); } public function setApiBase($GKqJY) { $this->apiBase = $GKqJY; return $this; } public function setKey($l6tBV) { $this->key = $l6tBV; return $this; } public function setSecret($DH19U) { $this->secret = $DH19U; return $this; } public function post($ik1Qg, $zvN10) { goto nvPcp; TNLHc: $ACVUe['key'] = $this->key; goto RatD9; spw0E: $ACVUe['sign'] = SignUtil::common($ACVUe, $this->secret); goto Xp3um; lNKWj: if (Response::isError($ZIe4d)) { return Response::generateError($ZIe4d['msg']); } goto lc63G; RatD9: $ACVUe['timestamp'] = time(); goto spw0E; nvPcp: $ACVUe = array(); goto TNLHc; Xp3um: $ZIe4d = CurlUtil::postJSON($this->apiBase . $ik1Qg, SerializeUtil::jsonEncode(array_merge($ACVUe, $zvN10)), array('header' => array('Content-Type' => 'application/json', 'Accept' => 'application/json'))); goto lNKWj; lc63G: return $ZIe4d['data']; goto r57pN; r57pN: } }