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); $params = json_encode($params, JSON_UNESCAPED_UNICODE);
$this->request->setIsSSL(true); $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->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg'); $this->request->setErrorMsgField('errmsg');
$result = $this->request->post($url, $params); $result = $this->request->post($url, $params);
-1
View File
@@ -510,7 +510,6 @@ class HttpClient
} else { } else {
$this->_data = $this->mergeParams($data); $this->_data = $this->mergeParams($data);
} }
if (!empty($this->_data)) { if (!empty($this->_data)) {
$client->setData($this->_data); $client->setData($this->_data);
} }
+100 -312
View File
@@ -3,38 +3,32 @@
namespace wchat\qq; namespace wchat\qq;
use Exception;
use wchat\common\Help; use wchat\common\Help;
/**
* Class Notify
* @package wchat\qq
*/
class Notify extends SmallProgram class Notify extends SmallProgram
{ {
public $appid = ''; public $appid = null;
public $mch_id = ''; public $mch_id = null;
public $device_info = ''; public $nonce_str = null;
public $nonce_str = ''; public $sign = null;
public $sign = ''; public $device_info = null;
public $sign_type = ''; public $trade_type = null;
public $result_code = ''; public $trade_state = null;
public $err_code = ''; public $bank_type = null;
public $err_code_des = ''; public $fee_type = null;
public $openid = ''; public $total_fee = null;
public $is_subscribe = ''; public $cash_fee = null;
public $trade_type = ''; public $coupon_fee = null;
public $bank_type = ''; public $transaction_id = null;
public $total_fee = ''; public $out_trade_no = null;
public $settlement_total_fee = ''; public $attach = null;
public $fee_type = ''; public $time_end = null;
public $cash_fee = ''; public $openid = null;
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 = '';
/** /**
* @return bool * @return bool
@@ -42,27 +36,18 @@ class Notify extends SmallProgram
*/ */
public function isSuccess() public function isSuccess()
{ {
if ($this->getReturnCode() != "SUCCESS") { return $this->getTradeState() === 'SUCCESS';
return false;
}
if ($this->getResultCode() != 'SUCCESS') {
return false;
}
return true;
} }
/** /**
* @param array $params * @param array $params
* @return $this * @return $this
* @throws Exception
*/ */
public function setPayNotifyData(array $params) public function setPayNotifyData(array $params)
{ {
if (!$this->validation($params)) { if (!$this->validation($params)) {
$this->setResultCode('FAIL'); throw new Exception('签名错误!');
$this->setErrCodeDes('签名错误');
unset($params['result_code'], $params['err_code_des']);
} }
foreach ($params as $key => $val) { foreach ($params as $key => $val) {
if (!property_exists($this, $key)) { if (!property_exists($this, $key)) {
@@ -93,7 +78,7 @@ class Notify extends SmallProgram
} }
/** /**
* @return mixed * @return null
*/ */
public function getAppid() public function getAppid()
{ {
@@ -101,7 +86,7 @@ class Notify extends SmallProgram
} }
/** /**
* @param mixed $appid * @param null $appid
* @return Notify * @return Notify
*/ */
public function setAppid($appid) public function setAppid($appid)
@@ -111,7 +96,7 @@ class Notify extends SmallProgram
} }
/** /**
* @return mixed * @return null
*/ */
public function getMchId() public function getMchId()
{ {
@@ -119,7 +104,7 @@ class Notify extends SmallProgram
} }
/** /**
* @param mixed $mch_id * @param null $mch_id
* @return Notify * @return Notify
*/ */
public function setMchId($mch_id) public function setMchId($mch_id)
@@ -129,25 +114,7 @@ class Notify extends SmallProgram
} }
/** /**
* @return mixed * @return null
*/
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
*/ */
public function getNonceStr() public function getNonceStr()
{ {
@@ -155,7 +122,7 @@ class Notify extends SmallProgram
} }
/** /**
* @param mixed $nonce_str * @param null $nonce_str
* @return Notify * @return Notify
*/ */
public function setNonceStr($nonce_str) public function setNonceStr($nonce_str)
@@ -165,7 +132,7 @@ class Notify extends SmallProgram
} }
/** /**
* @return mixed * @return null
*/ */
public function getSign() public function getSign()
{ {
@@ -173,7 +140,7 @@ class Notify extends SmallProgram
} }
/** /**
* @param mixed $sign * @param null $sign
* @return Notify * @return Notify
*/ */
public function setSign($sign) 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 * @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 $this;
} }
/** /**
* @return mixed * @return null
*/
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
*/ */
public function getTradeType() public function getTradeType()
{ {
@@ -299,7 +176,7 @@ class Notify extends SmallProgram
} }
/** /**
* @param mixed $trade_type * @param null $trade_type
* @return Notify * @return Notify
*/ */
public function setTradeType($trade_type) 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() public function getBankType()
{ {
@@ -317,7 +212,7 @@ class Notify extends SmallProgram
} }
/** /**
* @param mixed $bank_type * @param null $bank_type
* @return Notify * @return Notify
*/ */
public function setBankType($bank_type) public function setBankType($bank_type)
@@ -327,43 +222,7 @@ class Notify extends SmallProgram
} }
/** /**
* @return mixed * @return null
*/
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
*/ */
public function getFeeType() public function getFeeType()
{ {
@@ -371,7 +230,7 @@ class Notify extends SmallProgram
} }
/** /**
* @param mixed $fee_type * @param null $fee_type
* @return Notify * @return Notify
*/ */
public function setFeeType($fee_type) 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() public function getCashFee()
{ {
@@ -389,7 +266,7 @@ class Notify extends SmallProgram
} }
/** /**
* @param mixed $cash_fee * @param null $cash_fee
* @return Notify * @return Notify
*/ */
public function setCashFee($cash_fee) public function setCashFee($cash_fee)
@@ -399,25 +276,7 @@ class Notify extends SmallProgram
} }
/** /**
* @return mixed * @return null
*/
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
*/ */
public function getCouponFee() public function getCouponFee()
{ {
@@ -425,7 +284,7 @@ class Notify extends SmallProgram
} }
/** /**
* @param mixed $coupon_fee * @param null $coupon_fee
* @return Notify * @return Notify
*/ */
public function setCouponFee($coupon_fee) public function setCouponFee($coupon_fee)
@@ -435,79 +294,7 @@ class Notify extends SmallProgram
} }
/** /**
* @return mixed * @return null
*/
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
*/ */
public function getTransactionId() public function getTransactionId()
{ {
@@ -515,7 +302,7 @@ class Notify extends SmallProgram
} }
/** /**
* @param mixed $transaction_id * @param null $transaction_id
* @return Notify * @return Notify
*/ */
public function setTransactionId($transaction_id) public function setTransactionId($transaction_id)
@@ -525,7 +312,7 @@ class Notify extends SmallProgram
} }
/** /**
* @return mixed * @return null
*/ */
public function getOutTradeNo() public function getOutTradeNo()
{ {
@@ -533,7 +320,7 @@ class Notify extends SmallProgram
} }
/** /**
* @param mixed $out_trade_no * @param null $out_trade_no
* @return Notify * @return Notify
*/ */
public function setOutTradeNo($out_trade_no) public function setOutTradeNo($out_trade_no)
@@ -543,7 +330,7 @@ class Notify extends SmallProgram
} }
/** /**
* @return mixed * @return null
*/ */
public function getAttach() public function getAttach()
{ {
@@ -551,7 +338,7 @@ class Notify extends SmallProgram
} }
/** /**
* @param mixed $attach * @param null $attach
* @return Notify * @return Notify
*/ */
public function setAttach($attach) public function setAttach($attach)
@@ -561,7 +348,7 @@ class Notify extends SmallProgram
} }
/** /**
* @return mixed * @return null
*/ */
public function getTimeEnd() public function getTimeEnd()
{ {
@@ -569,7 +356,7 @@ class Notify extends SmallProgram
} }
/** /**
* @param mixed $time_end * @param null $time_end
* @return Notify * @return Notify
*/ */
public function setTimeEnd($time_end) 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 * @return Notify
*/ */
public function setReturnCode($return_code) public function setOpenid($openid)
{ {
$this->return_code = $return_code; $this->openid = $openid;
return $this; return $this;
} }
} }