<?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($lzbjA, $rvTrU = null, $STVWD = null) { $uavKu = new ModStartOpenApi(); return $uavKu->setApiBase($lzbjA)->setKey($rvTrU)->setSecret($STVWD); } public function setApiBase($lzbjA) { $this->apiBase = $lzbjA; return $this; } public function setKey($rvTrU) { $this->key = $rvTrU; return $this; } public function setSecret($STVWD) { $this->secret = $STVWD; return $this; } public function post($YjgEW, $OTBPk) { goto sabL6; sabL6: $zlK8N = array(); goto CvOi9; R8No5: return $UdQ1p['data']; goto maceg; jfa1y: $zlK8N['timestamp'] = time(); goto cYP7X; cYP7X: $zlK8N['sign'] = SignUtil::common($zlK8N, $this->secret); goto DL2is; wV19U: if (Response::isError($UdQ1p)) { return Response::generateError($UdQ1p['msg']); } goto R8No5; DL2is: $UdQ1p = CurlUtil::postJSON($this->apiBase . $YjgEW, json_encode(array_merge($zlK8N, $OTBPk)), array('header' => array('Content-Type' => 'application/json', 'Accept' => 'application/json'))); goto wV19U; CvOi9: $zlK8N['key'] = $this->key; goto jfa1y; maceg: } }