12 Commits

Author SHA1 Message Date
as2252258 aeb7a8c4b5 add clear 2020-08-10 11:19:52 +08:00
as2252258 e8c1f12fc8 add clear 2020-08-10 11:17:42 +08:00
as2252258 28a2b0b4f8 add clear 2020-07-30 17:17:46 +08:00
as2252258 7a8c869f6a add clear 2020-07-30 17:11:07 +08:00
as2252258 2e83dbc44f add clear 2020-07-30 17:09:48 +08:00
as2252258 7e58adf4ff add clear 2020-07-30 17:08:36 +08:00
as2252258 df40f74560 add clear 2020-07-30 16:58:05 +08:00
as2252258 7329a24577 add clear 2020-07-30 16:54:44 +08:00
as2252258 557c92a343 add clear 2020-07-30 16:49:30 +08:00
as2252258 2969eac00e add clear 2020-07-30 16:46:45 +08:00
as2252258 f218e12de3 add clear 2020-07-30 16:44:45 +08:00
as2252258 b6544dbb8e add clear 2020-07-30 16:43:54 +08:00
3 changed files with 101 additions and 314 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ abstract class Template extends Miniprogarampage
}
$params = json_encode($params, JSON_UNESCAPED_UNICODE);
$this->request->setIsSSL(true);
$this->request->addHeader('Content-Type', 'application/json');
$this->request->addHeader('Content-Type', 'application/json; charset=utf-8');
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
$result = $this->request->post($url, $params);
-1
View File
@@ -510,7 +510,6 @@ class HttpClient
} else {
$this->_data = $this->mergeParams($data);
}
if (!empty($this->_data)) {
$client->setData($this->_data);
}
+100 -312
View File
@@ -3,38 +3,32 @@
namespace wchat\qq;
use Exception;
use wchat\common\Help;
/**
* Class Notify
* @package wchat\qq
*/
class Notify extends SmallProgram
{
public $appid = '';
public $mch_id = '';
public $device_info = '';
public $nonce_str = '';
public $sign = '';
public $sign_type = '';
public $result_code = '';
public $err_code = '';
public $err_code_des = '';
public $openid = '';
public $is_subscribe = '';
public $trade_type = '';
public $bank_type = '';
public $total_fee = '';
public $settlement_total_fee = '';
public $fee_type = '';
public $cash_fee = '';
public $cash_fee_type = '';
public $coupon_fee = '';
public $coupon_count = '';
public $coupon_type_n = '';
public $coupon_id_n = '';
public $coupon_fee_n = '';
public $transaction_id = '';
public $out_trade_no = '';
public $attach = '';
public $time_end = '';
public $return_code = '';
public $appid = null;
public $mch_id = null;
public $nonce_str = null;
public $sign = null;
public $device_info = null;
public $trade_type = null;
public $trade_state = null;
public $bank_type = null;
public $fee_type = null;
public $total_fee = null;
public $cash_fee = null;
public $coupon_fee = null;
public $transaction_id = null;
public $out_trade_no = null;
public $attach = null;
public $time_end = null;
public $openid = null;
/**
* @return bool
@@ -42,27 +36,18 @@ class Notify extends SmallProgram
*/
public function isSuccess()
{
if ($this->getReturnCode() != "SUCCESS") {
return false;
}
if ($this->getResultCode() != 'SUCCESS') {
return false;
}
return true;
return $this->getTradeState() === 'SUCCESS';
}
/**
* @param array $params
* @return $this
* @throws Exception
*/
public function setPayNotifyData(array $params)
{
if (!$this->validation($params)) {
$this->setResultCode('FAIL');
$this->setErrCodeDes('签名错误');
unset($params['result_code'], $params['err_code_des']);
throw new Exception('签名错误!');
}
foreach ($params as $key => $val) {
if (!property_exists($this, $key)) {
@@ -93,7 +78,7 @@ class Notify extends SmallProgram
}
/**
* @return mixed
* @return null
*/
public function getAppid()
{
@@ -101,7 +86,7 @@ class Notify extends SmallProgram
}
/**
* @param mixed $appid
* @param null $appid
* @return Notify
*/
public function setAppid($appid)
@@ -111,7 +96,7 @@ class Notify extends SmallProgram
}
/**
* @return mixed
* @return null
*/
public function getMchId()
{
@@ -119,7 +104,7 @@ class Notify extends SmallProgram
}
/**
* @param mixed $mch_id
* @param null $mch_id
* @return Notify
*/
public function setMchId($mch_id)
@@ -129,25 +114,7 @@ class Notify extends SmallProgram
}
/**
* @return mixed
*/
public function getDeviceInfo()
{
return $this->device_info;
}
/**
* @param mixed $device_info
* @return Notify
*/
public function setDeviceInfo($device_info)
{
$this->device_info = $device_info;
return $this;
}
/**
* @return mixed
* @return null
*/
public function getNonceStr()
{
@@ -155,7 +122,7 @@ class Notify extends SmallProgram
}
/**
* @param mixed $nonce_str
* @param null $nonce_str
* @return Notify
*/
public function setNonceStr($nonce_str)
@@ -165,7 +132,7 @@ class Notify extends SmallProgram
}
/**
* @return mixed
* @return null
*/
public function getSign()
{
@@ -173,7 +140,7 @@ class Notify extends SmallProgram
}
/**
* @param mixed $sign
* @param null $sign
* @return Notify
*/
public function setSign($sign)
@@ -183,115 +150,25 @@ class Notify extends SmallProgram
}
/**
* @return mixed
* @return null
*/
public function getSignType()
public function getDeviceInfo()
{
return $this->sign_type;
return $this->device_info;
}
/**
* @param mixed $sign_type
* @param null $device_info
* @return Notify
*/
public function setSignType($sign_type)
public function setDeviceInfo($device_info)
{
$this->sign_type = $sign_type;
$this->device_info = $device_info;
return $this;
}
/**
* @return mixed
*/
public function getResultCode()
{
return $this->result_code;
}
/**
* @param mixed $result_code
* @return Notify
*/
public function setResultCode($result_code)
{
$this->result_code = $result_code;
return $this;
}
/**
* @return mixed
*/
public function getErrCode()
{
return $this->err_code;
}
/**
* @param mixed $err_code
* @return Notify
*/
public function setErrCode($err_code)
{
$this->err_code = $err_code;
return $this;
}
/**
* @return mixed
*/
public function getErrCodeDes()
{
return $this->err_code_des;
}
/**
* @param mixed $err_code_des
* @return Notify
*/
public function setErrCodeDes($err_code_des)
{
$this->err_code_des = $err_code_des;
return $this;
}
/**
* @return mixed
*/
public function getOpenid()
{
return $this->openid;
}
/**
* @param mixed $openid
* @return Notify
*/
public function setOpenid($openid)
{
$this->openid = $openid;
return $this;
}
/**
* @return mixed
*/
public function getIsSubscribe()
{
return $this->is_subscribe;
}
/**
* @param mixed $is_subscribe
* @return Notify
*/
public function setIsSubscribe($is_subscribe)
{
$this->is_subscribe = $is_subscribe;
return $this;
}
/**
* @return mixed
* @return null
*/
public function getTradeType()
{
@@ -299,7 +176,7 @@ class Notify extends SmallProgram
}
/**
* @param mixed $trade_type
* @param null $trade_type
* @return Notify
*/
public function setTradeType($trade_type)
@@ -309,7 +186,25 @@ class Notify extends SmallProgram
}
/**
* @return mixed
* @return null
*/
public function getTradeState()
{
return $this->trade_state;
}
/**
* @param null $trade_state
* @return Notify
*/
public function setTradeState($trade_state)
{
$this->trade_state = $trade_state;
return $this;
}
/**
* @return null
*/
public function getBankType()
{
@@ -317,7 +212,7 @@ class Notify extends SmallProgram
}
/**
* @param mixed $bank_type
* @param null $bank_type
* @return Notify
*/
public function setBankType($bank_type)
@@ -327,43 +222,7 @@ class Notify extends SmallProgram
}
/**
* @return mixed
*/
public function getTotalFee()
{
return $this->total_fee;
}
/**
* @param mixed $total_fee
* @return Notify
*/
public function setTotalFee($total_fee)
{
$this->total_fee = $total_fee;
return $this;
}
/**
* @return mixed
*/
public function getSettlementTotalFee()
{
return $this->settlement_total_fee;
}
/**
* @param mixed $settlement_total_fee
* @return Notify
*/
public function setSettlementTotalFee($settlement_total_fee)
{
$this->settlement_total_fee = $settlement_total_fee;
return $this;
}
/**
* @return mixed
* @return null
*/
public function getFeeType()
{
@@ -371,7 +230,7 @@ class Notify extends SmallProgram
}
/**
* @param mixed $fee_type
* @param null $fee_type
* @return Notify
*/
public function setFeeType($fee_type)
@@ -381,7 +240,25 @@ class Notify extends SmallProgram
}
/**
* @return mixed
* @return null
*/
public function getTotalFee()
{
return $this->total_fee;
}
/**
* @param null $total_fee
* @return Notify
*/
public function setTotalFee($total_fee)
{
$this->total_fee = $total_fee;
return $this;
}
/**
* @return null
*/
public function getCashFee()
{
@@ -389,7 +266,7 @@ class Notify extends SmallProgram
}
/**
* @param mixed $cash_fee
* @param null $cash_fee
* @return Notify
*/
public function setCashFee($cash_fee)
@@ -399,25 +276,7 @@ class Notify extends SmallProgram
}
/**
* @return mixed
*/
public function getCashFeeType()
{
return $this->cash_fee_type;
}
/**
* @param mixed $cash_fee_type
* @return Notify
*/
public function setCashFeeType($cash_fee_type)
{
$this->cash_fee_type = $cash_fee_type;
return $this;
}
/**
* @return mixed
* @return null
*/
public function getCouponFee()
{
@@ -425,7 +284,7 @@ class Notify extends SmallProgram
}
/**
* @param mixed $coupon_fee
* @param null $coupon_fee
* @return Notify
*/
public function setCouponFee($coupon_fee)
@@ -435,79 +294,7 @@ class Notify extends SmallProgram
}
/**
* @return mixed
*/
public function getCouponCount()
{
return $this->coupon_count;
}
/**
* @param mixed $coupon_count
* @return Notify
*/
public function setCouponCount($coupon_count)
{
$this->coupon_count = $coupon_count;
return $this;
}
/**
* @return mixed
*/
public function getCouponTypeN()
{
return $this->coupon_type_n;
}
/**
* @param mixed $coupon_type_n
* @return Notify
*/
public function setCouponTypeN($coupon_type_n)
{
$this->coupon_type_n = $coupon_type_n;
return $this;
}
/**
* @return mixed
*/
public function getCouponIdN()
{
return $this->coupon_id_n;
}
/**
* @param mixed $coupon_id_n
* @return Notify
*/
public function setCouponIdN($coupon_id_n)
{
$this->coupon_id_n = $coupon_id_n;
return $this;
}
/**
* @return mixed
*/
public function getCouponFeeN()
{
return $this->coupon_fee_n;
}
/**
* @param mixed $coupon_fee_n
* @return Notify
*/
public function setCouponFeeN($coupon_fee_n)
{
$this->coupon_fee_n = $coupon_fee_n;
return $this;
}
/**
* @return mixed
* @return null
*/
public function getTransactionId()
{
@@ -515,7 +302,7 @@ class Notify extends SmallProgram
}
/**
* @param mixed $transaction_id
* @param null $transaction_id
* @return Notify
*/
public function setTransactionId($transaction_id)
@@ -525,7 +312,7 @@ class Notify extends SmallProgram
}
/**
* @return mixed
* @return null
*/
public function getOutTradeNo()
{
@@ -533,7 +320,7 @@ class Notify extends SmallProgram
}
/**
* @param mixed $out_trade_no
* @param null $out_trade_no
* @return Notify
*/
public function setOutTradeNo($out_trade_no)
@@ -543,7 +330,7 @@ class Notify extends SmallProgram
}
/**
* @return mixed
* @return null
*/
public function getAttach()
{
@@ -551,7 +338,7 @@ class Notify extends SmallProgram
}
/**
* @param mixed $attach
* @param null $attach
* @return Notify
*/
public function setAttach($attach)
@@ -561,7 +348,7 @@ class Notify extends SmallProgram
}
/**
* @return mixed
* @return null
*/
public function getTimeEnd()
{
@@ -569,7 +356,7 @@ class Notify extends SmallProgram
}
/**
* @param mixed $time_end
* @param null $time_end
* @return Notify
*/
public function setTimeEnd($time_end)
@@ -579,21 +366,22 @@ class Notify extends SmallProgram
}
/**
* @return mixed
* @return null
*/
public function getReturnCode()
public function getOpenid()
{
return $this->return_code;
return $this->openid;
}
/**
* @param mixed $return_code
* @param null $openid
* @return Notify
*/
public function setReturnCode($return_code)
public function setOpenid($openid)
{
$this->return_code = $return_code;
$this->openid = $openid;
return $this;
}
}