新增菜单快捷搜索,支持单拼、全拼、中文搜索

新增基类的selectpage方法,用于独立提供下拉列表搜索
新增前台SMS控制器,用于验证码的发送
新增JS的Fast的全局方法
新增CRUD生成Model中自动更新权重weigh字段的功能
修复install.php文件检测和目录检测的BUG
修复前台Ucenter方法公开访问的BUG
修复在路由中禁用Admin模块的路由
修复部分脚本显示编码的BUG
修复CRUD时自定义主键时的生成的Model关联错误的BUG
移除冗余的LESS文件和CSS文件
移除Configvalue模块功能
pull/135/MERGE
Karson 2017-07-11 23:58:14 +08:00
parent a34086faf5
commit 311f1d7626
184 changed files with 2903 additions and 13810 deletions

View File

@ -214,8 +214,12 @@ class Crud extends Command
throw new Exception("table not found");
}
}
else
{
$table = stripos($table, $prefix) === 0 ? substr($table, strlen($prefix)) : $table;
}
$tableInfo = $tableInfo[0];
$relationModelTableType = 'table';
//检查关联表
if ($relation)
@ -232,6 +236,10 @@ class Crud extends Command
throw new Exception("relation table not found");
}
}
else
{
$relation = stripos($relation, $prefix) === 0 ? substr($relation, strlen($prefix)) : $relation;
}
}
//根据表名匹配对应的Fontawesome图标
@ -442,8 +450,8 @@ class Crud extends Command
$fieldName = "row[{$field}]";
$defaultValue = $v['COLUMN_DEFAULT'];
$editValue = "{\$row.{$field}}";
// 如果默认值为空,则是一个必选项
if ($v['COLUMN_DEFAULT'] == '')
// 如果默认值非null,则是一个必选项
if (!is_null($v['COLUMN_DEFAULT']))
{
$attrArr['data-rule'] = 'required';
}
@ -511,6 +519,7 @@ class Crud extends Command
}
else if ($inputType == 'checkbox' || $inputType == 'radio')
{
unset($attrArr['data-rule']);
$fieldName = $inputType == 'checkbox' ? $fieldName .= "[]" : $fieldName;
$attrArr['name'] = "row[{$fieldName}]";
@ -534,6 +543,7 @@ class Crud extends Command
}
else if ($inputType == 'switch')
{
unset($attrArr['data-rule']);
if ($defaultValue === '1' || $defaultValue === 'Y')
{
$yes = $defaultValue;
@ -560,10 +570,12 @@ class Crud extends Command
$defaultValue = '';
$attrArr['data-rule'] = 'required';
$cssClassArr[] = 'selectpage';
$attrArr['data-db-table'] = substr($field, 0, strripos($field, '_'));
$selectpageController = str_replace('_', '/', substr($field, 0, strripos($field, '_')));
$attrArr['data-source'] = $selectpageController . "/index";
//如果是类型表需要特殊处理下
if ($attrArr['data-db-table'] == 'category')
if ($selectpageController == 'category')
{
$attrArr['data-source'] = 'category/selectpage';
$attrArr['data-params'] = '##replacetext##';
$search = '"##replacetext##"';
$replace = '\'{"custom[type]":"' . $table . '"}\'';
@ -677,6 +689,12 @@ class Crud extends Command
$validateNamespace = "{$appNamespace}\\" . $moduleName . "\\validate";
$validateName = $modelName;
$modelInit = '';
if ($priKey != $order)
{
$modelInit = $this->getReplacedStub('mixins' . DS . 'modelinit', ['order' => $order]);
}
$data = [
'controllerNamespace' => $controllerNamespace,
'modelNamespace' => $modelNamespace,
@ -716,7 +734,8 @@ class Crud extends Command
'getEnumList' => implode("\n\n", $getEnumArr),
'getAttrList' => implode("\n\n", $getAttrArr),
'setAttrList' => implode("\n\n", $setAttrArr),
'modelMethod' => '',
'modelInit' => $modelInit,
'modelRelationMethod' => '',
];
//如果使用关联模型
@ -734,7 +753,7 @@ class Crud extends Command
$data['relationForeignKey'] = $relationForeignKey;
$data['relationPrimaryKey'] = $relationPrimaryKey ? $relationPrimaryKey : $priKey;
//构造关联模型的方法
$data['modelMethod'] = $this->getReplacedStub('modelmethod', $data);
$data['modelRelationMethod'] = $this->getReplacedStub('mixins' . DS . 'modelrelationmethod', $data);
}
// 生成控制器文件
@ -1138,7 +1157,6 @@ EOD;
protected function getJsColumn($field, $datatype = '', $extend = '')
{
$lang = ucfirst($field);
$html = str_repeat(" ", 24) . "{field: '{$field}{$extend}', title: __('{$lang}')";
$formatter = '';
foreach ($this->fieldFormatterSuffix as $k => $v)
{
@ -1159,7 +1177,12 @@ EOD;
}
}
}
$formatter = $extend ? '' : $formatter;
if ($formatter)
{
$extend = '';
}
$html = str_repeat(" ", 24) . "{field: '{$field}{$extend}', title: __('{$lang}')";
//$formatter = $extend ? '' : $formatter;
if ($extend)
{
$html .= ", operate:false";

View File

@ -6,7 +6,8 @@
{
//当前是否为关联查询
$this->relationSearch = {%relationSearch%};
//设置过滤方法
$this->request->filter(['strip_tags', 'htmlspecialchars']);
if ($this->request->isAjax())
{
list($where, $sort, $order, $offset, $limit) = $this->buildparams();

View File

@ -1,4 +1,4 @@
{foreach name="{%fieldList%}" item="vo"}
<label for="{%fieldName%}-{$key}"><input id="{%fieldName%}-{$key}" name="{%fieldName%}" type="checkbox" value="{$key}" {in name="key" value="{%selectedValue%}"}checked{/in} /> {$vo}</label>
<label for="{%fieldName%}-{$key}"><input id="{%fieldName%}-{$key}" name="{%fieldName%}" type="checkbox" value="{$key}" {in name="key" value="{%selectedValue%}"}checked{/in} /> {$vo}</label>
{/foreach}

View File

@ -1,4 +1,4 @@
{foreach name="{%fieldList%}" item="vo"}
<label for="{%fieldName%}-{$key}"><input id="{%fieldName%}-{$key}" name="{%fieldName%}" type="radio" value="{$key}" {in name="key" value="{%selectedValue%}"}checked{/in} /> {$vo}</label>
<label for="{%fieldName%}-{$key}"><input id="{%fieldName%}-{$key}" name="{%fieldName%}" type="radio" value="{$key}" {in name="key" value="{%selectedValue%}"}checked{/in} /> {$vo}</label>
{/foreach}

View File

@ -0,0 +1,7 @@
protected static function init()
{
self::afterInsert(function ($row) {
$row->save(['{%order%}' => $row['id']]);
});
}

View File

@ -1,5 +1,5 @@
public function {%relationMethod%}()
{
return $this->{%relationMode%}('{%relationModelName%}', '{%relationForeignKey%}', '{%pk%}')->setEagerlyType(0);
return $this->{%relationMode%}('{%relationModelName%}', '{%relationForeignKey%}', '{%relationPrimaryKey%}')->setEagerlyType(0);
}

View File

@ -21,6 +21,7 @@ class {%modelName%} extends Model
{%appendAttrList%}
];
{%modelInit%}
{%getEnumList%}
@ -28,5 +29,5 @@ class {%modelName%} extends Model
{%setAttrList%}
{%modelMethod%}
{%modelRelationMethod%}
}

File diff suppressed because one or more lines are too long

View File

@ -58,7 +58,7 @@ class Min extends Command
{
if (IS_WIN)
{
throw new Exception("node environment require nodejs!please check http://doc.fastadmin.net/322813 !");
throw new Exception("node environment not found!please check http://doc.fastadmin.net/faq.html !");
}
try

View File

@ -1,26 +1,10 @@
<?php
use app\common\model\Category;
use app\common\model\Configvalue;
use fast\Form;
use fast\Tree;
use think\Db;
/**
* 重新生成上传的参数配置
* @param array $params
* @return string
*/
function get_upload_multipart($params = [])
{
// 加载配置
$configvalue = new Configvalue;
// 上传参数配置配置
$uploadcfg = $configvalue->upload($params);
return json_encode(isset($uploadcfg['multipart']) ? $uploadcfg['multipart'] : []);
}
/**
* 生成下拉列表
* @param string $name

View File

@ -4,7 +4,6 @@ namespace app\admin\controller;
use app\common\controller\Backend;
use fast\Random;
use fast\Tree;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use think\Cache;
@ -23,114 +22,12 @@ class Ajax extends Backend
protected $noNeedRight = ['*'];
protected $layout = '';
/**
* 自动完成
*/
public function typeahead()
public function _initialize()
{
$search = $this->request->get("search");
$field = $this->request->get("field");
$field = str_replace(['row[', ']'], '', $field);
if (substr($field, -3) !== '_id' && substr($field, -4) !== '_ids')
{
$this->code = -1;
return;
}
$searchfield = 'name';
$fieldArr = explode('_', $field);
$field = $fieldArr[0];
switch ($field)
{
case 'category':
$field = 'category';
$searchfield = 'name';
break;
case 'user':
$searchfield = 'nickname';
break;
}
parent::_initialize();
$searchlist = Db::name($field)
->whereOr($searchfield, 'like', "%{$search}%")
->whereOr('id', 'like', "%{$search}%")
->limit(10)
->field("id,{$searchfield} AS name")
->select();
$this->code = 1;
$this->data = ['searchlist' => $searchlist];
}
/**
* SelectPage通用下拉列表搜索
*/
public function selectpage()
{
//搜索关键词,客户端输入以空格分开,这里接收为数组
$word = $this->request->request("q_word/a");
//当前页
$page = $this->request->request("pageNumber");
//分页大小
$pagesize = $this->request->request("pageSize");
//搜索条件
$andor = $this->request->request("and_or");
//排序方式
$orderby = $this->request->request("order_by/a");
//表名
$table = $this->request->request("db_table");
//显示的字段
$field = $this->request->request("field");
//主键
$primarykey = $this->request->request("pkey_name");
//主键值
$primaryvalue = $this->request->request("pkey_value");
//搜索字段
$searchfield = $this->request->request("search_field/a");
//自定义搜索条件
$custom = $this->request->request("custom/a");
$order = [];
foreach ($orderby as $k => $v)
{
$order[$v[0]] = $v[1];
}
$field = $field ? $field : 'name';
//如果不使用ajax/selectpage这个页面提供结果,则是自己的控制器单独写搜索条件,$where按自己的需求写即可
//这里只是能用考虑,所以搜索条件写得比较复杂
//如果有primaryvalue,说明当前是初始化传值
if ($primaryvalue)
{
$where = [$primarykey => ['in', $primaryvalue]];
}
else
{
$where = function($query) use($word, $andor, $field, $searchfield, $custom) {
$where = $andor == "OR" ? "whereOr" : "where";
foreach ($word as $k => $v)
{
foreach ($searchfield as $m => $n)
{
$query->{$where}($n, "like", "%{$v}%");
}
}
if ($custom && is_array($custom))
{
foreach ($custom as $k => $v)
{
$query->where($k, '=', $v);
}
}
};
}
$list = [];
$total = Db::name($table)->where($where)->count();
if ($total > 0)
{
$list = Db::name($table)->where($where)->order($order)->page($page, $pagesize)->field("{$primarykey},{$field}")->select();
}
//这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮
return json(['list' => $list, 'total' => $total]);
//设置过滤方法
$this->request->filter(['strip_tags', 'htmlspecialchars']);
}
/**
@ -147,87 +44,6 @@ class Ajax extends Backend
return $result;
}
/**
* 读取角色权限树
*/
public function roletree()
{
$this->loadlang('auth/group');
$model = model('AuthGroup');
$id = $this->request->post("id");
$pid = $this->request->post("pid");
$parentgroupmodel = $model->get($pid);
$currentgroupmodel = NULL;
if ($id)
{
$currentgroupmodel = $model->get($id);
}
if (($pid || $parentgroupmodel) && (!$id || $currentgroupmodel))
{
$id = $id ? $id : NULL;
$ruleList = collection(model('AuthRule')->order('weigh', 'desc')->select())->toArray();
//读取父类角色所有节点列表
$parentRuleList = [];
if (in_array('*', explode(',', $parentgroupmodel->rules)))
{
$parentRuleList = $ruleList;
}
else
{
$parent_rule_ids = explode(',', $parentgroupmodel->rules);
foreach ($ruleList as $k => $v)
{
if (in_array($v['id'], $parent_rule_ids))
{
$parentRuleList[] = $v;
}
}
}
//当前所有正常规则列表
Tree::instance()->init($ruleList);
//读取当前角色下规则ID集合
$admin_rule_ids = $this->auth->getRuleIds();
//是否是超级管理员
$superadmin = $this->auth->isSuperAdmin();
//当前拥有的规则ID集合
$current_rule_ids = $id ? explode(',', $currentgroupmodel->rules) : [];
if (!$id || !in_array($pid, Tree::instance()->getChildrenIds($id, TRUE)))
{
$ruleList = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
$hasChildrens = [];
foreach ($ruleList as $k => $v)
{
if ($v['haschild'])
$hasChildrens[] = $v['id'];
}
$nodelist = [];
foreach ($parentRuleList as $k => $v)
{
if (!$superadmin && !in_array($v['id'], $admin_rule_ids))
continue;
$state = array('selected' => in_array($v['id'], $current_rule_ids) && !in_array($v['id'], $hasChildrens));
$nodelist[] = array('id' => $v['id'], 'parent' => $v['pid'] ? $v['pid'] : '#', 'text' => $v['title'], 'type' => 'menu', 'state' => $state);
}
$this->code = 1;
$this->data = $nodelist;
}
else
{
$this->code = -1;
$this->data = __('Can not change the parent to child');
}
}
else
{
$this->code = -1;
$this->data = __('Group not found');
}
}
/**
* 上传文件
*/
@ -337,6 +153,8 @@ class Ajax extends Backend
$ids = explode(',', $ids);
$prikey = 'id';
$pid = $this->request->post("pid");
//限制更新的字段
$field = in_array($field, ['weigh']) ? $field : 'weigh';
// 如果设定了pid的值,此时只匹配满足条件的ID,其它忽略
if ($pid !== '')
@ -430,7 +248,7 @@ class Ajax extends Backend
}
/**
* 读取分类数据
* 读取分类数据,联动列表
*/
public function category()
{
@ -457,7 +275,7 @@ class Ajax extends Backend
}
/**
* 读取省市区数据
* 读取省市区数据,联动列表
*/
public function area()
{

View File

@ -17,10 +17,12 @@ class Category extends Backend
protected $model = null;
protected $categorylist = [];
protected $noNeedRight = ['selectpage'];
public function _initialize()
{
parent::_initialize();
$this->request->filter(['strip_tags']);
$this->model = model('Category');
$tree = Tree::instance();
@ -54,4 +56,14 @@ class Category extends Backend
return $this->view->fetch();
}
/**
* Selectpage搜索
*
* @internal
*/
public function selectpage()
{
return parent::selectpage();
}
}

View File

@ -14,6 +14,7 @@ class Page extends Backend
{
protected $model = null;
protected $relationSearch = true;
public function _initialize()
{
@ -21,4 +22,30 @@ class Page extends Backend
$this->model = model('Page');
}
/**
* 查看
*/
public function index()
{
if ($this->request->isAjax())
{
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->with("category")
->where($where)
->order($sort, $order)
->count();
$list = $this->model
->with("category")
->where($where)
->order($sort, $order)
->limit($offset, $limit)
->select();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace app\admin\controller;
use app\common\controller\Backend;
/**
* 会员管理
*
* @icon fa fa-circle-o
* @internal
*/
class User extends Backend
{
/**
* User模型对象
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = model('User');
}
}

View File

@ -22,4 +22,5 @@ class Version extends Backend
parent::_initialize();
$this->model = model('Version');
}
}

View File

@ -19,6 +19,8 @@ class Group extends Backend
protected $childrenIds = [];
//当前组别列表数据
protected $groupdata = [];
//无需要权限判断的方法
protected $noNeedRight = ['roletree'];
public function _initialize()
{
@ -78,7 +80,7 @@ class Group extends Backend
if ($this->request->isPost())
{
$this->code = -1;
$params = $this->request->post("row/a");
$params = $this->request->post("row/a", [], 'strip_tags');
$params['rules'] = explode(',', $params['rules']);
if (!in_array($params['pid'], $this->childrenIds))
{
@ -124,7 +126,7 @@ class Group extends Backend
if ($this->request->isPost())
{
$this->code = -1;
$params = $this->request->post("row/a");
$params = $this->request->post("row/a", [], 'strip_tags');
// 父节点不能是它自身的子节点
if (!in_array($params['pid'], $this->childrenIds))
{
@ -171,8 +173,7 @@ class Group extends Backend
{
$ids = explode(',', $ids);
$grouplist = $this->auth->getGroups();
$group_ids = array_map(function($group)
{
$group_ids = array_map(function($group) {
return $group['id'];
}, $grouplist);
// 移除掉当前管理员所在组别
@ -223,4 +224,87 @@ class Group extends Backend
return;
}
/**
* 读取角色权限树
*
* @internal
*/
public function roletree()
{
$this->loadlang('auth/group');
$model = model('AuthGroup');
$id = $this->request->post("id");
$pid = $this->request->post("pid");
$parentgroupmodel = $model->get($pid);
$currentgroupmodel = NULL;
if ($id)
{
$currentgroupmodel = $model->get($id);
}
if (($pid || $parentgroupmodel) && (!$id || $currentgroupmodel))
{
$id = $id ? $id : NULL;
$ruleList = collection(model('AuthRule')->order('weigh', 'desc')->select())->toArray();
//读取父类角色所有节点列表
$parentRuleList = [];
if (in_array('*', explode(',', $parentgroupmodel->rules)))
{
$parentRuleList = $ruleList;
}
else
{
$parent_rule_ids = explode(',', $parentgroupmodel->rules);
foreach ($ruleList as $k => $v)
{
if (in_array($v['id'], $parent_rule_ids))
{
$parentRuleList[] = $v;
}
}
}
//当前所有正常规则列表
Tree::instance()->init($ruleList);
//读取当前角色下规则ID集合
$admin_rule_ids = $this->auth->getRuleIds();
//是否是超级管理员
$superadmin = $this->auth->isSuperAdmin();
//当前拥有的规则ID集合
$current_rule_ids = $id ? explode(',', $currentgroupmodel->rules) : [];
if (!$id || !in_array($pid, Tree::instance()->getChildrenIds($id, TRUE)))
{
$ruleList = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
$hasChildrens = [];
foreach ($ruleList as $k => $v)
{
if ($v['haschild'])
$hasChildrens[] = $v['id'];
}
$nodelist = [];
foreach ($parentRuleList as $k => $v)
{
if (!$superadmin && !in_array($v['id'], $admin_rule_ids))
continue;
$state = array('selected' => in_array($v['id'], $current_rule_ids) && !in_array($v['id'], $hasChildrens));
$nodelist[] = array('id' => $v['id'], 'parent' => $v['pid'] ? $v['pid'] : '#', 'text' => $v['title'], 'type' => 'menu', 'state' => $state);
}
$this->code = 1;
$this->data = $nodelist;
}
else
{
$this->code = -1;
$this->data = __('Can not change the parent to child');
}
}
else
{
$this->code = -1;
$this->data = __('Group not found');
}
}
}

View File

@ -61,7 +61,7 @@ class Rule extends Backend
if ($this->request->isPost())
{
$this->code = -1;
$params = $this->request->post("row/a");
$params = $this->request->post("row/a", [], 'strip_tags');
if ($params)
{
if (!$params['ismenu'] && !$params['pid'])
@ -90,7 +90,7 @@ class Rule extends Backend
if ($this->request->isPost())
{
$this->code = -1;
$params = $this->request->post("row/a");
$params = $this->request->post("row/a", [], 'strip_tags');
if ($params)
{
if (!$params['ismenu'] && !$params['pid'])

View File

@ -25,6 +25,8 @@ class Multitable extends Backend
*/
public function index()
{
$this->loadlang('general/attachment');
$this->loadlang('general/crontab');
return $this->view->fetch();
}

View File

@ -2,8 +2,10 @@
namespace app\admin\controller\general;
use app\common\library\Email;
use app\common\controller\Backend;
use app\common\library\Email;
use app\common\model\Config as ConfigModel;
use think\Exception;
/**
* 系统配置
@ -25,7 +27,7 @@ class Config extends Backend
public function index()
{
$siteList = [];
$groupList = \app\admin\model\Config::getGroupList();
$groupList = ConfigModel::getGroupList();
foreach ($groupList as $k => $v)
{
$siteList[$k]['name'] = $k;
@ -58,8 +60,8 @@ class Config extends Backend
$index++;
}
$this->view->assign('siteList', $siteList);
$this->view->assign('typeList', \app\admin\model\Config::getTypeList());
$this->view->assign('groupList', \app\admin\model\Config::getGroupList());
$this->view->assign('typeList', ConfigModel::getTypeList());
$this->view->assign('groupList', ConfigModel::getGroupList());
return $this->view->fetch();
}
@ -116,7 +118,7 @@ class Config extends Backend
$this->msg = $this->model->getError();
}
}
catch (think\Exception $e)
catch (Exception $e)
{
$this->msg = $e->getMessage();
}

View File

@ -1,130 +0,0 @@
<?php
namespace app\admin\controller\general;
use app\common\controller\Backend;
/**
* 基本配置
*
* @icon fa fa-cog
* @remark 用于管理一些字典数据,通常以键值格式进行录入,保存的数据格式为JSON
* @internal
*/
class Configvalue extends Backend
{
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = model('Configvalue');
}
/**
* 查看
*/
public function index()
{
if ($this->request->isAjax())
{
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->where($where)
->order($sort, $order)
->count();
$list = $this->model
->where($where)
->order($sort, $order)
->limit($offset, $limit)
->select();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
/**
* 添加
*/
public function add()
{
if ($this->request->isPost())
{
$this->code = -1;
$params = $this->request->post("row/a");
if ($params)
{
if ($this->request->has('field'))
{
//JSON字段
$fieldarr = $valuearr = [];
$field = $this->request->post('field/a');
$value = $this->request->post('value/a');
foreach ($field as $k => $v)
{
if ($v != '')
{
$fieldarr[] = $field[$k];
$valuearr[] = $value[$k];
}
}
$params['content'] = array_combine($fieldarr, $valuearr);
}
$this->model->save($params);
$this->code = 1;
}
return;
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = NULL)
{
$row = $this->model->get(['id' => $ids]);
if (!$row)
$this->error(__('No Results were found'));
// 状态为locked时不允许编辑
if ($row['status'] == 'locked')
$this->error(__('The current item can not be edited'));
if ($this->request->isPost())
{
$this->code = -1;
$params = $this->request->post("row/a");
if ($params)
{
if ($this->request->has('field'))
{
//JSON字段
$fieldarr = $valuearr = [];
$field = $this->request->post('field/a');
$value = $this->request->post('value/a');
foreach ($field as $k => $v)
{
if ($v != '')
{
$fieldarr[] = $field[$k];
$valuearr[] = $value[$k];
}
}
$params['content'] = array_combine($fieldarr, $valuearr);
}
$row->save($params);
$this->code = 1;
}
return;
}
$this->view->assign("row", $row);
return $this->view->fetch();
}
}

View File

@ -28,14 +28,6 @@ class Database extends Backend
$tables[] = ['name' => reset($row), 'rows' => 0];
}
$data['tables'] = $tables;
/*
$one = Db::table('configvalue')->where('name', 'sql')->find();
$saved_sql = [];
if ($one && $one['content'])
$saved_sql = explode('###', $one['content']);
$data['saved_sql'] = array_values(array_filter($saved_sql));
* */
$data['saved_sql'] = [];
$this->view->assign($data);
return $this->view->fetch();

View File

@ -5,5 +5,6 @@ return [
'The parent group can not found' => '父组别未找到',
'Group not found' => '组别未找到',
'Can not change the parent to child' => '父组别不能是它的子组别',
'Can not change the parent to self' => '父组别不能是它的子组别',
'You can not delete group that contain child group and administrators' => '你不能删除含有子组和管理员的组',
];

View File

@ -1,14 +1,15 @@
<?php
return [
'Pid' => '父ID',
'Type' => '栏目类型',
'Image' => '图片',
'Keywords' => '关键字',
'Description' => '描述',
'Diyname' => '自定义名称',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Weigh' => '权重',
'Status' => '状态'
'Id' => 'ID',
'Pid' => '父ID',
'Type' => '栏目类型',
'Image' => '图片',
'Keywords' => '关键字',
'Description' => '描述',
'Diyname' => '自定义名称',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Weigh' => '权重',
'Status' => '状态'
];

View File

@ -1,9 +1,9 @@
<?php
return [
'name' => '变量名称',
'intro' => '描述',
'group' => '分组',
'type' => '类型',
'value' => '变量值'
'name' => '变量名称',
'intro' => '描述',
'group' => '分组',
'type' => '类型',
'value' => '变量值'
];

View File

@ -2,6 +2,7 @@
return [
'Title' => '标题',
'Search menu' => '搜索菜单',
'Layout Options' => '布局设定',
'Fixed Layout' => '固定布局',
'You can\'t use fixed and boxed layouts together' => '盒子模型和固定布局不能同时启作用',

View File

@ -3,6 +3,7 @@
return [
'id' => 'ID',
'category_id' => '分类ID',
'category' => '分类',
'title' => '标题',
'keywords' => '关键字',
'flag' => '标志',

View File

@ -288,10 +288,12 @@ class Auth extends \fast\Auth
$select_id = $v['name'] == $activeUrl ? $v['id'] : $select_id;
$v['url'] = $v['name'];
$v['badge'] = isset($badgeList[$v['name']]) ? $badgeList[$v['name']] : '';
$v['py'] = \fast\Pinyin::get($v['title'], true);
$v['pinyin'] = \fast\Pinyin::get($v['title']);
}
// 构造菜单数据
Tree::instance()->init($ruleList);
$menu = Tree::instance()->getTreeMenu(0, '<li class="@class"><a href="@url" addtabs="@id" url="@url"><i class="@icon"></i> <span>@title</span> <span class="pull-right-container">@caret @badge</span></a> @childlist</li>', $select_id, '', 'ul', 'class="treeview-menu"');
$menu = Tree::instance()->getTreeMenu(0, '<li class="@class"><a href="@url" addtabs="@id" url="@url" py="@py" pinyin="@pinyin"><i class="@icon"></i> <span>@title</span> <span class="pull-right-container">@caret @badge</span></a> @childlist</li>', $select_id, '', 'ul', 'class="treeview-menu"');
return $menu;
}

View File

@ -10,8 +10,15 @@ trait Backend
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'htmlspecialchars']);
if ($this->request->isAjax())
{
//如果发送的来源是Selectpage则转发到Selectpage
if ($this->request->request('pkey_name'))
{
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->where($where)

View File

@ -0,0 +1,203 @@
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label for="c-category_id" class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-category_id" data-rule="required" data-source="category/selectpage" data-params='{"custom[type]":""}' class="form-control selectpage" name="row[category_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-category_ids" class="control-label col-xs-12 col-sm-2">{:__('Category_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-category_ids" data-rule="required" data-source="category/selectpage" data-params='{"custom[type]":""}' data-multiple="true" class="form-control selectpage" name="row[category_ids]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-user_id" class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-user_ids" class="control-label col-xs-12 col-sm-2">{:__('User_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_ids" data-rule="required" data-source="user/index" data-multiple="true" data-field="nickname" class="form-control selectpage" name="row[user_ids]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-week" class="control-label col-xs-12 col-sm-2">{:__('Week')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-week" data-rule="required" class="form-control selectpicker" name="row[week]">
{foreach name="weekList" item="vo"}
<option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label for="c-flag" class="control-label col-xs-12 col-sm-2">{:__('Flag')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-flag" data-rule="required" class="form-control selectpicker" multiple="" name="row[flag][]">
{foreach name="flagList" item="vo"}
<option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label for="c-genderdata" class="control-label col-xs-12 col-sm-2">{:__('Genderdata')}:</label>
<div class="col-xs-12 col-sm-8">
{foreach name="genderdataList" item="vo"}
<label for="row[genderdata]-{$key}"><input id="row[genderdata]-{$key}" name="row[genderdata]" type="radio" value="{$key}" {in name="key" value="male"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
<div class="form-group">
<label for="c-hobbydata" class="control-label col-xs-12 col-sm-2">{:__('Hobbydata')}:</label>
<div class="col-xs-12 col-sm-8">
{foreach name="hobbydataList" item="vo"}
<label for="row[hobbydata][]-{$key}"><input id="row[hobbydata][]-{$key}" name="row[hobbydata][]" type="checkbox" value="{$key}" {in name="key" value=""}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
<div class="form-group">
<label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" data-rule="required" class="form-control summernote" rows="5" name="row[content]" cols="50"></textarea>
</div>
</div>
<div class="form-group">
<label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="form-inline">
<input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value="">
<span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<ul class="row list-inline plupload-preview" id="p-image"></ul>
</div>
</div>
</div>
<div class="form-group">
<label for="c-images" class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="form-inline">
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="">
<span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/*" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<ul class="row list-inline plupload-preview" id="p-images"></ul>
</div>
</div>
</div>
<div class="form-group">
<label for="c-attachfile" class="control-label col-xs-12 col-sm-2">{:__('Attachfile')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="form-inline">
<input id="c-attachfile" data-rule="required" class="form-control" size="50" name="row[attachfile]" type="text" value="">
<span><button type="button" id="plupload-attachfile" class="btn btn-danger plupload" data-input-id="c-attachfile" data-multiple="false"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-attachfile" class="btn btn-primary fachoose" data-input-id="c-attachfile" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
</div>
</div>
<div class="form-group">
<label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-keywords" data-rule="required" class="form-control" name="row[keywords]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-description" data-rule="required" class="form-control" name="row[description]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-price" class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" class="form-control" step="0.01" name="row[price]" type="number" value="0.00">
</div>
</div>
<div class="form-group">
<label for="c-views" class="control-label col-xs-12 col-sm-2">{:__('Views')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-views" class="form-control" name="row[views]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label for="c-startdate" class="control-label col-xs-12 col-sm-2">{:__('Startdate')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-startdate" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[startdate]" type="text" value="{:date('Y-m-d')}">
</div>
</div>
<div class="form-group">
<label for="c-activitytime" class="control-label col-xs-12 col-sm-2">{:__('Activitytime')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-activitytime" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[activitytime]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
<div class="form-group">
<label for="c-year" class="control-label col-xs-12 col-sm-2">{:__('Year')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-year" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY" data-use-current="true" name="row[year]" type="text" value="{:date('Y')}">
</div>
</div>
<div class="form-group">
<label for="c-times" class="control-label col-xs-12 col-sm-2">{:__('Times')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-times" data-rule="required" class="form-control datetimepicker" data-date-format="HH:mm:ss" data-use-current="true" name="row[times]" type="text" value="{:date('H:i:s')}">
</div>
</div>
<div class="form-group">
<label for="c-refreshtime" class="control-label col-xs-12 col-sm-2">{:__('Refreshtime')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-refreshtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[refreshtime]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
<div class="form-group">
<label for="c-weigh" class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label for="c-status" class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="normal"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
<div class="form-group">
<label for="c-state" class="control-label col-xs-12 col-sm-2">{:__('State')}:</label>
<div class="col-xs-12 col-sm-8">
{foreach name="stateList" item="vo"}
<label for="row[state]-{$key}"><input id="row[state]-{$key}" name="row[state]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>

View File

@ -1,9 +1,9 @@
<!-- Logo -->
<a href="javascript:;" class="logo">
<!-- 迷你模式下Logo的大小为50X50 -->
<span class="logo-mini">{$site.name|mb_substr=0,4|strtoupper}</span>
<span class="logo-mini">{$site.name|mb_substr=0,4,'utf-8'|strtoupper}</span>
<!-- 普通模式下Logo -->
<span class="logo-lg"><b>{$site.name|mb_substr=0,4}</b>{$site.name|mb_substr=4}</span>
<span class="logo-lg"><b>{$site.name|mb_substr=0,4,'utf-8'}</b>{$site.name|mb_substr=4,null,'utf-8'}</span>
</a>
<!-- 顶部通栏样式 -->
<nav class="navbar navbar-static-top">

View File

@ -10,11 +10,18 @@
<i class="fa fa-circle text-success"></i> {:__('Online')}
</div>
</div>
<!-- search form -->
<form action="#" method="get" class="sidebar-form hidden-xs" style="overflow:visible;border:none;">
<select class="form-control fastmenujump btn">
<option value="">{:__('Shortcut')}</option>
</select>
<form action="" method="get" class="sidebar-form" onsubmit="return false;">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="{:__('Search menu')}">
<span class="input-group-btn">
<button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
</button>
</span>
<div class="menuresult list-group sidebar-form hide">
</div>
</div>
</form>
<!-- /.search form -->

View File

@ -295,8 +295,8 @@
<h5>文章统计</h5>
</div>
<div class="ibox-content">
<h1 class="no-margins">1234</h1>
<div class="stat-percent font-bold text-gray"><i class="fa fa-modx"></i> 1234</div>
<h1 class="no-margins">1043</h1>
<div class="stat-percent font-bold text-gray"><i class="fa fa-modx"></i> 2592</div>
<small>总文章数</small>
</div>
</div>
@ -318,8 +318,8 @@
<div class="font-bold text-navy"><i class="fa fa-commenting"></i> <small>总评论数</small></div>
</div>
<div class="col-md-6">
<h1 class="no-margins">1234</h1>
<div class="font-bold text-navy"><i class="fa fa-heart"></i> <small>动态评论点赞数</small></div>
<h1 class="no-margins">6754</h1>
<div class="font-bold text-navy"><i class="fa fa-heart"></i> <small>总评论点赞数</small></div>
</div>
</div>
</div>
@ -337,11 +337,11 @@
<div class="row">
<div class="col-md-6">
<h1 class="no-margins">1234</h1>
<h1 class="no-margins">5302</h1>
<div class="font-bold text-navy"><i class="fa fa-commenting"></i> <small>总评论数</small></div>
</div>
<div class="col-md-6">
<h1 class="no-margins">1234</h1>
<h1 class="no-margins">8205</h1>
<div class="font-bold text-navy"><i class="fa fa-user"></i> <small>总参与人数</small></div>
</div>
</div>

View File

@ -0,0 +1,203 @@
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label for="c-category_id" class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-category_id" data-rule="required" data-source="category/selectpage" data-params='{"custom[type]":""}' class="form-control selectpage" name="row[category_id]" type="text" value="{$row.category_id}">
</div>
</div>
<div class="form-group">
<label for="c-category_ids" class="control-label col-xs-12 col-sm-2">{:__('Category_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-category_ids" data-rule="required" data-source="category/selectpage" data-params='{"custom[type]":""}' data-multiple="true" class="form-control selectpage" name="row[category_ids]" type="text" value="{$row.category_ids}">
</div>
</div>
<div class="form-group">
<label for="c-user_id" class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id}">
</div>
</div>
<div class="form-group">
<label for="c-user_ids" class="control-label col-xs-12 col-sm-2">{:__('User_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_ids" data-rule="required" data-source="user/index" data-multiple="true" data-field="nickname" class="form-control selectpage" name="row[user_ids]" type="text" value="{$row.user_ids}">
</div>
</div>
<div class="form-group">
<label for="c-week" class="control-label col-xs-12 col-sm-2">{:__('Week')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-week" data-rule="required" class="form-control selectpicker" name="row[week]">
{foreach name="weekList" item="vo"}
<option value="{$key}" {in name="key" value="$row.week"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label for="c-flag" class="control-label col-xs-12 col-sm-2">{:__('Flag')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-flag" data-rule="required" class="form-control selectpicker" multiple="" name="row[flag][]">
{foreach name="flagList" item="vo"}
<option value="{$key}" {in name="key" value="$row.flag"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label for="c-genderdata" class="control-label col-xs-12 col-sm-2">{:__('Genderdata')}:</label>
<div class="col-xs-12 col-sm-8">
{foreach name="genderdataList" item="vo"}
<label for="row[genderdata]-{$key}"><input id="row[genderdata]-{$key}" name="row[genderdata]" type="radio" value="{$key}" {in name="key" value="$row.genderdata"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
<div class="form-group">
<label for="c-hobbydata" class="control-label col-xs-12 col-sm-2">{:__('Hobbydata')}:</label>
<div class="col-xs-12 col-sm-8">
{foreach name="hobbydataList" item="vo"}
<label for="row[hobbydata][]-{$key}"><input id="row[hobbydata][]-{$key}" name="row[hobbydata][]" type="checkbox" value="{$key}" {in name="key" value="$row.hobbydata"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
<div class="form-group">
<label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title}">
</div>
</div>
<div class="form-group">
<label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" data-rule="required" class="form-control summernote" rows="5" name="row[content]" cols="50">{$row.content}</textarea>
</div>
</div>
<div class="form-group">
<label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="form-inline">
<input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value="{$row.image}">
<span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<ul class="row list-inline plupload-preview" id="p-image"></ul>
</div>
</div>
</div>
<div class="form-group">
<label for="c-images" class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="form-inline">
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images}">
<span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/*" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<ul class="row list-inline plupload-preview" id="p-images"></ul>
</div>
</div>
</div>
<div class="form-group">
<label for="c-attachfile" class="control-label col-xs-12 col-sm-2">{:__('Attachfile')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="form-inline">
<input id="c-attachfile" data-rule="required" class="form-control" size="50" name="row[attachfile]" type="text" value="{$row.attachfile}">
<span><button type="button" id="plupload-attachfile" class="btn btn-danger plupload" data-input-id="c-attachfile" data-multiple="false"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-attachfile" class="btn btn-primary fachoose" data-input-id="c-attachfile" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
</div>
</div>
<div class="form-group">
<label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-keywords" data-rule="required" class="form-control" name="row[keywords]" type="text" value="{$row.keywords}">
</div>
</div>
<div class="form-group">
<label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-description" data-rule="required" class="form-control" name="row[description]" type="text" value="{$row.description}">
</div>
</div>
<div class="form-group">
<label for="c-price" class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" class="form-control" step="0.01" name="row[price]" type="number" value="{$row.price}">
</div>
</div>
<div class="form-group">
<label for="c-views" class="control-label col-xs-12 col-sm-2">{:__('Views')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-views" class="form-control" name="row[views]" type="number" value="{$row.views}">
</div>
</div>
<div class="form-group">
<label for="c-startdate" class="control-label col-xs-12 col-sm-2">{:__('Startdate')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-startdate" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[startdate]" type="text" value="{$row.startdate}">
</div>
</div>
<div class="form-group">
<label for="c-activitytime" class="control-label col-xs-12 col-sm-2">{:__('Activitytime')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-activitytime" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[activitytime]" type="text" value="{$row.activitytime}">
</div>
</div>
<div class="form-group">
<label for="c-year" class="control-label col-xs-12 col-sm-2">{:__('Year')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-year" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY" data-use-current="true" name="row[year]" type="text" value="{$row.year}">
</div>
</div>
<div class="form-group">
<label for="c-times" class="control-label col-xs-12 col-sm-2">{:__('Times')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-times" data-rule="required" class="form-control datetimepicker" data-date-format="HH:mm:ss" data-use-current="true" name="row[times]" type="text" value="{$row.times}">
</div>
</div>
<div class="form-group">
<label for="c-refreshtime" class="control-label col-xs-12 col-sm-2">{:__('Refreshtime')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-refreshtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[refreshtime]" type="text" value="{$row.refreshtime|datetime}">
</div>
</div>
<div class="form-group">
<label for="c-weigh" class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh}">
</div>
</div>
<div class="form-group">
<label for="c-status" class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
<div class="form-group">
<label for="c-state" class="control-label col-xs-12 col-sm-2">{:__('State')}:</label>
<div class="col-xs-12 col-sm-8">
{foreach name="stateList" item="vo"}
<label for="row[state]-{$key}"><input id="row[state]-{$key}" name="row[state]" type="radio" value="{$key}" {in name="key" value="$row.state"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>

View File

@ -126,7 +126,7 @@
<tr>
<td></td>
<td>
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</td>
<td></td>
@ -205,7 +205,7 @@ key2|value2</textarea>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-4">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>

View File

@ -0,0 +1,25 @@
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
{:build_toolbar()}
<div class="dropdown btn-group">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
</ul>
</div>
</div>
<table id="table" class="table table-striped table-bordered table-hover" width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,8 +1,8 @@
<form id="add-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label for="c-category_id" class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>
<label for="c-category_id" class="control-label col-xs-12 col-sm-2">{:__('Category')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-category_id" class="form-control selectpage" data-db-table="category" data-params='{"custom[type]":"page"}' name="row[category_id]" type="text" value="" data-rule="required">
<input id="c-category_id" class="form-control selectpage" data-source="category/selectpage" data-params='{"custom[type]":"page"}' name="row[category_id]" type="text" value="" data-rule="required">
</div>
</div>
<div class="form-group">

View File

@ -1,9 +1,9 @@
<form id="edit-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label for="c-category_id" class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>
<label for="c-category_id" class="control-label col-xs-12 col-sm-2">{:__('Category')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-category_id" class="form-control selectpage" data-db-table="category" data-params='{"custom[type]":"page"}' name="row[category_id]" type="text" value="{$row.category_id}" data-rule="required">
<input id="c-category_id" class="form-control selectpage" data-source="category/selectpage" data-params='{"custom[type]":"page"}' name="row[category_id]" type="text" value="{$row.category_id}" data-rule="required">
</div>
</div>
<div class="form-group">

View File

@ -1,6 +1,5 @@
<?php
use app\common\model\Configvalue;
use think\Lang;
// 公共助手函数
@ -65,19 +64,3 @@ if (!function_exists('datetime'))
}
}
if (!function_exists('configvalue'))
{
/**
* 获取后台动态定义的配置
* @param string $id ID
* @return array
*/
function configvalue($id)
{
$data = Configvalue::get($id);
return $data ? $data->content : null;
}
}

View File

@ -3,7 +3,6 @@
namespace app\common\controller;
use app\admin\library\Auth;
use app\common\model\Configvalue;
use think\Config;
use think\Controller;
use think\Lang;
@ -78,7 +77,7 @@ class Backend extends Controller
* 是否开启模型场景验证
*/
protected $modelSceneValidate = false;
/**
* Multi方法可批量修改的字段
*/
@ -160,7 +159,7 @@ class Backend extends Controller
// 配置信息
$config = [
'site' => array_intersect_key($site, array_flip(['name', 'cdnurl', 'version', 'timezone', 'languages'])),
'upload' => Configvalue::upload(),
'upload' => \app\common\model\Config::upload(),
'modulename' => $modulename,
'controllername' => $controllername,
'actionname' => $actionname,
@ -177,7 +176,7 @@ class Backend extends Controller
$this->assign('admin', Session::get('admin'));
}
/**
* 加载语言文件
* @param string $name
@ -290,6 +289,85 @@ class Backend extends Controller
return [$where, $sort, $order, $offset, $limit];
}
/**
* Selectpage的实现方法
*
* 当前方法只是一个比较通用的搜索匹配,请按需重载此方法来编写自己的搜索逻辑,$where按自己的需求写即可
* 这里示例了所有的参数,所以比较复杂,实现上自己实现只需简单的几行即可
*
*/
protected function selectpage()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'htmlspecialchars']);
//搜索关键词,客户端输入以空格分开,这里接收为数组
$word = (array) $this->request->request("q_word/a");
//当前页
$page = $this->request->request("page");
//分页大小
$pagesize = $this->request->request("page_size");
//搜索条件
$andor = $this->request->request("and_or");
//排序方式
$orderby = (array) $this->request->request("order_by/a");
//显示的字段
$field = $this->request->request("field");
//主键
$primarykey = $this->request->request("pkey_name");
//主键值
$primaryvalue = $this->request->request("pkey_value");
//搜索字段
$searchfield = (array) $this->request->request("search_field/a");
//自定义搜索条件
$custom = (array) $this->request->request("custom/a");
$order = [];
foreach ($orderby as $k => $v)
{
$order[$v[0]] = $v[1];
}
$field = $field ? $field : 'name';
//如果有primaryvalue,说明当前是初始化传值
if ($primaryvalue)
{
$where = [$primarykey => ['in', $primaryvalue]];
}
else
{
$where = function($query) use($word, $andor, $field, $searchfield, $custom) {
foreach ($word as $k => $v)
{
foreach ($searchfield as $m => $n)
{
$query->where($n, "like", "%{$v}%", $andor);
}
}
if ($custom && is_array($custom))
{
foreach ($custom as $k => $v)
{
$query->where($k, '=', $v);
}
}
};
}
$list = [];
$total = $this->model->where($where)->count();
if ($total > 0)
{
$list = $this->model->where($where)
->order($order)
->page($page, $pagesize)
->field("{$primarykey},{$field}")
->field("password,salt", true)
->select();
}
//这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮
return json(['list' => $list, 'total' => $total]);
}
/**
* 析构方法
*
@ -299,7 +377,13 @@ class Backend extends Controller
//判断是否设置code值,如果有则变动response对象的正文
if (!is_null($this->code))
{
$this->result($this->data, $this->code, $this->msg, 'json');
$result = [
'code' => $this->code,
'msg' => $this->msg,
'time' => $_SERVER['REQUEST_TIME'],
'data' => $this->data,
];
echo json_encode($result);
}
}

View File

@ -3,7 +3,6 @@
namespace app\common\controller;
use app\common\library\Auth;
use app\common\model\Configvalue;
use think\Config;
use think\Controller;
use think\Lang;
@ -50,6 +49,8 @@ class Frontend extends Controller
public function _initialize()
{
//移除HTML标签
$this->request->filter('strip_tags');
$modulename = $this->request->module();
$controllername = strtolower($this->request->controller());
$actionname = strtolower($this->request->action());
@ -67,13 +68,7 @@ class Frontend extends Controller
// 检测是否需要验证登录
if (!$this->user->match($this->noNeedLogin))
{
//检测是否登录
if (!$this->user->isLogin())
{
$url = Session::get('referer');
$url = $url ? $url : $this->request->url();
$this->error(__('Please login first'), url('/user/login', ['url' => $url]));
}
$this->checkLogin();
}
// 将auth对象渲染至视图
@ -92,12 +87,12 @@ class Frontend extends Controller
// 配置信息
$config = [
'site' => array_intersect_key($site, array_flip(['name', 'cdnurl', 'version', 'timezone', 'languages'])),
'upload' => Configvalue::upload(),
'upload' => \app\common\model\Config::upload(),
'modulename' => $modulename,
'controllername' => $controllername,
'actionname' => $actionname,
'jsname' => 'frontend/' . str_replace('.', '/', $controllername),
'moduleurl' => url("/{$modulename}", '', false),
'moduleurl' => rtrim(url("/{$modulename}", '', false), '/'),
'language' => $lang
];
$this->loadlang($controllername);
@ -105,6 +100,17 @@ class Frontend extends Controller
$this->assign('config', $config);
}
protected function checkLogin()
{
//检测是否登录
if (!$this->user->isLogin())
{
$url = Session::get('referer');
$url = $url ? $url : $this->request->url();
$this->error(__('Please login first'), url('/user/login', ['url' => $url]));
}
}
/**
* 加载语言文件
* @param string $name

View File

@ -103,7 +103,7 @@ abstract class Uc extends Controller
return false;
}
$timestamp = time();
if ($timestamp - $get['time'] > 36001111)
if ($timestamp - $get['time'] > 3600)
{
$this->error = '请求有效期已过';
return false;

View File

@ -0,0 +1,110 @@
<?php
namespace app\common\model;
use think\Model;
class Config extends Model
{
// 表名,不含前缀
protected $name = 'config';
// 自动写入时间戳字段
protected $autoWriteTimestamp = false;
// 定义时间戳字段名
protected $createTime = false;
protected $updateTime = false;
// 追加属性
protected $append = [
];
/**
* 读取配置类型
* @return array
*/
public static function getTypeList()
{
$typeList = [
'string' => __('String'),
'text' => __('Text'),
'number' => __('Number'),
'datetime' => __('Datetime'),
'select' => __('Select'),
'selects' => __('Selects'),
'image' => __('Image'),
'images' => __('Images'),
'file' => __('File'),
'files' => __('Files'),
'checkbox' => __('Checkbox'),
'radio' => __('Radio'),
'array' => __('Array'),
];
return $typeList;
}
/**
* 读取分类分组列表
* @return array
*/
public static function getGroupList()
{
$groupList = config('site.configgroup');
return $groupList;
}
/**
* 加载上传配置
*
* @param array $params 扩展参数,常用字段savekey,mimetype,maxsize,ext-param,notify-url,return-url<br>
* 更多字段可参考http://docs.upyun.com/api/form_api/#_2
*
* @return array
*/
public static function upload($params = [])
{
$uploadcfg = config('upload');
$uploadcfg = $uploadcfg ? $uploadcfg : [];
$uploadcfg = array_merge($uploadcfg, $params);
$uploadcfg['bucket'] = isset($uploadcfg['bucket']) ? $uploadcfg['bucket'] : '';
$multiple = isset($uploadcfg['multiple']) ? $uploadcfg['multiple'] : false;
$savekey = isset($uploadcfg['savekey']) ? $uploadcfg['savekey'] : '';
$uploadcfg['save-key'] = isset($uploadcfg['save-key']) ? $uploadcfg['save-key'] : $savekey;
$expiration = time() + (isset($uploadcfg['expire']) ? $uploadcfg['expire'] : 600);
$uploadcfg['expiration'] = isset($uploadcfg['expiration']) ? $uploadcfg['expiration'] : $expiration;
$notifyurl = isset($uploadcfg['notifyurl']) ? $uploadcfg['notifyurl'] : '';
$returnurl = isset($uploadcfg['returnurl']) ? $uploadcfg['returnurl'] : '';
if ($notifyurl)
$uploadcfg['notify-url'] = $notifyurl;
else
unset($uploadcfg['notify-url']);
if ($returnurl)
$uploadcfg['return-url'] = $returnurl;
else
unset($uploadcfg['return-url']);
//设置允许的附加字段
$allowfields = [
'bucket', 'save-key', 'expiration', 'date', 'content-md5', 'notify-url', 'return-url', 'content-secret', 'content-type', 'allow-file-type', 'content-length-range',
'image-width-range', 'image-height-range', 'x-gmkerl-thumb', 'x-gmkerl-type', 'apps', 'b64encoded', 'ext-param'
];
$params = array_intersect_key($uploadcfg, array_flip($allowfields));
$policy = base64_encode(json_encode($params));
$signature = md5($policy . '&' . (isset($uploadcfg['formkey']) ? $uploadcfg['formkey'] : ''));
$multipart = [
'policy' => $policy,
'signature' => $signature,
];
$multipart = array_merge($multipart, $params);
return [
'cdnurl' => isset($uploadcfg['cdnurl']) ? $uploadcfg['cdnurl'] : '',
'uploadurl' => isset($uploadcfg['uploadurl']) ? $uploadcfg['uploadurl'] : url('ajax/upload'),
'bucket' => $uploadcfg['bucket'],
'maxsize' => isset($uploadcfg['maxsize']) ? $uploadcfg['maxsize'] : '',
'mimetype' => isset($uploadcfg['mimetype']) ? $uploadcfg['mimetype'] : '',
'multipart' => $multipart,
'multiple' => $multiple,
];
}
}

View File

@ -13,4 +13,8 @@ class Page extends Model
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
public function category()
{
return $this->belongsTo('Category', 'category_id')->setEagerlyType(0);
}
}

View File

@ -37,6 +37,7 @@ class Ajax extends Frontend
*/
public function upload()
{
$this->checkLogin();
$this->code = -1;
$file = $this->request->file('file');

View File

@ -0,0 +1,168 @@
<?php
namespace app\index\controller;
use app\common\controller\Frontend;
use app\common\library\Email;
use app\common\library\Sms as Smslib;
use app\common\model\User;
use think\Session;
/**
* 短信控制器
*/
class Sms extends Frontend
{
/**
* 发送验证码
*
* 必选参数:mobile,type<br>
* 可选参数:
*/
public function send()
{
$this->code = -1;
$mobile = $this->request->post("mobile");
$type = $this->request->post("type");
$type = $type ? $type : 'register';
$last = Smslib::get($mobile, $type);
if ($last && time() - $last['createtime'] < 60)
{
//发送频繁
$this->msg = __('SMS sent frequently');
return;
}
if ($type)
{
$userinfo = User::getByMobile($mobile);
if ($type == 'register' && $userinfo)
{
//注册账号
$this->msg = __('The phone number already exists');
return;
}
else if ($type == 'changepwd' && !$userinfo)
{
//修改密码
$this->msg = __('The phone number not exists');
return;
}
else if (in_array($type, ['changemobile', 'bindmobile']) && $userinfo)
{
//修改手机号
$this->msg = __('The phone number already exists');
return;
}
}
$ret = Smslib::send($mobile, '', $type);
if ($ret)
{
$this->code = 1;
$this->msg = "发送成功";
}
else
{
$this->msg = __('Send failed, please try again later');
}
return;
}
/**
* 检测验证码
*
* 必选参数:mobile,type,captchacode<br>
* 可选参数:
*/
public function check()
{
$this->code = -1;
$mobile = $this->request->post("mobile");
$type = $this->request->post("type");
$type = $type ? $type : 'register';
$captchacode = $this->request->post("captchacode");
if ($type)
{
$userinfo = User::getByMobile($mobile);
if ($type == 'register' && $userinfo)
{
//注册账号
$this->msg = __('The phone number already exists');
return;
}
else if ($type == 'changepwd' && !$userinfo)
{
//修改密码
$this->msg = __('The phone number note exists');
return;
}
else if (in_array($type, ['changemobile', 'bindmobile']) && $userinfo)
{
//修改手机号
$this->msg = __('The phone number already exists');
return;
}
}
$ret = Smslib::check($mobile, $captchacode, $type);
if ($ret)
{
$this->code = 1;
}
else
{
$this->msg = __('The captcha code not correct');
}
return;
}
public function sendemail()
{
$this->code = -1;
$email = $this->request->post("email");
$type = $this->request->post("type");
$type = $type ? $type : 'register';
$name = "email{$type}";
$session = session($name);
if (!$session)
{
if (time() - $session['time'] < 120)
{
$this->msg = "发送邮箱验证码过于频繁";
return;
}
}
if (Smslib::sendemail($email, '', $type))
{
$this->code = 1;
$this->msg = "发送成功";
}
else
{
$this->msg = "发送邮件失败!请稍后重试!";
}
}
public function checkemail()
{
$this->code = -1;
$email = $this->request->post("email");
$type = $this->request->post("type");
$type = $type ? $type : 'register';
$ret = Smslib::checkemail($email, $captchacode, $type);
if ($ret)
{
$this->code = 1;
}
else
{
$this->msg = __('The captcha code not correct');
}
}
}

View File

@ -40,7 +40,7 @@ class Ucenter extends Uc
/**
* 删除用户
*/
function deleteuser()
protected function deleteuser()
{
$uids = $this->get['ids'];
$uids = is_array($uids) ? $uids : explode(',', $uids);
@ -54,7 +54,7 @@ class Ucenter extends Uc
/**
* 获取标签
*/
function gettag()
protected function gettag()
{
$name = $this->get['id'];
if (!API_GETTAG)
@ -82,7 +82,7 @@ class Ucenter extends Uc
/**
* 同步注册
*/
function synregister()
protected function synregister()
{
$uid = $this->get['uid'];
$username = $this->get['username'];
@ -102,7 +102,7 @@ class Ucenter extends Uc
/**
* 同步登录
*/
function synlogin()
protected function synlogin()
{
$uid = $this->get['uid'];
$username = $this->get['username'];
@ -119,7 +119,7 @@ class Ucenter extends Uc
/**
* 同步退出
*/
function synlogout()
protected function synlogout()
{
if (!API_SYNLOGOUT)
{
@ -135,7 +135,7 @@ class Ucenter extends Uc
/**
* 添加用户
*/
function adduser()
protected function adduser()
{
$uid = $this->get['uid'];
$username = $this->get['username'];
@ -167,7 +167,7 @@ class Ucenter extends Uc
/**
* 更新用户信息,包含用户名,密码,邮箱,手机号和其它扩展信息
*/
function updateinfo()
protected function updateinfo()
{
if (!API_UPDATEINFO)
{
@ -211,7 +211,7 @@ class Ucenter extends Uc
/**
* 更新禁言文字
*/
function updatebadwords()
protected function updatebadwords()
{
if (!API_UPDATEBADWORDS)
{
@ -238,7 +238,7 @@ class Ucenter extends Uc
/**
* 更新HOSTS
*/
function updatehosts()
protected function updatehosts()
{
if (!API_UPDATEHOSTS)
{
@ -256,7 +256,7 @@ class Ucenter extends Uc
/**
* 更新App信息
*/
function updateapps()
protected function updateapps()
{
if (!API_UPDATEAPPS)
{
@ -291,7 +291,7 @@ class Ucenter extends Uc
/**
* 更新客户端配置文件
*/
function updateclient()
protected function updateclient()
{
if (!API_UPDATECLIENT)
{
@ -309,7 +309,7 @@ class Ucenter extends Uc
/**
* 更新积分
*/
function updatecredit()
protected function updatecredit()
{
if (!API_UPDATECREDIT)
{
@ -324,7 +324,7 @@ class Ucenter extends Uc
/**
* 获取积分
*/
function getcredit()
protected function getcredit()
{
if (!API_GETCREDIT)
{
@ -335,7 +335,7 @@ class Ucenter extends Uc
/**
* 获取积分配置
*/
function getcreditsettings()
protected function getcreditsettings()
{
if (!API_GETCREDITSETTINGS)
{
@ -351,7 +351,7 @@ class Ucenter extends Uc
/**
* 更新积分配置
*/
function updatecreditsettings()
protected function updatecreditsettings()
{
if (!API_UPDATECREDITSETTINGS)
{

View File

@ -0,0 +1,9 @@
<?php
return [
'SMS sent frequently' => '短信发送频繁',
'The phone number already exists' => '手机号已经存在',
'The phone number note exists' => '手机号不存在',
'The captcha code not correct' => '验证码不正确',
'Send failed, please try again later' => '发送失败,请稍后重试',
];

View File

@ -10,6 +10,10 @@
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
//如果有定义绑定后台模块则禁用路由规则
if (defined('BIND_MODULE') && BIND_MODULE == 'admin')
return [];
return [
//别名配置,别名只能是映射到控制器且访问时必须加上请求的方法
// '__alias__' => [

View File

@ -14,11 +14,12 @@ class Pinyin
/**
* 获取文字的拼音
* @param string $chinese 中文汉字
* @param boolean $ucfirst 是否首字母大写
* @param boolean $onlyfirst 是否只返回拼音首字母
* @param string $delimiter 分隔符
* @param string $charset 文字编码
* @return string
*/
public static function get($chinese, $ucfirst = false, $charset = 'utf-8')
public static function get($chinese, $onlyfirst = false, $delimiter = '', $ucfirst = false, $charset = 'utf-8')
{
$keys_a = explode('|', self::$keys);
$values_a = explode('|', self::$values);
@ -36,7 +37,12 @@ class Pinyin
$_Q = ord(substr($chinese, ++$i, 1));
$_P = $_P * 256 + $_Q - 65536;
}
$result .= ($ucfirst ? ucfirst(self::_pinyin($_P, $data)) : self::_pinyin($_P, $data));
$result .= ($onlyfirst ? substr(self::_pinyin($_P, $data), 0, 1) : self::_pinyin($_P, $data));
$result .= $delimiter;
}
if ($delimiter)
{
$result = rtrim($result, $delimiter);
}
return preg_replace("/[^a-z0-9_\-]*/i", '', $result);

View File

@ -50,12 +50,6 @@ body.is-dialog {
/*width: 70%;*/
max-width: 885px;
}
.form-group .bootstrap-tagsinput {
display: inherit;
}
.form-group .bootstrap-tagsinput span.twitter-typeahead {
width: auto;
}
.content {
min-height: 500px;
}
@ -135,6 +129,11 @@ table.table-template {
margin-bottom: -5px;
padding: 10px 20px;
}
.img-center {
margin: 0 auto;
display: inline;
float: none;
}
/*
* RIBBON
*/
@ -331,6 +330,37 @@ table.table-template {
.nav-addtabs li:hover > .close-tab {
display: block;
}
.main-sidebar .sidebar-form {
overflow: visible;
}
.main-sidebar .sidebar-form .menuresult {
z-index: 999;
position: absolute;
top: 34px;
left: -1px;
width: 100%;
max-height: 250px;
overflow: auto;
margin: 0;
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.main-sidebar .sidebar-form .menuresult a {
border-top: 1px solid #eee;
background-color: #fff;
border-bottom: 1px solid #eee;
margin-bottom: -1px;
display: block;
padding: 10px 15px;
color: #222d32;
}
.main-sidebar .sidebar-form .menuresult a:hover {
background: #eee;
}
.input-group .sp_result_area {
width: 100%;
}
.sidebar-menu.show-submenu .treeview-menu {
display: block;
}

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
/*# sourceMappingURL=mixins.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=alerts.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=background-variant.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=border-radius.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=buttons.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=center-block.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=clearfix.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=forms.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=gradients.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=grid-framework.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=grid.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=hide-text.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=image.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=labels.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=list-group.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=nav-divider.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=nav-vertical-align.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=opacity.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=pagination.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=panels.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=progress-bar.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=reset-filter.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=reset-text.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=resize.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=responsive-visibility.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=size.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=tab-focus.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=table-row.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=text-emphasis.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=text-overflow.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=vendor-prefixes.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=variables.css.map */

File diff suppressed because it is too large Load Diff

View File

@ -1,49 +0,0 @@
.media {
margin-top: 15px;
}
.media:first-child {
margin-top: 0;
}
.media,
.media-body {
zoom: 1;
overflow: hidden;
}
.media-body {
width: 10000px;
}
.media-object {
display: block;
}
.media-object.img-thumbnail {
max-width: none;
}
.media-right,
.media > .pull-right {
padding-left: 10px;
}
.media-left,
.media > .pull-left {
padding-right: 10px;
}
.media-left,
.media-right,
.media-body {
display: table-cell;
vertical-align: top;
}
.media-middle {
vertical-align: middle;
}
.media-bottom {
vertical-align: bottom;
}
.media-heading {
margin-top: 0;
margin-bottom: 5px;
}
.media-list {
padding-left: 0;
list-style: none;
}
/*# sourceMappingURL=media.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=mixins.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=alerts.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=background-variant.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=border-radius.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=buttons.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=center-block.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=clearfix.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=forms.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=gradients.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=grid-framework.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=grid.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=hide-text.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=image.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=labels.css.map */

View File

@ -1 +0,0 @@
/*# sourceMappingURL=list-group.css.map */

Some files were not shown because too many files have changed in this diff Show More