Exemple #1
0
 /**
  * 个人会员
  */
 public function index($uid = '', $account = '', $nickname = '', $mobile = '', $pid = '', $status = '')
 {
     $map = ['status' => ['egt', 0]];
     if (is_numeric($pid)) {
         $map['pid'] = $pid;
     }
     if (is_numeric($uid)) {
         $map['id'] = $uid;
     }
     if ($account) {
         $map['account'] = ['like', "%{$account}%"];
     }
     if ($nickname) {
         $map['nickname'] = ['like', "%{$nickname}%"];
     }
     if (is_numeric($mobile)) {
         $map['mobile'] = ['like', "%{$mobile}%"];
     }
     if (is_numeric($status) && $status == 2) {
         $map['status'] = $status;
     }
     $list = parent::_list('Member', $map, 'last_time desc,create_time desc');
     $this->assign('list', $list);
     return $this->fetch();
 }
Exemple #2
0
 /**
  * 参数配置
  * @param  string $title 搜索标题
  * @param  string $group 当前分组
  */
 public function params($title = '', $group = '')
 {
     $map = ['hide' => 0, 'status' => ['egt', 0]];
     if ($title) {
         $map['title|name'] = ['like', "%{$title}%"];
     }
     if ($group) {
         $map['group'] = $group;
     }
     $list = parent::_list('Config', $map, 'sort asc,create_time desc,update_time desc');
     $this->assign('list', $list);
     return $this->fetch();
 }
Exemple #3
0
 /**
  * 上传文件管理
  */
 public function index($type = '')
 {
     $total = disk_total_space(".");
     $this->assign('disk_use', round(($total - disk_free_space(".")) / $total * 100, 2));
     $map = [];
     if ($type) {
         $map['type'] = $type;
     }
     $list = parent::_list('Storage', $map);
     $this->assign('list', $list);
     $this->assign('size', Db::name('Storage')->where($map)->sum('size'));
     $this->assign('types', Db::name('Storage')->field('type')->distinct('type')->select());
     return $this->fetch();
 }
Exemple #4
0
 /**
  * 菜单列表
  * @param  integer $pid [description]
  */
 public function index($pid = 0, $title = '')
 {
     $map = ['status' => ['egt', 0]];
     if ($title) {
         $map['title'] = array('like', "%{$title}%");
     } else {
         $map['pid'] = $pid;
     }
     $list = parent::_list('Menu', $map, 'sort asc,id asc');
     $this->assign('list', $list);
     $tree = Db::name('Menu')->where('status', 'egt', 0)->order('sort asc,id asc')->select();
     $this->assign('tree', \tools\Tree::listTree($tree));
     return $this->fetch();
 }
Exemple #5
0
 /**
  * 文章列表与回收站 通用的列表与搜索
  * @param  [type] $status
  * @param  [type] $title
  * @param  [type] $category
  */
 private function _baseList($status, $title, $category)
 {
     $map['status'] = $status;
     // 按标题搜索
     if ($title) {
         $map['title'] = ['like', "%{$title}%"];
     }
     // 分类搜索
     if (is_numeric($category)) {
         $map['category_id'] = $category;
     }
     $list = parent::_list('Article', $map, 'level desc,create_time desc');
     $this->assign('list', $list);
     $this->assign('cate_list', Loader::model('Category')->treeSelect('article'));
 }
Exemple #6
0
 public function index($title = '', $pid = '')
 {
     if ($title) {
         $map['title'] = ['like', "%{$title}%"];
     }
     if (is_numeric($pid)) {
         $map['pid'] = $pid;
     } else {
         $map['pid'] = 0;
     }
     $map['status'] = ['egt', 0];
     $list = parent::_list('Category', $map, 'sort asc');
     $this->assign('list', $list);
     $tree = Db::name('Category')->where('status', 'egt', 0)->order('sort asc,id asc')->select();
     $this->assign('tree', \tools\Tree::listTree($tree));
     return $this->fetch();
 }
Exemple #7
0
 /**
  * [user description]
  */
 public function user($id)
 {
     if (IS_POST) {
         $uids = $this->request->post('uid/a');
         if (empty($uids)) {
             return $this->error();
         }
         foreach ($uids as $key => $value) {
             $data = ['auth_id' => $id, 'uid' => $value, 'create_time' => NOW_TIME];
             Db::name('AuthUser')->insert($data);
         }
         return $this->success();
     } else {
         // 分组内已有用户
         $uids = Db::name('AuthUser')->where('auth_id', $id)->column('uid') ?: [0];
         $uMap = ['id' => ['notin', $uids], 'status' => ['egt', 0]];
         // 列出分组外用户
         $this->assign('user_list', Db::name('Member')->where($uMap)->select());
         $map = ['id' => ['in', $uids], 'status' => ['egt', 0]];
         $list = parent::_list('Member', $map);
         $this->assign('list', $list);
         return $this->fetch();
     }
 }
Exemple #8
0
 /**
  * 模板消息
  */
 public function template()
 {
     if (IS_AJAX) {
         self::initWechat();
         $list = Template::get();
         if ($list) {
             Db::name('WechatTemplate')->where('status', 'egt', 0)->delete();
             foreach ($list['template_list'] as $key => $value) {
                 $value['create_time'] = NOW_TIME;
                 $value['update_time'] = 0;
                 $value['status'] = 1;
                 Db::name('WechatTemplate')->insert($value);
             }
             return $this->success();
         } else {
             return $this->error(Wechat::error());
         }
     } else {
         $list = parent::_list('WechatTemplate');
         $this->assign('list', $list);
         return $this->fetch();
     }
 }