Ejemplo n.º 1
0
 public function save()
 {
     $group = AuthGroupModel::getUserGroup(UID);
     if ($group[0]['group_id'] == 1) {
         $_POST['uid'] = 1;
     }
     $id = I('param.id');
     if ($id) {
         $Music = M('Muisc');
         $gdlist = $Music->field('id')->where('ggid=' . $id)->select();
         if (!empty($gdlist)) {
             foreach ($gdlist as $gd) {
                 $Music->where('id=' . $gd['id'])->setField('del_flag', '2');
             }
         }
         $_POST['update_date'] = NOW_TIME;
         if ($this->Notice->create() && $this->Notice->save()) {
         } else {
             $this->error('Err: ' . $this->Notice->getDbError());
         }
         if ($this->Ndetail->create() && $this->Ndetail > save()) {
             $this->success('公告更新成功', U('index'));
         } else {
             $this->Notice->where('id=' . I('param.id'))->delete();
             $this->error('Err: ' . $this->Notice->getDbError());
         }
     } else {
         $_POST['update_date'] = NOW_TIME;
         $_POST['create_date'] = NOW_TIME;
         if ($this->Ndetail->create() && $this->Ndetail > add()) {
             $this->success('公告更新成功', U('index'));
         } else {
             $this->error('Err: ' . $this->Ndetail->getDbError());
         }
         if ($this->Notice->create() && $this->Notice->add()) {
             $this->success('公告更新成功', U('index'));
         } else {
             $this->error('Err: ' . $this->Notice->getDbError());
         }
     }
 }
Ejemplo n.º 2
0
 public function index()
 {
     $group = AuthGroupModel::getUserGroup(UID);
     if ($group[0]['group_id'] == 2) {
         $map['uid'] = UID;
     }
     $id = I('param.id');
     if (!empty($id)) {
         $map['id'] = $id;
     }
     $title = I('param.title');
     if (!empty($title)) {
         $map['title'] = array('like', '%' . $title . '%');
     }
     $uid = I('param.uid');
     if (!empty($uid)) {
         $map['uid'] = $uid;
     }
     $list = $this->lists($this->Youpin, $map, 'create_time desc', true);
     $this->assign('list', $list);
     $this->assign('meta_title', '有品管理');
     $this->display();
 }
 /**
  * 将用户添加到用户组的编辑页面
  * @author 朱亚杰 <*****@*****.**>
  */
 public function group()
 {
     $uid = I('uid');
     $auth_groups = D('AuthGroup')->getGroups();
     $user_groups = AuthGroupModel::getUserGroup($uid);
     $ids = array();
     foreach ($user_groups as $value) {
         $ids[] = $value['group_id'];
     }
     $nickname = D('Member')->getNickName($uid);
     $this->assign('nickname', $nickname);
     $this->assign('auth_groups', $auth_groups);
     $this->assign('user_groups', implode(',', $ids));
     $this->display();
 }