ResetDegreeCommand.php 837 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Created by north.Deng's MAC
  4. * User: north.Deng
  5. * Date: 2018/5/4
  6. * Time: 下午1:12
  7. * description :
  8. */
  9. class ResetDegreeCommand extends CConsoleCommand
  10. {
  11. public function run($args){
  12. //error_reporting(E_ERROR);
  13. ini_set('memory_limit', '256M');
  14. //ini_set('mongo.long_as_object',1);
  15. set_time_limit(0);
  16. self::reset();
  17. }
  18. public function reset()
  19. {
  20. $emp = JGEmploye::model()->findAll();
  21. foreach ($emp as $value) {
  22. $value->degree = 1;
  23. $value->save();
  24. }
  25. $c= new EMongoCriteria();
  26. $c->expire_time('<=',time());
  27. $coupons = JCoupon::model()->findAll($c);
  28. foreach ($coupons as $coupon) {
  29. $coupon->status = 2;
  30. $coupon->save();
  31. }
  32. }
  33. }