<?php /** * Created by PhpStorm. * User: zhonglei * Date: 18/4/26 * Time: 15:50 */ namespace Frontend\Controller\Callback; use Think\Log; use VcySDK\Cron; use VcySDK\Service; use Common\Common\Constant; use Common\Common\MapHelper; use Common\Service\MapService; class SendStopController extends AbstractController { /** * 发送地图终止消息接口 * @author zhonglei */ public function Index() { $stream_data = file_get_contents('php://input'); $stream_data = empty($stream_data) ? [] : json_decode($stream_data, true); Log::record('---SendRemind stream data:' . var_export($stream_data, true), Log::INFO); $cron_id = I('get.cron_id', '', 'trim'); $map_id = I('get.map_id', 0, 'intval'); $uids = $stream_data['uids'] ?? []; // 删除计划任务 if (!empty($cron_id)) { $cronSdk = new Cron(Service::instance()); $cronSdk->delete($cron_id); } // 发送消息 if (!empty($map_id) && \is_array($uids) && !empty($uids)) { $mapServ = new MapService(); $map = $mapServ->get_by_conds(['map_id' => $map_id, 'map_status' => Constant::MAP_IS_STATUS_END]); if (!empty($map)) { $mapHelper = &MapHelper::instance(); $mapHelper->sendStop($map, $uids); } } exit('SUCCESS'); } }