管理功能升级
This commit is contained in:
@@ -16,8 +16,11 @@ class User extends Base{
|
||||
|
||||
if (!is_login() and !in_array($this->url,array('user/login/index', 'user/index/verify'))) {
|
||||
$this->redirect('user/login/index');exit();
|
||||
}else{
|
||||
}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'));
|
||||
}
|
||||
$this->assign('user', $user);
|
||||
|
||||
//设置会员中心菜单
|
||||
@@ -34,7 +37,11 @@ class User extends Base{
|
||||
$menu['订单管理'] = array(
|
||||
array('title'=>'我的订单', 'url'=>'user/order/index', 'icon'=>'shopping-bag'),
|
||||
);
|
||||
$menu['内容管理'] = $this->getContentMenu();
|
||||
$contetnmenu = $this->getContentMenu();
|
||||
if (!empty($contetnmenu)) {
|
||||
$menu['内容管理'] = $contetnmenu;
|
||||
}
|
||||
|
||||
foreach ($menu as $group => $item) {
|
||||
foreach ($item as $key => $value) {
|
||||
if (url($value['url']) == $_SERVER['REQUEST_URI']) {
|
||||
@@ -51,6 +58,7 @@ class User extends Base{
|
||||
protected function getContentMenu(){
|
||||
$list = array();
|
||||
$map = array(
|
||||
'is_user_show' => 1,
|
||||
'status' => array('gt',0),
|
||||
'extend' => array('gt',0),
|
||||
);
|
||||
@@ -64,4 +72,13 @@ class User extends Base{
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
protected function checkProfile($user){
|
||||
$result = true;
|
||||
//判断用户资料是否填写完整
|
||||
if (!$user['nickname'] || !$user['qq']) {
|
||||
$result = false;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class User extends \think\model\Merge{
|
||||
* 用户注册
|
||||
* @param integer $user 用户信息数组
|
||||
*/
|
||||
function register($username, $password, $repassword, $isautologin = true){
|
||||
function register($username, $password, $repassword, $email, $isautologin = true){
|
||||
if ($password !== $repassword) {
|
||||
$this->error = "密码和确认密码不相同";
|
||||
return false;
|
||||
@@ -119,6 +119,7 @@ class User extends \think\model\Merge{
|
||||
$data['username'] = $username;
|
||||
$data['salt'] = rand_string(6);
|
||||
$data['password'] = $password;
|
||||
$data['email'] = $email;
|
||||
$result = $this->validate(true)->save($data);
|
||||
if ($result) {
|
||||
$this->data['uid'] = $result;
|
||||
|
||||
@@ -16,11 +16,16 @@ class Member extends \think\Validate{
|
||||
|
||||
protected $rule = array(
|
||||
'username' => 'require|unique:member|/^[a-zA-Z]\w{0,39}$/',
|
||||
'email' => 'require|unique:member|email',
|
||||
);
|
||||
protected $message = array(
|
||||
'username.require' => '用户名必须',
|
||||
'username.unique' => '用户名已存在',
|
||||
'email.require' => '邮箱必须',
|
||||
'email.unique' => '邮箱已存在',
|
||||
);
|
||||
protected $scene = array(
|
||||
//'add' => 'username,email',
|
||||
);
|
||||
protected $scene = array();
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ class Ad{
|
||||
echo "";return;
|
||||
}
|
||||
$ad = db('Ad')->where(array('place_id'=>$place['id'],'status'=>1))->select();
|
||||
$list = array();
|
||||
foreach ($ad as $key => $value) {
|
||||
if ($value['photolist'] != '') {
|
||||
$photolist = explode(',', $value['photolist']);
|
||||
|
||||
Reference in New Issue
Block a user