347 lines
11 KiB
PHP
347 lines
11 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Welcome extends CI_Controller {
|
|
|
|
public function index()
|
|
{
|
|
echo "<h1>404</h1>";exit;
|
|
}
|
|
|
|
public function neta(){
|
|
//echo "<h1>404</h1>";exit;
|
|
//生产地址
|
|
$url = 'https://salesapp.hozonauto.com/appservice/app/if/salesclue/createSalesclue';
|
|
|
|
//测试地址
|
|
//$url = 'https://salespp-sit.hozonauto.com/appservice/app/if/salesclue/createSalesclue';
|
|
|
|
$cus = array('18878903790');
|
|
|
|
$comments = '100681'; //门店编码
|
|
$samobile = '18677222303';//销售手机
|
|
|
|
$cusSource3 = '023305'; //本地通
|
|
//$cusSource3 = '023409'; //区域云店 福泉厦
|
|
|
|
$city_id = '350200';
|
|
//$voId = $city_id . date('mdHis') . sprintf("%06d", rand(1,999999));
|
|
|
|
foreach ($cus as $v){
|
|
|
|
$voId = $city_id . date('mdHis') . sprintf("%06d", rand(1,999999));
|
|
|
|
$data[] = array(
|
|
'voId' => $voId,
|
|
'cusSource3' => $cusSource3,
|
|
'customerName' => '客户',
|
|
'dealerCode' => $comments,
|
|
'fromSystem' => "好店云",
|
|
'mobile' => $v,
|
|
'saMobile' => $samobile,
|
|
'cusType' => '30111001',
|
|
'remark' => '网约车',
|
|
'intentModel' => "哪吒AYA",
|
|
);
|
|
}
|
|
|
|
print_r(json_encode($data,JSON_UNESCAPED_UNICODE));
|
|
|
|
$data = json_encode($data, JSON_UNESCAPED_UNICODE);
|
|
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_POST, 1);
|
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
//https
|
|
if (strlen($url) > 5 && strtolower(substr($url, 0, 5)) == "https") {
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
|
}
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
|
'Content-Type: application/json; charset=utf-8',
|
|
'Content-Length: ' . strlen($data)
|
|
)
|
|
);
|
|
$response = curl_exec($ch);
|
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
curl_close($ch);
|
|
|
|
var_dump($response);
|
|
}
|
|
|
|
public function add_clues()
|
|
{
|
|
$this->load->model('hdcloud/neta_model');
|
|
|
|
|
|
$dealerCode = array('100222');
|
|
|
|
foreach ($dealerCode as $d)
|
|
{
|
|
$mobiles = $this->neta_model->select(array('status' => 0), '', 1, 29);
|
|
|
|
foreach ($mobiles as $k => $v) {
|
|
$city_id = '350200';
|
|
$voId = $city_id . date('mdHis') . sprintf("%06d", rand(1,999999));
|
|
|
|
$data[] = array(
|
|
'voId' => $voId,
|
|
'cusSource3' => '020211',//'023409'区域云店,//023410:云店营销节点 //020103太平洋
|
|
'customerName' => '客户',
|
|
'dealerCode' => $d,
|
|
'fromSystem' => "好店云",
|
|
'mobile' => $v['mobile'],
|
|
'saMobile' => '',
|
|
'cusType' => '30111001',
|
|
'remark' => "",
|
|
'intentModel' => "",
|
|
);
|
|
|
|
$this->neta_model->update(array('status' => 1), array('id' => $v['id']));
|
|
}
|
|
|
|
$data = json_encode($data, JSON_UNESCAPED_UNICODE);
|
|
|
|
$url = 'https://salesapp.hozonauto.com/appservice/app/if/salesclue/createSalesclue';
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_POST, 1);
|
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
//https
|
|
if (strlen($url) > 5 && strtolower(substr($url, 0, 5)) == "https") {
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
|
}
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
|
'Content-Type: application/json; charset=utf-8',
|
|
'Content-Length: ' . strlen($data)
|
|
)
|
|
);
|
|
$response = curl_exec($ch);
|
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
curl_close($ch);
|
|
|
|
var_dump($response);
|
|
}
|
|
}
|
|
|
|
|
|
public function upload(){
|
|
// 应用信息
|
|
$appid = '17dcc133'; // 应用 ID
|
|
$secretKey = '9d8b02ec2b9ea8dfdc51a1aed2e10986'; // 应用密钥
|
|
$uploadUrl = 'https://raasr.xfyun.cn/v2/api/upload'; // 文件上传接口地址
|
|
|
|
// 音频文件的 URL
|
|
$audioUrl = 'https://media.liche.cn/liche/yx/aef4c825a1ccb330/0a10dcea56ba1a2a.wav'; // 音频文件 URL
|
|
|
|
// 当前时间戳
|
|
$ts = time();
|
|
|
|
// 生成签名
|
|
$baseString = $appid . $ts;
|
|
$signa = base64_encode(hash_hmac('sha1', md5($baseString), $secretKey, true));
|
|
|
|
// 初始化 cURL
|
|
$ch = curl_init();
|
|
|
|
// 音频文件的元信息
|
|
$audioInfo = [
|
|
'appId' => $appid,
|
|
'signa' => $signa,
|
|
'ts' => $ts,
|
|
'fileName' => basename($audioUrl), // 文件名
|
|
'fileSize' => 1, // URL 模式下,文件大小可以传 0
|
|
'duration' => 1, // URL 模式下,音频时长可以传 0
|
|
'audioMode' => 'urlLink', // 使用 URL 外链模式
|
|
'audioUrl' => urlencode($audioUrl), // 音频文件的 URL
|
|
];
|
|
|
|
$queryString = http_build_query($audioInfo); // 将数组转换为查询字符串
|
|
$uploadUrl .= '?' . $queryString;
|
|
|
|
// 设置请求头
|
|
$headers = [
|
|
'Content-Type: application/json;charset=UTF-8', // URL 模式下,请求体为 JSON 格式
|
|
'Chunked: false'
|
|
];
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $uploadUrl);
|
|
curl_setopt($ch, CURLOPT_POST, 1);
|
|
curl_setopt($ch, CURLOPT_HEADER, $headers);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, '{}');
|
|
|
|
// 执行请求
|
|
$response = curl_exec($ch);
|
|
|
|
// 关闭 cURL
|
|
curl_close($ch);
|
|
|
|
// 输出响应结果
|
|
echo $response;
|
|
}
|
|
|
|
public function getResult(){
|
|
// 应用信息
|
|
$appid = '17dcc133'; // 应用 ID
|
|
$secretKey = '9d8b02ec2b9ea8dfdc51a1aed2e10986'; // 应用密钥
|
|
$getUrl = 'https://raasr.xfyun.cn/v2/api/getResult'; // 接口地址
|
|
|
|
// 当前时间戳
|
|
$ts = time();
|
|
|
|
// 生成签名
|
|
$baseString = $appid . $ts;
|
|
$signa = base64_encode(hash_hmac('sha1', md5($baseString), $secretKey, true));
|
|
|
|
// 初始化 cURL
|
|
$ch = curl_init();
|
|
|
|
// 音频文件的元信息
|
|
|
|
$audioInfo = [
|
|
'appId' => $appid,
|
|
'signa' => $signa,
|
|
'ts' => $ts,
|
|
'orderId' => 'DKHJQ20250220174031610SI0cnrYneSIz8bZm'
|
|
];
|
|
|
|
$queryString = http_build_query($audioInfo); // 将数组转换为查询字符串
|
|
$getUrl .= '?' . $queryString;
|
|
|
|
// 设置请求头
|
|
$headers = [
|
|
'Content-Type: multipart/form-data;', // URL 模式下,请求体为 JSON 格式
|
|
];
|
|
|
|
// 设置 cURL 选项
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $getUrl);
|
|
curl_setopt($ch, CURLOPT_POST, 1);
|
|
curl_setopt($ch, CURLOPT_HEADER, $headers);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, '{}');
|
|
|
|
// 执行请求
|
|
$response = curl_exec($ch);
|
|
|
|
// 关闭 cURL
|
|
curl_close($ch);
|
|
|
|
// 输出响应结果
|
|
echo $response;
|
|
}
|
|
|
|
|
|
public function hs(){
|
|
$appId = "3231454391"; // 替换为你的 App ID
|
|
$token = "h2MUNInVzaduLZeSy7AGclRNOft1k25o"; // 替换为你的 Token
|
|
$uuid = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
|
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
|
|
mt_rand(0, 0xffff),
|
|
mt_rand(0, 0x0fff) | 0x4000,
|
|
mt_rand(0, 0x3fff) | 0x8000,
|
|
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
|
|
|
|
|
|
// 初始化 cURL
|
|
$ch = curl_init();
|
|
|
|
// 提交识别请求的 URL 和查询结果的 URL
|
|
$submitUrl = "https://openspeech.bytedance.com/api/v3/auc/bigmodel/submit";
|
|
$audioUrl = "https://media.liche.cn/liche/yx/aef4c825a1ccb330/0a10dcea56ba1a2a.wav"; // 替换为你的音频文件 URL
|
|
|
|
// 构造请求体
|
|
$jsonBody = json_encode([
|
|
"audio" => [
|
|
"url" => $audioUrl,
|
|
"format" => "wav",
|
|
],
|
|
"request" => ["model_name" => "bigmodel"]
|
|
]);
|
|
|
|
// 提交识别请求
|
|
$headers = [
|
|
"X-Api-App-Key: $appId",
|
|
"X-Api-Access-Key: $token",
|
|
"X-Api-Resource-Id: volc.bigasr.auc",
|
|
"X-Api-Request-Id: $uuid",
|
|
"X-Api-Sequence: -1"
|
|
];
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $submitUrl);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonBody);
|
|
curl_setopt($ch, CURLOPT_HEADER, true);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
$submitResponse = curl_exec($ch);
|
|
|
|
// 分割响应头和正文
|
|
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
|
$header = substr($submitResponse, 0, $headerSize);
|
|
$body = substr($submitResponse, $headerSize);
|
|
|
|
echo $uuid."\n";
|
|
var_dump($submitResponse);exit;
|
|
$submitHttpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
|
|
if ($submitHttpCode != 200) {
|
|
print_r(["error" => "Submit request failed with HTTP code $submitHttpCode", "response" => $submitResponse]) ;
|
|
}
|
|
|
|
$submitResult = json_decode($submitResponse, true);
|
|
if ($submitResult["status_code"] != 20000000) {
|
|
print_r(["error" => "Submit request failed: " . $submitResult["message"], "response" => $submitResponse]) ;
|
|
}
|
|
|
|
$logId = $submitResult["log_id"];
|
|
echo "Log ID: $logId\n";
|
|
}
|
|
|
|
public function getHs(){
|
|
$appId = "3231454391"; // 替换为你的 App ID
|
|
$token = "h2MUNInVzaduLZeSy7AGclRNOft1k25o"; // 替换为你的 Token
|
|
$rid = 'f14510ff-973a-4771-9491-718a0133dcc1';
|
|
|
|
// 初始化 cURL
|
|
$ch = curl_init();
|
|
|
|
// 提交识别请求的 URL 和查询结果的 URL
|
|
$queryUrl = "https://openspeech.bytedance.com/api/v3/auc/bigmodel/query";
|
|
|
|
// 提交识别请求
|
|
$headers = [
|
|
"X-Api-App-Key: $appId",
|
|
"X-Api-Access-Key: $token",
|
|
"X-Api-Resource-Id: volc.bigasr.auc",
|
|
"X-Api-Request-Id: $rid",
|
|
];
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $queryUrl);
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, '{}');
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
|
curl_setopt($ch, CURLOPT_HEADER, true);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
$submitResponse = curl_exec($ch);
|
|
|
|
// 分割响应头和正文
|
|
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
|
$header = substr($submitResponse, 0, $headerSize);
|
|
$body = substr($submitResponse, $headerSize);
|
|
|
|
var_dump($submitResponse);exit;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|