NewCommissionCron.Class.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 Util\Common\PartnerTools;
  11. use Util\Common\AgentTools;
  12. use JinDouYun\Model\Market\MCoupon;
  13. use Mall\Framework\Core\StatusCode;
  14. class NewCommissionCron
  15. {
  16. //命令:php /www/wwwroot/apiqnys.liuniukj.com/Public/www/index.php -mCron -cNewCommissionCron -anewCommissionTask >> /www/wwwroot/logs/apiqnys.liuniukj.com/cron.log 2>&1 &
  17. public function newCommissionTask(){
  18. echo PHP_EOL."新佣金计算任务开始".PHP_EOL;
  19. $objDEnterprise = new DEnterprise();
  20. $objDEnterprise->setTable('qianniao_enterprise_1');
  21. $enterpriseList = $objDEnterprise->select(['deleteStatus' => StatusCode::$standard]);
  22. if (empty($enterpriseList)){
  23. echo '企业数据为空'.PHP_EOL;
  24. die;
  25. }
  26. foreach ($enterpriseList as $value){
  27. if(empty($value['id'])) continue;
  28. //合伙人任务
  29. $taskTotal = new PartnerTools($value['id']);
  30. $res = $taskTotal->runTask();
  31. if(empty($res) || empty($res["code"])){
  32. echo '系统错误'.PHP_EOL;
  33. }else{
  34. echo json_encode($res,JSON_UNESCAPED_UNICODE).PHP_EOL;
  35. }
  36. //门店代理任务
  37. $taskTotal2 = new AgentTools($value['id']);
  38. $res2 = $taskTotal2->runTaskNew();
  39. if(empty($res2) || empty($res2["code"])){
  40. echo '系统错误'.PHP_EOL;
  41. }else{
  42. echo json_encode($res2,JSON_UNESCAPED_UNICODE).PHP_EOL;
  43. }
  44. }
  45. echo '新佣金计算任务结束'.PHP_EOL;
  46. }
  47. }