日常更新

This commit is contained in:
2019-09-29 21:19:30 +08:00
parent c29b8358be
commit 07faf60918
196 changed files with 1367 additions and 524 deletions

View File

@@ -22,7 +22,8 @@ class Ad extends Admin{
$res = $adp->paginate(25, false, array(
'query' => $this->request->param()
));
$data = $res->toArray();
$data = $res->append(['show_type_text', 'status_text'])->toArray();
$this->data['data'] = $data;
return $this->data;
}
@@ -44,6 +45,7 @@ class Ad extends Admin{
$info['appid'] = rand_string(10, 1); //八位数字appid
$info['appsecret'] = rand_string(32); //32位数字加字母秘钥
$this->data['data'] = array(
'show_type' => $adp->show_type,
'info' => $info
);
@@ -71,6 +73,7 @@ class Ad extends Admin{
$info = $adp->where('id', $this->request->param('id'))->find();
$this->data['template'] = "add";
$this->data['data'] = array(
'show_type' => $adp->show_type,
'info' => $info
);
return $this->data;
@@ -104,7 +107,7 @@ class Ad extends Admin{
$res = $ad->paginate(25, false, array(
'query' => $this->request->param()
));
$data = $res->toArray();
$data = $res->append(['cover','status_text'])->toArray();
$this->data['data'] = $data;
return $this->data;
}

View File

@@ -9,13 +9,97 @@
namespace app\controller\admin;
use app\controller\Admin;
use app\Model\Category as CategoryModel;
class Category extends Admin{
/**
* @title 系统首页
* @title 栏目列表
*/
public function index(){
public function index(CategoryModel $category){
if($this->request->isAjax()){
$tree = $this->request->param('tree', 0);
$map = array();
$res = $category->where($map)->order('sort asc, id asc')->select();
$list = $res->toArray();
if($tree){
if (!empty($list)) {
$tree = new \com\Tree();
$list = $tree->toFormatTree($list);
}
}
$this->data['data'] = $list;
return $this->data;
}
}
/**
* @title 添加栏目
*/
public function add(CategoryModel $category){
if ($this->request->isPost()) {
$data = $this->request->post();
$result = $category->save($data);
if (false !== $result) {
return $this->success('成功添加', url('/admin/category/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(CategoryModel $category){
if ($this->request->isPost()) {
$data = $this->request->post();
if (!isset($data['id']) || !$data['id']) {
return $this->error('非法操作!');
}
$result = $category->exists(true)->save($data);
if (false !== $result) {
return $this->success('修改成功', url('/admin/category/index'));
}else{
return $this->error($this->model->getError());
}
}else{
$info = $category->where('id', $this->request->param('id'))->find();
$this->data['template'] = "add";
$this->data['data'] = array(
'info' => $info
);
return $this->data;
}
}
/**
* @title 删除栏目
*/
public function del(CategoryModel $category){
$ids = $this->request->param('ids', 0);
if(!$ids){
return $this->error('非法操作!');
}else{
$ids = \explode(",", $ids);
}
$result = $category->where('id', 'IN', $ids)->delete();
if(false !== $result){
return $this->success('删除成功!');
}else{
return $this->error('删除失败!');
}
}
}

View File

@@ -9,16 +9,101 @@
namespace app\controller\admin;
use app\controller\Admin;
use app\Model\Channel as ChannelModel;
class Channel extends Admin{
/**
* @title 频道列表
*/
public function index(ChannelModel $channel){
if($this->request->isAjax()){
$tree = $this->request->param('tree', 0);
$map = array();
$res = $channel->where($map)->order('sort asc, id asc')->select();
$list = $res->toArray();
if($tree){
if (!empty($list)) {
$tree = new \com\Tree();
$list = $tree->toFormatTree($list);
}
}
$this->data['data'] = $list;
return $this->data;
}else{
$this->data['data'] = array(
'type' => $this->request->param('type', 0),
);
return $this->data;
}
}
/**
* @title 系统首页
* @title 添加频道
*/
public function index(){
$this->data['data'] = array(
'tree' => array()
);
return $this->data;
public function add(ChannelModel $channel){
if ($this->request->isPost()) {
$data = $this->request->post();
$result = $channel->save($data);
if (false !== $result) {
return $this->success('成功添加', url('/admin/channel/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(ChannelModel $channel){
if ($this->request->isPost()) {
$data = $this->request->post();
if (!isset($data['id']) || !$data['id']) {
return $this->error('非法操作!');
}
$result = $channel->exists(true)->save($data);
if (false !== $result) {
return $this->success('修改成功', url('/admin/channel/index'));
}else{
return $this->error($this->model->getError());
}
}else{
$info = $channel->where('id', $this->request->param('id'))->find();
$this->data['template'] = "add";
$this->data['data'] = array(
'info' => $info
);
return $this->data;
}
}
/**
* @title 删除频道
*/
public function del(ChannelModel $channel){
$ids = $this->request->param('ids', 0);
if(!$ids){
return $this->error('非法操作!');
}else{
$ids = \explode(",", $ids);
}
$result = $channel->where('id', 'IN', $ids)->delete();
if(false !== $result){
return $this->success('删除成功!');
}else{
return $this->error('删除失败!');
}
}
}

View File

@@ -10,12 +10,89 @@ namespace app\controller\admin;
use app\controller\Admin;
use app\model\Form as FormModel;
class Form extends Admin{
/**
* @title 系统首页
*/
public function index(){
public function index(FormModel $form){
if ($this->request->isAjax()) {
$res = $form->paginate(25, false, array(
'query' => $this->request->param()
));
$data = $res->toArray();
$this->data['data'] = $data;
return $this->data;
}
}
/**
* @title 添加客户端
*/
public function add(FormModel $form){
if ($this->request->isPost()) {
$data = $this->request->post();
$result = $form->save($data);
if (false !== $result) {
return $this->success('成功添加', url('/admin/form/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(FormModel $form){
if ($this->request->isPost()) {
$data = $this->request->post();
if (!isset($data['id']) || !$data['id']) {
return $this->error('非法操作!');
}
$result = $form->exists(true)->save($data);
if (false !== $result) {
return $this->success('修改成功', url('/admin/form/index'));
}else{
return $this->error($this->model->getError());
}
}else{
$info = $form->where('id', $this->request->param('id'))->find();
$this->data['template'] = "add";
$this->data['data'] = array(
'info' => $info
);
return $this->data;
}
}
/**
* @title 删除客户端
*/
public function del(FormModel $form){
$ids = $this->request->param('ids', 0);
if(!$ids){
return $this->error('非法操作!');
}else{
$ids = \explode(",", $ids);
}
$result = $form->where('id', 'IN', $ids)->delete();
if(false !== $result){
return $this->success('删除成功!');
}else{
return $this->error('删除失败!');
}
}
}

View File

@@ -20,7 +20,8 @@ class Index extends Admin{
/**
* @title 系统首页
*/
public function index(){
public function index(Menu $menu){
$this->data['data'] = array('menu' => $menu->getMenu($this->request));
return $this->data;
}