<?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($gCPBo, $GUcFO = null, $SsJ23 = null) { $lAU1x = new ModStartOpenApi(); return $lAU1x->setApiBase($gCPBo)->setKey($GUcFO)->setSecret($SsJ23); } public function setApiBase($gCPBo) { $this->apiBase = $gCPBo; return $this; } public function setKey($GUcFO) { $this->key = $GUcFO; return $this; } public function setSecret($SsJ23) { $this->secret = $SsJ23; return $this; } public function post($XVqXz, $IaeCl) { goto n9HuZ; A32XL: if (Response::isError($gbVzz)) { return Response::generateError($gbVzz['msg']); } goto nLVfo; hGMX_: $pmJAc['key'] = $this->key; goto PQ6A8; PQ6A8: $pmJAc['timestamp'] = time(); goto uFAMd; SnyKe: $gbVzz = CurlUtil::postJSON($this->apiBase . $XVqXz, json_encode(array_merge($pmJAc, $IaeCl)), array('header' => array('Content-Type' => 'application/json', 'Accept' => 'application/json'))); goto A32XL; uFAMd: $pmJAc['sign'] = SignUtil::common($pmJAc, $this->secret); goto SnyKe; nLVfo: return $gbVzz['data']; goto cvE8Z; n9HuZ: $pmJAc = array(); goto hGMX_; cvE8Z: } }