105 lines
1.4 KiB
PHP
105 lines
1.4 KiB
PHP
<?php
|
|
|
|
|
|
namespace wchat\qq\result;
|
|
|
|
/**
|
|
* Class RedHatResult
|
|
* @package qq\result
|
|
*/
|
|
class RedHatResult
|
|
{
|
|
|
|
public $result;
|
|
public $res_info;
|
|
|
|
public $listid;
|
|
public $state;
|
|
public $total_num;
|
|
public $recv_num;
|
|
public $total_amount;
|
|
public $recv_amount;
|
|
public $recv_details;
|
|
public $uin;
|
|
|
|
|
|
const RED_HAT_STATUS_PAID = 1;
|
|
const RED_HAT_STATUS_SNATCHED = 2;
|
|
const RED_HAT_STATUS_EXPIRED = 3;
|
|
const RED_HAT_STATUS_REFUNDED = 4;
|
|
|
|
|
|
/**
|
|
* RedHatResult constructor.
|
|
* @param array $array
|
|
*/
|
|
public function __construct(array $array)
|
|
{
|
|
$this->init($array);
|
|
}
|
|
|
|
/**
|
|
* @param $array
|
|
* @return $this
|
|
*/
|
|
private function init($array)
|
|
{
|
|
foreach ($array as $key => $value) {
|
|
if (!property_exists($this, $key)) {
|
|
continue;
|
|
}
|
|
$this->{$key} = $value;
|
|
}
|
|
return $this;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param $field
|
|
* @return mixed
|
|
*/
|
|
public function get($field)
|
|
{
|
|
return $this->$field;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return bool
|
|
* 是否已完成支付
|
|
*/
|
|
public function isPaid()
|
|
{
|
|
return $this->state == self::RED_HAT_STATUS_PAID;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
* 是否已抢完
|
|
*/
|
|
public function isSnatched()
|
|
{
|
|
return $this->state == self::RED_HAT_STATUS_SNATCHED;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function isExpired()
|
|
{
|
|
return $this->state == self::RED_HAT_STATUS_EXPIRED;
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function isRefunded()
|
|
{
|
|
return $this->state == self::RED_HAT_STATUS_REFUNDED;
|
|
}
|
|
|
|
}
|