commit 02a1ba8c2e5aa692aa9eebab4584de6f3ddd7cc4 Author: iuu <2167162990@qq.com> Date: Tue Aug 13 15:27:23 2024 +0800 'init' diff --git a/qa.php b/qa.php new file mode 100644 index 0000000..d1ab235 --- /dev/null +++ b/qa.php @@ -0,0 +1,89 @@ + $totalCost, + "activityId" => $activityId, + "maleCount" => 0, + "femaleCount" => 0, + "payType" => 3, + // "hangPeopleDetails" => [], + "groupId" => $groupId, + // "applyRemark" => "", + // "teamName" => "", + // "idNumber" => "", + // "birthday" => "", + "xbSex" => null, + "cardType" => 1, + // "realName" => "", + // "memberRemarkList" => [], + // "trackActMemberProjectDoList" => [] + ]; + var_dump(json_encode($post_data)); + $response = api_request_curl($url, $custom_post_headers, $post_data); + echo $response; + +} + +function api_request_curl($url, $custom_headers = [], $postData = array()) +{ + + if (empty($url)) return ''; + $postData = json_encode($postData); + + $curl = curl_init(); //初始化 + curl_setopt($curl, CURLOPT_URL, $url); //设置url + curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); //设置http验证方法 + curl_setopt($curl, CURLOPT_TIMEOUT, 30); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //设置curl_exec获取的信息的返回方式 + curl_setopt($curl, CURLOPT_POST, 1); //设置发送方式为post请求 + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); //设置post的数据 + // 如果有自定义请求头,则设置请求头 +// if (!empty($custom_headers)) { +// curl_setopt($curl, CURLOPT_HTTPHEADER, $custom_headers); +// } + + $array = array_merge($custom_headers, array( + 'Content-Type: application/json', + 'Content-Length: ' . strlen($postData)) + ); + curl_setopt($curl, CURLOPT_HTTPHEADER, $array); + // 接受压缩响应 + curl_setopt($curl, CURLOPT_ENCODING, ''); + + + $result = curl_exec($curl); + if ($result === false) { + throw new Exception('Http request message :' . curl_error($curl)); + } + curl_close($curl); + // 尝试解压缩响应数据 + $decoded_response = @gzdecode($result); + if ($decoded_response !== false) { + return $decoded_response; + } + + + return $result; +} + diff --git a/qc.php b/qc.php new file mode 100644 index 0000000..cef9c12 --- /dev/null +++ b/qc.php @@ -0,0 +1,89 @@ + $totalCost, + "activityId" => $activityId, + "maleCount" => 0, + "femaleCount" => 0, + "payType" => 3, + // "hangPeopleDetails" => [], + "groupId" => $groupId, + // "applyRemark" => "", + // "teamName" => "", + // "idNumber" => "", + // "birthday" => "", + "xbSex" => null, + "cardType" => 1, + // "realName" => "", + // "memberRemarkList" => [], + // "trackActMemberProjectDoList" => [] + ]; + var_dump(json_encode($post_data)); + $response = api_request_curl($url, $custom_post_headers, $post_data); + echo $response; + +} + +function api_request_curl($url, $custom_headers = [], $postData = array()) +{ + + if (empty($url)) return ''; + $postData = json_encode($postData); + + $curl = curl_init(); //初始化 + curl_setopt($curl, CURLOPT_URL, $url); //设置url + curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); //设置http验证方法 + curl_setopt($curl, CURLOPT_TIMEOUT, 30); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //设置curl_exec获取的信息的返回方式 + curl_setopt($curl, CURLOPT_POST, 1); //设置发送方式为post请求 + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); //设置post的数据 + // 如果有自定义请求头,则设置请求头 +// if (!empty($custom_headers)) { +// curl_setopt($curl, CURLOPT_HTTPHEADER, $custom_headers); +// } + + $array = array_merge($custom_headers, array( + 'Content-Type: application/json', + 'Content-Length: ' . strlen($postData)) + ); + curl_setopt($curl, CURLOPT_HTTPHEADER, $array); + // 接受压缩响应 + curl_setopt($curl, CURLOPT_ENCODING, ''); + + + $result = curl_exec($curl); + if ($result === false) { + throw new Exception('Http request message :' . curl_error($curl)); + } + curl_close($curl); + // 尝试解压缩响应数据 + $decoded_response = @gzdecode($result); + if ($decoded_response !== false) { + return $decoded_response; + } + + + return $result; +} + diff --git a/qd.php b/qd.php new file mode 100644 index 0000000..399bce0 --- /dev/null +++ b/qd.php @@ -0,0 +1,89 @@ + $totalCost, + "activityId" => $activityId, + "maleCount" => 0, + "femaleCount" => 0, + "payType" => 3, + // "hangPeopleDetails" => [], + "groupId" => $groupId, + // "applyRemark" => "", + // "teamName" => "", + // "idNumber" => "", + // "birthday" => "", + "xbSex" => null, + "cardType" => 1, + // "realName" => "", + // "memberRemarkList" => [], + // "trackActMemberProjectDoList" => [] + ]; + var_dump(json_encode($post_data)); + $response = api_request_curl($url, $custom_post_headers, $post_data); + echo $response; + +} + +function api_request_curl($url, $custom_headers = [], $postData = array()) +{ + + if (empty($url)) return ''; + $postData = json_encode($postData); + + $curl = curl_init(); //初始化 + curl_setopt($curl, CURLOPT_URL, $url); //设置url + curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); //设置http验证方法 + curl_setopt($curl, CURLOPT_TIMEOUT, 30); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //设置curl_exec获取的信息的返回方式 + curl_setopt($curl, CURLOPT_POST, 1); //设置发送方式为post请求 + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); //设置post的数据 + // 如果有自定义请求头,则设置请求头 +// if (!empty($custom_headers)) { +// curl_setopt($curl, CURLOPT_HTTPHEADER, $custom_headers); +// } + + $array = array_merge($custom_headers, array( + 'Content-Type: application/json', + 'Content-Length: ' . strlen($postData)) + ); + curl_setopt($curl, CURLOPT_HTTPHEADER, $array); + // 接受压缩响应 + curl_setopt($curl, CURLOPT_ENCODING, ''); + + + $result = curl_exec($curl); + if ($result === false) { + throw new Exception('Http request message :' . curl_error($curl)); + } + curl_close($curl); + // 尝试解压缩响应数据 + $decoded_response = @gzdecode($result); + if ($decoded_response !== false) { + return $decoded_response; + } + + + return $result; +} + diff --git a/qq.php b/qq.php new file mode 100644 index 0000000..114c3fe --- /dev/null +++ b/qq.php @@ -0,0 +1,272 @@ + $totalCost, + "activityId" => $activityId, + "maleCount" => 0, + "femaleCount" => 0, + "payType" => 3, + "hangPeopleDetails" => [], + "groupId" => $groupId, + "applyRemark" => "", + "teamName" => "", + "idNumber" => "", + "birthday" => "", + "xbSex" => null, + "cardType" => 1, + "realName" => "", + "memberRemarkList" => [], + "trackActMemberProjectDoList" => [] + ]; + var_dump(json_encode($post_data)); + $response = api_request_curl($url, $custom_post_headers, $post_data); + echo $response; + +} + + + +// 搜索 +//$str = '奥体打球'; +//$str = urlencode($str); +//$searchListUrl = 'https://www.shuote.top:8082/flash/activity/searchList?keyWord='.$str.'&city=%E6%B5%8E%E5%8D%97%E5%B8%82&sportId=1&longitude=116.89963406032986&latitude=36.66725802951389&pageSize=15&pageNo=1&isHas=true&isLoading=false&isLimitPublisher=0'; +//$response = curl_get_with_custom_headers($searchListUrl, $custom_get_headers); +//$data = json_decode($response, true); +//var_dump($data); +//exit(); + + +// 菜单 +//$url = 'https://www.shuote.top:8082/flash/sport/sortList'; +// 活动列表 +//$url = 'https://www.shuote.top:8082/flash/activity/list?pageNo=1&pageSize=100&sortRule=0&latitude=36.66725802951389&longitude=116.89963406032986&area=&city=%E6%B5%8E%E5%8D%97&nearby=&date=&levelLower=1&levelUpper=9&sportId=1'; + +if (!$pay) { + + $user = "https://www.shuote.top:8082/flash/user/getUserInfo?sportId=11"; + $response = curl_get_with_custom_headers($user, $custom_get_headers); + $data = json_decode($response, true); + if (!empty($data) && $data['code'] == 200) { + $nickName = $data['result']['nickName']; + echo "账户:" . $nickName . "
" . PHP_EOL; + + } + + $userWallet = 'https://www.shuote.top:8082/flash/wallet/userWallet'; + $response = curl_get_with_custom_headers($userWallet, $custom_get_headers); + $data = json_decode($response, true); + if (!empty($data) && $data['code'] == 200) { + $totalAmount = $data['result']['totalAmount']; + $availableAmount = $data['result']['availableAmount']; + $frozenAmount = $data['result']['frozenAmount']; + echo "总余额:" . $totalAmount . "
" . PHP_EOL; + echo "冻结中:" . $frozenAmount . "
" . PHP_EOL; + echo "可提现:" . $availableAmount . "
" . PHP_EOL; + } + +// 活动详情 +//$detailUrl = 'https://www.shuote.top:8082/flash/activity/detail?activityId=661001&latitude=36.66725802951389&longitude=116.89963406032986'; + $detailUrl = 'https://www.shuote.top:8082/flash/activity/detail?activityId=' . $activityId . '&latitude=36.66725802951389&longitude=116.89963406032986'; + $response = curl_get_with_custom_headers($detailUrl, $custom_get_headers); + $data = json_decode($response, true); +//var_dump($data); + if (!empty($data) && $data['code'] == 200) { + $activityId = $data['result']['activityId']; + $activityTitle = $data['result']['activityTitle']; + $totalCost = $data['result']['totalCost']; + echo "活动ID:" . $activityId . "
" . PHP_EOL; + echo "活动名称:" . $activityTitle . "
" . PHP_EOL; + echo "报名价格:" . $totalCost . "
" . PHP_EOL; + } + + + // getApplyInfo + + $getApplyInfoUrl = 'https://www.shuote.top:8082/flash/activity/getApplyInfo?activityId=' . $activityId; + $response = curl_get_with_custom_headers($getApplyInfoUrl, $custom_get_headers); + $data = json_decode($response, true); + if (!empty($data) && $data['code'] == 200) { + $resp = $data['result']['actGroups']; + foreach ($resp as $group) { + echo "报名组ID:" . $group['groupId'] . "----报名组名称" . $group['groupName'] . "
" . PHP_EOL; + } + } + +} + + + +function curl_get_with_custom_headers($url, $custom_headers = []) +{ + // 初始化 cURL 会话 + $ch = curl_init(); + + // 设置 cURL 选项 + curl_setopt($ch, CURLOPT_URL, $url); // 设置请求的 URL + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 设置返回结果为字符串,而不是直接输出 + curl_setopt($ch, CURLOPT_HEADER, false); // 不输出头信息 + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // 跟踪重定向 + + // 如果有自定义请求头,则设置请求头 + if (!empty($custom_headers)) { + curl_setopt($ch, CURLOPT_HTTPHEADER, $custom_headers); + } + + // 接受压缩响应 + curl_setopt($ch, CURLOPT_ENCODING, ''); + + // 执行 cURL 请求 + $response = curl_exec($ch); + + // 检查是否有错误 + if (curl_errno($ch)) { + echo 'cURL 错误: ' . curl_error($ch); + } + + // 关闭 cURL 会话 + curl_close($ch); + + // 尝试解压缩响应数据 + $decoded_response = @gzdecode($response); + if ($decoded_response !== false) { + return $decoded_response; + } + + // 返回原始响应结果 + return $response; +} + + +function api_request_curl($url, $custom_headers = [], $postData = array()) +{ + + if (empty($url)) return ''; + $postData = json_encode($postData); + + $curl = curl_init(); //初始化 + curl_setopt($curl, CURLOPT_URL, $url); //设置url + curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); //设置http验证方法 + curl_setopt($curl, CURLOPT_TIMEOUT, 30); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //设置curl_exec获取的信息的返回方式 + curl_setopt($curl, CURLOPT_POST, 1); //设置发送方式为post请求 + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); //设置post的数据 + // 如果有自定义请求头,则设置请求头 +// if (!empty($custom_headers)) { +// curl_setopt($curl, CURLOPT_HTTPHEADER, $custom_headers); +// } + + $array = array_merge($custom_headers, array( + 'Content-Type: application/json', + 'Content-Length: ' . strlen($postData)) + ); + curl_setopt($curl, CURLOPT_HTTPHEADER, $array); + // 接受压缩响应 + curl_setopt($curl, CURLOPT_ENCODING, ''); + + + $result = curl_exec($curl); + if ($result === false) { + throw new Exception('Http request message :' . curl_error($curl)); + } + curl_close($curl); + // 尝试解压缩响应数据 + $decoded_response = @gzdecode($result); + if ($decoded_response !== false) { + return $decoded_response; + } + + + return $result; +} + + + +// +// +// +//// 使用示例 +//$url = 'https://www.shuote.top:8082/flash/activity/applyActivity'; +//$custom_post_headers = [ +// 'Host: www.shuote.top:8082', +// 'Connection: keep-alive', +// 'Content-Length: 280', +// 'Request-Channel: MP-WEIXIN', +// 'content-type: application/json', +// 'X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjdXN0b21QYXJhbWV0ZXIiOiJxd2VyMTIzNCIsImV4cCI6MTcyMDA2NTA2NiwidXNlcklkIjoxOTY0ODg3fQ.bGiCXbvGVGR_E6CHeaNP-XJxnxibrTgKGBvj8Q9HBu0', +// 'Accept-Encoding: gzip,compress,br,deflate', +// 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.49(0x18003137) NetType/WIFI Language/zh_CN', +// 'Referer: https://servicewechat.com/wxbb50595cab69d719/403/page-frame.html' +//]; +// +//$post_data = [ +// "payAmount" => "15.00", +// "activityId" => "657373", +// "maleCount" => 0, +// "femaleCount" => 0, +// "payType" => 3, +// "hangPeopleDetails" => [], +// "groupId" => 1126719, +// "applyRemark" => "", +// "teamName" => "", +// "idNumber" => "", +// "birthday" => "", +// "xbSex" => null, +// "cardType" => 1, +// "realName" => "", +// "memberRemarkList" => [], +// "trackActMemberProjectDoList" => [] +//]; +// +//$response = curl_post_with_custom_headers($url, $custom_headers, $post_data); +// +//echo $response; +// +// +// + + +// {"payAmount":"15.00","activityId":"657373","maleCount":0,"femaleCount":0,"payType":3,"hangPeopleDetails":[],"groupId":1126719,"applyRemark":"","teamName":"","idNumber":"","birthday":"","xbSex":null,"cardType":1,"realName":"","memberRemarkList":[],"trackActMemberProjectDoList":[]} + + +//curl 'https://www.shuote.top:8082/flash/activity/applyActivity' -H 'Host: www.shuote.top:8082' -H 'Connection: keep-alive' -H 'Content-Length: 280' -H 'Request-Channel: MP-WEIXIN' -H 'content-type: application/json' -H 'X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjdXN0b21QYXJhbWV0ZXIiOiJxd2VyMTIzNCIsImV4cCI6MTcyMDA2NTA2NiwidXNlcklkIjoxOTY0ODg3fQ.bGiCXbvGVGR_E6CHeaNP-XJxnxibrTgKGBvj8Q9HBu0' -H 'Accept-Encoding: gzip,compress,br,deflate' -H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.49(0x18003137) NetType/WIFI Language/zh_CN' -H 'Referer: https://servicewechat.com/wxbb50595cab69d719/403/page-frame.html' --data '{"payAmount":"15.00","activityId":"657373","maleCount":0,"femaleCount":0,"payType":3,"hangPeopleDetails":[],"groupId":1126719,"applyRemark":"","teamName":"","idNumber":"","birthday":"","xbSex":null,"cardType":1,"realName":"","memberRemarkList":[],"trackActMemberProjectDoList":[]}' +