Exemple #1
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 #2
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 #3
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 #4
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 #5
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 #6
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 #7
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();
     }
 }
Exemple #8
0
 /**
  * 绑定钉钉
  * @return [type] [description]
  */
 public function bindding($id, $type = 'bind')
 {
     if ($type == 'unbind') {
         $data = ['ding_uid' => '', 'ding_openid' => '', 'update_time' => NOW_TIME];
         if (Db::name('Member')->where('id', $id)->update($data)) {
             logs('用户钉钉成功解除绑定');
             return $this->success();
         } else {
             return $this->error();
         }
     } else {
         if (IS_POST) {
             $dingid = $this->request->post('dingid');
             if (empty($dingid)) {
                 return $this->error('必须选择一个钉钉用户');
             }
             $dingUser = Db::name('DingUser')->where('id', $dingid)->field('userid,openid')->find();
             if (!$dingUser) {
                 return $this->error('钉钉用户不存在');
             }
             $data = ['ding_openid' => $dingUser['openid'], 'ding_uid' => $dingUser['userid']];
             if (Db::name('member')->where(['id' => $id])->update($data)) {
                 logs('用户钉钉绑定成功', $data);
                 /* 发送钉钉消息通知 */
                 if ($this->request->post('notice')) {
                     parent::_initDing();
                     \tools\Ding\CompanyMessage::oa($dingUser['userid'], '', 30443659, '账户绑定成功', '您的账户与平台账户绑定成功', 'http://d.nxr.cjango.com/center/index?dd_nav_bgcolor=FF18B4ED');
                 }
                 return $this->success();
             } else {
                 return $this->error();
             }
         } else {
             $info = Db::name('Member')->where('id', $id)->find();
             if (!empty($info['ding_openid'])) {
                 $this->assign('info', $info);
                 $this->assign('ding', Db::name('DingUser')->where('openid', $info['ding_openid'])->find());
             } else {
                 $hasBindIds = Db::name('Member')->where('ding_openid', 'neq', '')->column('ding_openid') ?: [''];
                 $list = Db::name('DingUser')->where('openid', 'notin', $hasBindIds)->field('id,name')->select();
                 $this->assign('list', $list);
             }
         }
         return $this->fetch();
     }
 }