12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- /**
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2019/12/16
- * Time: 9:41
- */
- namespace JinDouYun\Controller\Cron;
- use JinDouYun\Dao\Enterprise\DEnterprise;
- use JinDouYun\Model\Market\MCoupon;
- use Mall\Framework\Core\StatusCode;
- class CouponCron
- {
- /**
- * Doc: (des="")
- * User: XMing
- * Date: 2020/9/3
- * Time: 11:56 上午
- * @throws \Exception
- */
- public function grantCoupon()
- {
- $objDEnterprise = new DEnterprise();
- $objDEnterprise->setTable('qianniao_enterprise_1');
- $enterpriseList = $objDEnterprise->select(['deleteStatus' => StatusCode::$standard]);
- if ($enterpriseList === false){
- echo 'sql错误'.$objDEnterprise->error();
- echo PHP_EOL;
- die;
- }
- foreach ($enterpriseList as $value){
- $objMCoupon = new MCoupon('',$value['id']);
- $res =$objMCoupon->grantCoupon();
- if (!$res->isSuccess()){
- echo '执行错误'.$res->getData();
- echo PHP_EOL;
- die;
- }
- }
- echo '执行结束'.PHP_EOL;
- }
- }
|