123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <?php
- namespace app\admin\controller;
- use app\common\controller\Backend;
- use think\Db;
- class Imloggroup extends Backend
- {
-
-
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\admin\model\Imloggroup;
- }
- public function import()
- {
- parent::import();
- }
-
-
-
- public function index()
- {
-
- $this->relationSearch = true;
-
- $this->request->filter(['strip_tags', 'trim']);
- if ($this->request->isAjax()) {
-
- if ($this->request->request('keyField')) {
- return $this->selectpage();
- }
- list($where, $sort, $order, $offset, $limit) = $this->buildparams();
- $list = $this->model
- ->with(['user','party'])
- ->where($where)
- ->order($sort, $order)
- ->paginate($limit);
- foreach ($list as $row) {
-
- $row->getRelation('user')->visible(['nickname']);
- $row->getRelation('party')->visible(['room_type','party_name']);
- }
- $list2 = collection($list->items())->toArray();
- $type_arr = $this->type_arr();
- foreach($list2 as $key => &$val){
- $val['MsgType'] = isset($type_arr[$val['MsgType']]) ? $type_arr[$val['MsgType']] : '其他';
- }
- $result = array("total" => $list->total(), "rows" => $list2);
- return json($result);
- }
- return $this->view->fetch();
- }
- private function type_arr(){
- $type_arr = [
- 'TIMTextElem' => '文本',
- 'TIMImageElem' => '图片',
- 'TIMSoundElem' => '声音',
- 'TIMVideoFileElem' => '视频',
- ];
- return $type_arr;
- }
-
- public function showbody(){
- $id = input('id',0);
- $info = Db::name('imlog_group')->where('id',$id)->find();
- $type_arr = $this->type_arr();
- $info['typetext'] = isset($type_arr[$info['MsgType']]) ? $type_arr[$info['MsgType']] : '其他';
- $this->assign('info',$info);
- return $this->view->fetch();
- }
- }
|