<?php
namespace app\common\lib\gjp;
class Apiurl
{
protected $userId;
protected $appKey;
protected $SercretKey;
protected $currentTimestamp;
protected $dbName;
public function __construct($userId = '********')
{
$this->appKey = "*****************";
$this->SercretKey = "*******************";
$this->currentTimestamp = time();
$this->userId = $userId;
$this->dbName = '*****';
}
public function getApiUrl()
{
$url = "http://api.cmgrasp.com/CMGraspApi/GateWay";
$instanceGjpBasic = new \app\common\lib\gjp\Basic();
$instanceStr = new \app\common\lib\data\Str();
$randamStr = $instanceStr->setNonce(32,true);
$md5BeforeStr = "AppKey".$this->appKey."InvalidTime".date('YmdHis',$this->currentTimestamp)."RandamStr".$randamStr."UserId".$this->userId.$this->SercretKey;
$data = [
'MethodName' => (string)"graspcm.cmapi.getcustomerapiurl",
'AppKey' => (string)$this->appKey,
'UserId' => (string)$this->userId,
'InvalidTime' => (string)date('Y-m-d H:i:s'),
'RandamStr' => (string)$randamStr,
'SignStr' => (string)md5($md5BeforeStr),
'DbName' => (string)$this->dbName
];
$jsonData = json_encode($data);
$result = $instanceGjpBasic->curlRequest($url,"POST",$jsonData,true,false);
if($result['RetCode'] != 0){
$this->getApiUrl();
}
$resultData = json_decode($result['RetMsg'],true);
return $resultData;
}
}
版权属于:
小破孩
作品采用:
《
署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
》许可协议授权
评论 (0)