setName('Offline') ->setDescription('Offline start'); } /** * @param Input $input * @param Output $output * @return int|void|null * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\Exception */ protected function execute(Input $input, Output $output) { \think\Log::custom_log("助教上线时间过长未更新自动下线", "-------------- start --------------", "offline"); $massagers = \db("massager")->where("online", 1)->where("updatetime", "<", (time() - 6 * 60 * 60))->select(); $logs = []; foreach ($massagers as $item) { $s_res = (new MassagerActionService())->workClockIn($item["id"]); // 下线通知 TencentCloudService::tencent_cloud_vms_send($item["mobile"],'1478967'); array_push($logs, [$item["id"],$s_res->code()]); } \think\Log::custom_log("助教上线时间过长未更新自动下线", $logs, "offline"); \think\Log::custom_log("助教上线时间过长未更新自动下线", "--------------- over --------------", "offline"); } }