1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?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();
- $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);
- }
- }
- }
|