2019-12-02 17:53:08 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
2020-03-05 12:41:49 +08:00
|
|
|
namespace wchat\qq;
|
2019-12-02 17:53:08 +08:00
|
|
|
|
2020-03-05 12:41:49 +08:00
|
|
|
use wchat\common\Help;
|
|
|
|
|
use wchat\common\Result;
|
2019-12-02 17:53:08 +08:00
|
|
|
use qq\result\RedHatResult;
|
|
|
|
|
|
|
|
|
|
class Redhat extends SmallProgram
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private $charset = 'UTF8';
|
|
|
|
|
private $nonce_str = '';
|
|
|
|
|
private $sign = '';
|
|
|
|
|
private $mch_billno = '';
|
|
|
|
|
private $mch_id = '';
|
|
|
|
|
private $mch_name = '';
|
|
|
|
|
private $qqappid = '';
|
|
|
|
|
private $re_openid = '';
|
|
|
|
|
private $total_amount = '';
|
|
|
|
|
private $total_num = '';
|
|
|
|
|
private $wishing = '';
|
|
|
|
|
private $act_name = '';
|
|
|
|
|
private $icon_id = '';
|
|
|
|
|
private $banner_id = '';
|
|
|
|
|
private $notify_url = '';
|
|
|
|
|
private $not_send_msg = '';
|
|
|
|
|
private $min_value = '';
|
|
|
|
|
private $max_value = '';
|
|
|
|
|
private $key = '';
|
|
|
|
|
private $signType = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private $sendUrl = 'https://api.qpay.qq.com/cgi-bin/hongbao/qpay_hb_mch_send.cgi';
|
|
|
|
|
private $searchUrl = 'https://qpay.qq.com/cgi-bin/mch_query/qpay_hb_mch_list_query.cgi';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getKey()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->key;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $key
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setKey($key): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->key = $key;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getSignType()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->signType;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $signType
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setSignType($signType): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->signType = $signType;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getCharset()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->charset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $charset
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setCharset($charset): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->charset = $charset;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getNonceStr()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->nonce_str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $nonce_str
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setNonceStr($nonce_str): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->nonce_str = $nonce_str;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getSign()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->sign;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $sign
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setSign($sign): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->sign = $sign;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getMchBillno()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
if (empty($this->mch_billno)) {
|
|
|
|
|
return '1559179381' . date('Ymd') . mt_rand(11, 99) . date('His') . mt_rand(11, 99);
|
|
|
|
|
}
|
|
|
|
|
return $this->mch_billno;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $mch_billno
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setMchBillno($mch_billno): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->mch_billno = $mch_billno;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getMchId()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->mch_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $mch_id
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setMchId($mch_id): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->mch_id = $mch_id;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getMchName()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->mch_name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $mch_name
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setMchName($mch_name): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->mch_name = $mch_name;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getQqappid()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->qqappid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $qqappid
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setQqappid($qqappid): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->qqappid = $qqappid;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getReOpenid()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->re_openid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $re_openid
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setReOpenid($re_openid): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->re_openid = $re_openid;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getTotalAmount()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->total_amount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $total_amount
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setTotalAmount($total_amount): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->total_amount = $total_amount;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getTotalNum()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->total_num;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $total_num
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setTotalNum($total_num): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->total_num = $total_num;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getWishing()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->wishing;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $wishing
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setWishing($wishing): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->wishing = $wishing;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getActName()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->act_name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $act_name
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setActName($act_name): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->act_name = $act_name;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getIconId()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->icon_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $icon_id
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setIconId($icon_id): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->icon_id = $icon_id;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getBannerId()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->banner_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $banner_id
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setBannerId($banner_id): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->banner_id = $banner_id;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getNotifyUrl()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->notify_url;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $notify_url
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setNotifyUrl($notify_url): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->notify_url = $notify_url;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getNotSendMsg()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->not_send_msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $not_send_msg
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setNotSendMsg($not_send_msg): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->not_send_msg = $not_send_msg;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getMinValue()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->min_value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $min_value
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setMinValue($min_value): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->min_value = $min_value;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-04-06 15:15:37 +08:00
|
|
|
public function getMaxValue()
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
return $this->max_value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-04-06 15:20:39 +08:00
|
|
|
* @param $max_value
|
2019-12-02 17:53:08 +08:00
|
|
|
* @return Redhat
|
|
|
|
|
*/
|
2021-04-06 15:20:39 +08:00
|
|
|
public function setMaxValue($max_value): Redhat
|
2019-12-02 17:53:08 +08:00
|
|
|
{
|
|
|
|
|
$this->max_value = $max_value;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return mixed
|
|
|
|
|
* 构建请求参数
|
|
|
|
|
*/
|
|
|
|
|
private function generate()
|
|
|
|
|
{
|
|
|
|
|
$requestParam['charset'] = $this->getCharset();
|
|
|
|
|
$requestParam['nonce_str'] = $this->getNonceStr();
|
|
|
|
|
$requestParam['mch_billno'] = $this->getMchBillno();
|
|
|
|
|
$requestParam['mch_id'] = $this->getMchId();
|
|
|
|
|
$requestParam['mch_name'] = $this->getMchName();
|
|
|
|
|
$requestParam['qqappid'] = $this->getQqappid();
|
|
|
|
|
$requestParam['re_openid'] = $this->getReOpenid();
|
|
|
|
|
$requestParam['total_amount'] = $this->getTotalAmount() * 100;
|
|
|
|
|
$requestParam['min_value'] = $this->getMinValue() * 100;
|
|
|
|
|
$requestParam['max_value'] = $this->getMaxValue() * 100;
|
|
|
|
|
$requestParam['total_num'] = $this->getTotalNum();
|
|
|
|
|
$requestParam['wishing'] = $this->getWishing();
|
|
|
|
|
$requestParam['act_name'] = $this->getActName();
|
|
|
|
|
$requestParam['icon_id'] = $this->getIconId();
|
|
|
|
|
$requestParam['notify_url'] = $this->getNotifyUrl();
|
|
|
|
|
|
|
|
|
|
$requestParam['sign'] = $this->builderSign($requestParam);
|
|
|
|
|
|
|
|
|
|
return $requestParam;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param $requestParam
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
private function builderSign($requestParam)
|
|
|
|
|
{
|
|
|
|
|
return Help::sign($requestParam, $this->getKey(), $this->getSignType());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
* @throws
|
|
|
|
|
* 发红包
|
|
|
|
|
*/
|
|
|
|
|
public function redEnvelopes()
|
|
|
|
|
{
|
|
|
|
|
$callback = function ($response) {
|
|
|
|
|
$json = json_decode($response, true);
|
|
|
|
|
if (isset($json['return_code']) && $json['return_code'] != 'SUCCESS') {
|
|
|
|
|
$message = $json['return_msg'] ?? $json['retmsg'];
|
|
|
|
|
$param = ['code' => 500, 'message' => $message];
|
|
|
|
|
} else if ($json['retcode'] != 0) {
|
|
|
|
|
$param = ['code' => $json['retcode'], 'message' => $json['retmsg']];
|
|
|
|
|
} else {
|
|
|
|
|
$param = ['code' => 0, 'message' => $json['retmsg'], 'data' => ['listid' => $json['listid']]];
|
|
|
|
|
}
|
|
|
|
|
return new Result($param);
|
|
|
|
|
};
|
|
|
|
|
$this->request->setCallback($callback);
|
|
|
|
|
$response = $this->request->post($this->sendUrl, $this->generate());
|
|
|
|
|
if (!$response->isResultsOK()) {
|
|
|
|
|
throw new \Exception($response->getMessage());
|
|
|
|
|
}
|
|
|
|
|
return $response->getData('listid');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param $listid
|
|
|
|
|
* @param null $orderNo
|
|
|
|
|
* @return RedHatResult
|
|
|
|
|
* @throws \Exception
|
|
|
|
|
*
|
|
|
|
|
* 查询红包状态
|
|
|
|
|
*/
|
|
|
|
|
public function searchByOrderNo($listid, $orderNo = null)
|
|
|
|
|
{
|
|
|
|
|
$requestParam['nonce_str'] = $this->getNonceStr();
|
|
|
|
|
$requestParam['mch_id'] = $this->getMchId();
|
|
|
|
|
$requestParam['listid'] = $listid;
|
|
|
|
|
if (!empty($orderNo)) {
|
|
|
|
|
$requestParam['mch_billno'] = $orderNo;
|
|
|
|
|
}
|
|
|
|
|
$requestParam['sign'] = $this->builderSign($requestParam);
|
|
|
|
|
$this->request->setCallback(function ($response) {
|
|
|
|
|
$response = json_decode($response, true);
|
|
|
|
|
if (!isset($response['result']) || $response['result'] != 0) {
|
|
|
|
|
$param = ['code' => 500, 'message' => $response['res_info'] ?? '订单查询失败!', 'data' => $response];
|
|
|
|
|
} else {
|
|
|
|
|
$param = ['code' => 0, 'message' => 'system success!', 'data' => $response];
|
|
|
|
|
}
|
|
|
|
|
return new Result($param);
|
|
|
|
|
});
|
|
|
|
|
$response = $this->request->get($this->searchUrl, $requestParam);
|
|
|
|
|
if (!$response->isResultsOK()) {
|
|
|
|
|
throw new \Exception($response->getMessage());
|
|
|
|
|
}
|
|
|
|
|
return new RedHatResult($response->getData());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|