日常更新
This commit is contained in:
@@ -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']] : '未知';
|
||||
}
|
||||
}
|
||||
@@ -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
19
app/model/Category.php
Normal 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
17
app/model/Form.php
Normal 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']] : '未知';
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user