CouponCron.Class.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: XiaoMing
  5. * Date: 2019/12/16
  6. * Time: 9:41
  7. */
  8. namespace JinDouYun\Controller\Cron;
  9. use JinDouYun\Dao\Enterprise\DEnterprise;
  10. use JinDouYun\Model\Market\MCoupon;
  11. use Mall\Framework\Core\StatusCode;
  12. class CouponCron
  13. {
  14. /**
  15. * Doc: (des="")
  16. * User: XMing
  17. * Date: 2020/9/3
  18. * Time: 11:56 上午
  19. * @throws \Exception
  20. */
  21. public function grantCoupon()
  22. {
  23. $objDEnterprise = new DEnterprise();
  24. $objDEnterprise->setTable('qianniao_enterprise_1');
  25. $enterpriseList = $objDEnterprise->select(['deleteStatus' => StatusCode::$standard]);
  26. if ($enterpriseList === false){
  27. echo 'sql错误'.$objDEnterprise->error();
  28. echo PHP_EOL;
  29. die;
  30. }
  31. foreach ($enterpriseList as $value){
  32. $objMCoupon = new MCoupon('',$value['id']);
  33. $res =$objMCoupon->grantCoupon();
  34. if (!$res->isSuccess()){
  35. echo '执行错误'.$res->getData();
  36. echo PHP_EOL;
  37. die;
  38. }
  39. }
  40. echo '执行结束'.PHP_EOL;
  41. }
  42. }