| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace app\command;
- use app\api\model\order\Order;
- use app\api\model\system\Message;
- use app\api\service\MassagerActionService;
- use app\api\service\TencentCloudService;
- use app\api\service\ThirdPayService;
- use app\api\service\WalletService;
- use redis\RedLock;
- use think\console\Command;
- use think\console\Input;
- use think\console\Output;
- use think\Db;
- use think\Exception;
- // 接单超时
- class Offline extends Command
- {
- // 配置定时器的信息
- protected function configure()
- {
- $this->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");
- }
- }
|