184 lines
5.5 KiB
PHP
184 lines
5.5 KiB
PHP
<?php
|
|
/**
|
|
* 商业使用授权协议
|
|
*
|
|
* Copyright (c) 2025 [云泽网]. 保留所有权利.
|
|
*
|
|
* 本软件仅供评估使用。任何商业用途必须获得书面授权许可。
|
|
* 未经授权商业使用本软件属于侵权行为,将承担法律责任。
|
|
*
|
|
* 授权购买请联系: 357099073@qq.com
|
|
* 官方网站: https://www.yunzer.cn
|
|
*
|
|
* 评估用户须知:
|
|
* 1. 禁止移除版权声明
|
|
* 2. 禁止用于生产环境
|
|
* 3. 禁止转售或分发
|
|
*/
|
|
|
|
namespace app\admin\controller;
|
|
use app\admin\controller\Base;
|
|
use think\facade\Db;
|
|
use think\facade\View;
|
|
use think\facade\Request;
|
|
|
|
class Yunzertest extends Base{
|
|
public function icon_list(){
|
|
$lists = Db::table('yz_z_iconfont')->where('status','=',1)->select();
|
|
View::assign([
|
|
'lists' => $lists
|
|
]);
|
|
return View::fetch();
|
|
}
|
|
public function test_list(){
|
|
if(Request::isPost()){
|
|
$count = Db::table('yz_z_test')->count();
|
|
$page = (int)input('post.page',1);
|
|
$limit = (int)input('post.limit',10);
|
|
$lists = Db::table('yz_z_test')->order('test_id DESC')->page($page,$limit)->select()->each(function($item, $key){
|
|
if($item['test_reference'] == 1){
|
|
$item['test_reference'] = '开启';
|
|
}else{
|
|
$item['test_reference'] = '关闭';
|
|
}
|
|
$item['test_time'] = date('Y-m-d H:i:s',$item['test_time']);
|
|
return $item;
|
|
});
|
|
$this->returnCode(0,$lists,$count);
|
|
}else{
|
|
return View::fetch();
|
|
}
|
|
}
|
|
public function test_add(){
|
|
if(Request::isPost()){
|
|
$data['test_input'] = input('post.test_input');
|
|
$data['test_reference'] = input('post.test_reference');
|
|
$data['test_time'] = input('post.test_time');
|
|
if(!empty($data['test_time'])){
|
|
$data['test_time'] = strtotime($data['test_time']);
|
|
}
|
|
$data['test_data'] = input('post.test_data');
|
|
$data['test_datatime'] = input('post.test_datatime');
|
|
$data['test_img'] = input('post.test_img');
|
|
$data['test_rich_baidu'] = input('post.test_rich_baidu');
|
|
$data['test_url'] = input('post.test_url');
|
|
|
|
$insert = Db::table('yz_z_test')->insert($data);
|
|
if(empty($insert)){
|
|
$this->returnCode('91000001');
|
|
}
|
|
$this->returnCode(0);
|
|
}else{
|
|
return View::fetch();
|
|
}
|
|
}
|
|
public function test_edit(){
|
|
if(Request::isPost()){
|
|
$test_id = input('post.test_id');
|
|
$data['test_input'] = input('post.test_input');
|
|
$data['test_reference'] = input('post.test_reference');
|
|
$data['test_time'] = input('post.test_time');
|
|
if(!empty($data['test_time'])){
|
|
$data['test_time'] = strtotime($data['test_time']);
|
|
}
|
|
$data['test_data'] = input('post.test_data');
|
|
$data['test_datatime'] = input('post.test_datatime');
|
|
$data['test_img'] = input('post.test_img');
|
|
$data['test_rich'] = input('post.test_rich');
|
|
$data['test_rich_baidu'] = input('post.test_rich_baidu');
|
|
$data['test_url'] = input('post.test_url');
|
|
|
|
$update = Db::table('yz_z_test')->where('test_id',$test_id)->update($data);
|
|
if(empty($update)){
|
|
$this->returnCode('91000002');
|
|
}
|
|
$this->returnCode(0);
|
|
}else{
|
|
$test_id = input('get.test_id');
|
|
$find = Db::table('yz_z_test')->where('test_id',$test_id)->find();
|
|
if(!empty($find)){
|
|
$find['test_time'] = date('Y-m-d H:i:s',$find['test_time']);
|
|
}
|
|
View::assign([
|
|
'find' => $find
|
|
]);
|
|
return View::fetch();
|
|
}
|
|
}
|
|
public function test_del(){
|
|
$test_id = (int)input('post.test_id');
|
|
$res = Db::table('yz_z_test')->where('test_id',$test_id)->delete();
|
|
if(empty($res)){
|
|
$this->returnCode('91000003');
|
|
}
|
|
$this->returnCode(0);
|
|
}
|
|
public function test_static_list(){
|
|
$lists = Db::table('yz_z_test')
|
|
->order('test_id DESC')
|
|
->paginate();
|
|
View::assign([
|
|
'lists' => $lists
|
|
]);
|
|
return View::fetch();
|
|
}
|
|
public function test_static_add(){
|
|
if(Request::isPost()){
|
|
$data['test_input'] = input('post.test_input');
|
|
$data['test_reference'] = input('post.test_reference');
|
|
$data['test_time'] = input('post.test_time');
|
|
if(!empty($data['test_time'])){
|
|
$data['test_time'] = strtotime($data['test_time']);
|
|
}
|
|
$data['test_data'] = input('post.test_data');
|
|
$data['test_datatime'] = input('post.test_datatime');
|
|
$data['test_img'] = input('post.test_img');
|
|
$data['test_rich_baidu'] = input('post.test_rich_baidu');
|
|
$data['test_url'] = input('post.test_url');
|
|
|
|
$insert = Db::table('yz_z_test')->insert($data);
|
|
if(empty($insert)){
|
|
$this->returnCode('91000001');
|
|
}
|
|
$this->returnCode(0);
|
|
}else{
|
|
return View::fetch();
|
|
}
|
|
}
|
|
public function test_static_edit(){
|
|
if(Request::isPost()){
|
|
$test_id = input('post.test_id');
|
|
$data['test_input'] = input('post.test_input');
|
|
$data['test_reference'] = input('post.test_reference');
|
|
$data['test_time'] = input('post.test_time');
|
|
if(!empty($data['test_time'])){
|
|
$data['test_time'] = strtotime($data['test_time']);
|
|
}
|
|
$data['test_data'] = input('post.test_data');
|
|
$data['test_datatime'] = input('post.test_datatime');
|
|
$data['test_img'] = input('post.test_img');
|
|
$data['test_rich'] = input('post.test_rich');
|
|
$data['test_rich_baidu'] = input('post.test_rich_baidu');
|
|
$data['test_url'] = input('post.test_url');
|
|
|
|
$update = Db::table('yz_z_test')->where('test_id',$test_id)->update($data);
|
|
if(empty($update)){
|
|
$this->returnCode('91000002');
|
|
}
|
|
$this->returnCode(0);
|
|
}else{
|
|
$test_id = input('get.test_id');
|
|
$find = Db::table('yz_z_test')->where('test_id',$test_id)->find();
|
|
if(!empty($find)){
|
|
$find['test_time'] = date('Y-m-d H:i:s',$find['test_time']);
|
|
if(!empty($find['test_img'])){
|
|
$find['test_img_s'] = explode(';',$find['test_img']);
|
|
}
|
|
}
|
|
View::assign([
|
|
'find' => $find
|
|
]);
|
|
return View::fetch();
|
|
}
|
|
}
|
|
} |