<?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($QytV_, $oMJcb = null, $XCTFj = null) { $Sqehx = new ModStartOpenApi(); return $Sqehx->setApiBase($QytV_)->setKey($oMJcb)->setSecret($XCTFj); } public function setApiBase($QytV_) { $this->apiBase = $QytV_; return $this; } public function setKey($oMJcb) { $this->key = $oMJcb; return $this; } public function setSecret($XCTFj) { $this->secret = $XCTFj; return $this; } public function post($MiLaY, $dTnlu) { goto v3V_Y; pgPhd: if (Response::isError($bCCWW)) { return Response::generateError($bCCWW['msg']); } goto anqL7; QkkKW: $bCCWW = CurlUtil::postJSON($this->apiBase . $MiLaY, SerializeUtil::jsonEncode(array_merge($mattM, $dTnlu)), array('header' => array('Content-Type' => 'application/json', 'Accept' => 'application/json'))); goto pgPhd; nH6VV: $mattM['timestamp'] = time(); goto aiRfe; LEk_K: $mattM['key'] = $this->key; goto nH6VV; aiRfe: $mattM['sign'] = SignUtil::common($mattM, $this->secret); goto QkkKW; v3V_Y: $mattM = array(); goto LEk_K; anqL7: return $bCCWW['data']; goto yNpRO; yNpRO: } }