init
This commit is contained in:
78
application/index/controller/Ajax.php
Normal file
78
application/index/controller/Ajax.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\common\controller\Frontend;
|
||||
use think\Lang;
|
||||
use think\Loader;
|
||||
use think\Response;
|
||||
|
||||
/**
|
||||
* Ajax异步请求接口
|
||||
* @internal
|
||||
*/
|
||||
class Ajax extends Frontend
|
||||
{
|
||||
|
||||
protected $noNeedLogin = ['lang', 'upload'];
|
||||
protected $noNeedRight = ['*'];
|
||||
protected $layout = '';
|
||||
|
||||
/**
|
||||
* 加载语言包
|
||||
*/
|
||||
public function lang()
|
||||
{
|
||||
$this->request->get(['callback' => 'define']);
|
||||
$header = ['Content-Type' => 'application/javascript'];
|
||||
if (!config('app_debug')) {
|
||||
$offset = 30 * 60 * 60 * 24; // 缓存一个月
|
||||
$header['Cache-Control'] = 'public';
|
||||
$header['Pragma'] = 'cache';
|
||||
$header['Expires'] = gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
|
||||
}
|
||||
|
||||
$controllername = $this->request->get('controllername');
|
||||
$lang = $this->request->get('lang');
|
||||
if (!$lang || !in_array($lang, config('allow_lang_list')) || !$controllername || !preg_match("/^[a-z0-9_\.]+$/i", $controllername)) {
|
||||
return jsonp(['errmsg' => '参数错误'], 200, [], ['json_encode_param' => JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE]);
|
||||
}
|
||||
|
||||
$controllername = input("controllername");
|
||||
$className = Loader::parseClass($this->request->module(), 'controller', $controllername, false);
|
||||
|
||||
//存在对应的类才加载
|
||||
if (class_exists($className)) {
|
||||
$this->loadlang($controllername);
|
||||
}
|
||||
|
||||
//强制输出JSON Object
|
||||
return jsonp(Lang::get(), 200, $header, ['json_encode_param' => JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成后缀图标
|
||||
*/
|
||||
public function icon()
|
||||
{
|
||||
$suffix = $this->request->request("suffix");
|
||||
$suffix = $suffix ? $suffix : "FILE";
|
||||
$data = build_suffix_image($suffix);
|
||||
$header = ['Content-Type' => 'image/svg+xml'];
|
||||
$offset = 30 * 60 * 60 * 24; // 缓存一个月
|
||||
$header['Cache-Control'] = 'public';
|
||||
$header['Pragma'] = 'cache';
|
||||
$header['Expires'] = gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
|
||||
$response = Response::create($data, '', 200, $header);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
return action('api/common/upload');
|
||||
}
|
||||
|
||||
}
|
||||
93
application/index/controller/Datav.php
Normal file
93
application/index/controller/Datav.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\common\controller\Frontend;
|
||||
|
||||
class Datav extends Frontend
|
||||
{
|
||||
|
||||
protected $noNeedLogin = '*';
|
||||
protected $noNeedRight = '*';
|
||||
protected $layout = '';
|
||||
|
||||
//总览
|
||||
public function index()
|
||||
{
|
||||
return $this->view->fetch('jingmen/index');
|
||||
}
|
||||
|
||||
public function map_video()
|
||||
{
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
//监管系统大屏
|
||||
public function clm()
|
||||
{
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
//车辆码
|
||||
public function i_clm()
|
||||
{
|
||||
return $this->view->fetch('jingmen/i_clm');
|
||||
}
|
||||
|
||||
|
||||
//车辆动态
|
||||
public function cldt()
|
||||
{
|
||||
return $this->view->fetch('jingmen/cldt');
|
||||
}
|
||||
|
||||
// 运单动态
|
||||
public function yddt()
|
||||
{
|
||||
return $this->view->fetch('jingmen/yddt');
|
||||
}
|
||||
|
||||
// 报警列表
|
||||
public function bjlist()
|
||||
{
|
||||
|
||||
return $this->view->fetch('car/bjlist');
|
||||
|
||||
}
|
||||
|
||||
//车辆详情
|
||||
public function car_detail()
|
||||
{
|
||||
return $this->view->fetch('car/car_detail');
|
||||
}
|
||||
|
||||
//入园记录
|
||||
public function park_list()
|
||||
{
|
||||
return $this->view->fetch('car/park_list');
|
||||
}
|
||||
|
||||
//运单记录
|
||||
public function waybill_list()
|
||||
{
|
||||
return $this->view->fetch('car/waybill_list');
|
||||
}
|
||||
|
||||
//车辆轨迹
|
||||
public function vehicle_history()
|
||||
{
|
||||
// 支持通过车辆ID或车牌号查询
|
||||
$vehicleNoInput = input('id');
|
||||
if (is_numeric($vehicleNoInput)) {
|
||||
// 如果是数字,当作车辆ID处理
|
||||
$vehicleNo = \app\admin\model\yq\driver\Vehicle::where('id', $vehicleNoInput)->value('license');
|
||||
} else {
|
||||
// 如果是字符串,当作车牌号处理
|
||||
$vehicleNo = $vehicleNoInput;
|
||||
}
|
||||
$this->assign('vehicleNo', $vehicleNo);
|
||||
return $this->view->fetch('car/vehicle_history');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
100
application/index/controller/Index.php
Normal file
100
application/index/controller/Index.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\common\controller\Frontend;
|
||||
|
||||
class Index extends Frontend
|
||||
{
|
||||
|
||||
protected $noNeedLogin = '*';
|
||||
protected $noNeedRight = '*';
|
||||
protected $layout = '';
|
||||
private $iv = 'XAkVMV0l4Dk4tsqs';// iv的长度要根据加密方式和模式来定,aes-128-cbc偏移量的是16位
|
||||
|
||||
private $key = 'VlHFhskOPV1vrYTo12';
|
||||
|
||||
public function mb_str_splits($string, $split_length = 1, $encoding = 'UTF-8') {
|
||||
$result = [];
|
||||
$length = mb_strlen($string, $encoding);
|
||||
for ($i = 0; $i < $length; $i += $split_length) {
|
||||
$result[] = mb_substr($string, $i, $split_length, $encoding);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
//模拟AI回复文本输出
|
||||
public function outText($message)
|
||||
{
|
||||
if (ob_get_level() > 0) {
|
||||
ob_end_clean();
|
||||
}
|
||||
header('Content-Type: text/event-stream');
|
||||
header('Cache-Control: no-cache');
|
||||
header('Connection: keep-alive');
|
||||
header('X-Accel-Buffering: no');
|
||||
// 确保没有输出缓冲区阻止我们立即发送内容
|
||||
while (ob_get_level() > 0) {
|
||||
ob_end_flush();
|
||||
}
|
||||
ob_start();
|
||||
// 要显示的消息
|
||||
$msg = $this->mb_str_splits($message);
|
||||
foreach ($msg as $char) {
|
||||
|
||||
$data = ['choices' =>[['delta' =>['content' => $char]]]];
|
||||
echo 'data: ' . json_encode($data, JSON_UNESCAPED_UNICODE). PHP_EOL;
|
||||
ob_flush();
|
||||
flush();
|
||||
usleep(25000);
|
||||
}
|
||||
echo '[回答完毕]';
|
||||
ob_flush();
|
||||
flush();
|
||||
ob_end_flush();
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
// //获取园区坐标
|
||||
// $perimeter = (new Perimeter)->select();
|
||||
//
|
||||
// $str = '107.024924,29.817815;107.033335,29.822283;107.03591,29.823028;107.037455,29.825113;107.041918,29.826304;107.041918,29.829283;107.044836,29.830325;107.04621,29.827793;107.051531,29.825411;107.055651,29.821985;107.058226,29.820347;107.057539,29.817666;107.054793,29.816177;107.042605,29.810219;107.037798,29.805453;107.035567,29.800388;107.035223,29.796962;107.025954,29.788024;107.02561,29.784448;107.025439,29.783405;107.020975,29.781021;107.022349,29.779681;107.015311,29.77685;107.019259,29.771039;107.020804,29.769549;107.026125,29.774913;107.030417,29.779979;107.035738,29.786534;107.044493,29.798154;107.051188,29.805453;107.056509,29.809028;107.062174,29.8059;107.068011,29.802474;107.069384,29.80158;107.057711,29.786981;107.048785,29.775807;107.039515,29.766866;107.030588,29.759267;107.028872,29.75882;107.022349,29.763141;107.015654,29.770741;107.011706,29.77685;107.001234,29.774168;106.995055,29.773274;106.988703,29.783852;106.982695,29.786832;106.97497,29.788322;106.970679,29.786832;106.967074,29.786832;106.96364,29.79145;106.963812,29.794877;106.969134,29.802325;106.97291,29.805751;106.972395,29.813198;106.967245,29.81722;106.962954,29.820943;106.965872,29.827645;106.968619,29.832112;106.973082,29.839557;106.97909,29.848342;106.984583,29.855638;106.985785,29.856829;106.996599,29.85266;107.001234,29.861593;107.003638,29.864868;107.012736,29.864272;107.0184,29.862337;107.014109,29.850725;107.011362,29.845662;107.010847,29.842089;107.012736,29.837026;107.017199,29.830623;107.017371,29.830325;107.019945,29.829878;107.021319,29.826453;107.02355,29.821092;107.024752,29.818113';
|
||||
// $arr = explode(';', $str);
|
||||
// $lat_str = [];
|
||||
// foreach ($arr as $key => $value) {
|
||||
// $lat_lag = explode(',', $value);
|
||||
// $lat_str [] = [
|
||||
// 'lat' => $lat_lag[1],
|
||||
// 'lon' => $lat_lag[0],
|
||||
// ];
|
||||
// }
|
||||
// print_r(json_encode($lat_str));
|
||||
// die();
|
||||
|
||||
// 手机号 密码 加密
|
||||
// 单独加一个(对应)字段来存储验证 现在手机号和之前保存手机号
|
||||
// return $this->view->fetch('datav/index');
|
||||
// return $this->view->fetch();
|
||||
return $this->view->fetch('jingmen/index');
|
||||
|
||||
}
|
||||
|
||||
public function h5()
|
||||
{
|
||||
return $this->view->fetch('/index/h5');
|
||||
}
|
||||
|
||||
|
||||
public function encrypt($input)
|
||||
{
|
||||
return base64_encode(openssl_encrypt($input, 'AES-128-CBC', $this->key, OPENSSL_RAW_DATA, $this->iv));
|
||||
}
|
||||
|
||||
public function decrypt($input)
|
||||
{
|
||||
return openssl_decrypt(base64_decode($input), 'AES-128-CBC', $this->key, OPENSSL_RAW_DATA, $this->iv);
|
||||
}
|
||||
}
|
||||
|
||||
333
application/index/controller/User.php
Normal file
333
application/index/controller/User.php
Normal file
@@ -0,0 +1,333 @@
|
||||
<?php
|
||||
|
||||
namespace app\index\controller;
|
||||
|
||||
use addons\wechat\model\WechatCaptcha;
|
||||
use app\common\controller\Frontend;
|
||||
use app\common\library\Ems;
|
||||
use app\common\library\Sms;
|
||||
use app\common\model\Attachment;
|
||||
use think\Config;
|
||||
use think\Cookie;
|
||||
use think\Hook;
|
||||
use think\Session;
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 会员中心
|
||||
*/
|
||||
class User extends Frontend
|
||||
{
|
||||
protected $layout = 'default';
|
||||
protected $noNeedLogin = ['login', 'register', 'third'];
|
||||
protected $noNeedRight = ['*'];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$auth = $this->auth;
|
||||
|
||||
if (!Config::get('fastadmin.usercenter')) {
|
||||
$this->error(__('User center already closed'), '/');
|
||||
}
|
||||
|
||||
//监听注册登录退出的事件
|
||||
Hook::add('user_login_successed', function ($user) use ($auth) {
|
||||
$expire = input('post.keeplogin') ? 30 * 86400 : 0;
|
||||
Cookie::set('uid', $user->id, $expire);
|
||||
Cookie::set('token', $auth->getToken(), $expire);
|
||||
});
|
||||
Hook::add('user_register_successed', function ($user) use ($auth) {
|
||||
Cookie::set('uid', $user->id);
|
||||
Cookie::set('token', $auth->getToken());
|
||||
});
|
||||
Hook::add('user_delete_successed', function ($user) use ($auth) {
|
||||
Cookie::delete('uid');
|
||||
Cookie::delete('token');
|
||||
});
|
||||
Hook::add('user_logout_successed', function ($user) use ($auth) {
|
||||
Cookie::delete('uid');
|
||||
Cookie::delete('token');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员中心
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->view->assign('title', __('User center'));
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册会员
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$url = $this->request->request('url', '', 'url_clean');
|
||||
if ($this->auth->id) {
|
||||
$this->success(__('You\'ve logged in, do not login again'), $url ? $url : url('user/index'));
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$username = $this->request->post('username');
|
||||
$password = $this->request->post('password', '', null);
|
||||
$email = $this->request->post('email');
|
||||
$mobile = $this->request->post('mobile', '');
|
||||
$captcha = $this->request->post('captcha');
|
||||
$token = $this->request->post('__token__');
|
||||
$rule = [
|
||||
'username' => 'require|length:3,30',
|
||||
'password' => 'require|length:6,30',
|
||||
'email' => 'require|email',
|
||||
'mobile' => 'regex:/^1\d{10}$/',
|
||||
'__token__' => 'require|token',
|
||||
];
|
||||
|
||||
$msg = [
|
||||
'username.require' => 'Username can not be empty',
|
||||
'username.length' => 'Username must be 3 to 30 characters',
|
||||
'password.require' => 'Password can not be empty',
|
||||
'password.length' => 'Password must be 6 to 30 characters',
|
||||
'email' => 'Email is incorrect',
|
||||
'mobile' => 'Mobile is incorrect',
|
||||
];
|
||||
$data = [
|
||||
'username' => $username,
|
||||
'password' => $password,
|
||||
'email' => $email,
|
||||
'mobile' => $mobile,
|
||||
'__token__' => $token,
|
||||
];
|
||||
//验证码
|
||||
$captchaResult = true;
|
||||
$captchaType = config("fastadmin.user_register_captcha");
|
||||
if ($captchaType) {
|
||||
if ($captchaType == 'mobile') {
|
||||
$captchaResult = Sms::check($mobile, $captcha, 'register');
|
||||
} elseif ($captchaType == 'email') {
|
||||
$captchaResult = Ems::check($email, $captcha, 'register');
|
||||
} elseif ($captchaType == 'wechat') {
|
||||
$captchaResult = WechatCaptcha::check($captcha, 'register');
|
||||
} elseif ($captchaType == 'text') {
|
||||
$captchaResult = \think\Validate::is($captcha, 'captcha');
|
||||
}
|
||||
}
|
||||
if (!$captchaResult) {
|
||||
$this->error(__('Captcha is incorrect'));
|
||||
}
|
||||
$validate = new Validate($rule, $msg);
|
||||
$result = $validate->check($data);
|
||||
if (!$result) {
|
||||
$this->error(__($validate->getError()), null, ['token' => $this->request->token()]);
|
||||
}
|
||||
if ($this->auth->register($username, $password, $email, $mobile)) {
|
||||
$this->success(__('Sign up successful'), $url ? $url : url('user/index'));
|
||||
} else {
|
||||
$this->error($this->auth->getError(), null, ['token' => $this->request->token()]);
|
||||
}
|
||||
}
|
||||
//判断来源
|
||||
$referer = $this->request->server('HTTP_REFERER', '', 'url_clean');
|
||||
if (!$url && $referer && !preg_match("/(user\/login|user\/register|user\/logout)/i", $referer)) {
|
||||
$url = $referer;
|
||||
}
|
||||
$this->view->assign('captchaType', config('fastadmin.user_register_captcha'));
|
||||
$this->view->assign('url', $url);
|
||||
$this->view->assign('title', __('Register'));
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员登录
|
||||
*/
|
||||
public function login()
|
||||
{
|
||||
$url = $this->request->request('url', '', 'url_clean');
|
||||
if ($this->auth->id) {
|
||||
$this->success(__('You\'ve logged in, do not login again'), $url ?: url('user/index'));
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$account = $this->request->post('account');
|
||||
$password = $this->request->post('password', '', null);
|
||||
$keeplogin = (int)$this->request->post('keeplogin');
|
||||
$token = $this->request->post('__token__');
|
||||
$rule = [
|
||||
'account' => 'require|length:3,50',
|
||||
'password' => 'require|length:6,30',
|
||||
'__token__' => 'require|token',
|
||||
];
|
||||
|
||||
$msg = [
|
||||
'account.require' => 'Account can not be empty',
|
||||
'account.length' => 'Account must be 3 to 50 characters',
|
||||
'password.require' => 'Password can not be empty',
|
||||
'password.length' => 'Password must be 6 to 30 characters',
|
||||
];
|
||||
$data = [
|
||||
'account' => $account,
|
||||
'password' => $password,
|
||||
'__token__' => $token,
|
||||
];
|
||||
$validate = new Validate($rule, $msg);
|
||||
$result = $validate->check($data);
|
||||
if (!$result) {
|
||||
$this->error(__($validate->getError()), null, ['token' => $this->request->token()]);
|
||||
}
|
||||
if ($this->auth->login($account, $password)) {
|
||||
$this->success(__('Logged in successful'), $url ? $url : url('user/index'));
|
||||
} else {
|
||||
$this->error($this->auth->getError(), null, ['token' => $this->request->token()]);
|
||||
}
|
||||
}
|
||||
//判断来源
|
||||
$referer = $this->request->server('HTTP_REFERER', '', 'url_clean');
|
||||
if (!$url && $referer && !preg_match("/(user\/login|user\/register|user\/logout)/i", $referer)) {
|
||||
$url = $referer;
|
||||
}
|
||||
$this->view->assign('url', $url);
|
||||
$this->view->assign('title', __('Login'));
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$this->token();
|
||||
//退出本站
|
||||
$this->auth->logout();
|
||||
$this->success(__('Logout successful'), url('user/index'));
|
||||
}
|
||||
$html = "<form id='logout_submit' name='logout_submit' action='' method='post'>" . token() . "<input type='submit' value='ok' style='display:none;'></form>";
|
||||
$html .= "<script>document.forms['logout_submit'].submit();</script>";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
public function profile()
|
||||
{
|
||||
$this->view->assign('title', __('Profile'));
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
public function changepwd()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$oldpassword = $this->request->post("oldpassword", '', null);
|
||||
$newpassword = $this->request->post("newpassword", '', null);
|
||||
$renewpassword = $this->request->post("renewpassword", '', null);
|
||||
$token = $this->request->post('__token__');
|
||||
$rule = [
|
||||
'oldpassword' => 'require|regex:\S{6,30}',
|
||||
'newpassword' => 'require|regex:\S{6,30}',
|
||||
'renewpassword' => 'require|regex:\S{6,30}|confirm:newpassword',
|
||||
'__token__' => 'token',
|
||||
];
|
||||
|
||||
$msg = [
|
||||
'renewpassword.confirm' => __('Password and confirm password don\'t match')
|
||||
];
|
||||
$data = [
|
||||
'oldpassword' => $oldpassword,
|
||||
'newpassword' => $newpassword,
|
||||
'renewpassword' => $renewpassword,
|
||||
'__token__' => $token,
|
||||
];
|
||||
$field = [
|
||||
'oldpassword' => __('Old password'),
|
||||
'newpassword' => __('New password'),
|
||||
'renewpassword' => __('Renew password')
|
||||
];
|
||||
$validate = new Validate($rule, $msg, $field);
|
||||
$result = $validate->check($data);
|
||||
if (!$result) {
|
||||
$this->error(__($validate->getError()), null, ['token' => $this->request->token()]);
|
||||
}
|
||||
|
||||
$ret = $this->auth->changepwd($newpassword, $oldpassword);
|
||||
if ($ret) {
|
||||
$this->success(__('Reset password successful'), url('user/login'));
|
||||
} else {
|
||||
$this->error($this->auth->getError(), null, ['token' => $this->request->token()]);
|
||||
}
|
||||
}
|
||||
$this->view->assign('title', __('Change password'));
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
public function attachment()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax()) {
|
||||
$mimetypeQuery = [];
|
||||
$where = [];
|
||||
$filter = $this->request->request('filter');
|
||||
$filterArr = (array)json_decode($filter, true);
|
||||
if (isset($filterArr['mimetype']) && preg_match("/(\/|\,|\*)/", $filterArr['mimetype'])) {
|
||||
$this->request->get(['filter' => json_encode(array_diff_key($filterArr, ['mimetype' => '']))]);
|
||||
$mimetypeQuery = function ($query) use ($filterArr) {
|
||||
$mimetypeArr = array_filter(explode(',', $filterArr['mimetype']));
|
||||
foreach ($mimetypeArr as $index => $item) {
|
||||
$query->whereOr('mimetype', 'like', '%' . str_replace("/*", "/", $item) . '%');
|
||||
}
|
||||
};
|
||||
} elseif (isset($filterArr['mimetype'])) {
|
||||
$where['mimetype'] = ['like', '%' . $filterArr['mimetype'] . '%'];
|
||||
}
|
||||
|
||||
if (isset($filterArr['filename'])) {
|
||||
$where['filename'] = ['like', '%' . $filterArr['filename'] . '%'];
|
||||
}
|
||||
|
||||
if (isset($filterArr['createtime'])) {
|
||||
$timeArr = explode(' - ', $filterArr['createtime']);
|
||||
$where['createtime'] = ['between', [strtotime($timeArr[0]), strtotime($timeArr[1])]];
|
||||
}
|
||||
$search = $this->request->get('search');
|
||||
if ($search) {
|
||||
$where['filename'] = ['like', '%' . $search . '%'];
|
||||
}
|
||||
|
||||
$model = new Attachment();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$total = $model
|
||||
->where($where)
|
||||
->where($mimetypeQuery)
|
||||
->where('user_id', $this->auth->id)
|
||||
->order("id", "DESC")
|
||||
->count();
|
||||
|
||||
$list = $model
|
||||
->where($where)
|
||||
->where($mimetypeQuery)
|
||||
->where('user_id', $this->auth->id)
|
||||
->order("id", "DESC")
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$cdnurl = preg_replace("/\/(\w+)\.php$/i", '', $this->request->root());
|
||||
foreach ($list as $k => &$v) {
|
||||
$v['fullurl'] = ($v['storage'] == 'local' ? $cdnurl : $this->view->config['upload']['cdnurl']) . $v['url'];
|
||||
}
|
||||
unset($v);
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
$mimetype = $this->request->get('mimetype', '');
|
||||
$mimetype = substr($mimetype, -1) === '/' ? $mimetype . '*' : $mimetype;
|
||||
$this->view->assign('mimetype', $mimetype);
|
||||
$this->view->assign("mimetypeList", \app\common\model\Attachment::getMimetypeList());
|
||||
return $this->view->fetch();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user