123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <?php
- /**
- * Order.php UTF-8
- * 订单信息
- *
- * @date : 2018/1/19 14:59
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @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;
- }
- }
|