* @version : HUOSDK 8.0 */ namespace huolib\queue\request; class Order extends Request { private $order_id = ''; private $payway = ''; /* 支付方式 */ private $currency = 'CNY'; private $cp_order_id = ''; private $product_cnt = 1; private $product_id = ''; private $product_price = 0.00; private $product_name = ''; private $product_desc = ''; private $status = 1; private $pay_time = 0; /* 支付时间 */ public function __construct($data = []) { if (!empty($data)) { $this->setData($data); } } /** * 设置订单数据 * * @param array $data */ public function setData($data = []) { if (empty($data)) { return; } $this->setOrderId(get_val($data, 'order_id')); $this->setPayway(get_val($data, 'payway')); $this->setCurrency(get_val($data, 'currency', 'CNY')); $this->setCpOrderId(get_val($data, 'cp_order_id')); $this->setProductPrice(get_val($data, 'product_price', 0.00)); $this->setProductId(get_val($data, 'product_id')); $this->setProductCnt(get_val($data, 'product_cnt', 1)); $this->setProductName(get_val($data, 'product_name')); $this->setProductDesc(get_val($data, 'product_desc')); $this->setStatus(get_val($data, 'status')); } /** * 变量转数组 * * @return array */ public function toArray() { $_data = [ 'order_id' => $this->getOrderId(), 'payway' => $this->getPayway(), 'currency' => $this->getCurrency(), 'cp_order_id' => $this->getCpOrderId(), 'product_price' => $this->getProductPrice(), 'product_id' => $this->getProductId(), 'product_cnt' => $this->getProductCnt(), 'product_name' => $this->getProductName(), 'product_desc' => $this->getProductPrice(), 'status' => $this->getStatus(), ]; return $_data; } /** * 校验订单参数合法性 */ public function check() { // TODO: wuyonghong 2018/5/30 校验角色参数合法性 return true; } /** * @return string */ public function getOrderId() { return $this->order_id; } /** * @param string $order_id */ public function setOrderId($order_id) { $this->order_id = $order_id; } /** * @return string */ public function getCurrency() { return $this->currency; } /** * @param string $currency */ public function setCurrency($currency) { $this->currency = $currency; } /** * @return string */ public function getCpOrderId() { return $this->cp_order_id; } /** * @param string $cp_order_id */ public function setCpOrderId($cp_order_id) { $this->cp_order_id = $cp_order_id; } /** * @return float */ public function getProductPrice() { return $this->product_price; } /** * @param float $product_price */ public function setProductPrice($product_price) { $this->product_price = $product_price; } /** * @return string */ public function getProductId() { return $this->product_id; } /** * @param string $product_id */ public function setProductId($product_id) { $this->product_id = $product_id; } /** * @return int */ public function getProductCnt() { return $this->product_cnt; } /** * @param int $product_cnt */ public function setProductCnt($product_cnt) { $this->product_cnt = $product_cnt; } /** * @return string */ public function getProductName() { return $this->product_name; } /** * @param string $product_name */ public function setProductName($product_name) { $this->product_name = $product_name; } /** * @return string */ public function getProductDesc() { return $this->product_desc; } /** * @param string $product_desc */ public function setProductDesc($product_desc) { $this->product_desc = $product_desc; } /** * @return string */ public function getPayway() { return $this->payway; } /** * @param string $payway */ public function setPayway($payway) { $this->payway = $payway; } /** * @return int */ public function getStatus() { return $this->status; } /** * @param int $status */ public function setStatus($status) { $this->status = $status; } /** * @return int */ public function getPayTime() { return $this->pay_time; } /** * @param int $pay_time */ public function setPayTime($pay_time) { $this->pay_time = $pay_time; } }