前端组件调整,剔除无用文件

This commit is contained in:
2019-09-28 20:12:43 +08:00
parent 0b0d659c5e
commit c29b8358be
3496 changed files with 893 additions and 393801 deletions

View File

@@ -36,7 +36,7 @@ class Admin extends BaseController {
protected function success($msg, $url = ''){
$this->data['code'] = 0;
$this->data['msg'] = $msg;
$this->data['url'] = $url->__toString();
$this->data['url'] = $url ? $url->__toString() : '';
return $this->data;
}

View File

@@ -7,6 +7,10 @@ class Index extends BaseController {
protected $middleware = ['\app\http\middleware\Front'];
public function weixin(){
}
/**
* @title 网站首页
*/

View File

@@ -9,13 +9,173 @@
namespace app\controller\admin;
use app\controller\Admin;
use app\model\AdPlace;
use app\model\Ad as AdModel;
class Ad extends Admin{
/**
* @title 系统首页
* @title 广告位列表
*/
public function index(){
public function index(AdPlace $adp){
if ($this->request->isAjax()) {
$res = $adp->paginate(25, false, array(
'query' => $this->request->param()
));
$data = $res->toArray();
$this->data['data'] = $data;
return $this->data;
}
}
/**
* @title 添加广告位
*/
public function add(AdPlace $adp){
if ($this->request->isPost()) {
$data = $this->request->post();
$result = $adp->save($data);
if (false !== $result) {
return $this->success('成功添加', url('/admin/ad/index'));
}else{
return $this->error($this->model->getError());
}
}else{
$info['appid'] = rand_string(10, 1); //八位数字appid
$info['appsecret'] = rand_string(32); //32位数字加字母秘钥
$this->data['data'] = array(
'info' => $info
);
return $this->data;
}
}
/**
* @title 编辑广告位
*/
public function edit(AdPlace $adp){
if ($this->request->isPost()) {
$data = $this->request->post();
if (!isset($data['id']) || !$data['id']) {
return $this->error('非法操作!');
}
$result = $adp->exists(true)->save($data);
if (false !== $result) {
return $this->success('修改成功', url('/admin/ad/index'));
}else{
return $this->error($this->model->getError());
}
}else{
$info = $adp->where('id', $this->request->param('id'))->find();
$this->data['template'] = "add";
$this->data['data'] = array(
'info' => $info
);
return $this->data;
}
}
/**
* @title 删除广告位
*/
public function del(AdPlace $adp){
$ids = $this->request->param('ids', 0);
if(!$ids){
return $this->error('非法操作!');
}else{
$ids = \explode(",", $ids);
}
$result = $adp->where('id', 'IN', $ids)->delete();
if(false !== $result){
return $this->success('删除成功!');
}else{
return $this->error('删除失败!');
}
}
/**
* @title 广告列表
*/
public function lists(AdModel $ad){
if ($this->request->isAjax()) {
$res = $ad->paginate(25, false, array(
'query' => $this->request->param()
));
$data = $res->toArray();
$this->data['data'] = $data;
return $this->data;
}
}
/**
* @title 添加广告
*/
public function addad(AdModel $ad){
if ($this->request->isPost()) {
$data = $this->request->post();
$result = $ad->save($data);
if (false !== $result) {
return $this->success('成功添加', url('/admin/ad/index'));
}else{
return $this->error($this->model->getError());
}
}else{
$info['appid'] = rand_string(10, 1); //八位数字appid
$info['appsecret'] = rand_string(32); //32位数字加字母秘钥
$this->data['data'] = array(
'info' => $info
);
return $this->data;
}
}
/**
* @title 编辑广告
*/
public function editad(AdModel $ad){
if ($this->request->isPost()) {
$data = $this->request->post();
if (!isset($data['id']) || !$data['id']) {
return $this->error('非法操作!');
}
$result = $ad->exists(true)->save($data);
if (false !== $result) {
return $this->success('修改成功', url('/admin/ad/index'));
}else{
return $this->error($this->model->getError());
}
}else{
$info = $ad->where('id', $this->request->param('id'))->find();
$this->data['template'] = "addad";
$this->data['data'] = array(
'info' => $info
);
return $this->data;
}
}
/**
* @title 删除广告
*/
public function delad(AdModel $ad){
$ids = $this->request->param('ids', 0);
if(!$ids){
return $this->error('非法操作!');
}else{
$ids = \explode(",", $ids);
}
$result = $ad->where('id', 'IN', $ids)->delete();
if(false !== $result){
return $this->success('删除成功!');
}else{
return $this->error('删除失败!');
}
}
}

View File

@@ -34,7 +34,7 @@ class Client extends Admin{
*/
public function add(ClientModel $client){
if ($this->request->isPost()) {
$data = $this->request->param();
$data = $this->request->post();
$result = $client->save($data);
if (false !== $result) {
return $this->success('成功添加', url('/admin/client/index'));
@@ -57,12 +57,12 @@ class Client extends Admin{
*/
public function edit(ClientModel $client){
if ($this->request->isPost()) {
$data = $this->request->param();
$data = $this->request->post();
if (!isset($data['id']) || !$data['id']) {
return $this->error('非法操作!');
}
$result = $client->where(array('id'=>$data['id']))->save($data);
$result = $client->exists(true)->save($data);
if (false !== $result) {
return $this->success('修改成功', url('/admin/client/index'));
}else{
@@ -82,6 +82,18 @@ class Client extends Admin{
* @title 删除客户端
*/
public function del(ClientModel $client){
$ids = $this->request->param('ids', 0);
if(!$ids){
return $this->error('非法操作!');
}else{
$ids = \explode(",", $ids);
}
$result = $client->where('id', 'IN', $ids)->delete();
if(false !== $result){
return $this->success('删除成功!');
}else{
return $this->error('删除失败!');
}
}
}

View File

@@ -10,12 +10,29 @@ namespace app\controller\admin;
use app\controller\Admin;
/**
*
*/
class Content extends Admin{
/**
* @title 系统首
* @title 内容列表
*/
public function index(){
}
/**
* @title 内容添加
*/
public function add(){
if ($this->request->isAjax()) {
$result = false;
if (false !== $result) {
return $this->success();
}else{
return $this->error();
}
}
}
}

View File

@@ -35,12 +35,27 @@ class Index extends Admin{
*/
public function clear(){
if ($this->request->isAjax()) {
# code...
}else{
return $this->data;
$root = app()->getRootPath() . 'runtime/';
$this->delDirAndFile($root);
return $this->success('更新成功!');
}
}
/** 递归删除文件
* @param $dirName
* @param bool $subdir
*/
protected function delDirAndFile($dirName)
{
$list = glob($dirName . '*');
foreach ($list as $file) {
if (is_dir($file))
$this->delDirAndFile($file . '/');
else
@unlink($file);
}
@rmdir($dirName);
}
/**
* @title 后台登录
*/

View File

@@ -10,12 +10,89 @@ namespace app\controller\admin;
use app\controller\Admin;
use app\model\Link as LinkModel;
class Link extends Admin{
/**
* @title 系统首页
* @title 友链列表
*/
public function index(){
public function index(LinkModel $link){
if ($this->request->isAjax()) {
$res = $link->paginate(25, false, array(
'query' => $this->request->param()
));
$data = $res->toArray();
$this->data['data'] = $data;
return $this->data;
}
}
/**
* @title 添加友链
*/
public function add(LinkModel $link){
if ($this->request->isPost()) {
$data = $this->request->post();
$result = $link->save($data);
if (false !== $result) {
return $this->success('成功添加', url('/admin/link/index'));
}else{
return $this->error($this->model->getError());
}
}else{
$info['appid'] = rand_string(10, 1); //八位数字appid
$info['appsecret'] = rand_string(32); //32位数字加字母秘钥
$this->data['data'] = array(
'info' => $info
);
return $this->data;
}
}
/**
* @title 编辑友链
*/
public function edit(LinkModel $link){
if ($this->request->isPost()) {
$data = $this->request->post();
if (!isset($data['id']) || !$data['id']) {
return $this->error('非法操作!');
}
$result = $link->exists(true)->save($data);
if (false !== $result) {
return $this->success('修改成功', url('/admin/link/index'));
}else{
return $this->error($this->model->getError());
}
}else{
$info = $link->where('id', $this->request->param('id'))->find();
$this->data['template'] = "add";
$this->data['data'] = array(
'info' => $info
);
return $this->data;
}
}
/**
* @title 删除友链
*/
public function del(LinkModel $link){
$ids = $this->request->param('ids', 0);
if(!$ids){
return $this->error('非法操作!');
}else{
$ids = \explode(",", $ids);
}
$result = $link->where('id', 'IN', $ids)->delete();
if(false !== $result){
return $this->success('删除成功!');
}else{
return $this->error('删除失败!');
}
}
}

View File

@@ -18,12 +18,20 @@ class Menu extends Admin{
*/
public function index(){
if($this->request->isAjax()){
$tree = $this->request->param('tree', 0);
$menu = new MenuModel();
$map = array();
$res = $menu->where($map)->order('sort asc, id asc')->select();
$this->data['data'] = $res;
$list = $res->toArray();
if($tree){
if (!empty($list)) {
$tree = new \com\Tree();
$list = $tree->toFormatTree($list);
}
}
$this->data['data'] = $list;
return $this->data;
}
}