104 lines
3.7 KiB
PHP
104 lines
3.7 KiB
PHP
<?php
|
|
//ini_set("display_errors", "On");//打开错误提示
|
|
//ini_set("error_reporting",E_ALL);//显示所有错误
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class Welcome extends CI_Controller
|
|
{
|
|
|
|
public function index()
|
|
{
|
|
$this->load->view('welcome_message');
|
|
}
|
|
|
|
public function test()
|
|
{
|
|
$open_key = 'CdJiji028';
|
|
$secret_key = 'MjkJiji';
|
|
|
|
// 获取当前时间戳(秒)和微秒数
|
|
$microtime = microtime(true); // 返回一个浮点数,单位为秒
|
|
// 将其转换为毫秒时间戳(整数)
|
|
$t = (int)($microtime * 1000);
|
|
$t = time();
|
|
$token = $this->encode($secret_key.$t, $open_key);
|
|
|
|
$data = file_get_contents("https://xmmjk.dongzhumeijia.com/api/api/goodlist/token/{$token}/times/{$t}/start/0/number/50");
|
|
|
|
$str = trim($data, '\"');
|
|
|
|
// 解码Unicode转义字符
|
|
$str = json_decode('"' . $str . '"');
|
|
|
|
// 现在$str是有效的JSON字符串,可以解析为数组
|
|
$array = json_decode($str, true);
|
|
|
|
print_r($array);
|
|
|
|
// $this->load->library('carHome/daiFu');
|
|
// $daiFu = new DaiFu();
|
|
// $daiFu->uploadIdCardImage();
|
|
// $idCard = "350802199111298215";
|
|
// $req = $daiFu->queryIdCardImage($idCard);
|
|
// $requestId = time();
|
|
// $realName = "林聪聪";
|
|
// $cellphone = "18350451617";
|
|
// $req = $daiFu->signUp($requestId, $idCard, $realName, $cellphone);
|
|
// $req = $daiFu->querySignUp($requestId, $idCard, $realName, $cellphone);
|
|
// var_dump($req->isSuccess());
|
|
// var_dump($req->getMessage());
|
|
// var_dump($req->getData());
|
|
// $this->load->library('carHome/callOut');
|
|
// $this->load->library('carHome/callOutWechat');
|
|
// $callOut = new CallOut();
|
|
// $callOutWechat = new CallOutWechat();
|
|
// $req = $callOutWechat->getToken();
|
|
// $orderId = $requestId = time();
|
|
// $agentPhoneNo = '18350451617';
|
|
// $customerPhoneNo = '13365081602';
|
|
// $req = $callOutWechat->bind($requestId, $orderId, $agentPhoneNo, $customerPhoneNo);
|
|
// $req = $callOutWechat->outBind($requestId, $orderId, $agentPhoneNo, $customerPhoneNo);
|
|
// var_dump($req);
|
|
// $recKeyStr = "ZX202508211605082100201400636";
|
|
// $req = $callOutWechat->getAudio($recKeyStr);
|
|
// var_dump($req->getData());
|
|
// var_dump($req->getData());
|
|
// $callOut->call();
|
|
// $this->load->model('receiver/receiver_customers_model', 'customers_model');
|
|
// $rid = 17418;
|
|
// $bizId = 57;
|
|
// $res = $this->customers_model->Commissions($rid, $bizId);
|
|
// var_dump($res);
|
|
}
|
|
|
|
function encode($string, $key)
|
|
{
|
|
$key = md5($key);
|
|
$key_length = strlen($key);
|
|
$string = substr(md5($string . $key), 0, 8) . $string;
|
|
$string_length = strlen($string);
|
|
$rndkey = $box = array();
|
|
$result = '';
|
|
for ($i = 0; $i <= 255; $i++) {
|
|
$rndkey[$i] = ord($key[$i % $key_length]);
|
|
$box[$i] = $i;
|
|
}
|
|
for ($j = $i = 0; $i < 256; $i++) {
|
|
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
|
|
$tmp = $box[$i];
|
|
$box[$i] = $box[$j];
|
|
$box[$j] = $tmp;
|
|
}
|
|
for ($a = $j = $i = 0; $i < $string_length; $i++) {
|
|
$a = ($a + 1) % 256;
|
|
$j = ($j + $box[$a]) % 256;
|
|
$tmp = $box[$a];
|
|
$box[$a] = $box[$j];
|
|
$box[$j] = $tmp;
|
|
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) %
|
|
256]));
|
|
}
|
|
return str_replace('=', '', base64_encode($result));
|
|
}
|
|
}
|