日常更新

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

@@ -3,7 +3,18 @@ namespace app\model;
use think\Model;
class Ad extends Model
{
class Ad extends Model {
public $status = array(
1 => '开启',
0 => '关闭'
);
public function getCoverAttr($value, $data){
return get_cover($data['cover_id'], 'path');
}
public function getStatusTextAttr($value, $data){
return isset($this->status[$data['status']]) ? $this->status[$data['status']] : '未知';
}
}

View File

@@ -3,7 +3,31 @@ namespace app\model;
use think\Model;
class AdPlace extends Model
{
class AdPlace extends Model {
protected $type = array(
'start_time' => 'timestamp',
'end_time' => 'timestamp'
);
public $show_type = array(
1 => '幻灯片',
2 => '对联',
3 => '图片列表',
4 => '图文列表',
5 => '文字列表',
6 => '代码广告'
);
public $status = array(
1 => '开启',
0 => '关闭'
);
public function getShowTypeTextAttr($value, $data){
return isset($this->show_type[$data['show_type']]) ? $this->show_type[$data['show_type']] : '未知';
}
public function getStatusTextAttr($value, $data){
return isset($this->status[$data['status']]) ? $this->status[$data['status']] : '未知';
}
}

19
app/model/Category.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\model;
use think\Model;
/**
* @title: À¸Ä¿Ä£ÐÍ
*/
class Category extends Model {
}

17
app/model/Form.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
namespace app\model;
use think\Model;
class Form extends Model {
public $status = array(
1 => '开启',
0 => '关闭'
);
public function getStatusTextAttr($value, $data){
return isset($this->status[$data['status']]) ? $this->status[$data['status']] : '未知';
}
}

View File

@@ -10,12 +10,40 @@
namespace app\model;
use think\Model;
use think\Request;
use think\facade\Cache;
/**
* @title: 菜单模型
* @title: ²Ëµ¥Ä£ÐÍ
*/
class Menu extends Model {
/**
* @title ÏÔʾ²Ëµ¥
*/
public function getMenu(Request $request) {
$list = [];
$current_controller = '/' . str_replace('.', '/', strtolower($request->controller()));
$current_url = $current_controller . '/' . strtolower($request->action());
$menu = Cache::get('menu');
if (!$menu) {
$res = (new \app\model\Menu())->where('is_menu', 1)->order('sort asc, id asc')->select();
foreach ($res as $key => $item) {
$menu[$item['id']] = $item->toArray();
}
Cache::set('menu', $menu);
}
foreach ($menu as $key => $value) {
if ($request->isAdmin || in_array($value['id'], array())) {
$list[$value['id']] = $value;
}
}
$menuList = list_to_tree($list);
return $menuList;
}
public function getAuthMenuList(){
$list = $this->select();
$data = list_to_tree($list->toArray(), 'id', 'pid');