代码格式化
This commit is contained in:
@@ -9,14 +9,14 @@
|
||||
|
||||
namespace app\common\controller;
|
||||
|
||||
class User extends Base{
|
||||
class User extends Base {
|
||||
|
||||
public function _initialize(){
|
||||
public function _initialize() {
|
||||
parent::_initialize();
|
||||
|
||||
if (!is_login() and !in_array($this->url,array('user/login/index', 'user/index/verify'))) {
|
||||
if (!is_login() and !in_array($this->url, array('user/login/index', 'user/index/verify'))) {
|
||||
$this->redirect('user/login/index');exit();
|
||||
}elseif (is_login()) {
|
||||
} elseif (is_login()) {
|
||||
$user = model('User')->getInfo(session('user_auth.uid'));
|
||||
if (!$this->checkProfile($user) && $this->url !== 'user/profile/index') {
|
||||
return $this->error('请补充完个人资料!', url('user/profile/index'));
|
||||
@@ -28,14 +28,14 @@ class User extends Base{
|
||||
}
|
||||
}
|
||||
|
||||
protected function setMenu(){
|
||||
protected function setMenu() {
|
||||
$menu['基础设置'] = array(
|
||||
array('title'=>'个人资料', 'url'=>'user/profile/index', 'icon'=>'newspaper-o'),
|
||||
array('title'=>'密码修改', 'url'=>'user/profile/editpw', 'icon'=>'key'),
|
||||
array('title'=>'更换头像', 'url'=>'user/profile/avatar', 'icon'=>'male'),
|
||||
array('title' => '个人资料', 'url' => 'user/profile/index', 'icon' => 'newspaper-o'),
|
||||
array('title' => '密码修改', 'url' => 'user/profile/editpw', 'icon' => 'key'),
|
||||
array('title' => '更换头像', 'url' => 'user/profile/avatar', 'icon' => 'male'),
|
||||
);
|
||||
$menu['订单管理'] = array(
|
||||
array('title'=>'我的订单', 'url'=>'user/order/index', 'icon'=>'shopping-bag'),
|
||||
array('title' => '我的订单', 'url' => 'user/order/index', 'icon' => 'shopping-bag'),
|
||||
);
|
||||
$contetnmenu = $this->getContentMenu();
|
||||
if (!empty($contetnmenu)) {
|
||||
@@ -46,7 +46,7 @@ class User extends Base{
|
||||
foreach ($item as $key => $value) {
|
||||
if (url($value['url']) == $_SERVER['REQUEST_URI']) {
|
||||
$value['active'] = 'active';
|
||||
}else{
|
||||
} else {
|
||||
$value['active'] = '';
|
||||
}
|
||||
$menu[$group][$key] = $value;
|
||||
@@ -55,25 +55,25 @@ class User extends Base{
|
||||
$this->assign('__MENU__', $menu);
|
||||
}
|
||||
|
||||
protected function getContentMenu(){
|
||||
protected function getContentMenu() {
|
||||
$list = array();
|
||||
$map = array(
|
||||
$map = array(
|
||||
'is_user_show' => 1,
|
||||
'status' => array('gt',0),
|
||||
'extend' => array('gt',0),
|
||||
'status' => array('gt', 0),
|
||||
'extend' => array('gt', 0),
|
||||
);
|
||||
$list = db('Model')->where($map)->field("name,id,title,icon,'' as 'style'")->select();
|
||||
|
||||
foreach ($list as $key => $value) {
|
||||
$value['url'] = "user/content/index?model_id=".$value['id'];
|
||||
$value['title'] = $value['title']."管理";
|
||||
$value['icon'] = $value['icon'] ? $value['icon'] : 'file';
|
||||
$list[$key] = $value;
|
||||
$value['url'] = "user/content/index?model_id=" . $value['id'];
|
||||
$value['title'] = $value['title'] . "管理";
|
||||
$value['icon'] = $value['icon'] ? $value['icon'] : 'file';
|
||||
$list[$key] = $value;
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
protected function checkProfile($user){
|
||||
protected function checkProfile($user) {
|
||||
$result = true;
|
||||
//判断用户资料是否填写完整
|
||||
if (!$user['nickname'] || !$user['qq']) {
|
||||
|
||||
Reference in New Issue
Block a user