0, 'msg' => 'requestData不能为空,且必须是数组']; if (empty($url)) return ['status' => 0, 'msg' => 'url不能为空']; # 获取请求路径 if (empty($host_path)) { $config = config('api_config'); $host_path = $config['host_path']; } # 验证令牌 $token = '9c4cb25665cf08667c815420ab383cb5'; # 请求接口数据 $data = [ 'data' => base64_encode(json_encode($requestData)), 'token' => md5($token . date('Ymd')) ]; $json_data = json_encode($data); $createUrl = $host_path . $url; # 发起请求 $result = post_token($createUrl,$json_data,false,[],$token); $result = json_decode($result,true); # 判断返回信息 if ($result['code'] != 1) return ['status' => 0, 'msg' => $result['msg']]; return ['status' => 1]; } /** * 获取统计组ID * @param $dataType // 1 返回字符串 2 返回数组 * @return array|string */ public static function getGroupIds($dataType) { include '../module/dm/Dm.php'; $dm = new Dm(); $groupRes = $dm->select('bt_passenger_monitor_group',null,'"groupId"'); $groupIdArr = array_column($groupRes,'groupId') ?: []; return $dataType == 2 ? $groupIdArr : implode(",",$groupIdArr); } }