SendCouponLog.php 1002 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * User: charlie
  4. * 用户的代金券
  5. */
  6. class SendCouponLog extends MongoAr
  7. {
  8. public $_id;
  9. public $user_id;//发放用户的id
  10. public $device_id;//发放用户的device_id
  11. public $batch;//最后一次发放优惠券的批次
  12. public $last_batch_time;//上次发放优惠券的时间
  13. public function __construct($scenario='insert'){
  14. $this->setMongoDBComponent(Yii::app()->getComponent('mongodb_o2o'));
  15. parent::__construct($scenario);
  16. }
  17. public static function model($className=__CLASS__)
  18. {
  19. return parent::model($className);
  20. }
  21. public static function get($_id) {
  22. if(CommonFn::isMongoId($_id)){
  23. $criteria = new EMongoCriteria();
  24. $criteria->_id('==', $_id);
  25. $model = self::model()->find($criteria);
  26. return $model;
  27. }else{
  28. return false;
  29. }
  30. }
  31. public function getCollectionName()
  32. {
  33. return 'send_coupon_log';
  34. }
  35. }