diff --git a/application/admin/controller/orders/Review.php b/application/admin/controller/orders/Review.php index ed048c1..cfa10d5 100644 --- a/application/admin/controller/orders/Review.php +++ b/application/admin/controller/orders/Review.php @@ -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; diff --git a/application/command.php b/application/command.php index 1820a0c..92c2963 100755 --- a/application/command.php +++ b/application/command.php @@ -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', //跟进记录 ]; diff --git a/application/common/command/UpdateWorkerManCommand.php b/application/common/command/UpdateWorkerManCommand.php new file mode 100644 index 0000000..03d5500 --- /dev/null +++ b/application/common/command/UpdateWorkerManCommand.php @@ -0,0 +1,36 @@ +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(); + } + } + } + + +} \ No newline at end of file