189 lines
6.0 KiB
PHP
189 lines
6.0 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('100619');
|
|
|
|
foreach ($dealerCode as $d)
|
|
{
|
|
$mobiles = $this->neta_model->select(array('status' => 0), '', 1, 7);
|
|
|
|
foreach ($mobiles as $k => $v) {
|
|
$city_id = '350200';
|
|
$voId = $city_id . date('mdHis') . sprintf("%06d", rand(1,999999));
|
|
|
|
$data[] = array(
|
|
'voId' => $voId,
|
|
'cusSource3' => '020142',//'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 static function encrypt($data, $key) {
|
|
$key = base64_decode($key);
|
|
if (strlen($key) < 16) {
|
|
$key = str_pad($key, 16, "\0");
|
|
} elseif (strlen($key) > 16) {
|
|
$key = substr($key, 0, 16);
|
|
}
|
|
$iv = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; // ECB模式不需要IV,但PHP的openssl_encrypt函数需要
|
|
return openssl_encrypt($data, 'AES-128-ECB', $key, OPENSSL_RAW_DATA, $iv);
|
|
}
|
|
|
|
/**
|
|
* 将加密后的二进制数据转换成十六进制字符串
|
|
* @param string $binaryData 加密后的二进制数据
|
|
* @return string 十六进制字符串
|
|
*/
|
|
public static function parseBinary2HexStr($binaryData) {
|
|
return bin2hex($binaryData);
|
|
}
|
|
|
|
/**
|
|
* 加密数据并返回十六进制字符串
|
|
* @param mixed $obj 待加密的数据
|
|
* @param string $key 密钥
|
|
* @return string 加密后的十六进制字符串
|
|
*/
|
|
public static function encryptData($obj, $key) {
|
|
$content = is_string($obj) ? $obj : serialize($obj);
|
|
$encrypted = self::encrypt($content, $key);
|
|
return self::parseBinary2HexStr($encrypted);
|
|
}
|
|
|
|
public function t1()
|
|
{
|
|
$key = "B066+uPhhihfn0CLrU5Cpw==";
|
|
$data = "0534_1729650980126_1729650980126";
|
|
$encryptedData = $this->encryptData($data, $key);
|
|
echo "加密内容:" . strtoupper($encryptedData) . "\n";
|
|
}
|
|
|
|
public function t2()
|
|
{
|
|
$key = "MMrPzdpMKIVcQBOiQN/uoQ==";
|
|
$mobile = "13012341234";
|
|
$encryptedData = $this->encryptData($mobile, $key);
|
|
echo "手机号加密内容:" . strtoupper($encryptedData) . "\n";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|