sth
This commit is contained in:
parent
a138871cc2
commit
5417d0daa9
|
|
@ -4,6 +4,7 @@ namespace app\admin\controller\orders;
|
|||
|
||||
use app\admin\model\Order;
|
||||
use app\common\controller\Backend;
|
||||
use Exception;
|
||||
use think\Db;
|
||||
use think\exception\PDOException;
|
||||
use think\exception\ValidateException;
|
||||
|
|
|
|||
|
|
@ -21,4 +21,9 @@ return [
|
|||
'app\admin\command\ItemImportCommand',
|
||||
'app\admin\command\ImportServiceItems',
|
||||
'app\admin\command\Test',
|
||||
|
||||
'app\common\command\UpdateWorkerManCommand', //更新师傅评分
|
||||
'app\common\command\CheckOrderDispatchCommand', //检测超时的任务
|
||||
'app\common\command\CheckOrderDispatchGotCommand', //dispatch未接单通知
|
||||
'app\common\command\CheckOrdeRecordCommand', //跟进记录
|
||||
];
|
||||
|
|
|
|||
36
application/common/command/UpdateWorkerManCommand.php
Normal file
36
application/common/command/UpdateWorkerManCommand.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
use app\admin\model\order\Review;
|
||||
use app\admin\model\OrderDispatch;
|
||||
use app\admin\model\OrderDispatchRecord;
|
||||
|
||||
use app\admin\model\Worker;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
|
||||
class UpdateWorkerManCommand extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('update-worker-man-info')
|
||||
->setDescription('更新师傅信息(评分),每天一次');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$workers = Worker::all();
|
||||
foreach ($workers as $worker)
|
||||
{
|
||||
$avg = Review::where('worker_id',$worker->id)->avg('worker_star');
|
||||
if($avg){
|
||||
$worker->star = $avg;
|
||||
$worker->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user