You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4 KiB

<?php
namespace app\controller;
use app\BaseController;
use think\facade\View;
use think\facade\Db;
use app\common\lib\Aes;
class Index extends BaseController
{
public function index()
{
return redirect('/home');
}
public function shorturl(){
$uid = base_convert(input('id'), 36, 10);
$result = Db::name('user')
->field('user_id,real_name,company,avatar,mark,uniqid')
->where('id',$uid)
->find();
if(!$result){
View::assign('username','');
View::assign('company','');
View::assign('mark','');
View::assign('avatar','');
View::assign('url','/home');
}else{
$aes = new Aes([]);
if(strlen(trim($result['uniqid']))>0){
$params = urlencode($aes->encrypt('verify_code='.$result['uniqid']));
}else{
$params = urlencode($aes->encrypt('user_id='.$result['user_id']));
}
$result['nfcurl'] = getUrl().'/card/?params='.$params;
View::assign('username',$result['real_name']);
View::assign('company',$result['company']);
View::assign('mark',$result['mark']);
View::assign('avatar',$result['avatar']);
View::assign('url',$result['nfcurl']);
}
return View::fetch();
}
}