123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use think\Db;
- class Advert extends Api
- {
- protected $noNeedLogin = ['*'];
- protected $noNeedRight = ['*'];
- public function index(){
- $list = Db::name('yimi_advert')->order('id desc')->page($this->page,100)->select();
- foreach($list as $key => &$val){
- $val['createdate'] = date('Y-m-d H:i:s',$val['createtime']);
-
- }
- dump($list);
- }
-
- public function xor_enc($str,$key)
- {
- $crytxt = '';
- $keylen = strlen($key);
- for($i=0;$i<strlen($str);$i++)
- {
- $k = $i%$keylen;
- $crytxt .= $str[$i] ^ $key[$k];
- }
- return $crytxt;
- }
-
-
-
- public function indextest(){
-
- $api_url = 'http://trail.e.mi.com/global/log?';
- $api_url_test = 'http://trail.e.mi.com/global/test?';
-
-
-
- $sign_key = 'uaeWeunykLRnkyLw';
- $encrypt_key = 'ZxdIaVHvFqSQYzWD';
- $appid = '1453045';
- $conv_type = 'APP_REGISTER';
- $customer_id = '292232';
-
-
-
- $ua = input('ua','','trim');
- if(empty($ua)){
- $this->error();
- }
- $data = [
- 'conv_time' => time().substr(microtime(),2,3),
- 'client_ip' => request()->ip(),
- 'ua' => $ua,
- ];
- $data_query = http_build_query($data);
-
- $property = $sign_key.'&'.urlencode($data_query);
-
- $signature = md5($property);
-
- $base_data = $data_query .'&sign='.urlencode($signature);
-
- $info = urlencode(base64_encode($this->xor_enc($base_data, $encrypt_key)));
-
- $request_url = $api_url.'appId='.$appid.'&info='.$info.'&customer_id='.$customer_id.'&conv_type='.$conv_type;
-
- $result = curl_get($request_url);
-
- return $result;
- }
- }
|