RechargeOrder.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: PHP
  5. * Date: 2016/9/26
  6. * Time: 11:57
  7. * 充值卡 订单模型
  8. */
  9. class RechargeOrder extends MongoAr
  10. {
  11. public $_id;
  12. public $user;//充值用户 mongoid
  13. public $time;//充值时间
  14. public $recharge;//充值卡 mongoid
  15. public $charge_id;//ping++的chargeId,charge_id即为支付单号
  16. public $pay_channel;//支付渠道
  17. public $price; //订单金额
  18. public $status=0;//订单状态 0=>待支付 1=>已支付
  19. public function __construct($scenario='insert'){
  20. $this->setMongoDBComponent(Yii::app()->getComponent('mongodb_o2o'));
  21. parent::__construct($scenario);
  22. }
  23. public static $status_option = array(
  24. 0 => array('name' => '待支付'),
  25. 1 => array('name' => '已支付'),
  26. );
  27. public static function model($className=__CLASS__)
  28. {
  29. return parent::model($className);
  30. }
  31. public function getCollectionName()
  32. {
  33. return 'recharge_order';
  34. }
  35. public static function get($_id) {
  36. if(CommonFn::isMongoId($_id)){
  37. $criteria = new EMongoCriteria();
  38. $criteria->_id('==', $_id);
  39. $model = self::model()->find($criteria);
  40. return $model;
  41. }else{
  42. return false;
  43. }
  44. }
  45. }