This commit is contained in:
xman 2025-04-17 17:30:29 +08:00
parent a138871cc2
commit 5417d0daa9
3 changed files with 42 additions and 0 deletions

View File

@ -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;

View File

@ -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', //跟进记录
];

View 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();
}
}
}
}