public function __construct($url, array $key, $merCustId) { if (empty($url) || empty($key) || empty($merCustId)) { throw new Exception('URL、KEY、MERCUST_ID为必要参数。其中KEY参数为数组,传入私有KEY和公有KEY!'); } $this->config = ['url' => $url, 'privateKey' => Arr::get($key, 'privateKey', ''), 'publicKey' => Arr::get($key, 'publicKey', ''), 'merCustId' => $merCustId]; $this->attribute = (array) $this->attribute(); //获得属性参数 $this->sortAttribute = (array) $this->sortAttribute(); //获取排序顺序参数 $this->requiredAttr = (array) $this->requiredAttr(); //获取必要参数 $this->value['Version'] = self::VERSION_10; //设置版本号,默认为10版本 $className = explode('\\', get_class($this)); //静态获取类名 $this->value['CmdId'] = end($className); //设置操作 $this->value['MerCustId'] = $this->config['merCustId']; //设置商户号 }
public function getDesc() { return Arr::get($this->value, 'RespDesc', ''); }
public function getCardId() { return Arr::get($this->value, 'UsrCustId'); }
public function __get($key) { return Arr::get($this->value, $key); }