| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 | 
							- <?php
 
- namespace app\cron;
 
- use app\common\model\Config;
 
- use app\common\model\Orders as OrderModel;
 
- use think\Db;
 
- use yunwuxin\cron\Task;
 
- //订单自动派单
 
- class Orders extends Task
 
- {
 
-     public function configure()
 
-     {
 
-         $this->everyMinute(); //每分钟执行一次
 
-     }
 
-     /**
 
-      * 执行任务
 
-      * @return mixed
 
-      */
 
-     protected function execute()
 
-     {
 
-         try{
 
-             $this->autoSend();
 
-         }catch (\Exception $e){
 
-             trace($e->getMessage());
 
-         }
 
-     }
 
-     public function autoSend(){
 
-         $config = Db::name('config')
 
-             ->where('name','org_auto_send')
 
-             ->find();
 
-         if($config){
 
-             $list = Db::name('config_org')
 
-                 ->where('config_id',$config['id'])
 
-                 ->where('value',1)
 
-                 ->column('org_id');
 
-             foreach ($list as $k=>$v){
 
-                 queue_push(json_encode(['org_id'=>$v]),3);
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |