1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace app\admin\controller;
- use app\common\controller\Backend;
- use think\Db;
- class Goldlog extends Backend
- {
-
-
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\admin\model\Goldlog;
- }
- 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', 'otheruser'])
- ->where($where)
- ->order($sort, $order)
- ->paginate($limit);
- $wallet_logtype = config('wallet.logtype');
- $mt_user_match_video_log = Db::name('user_match_video_log');
- $mt_user_match_audio_log = Db::name('user_match_audio_log');
- foreach ($list as $row) {
- $row->getRelation('user')->visible(['username', 'nickname']);
- $row->getRelation('otheruser')->visible(['username', 'nickname']);
- $row['log_type_text'] = isset($wallet_logtype[$row['log_type']]) ? $wallet_logtype[$row['log_type']] : '';
- $row['call_minutes'] = '';
- if ($row['log_type'] == 11) {
- $row['call_minutes'] = $mt_user_match_video_log->where(['id' => $row['table_id']])->value('call_minutes');
- } elseif ($row['log_type'] == 12) {
- $row['call_minutes'] = $mt_user_match_audio_log->where(['id' => $row['table_id']])->value('call_minutes');
- }
- }
- $result = array("total" => $list->total(), "rows" => $list->items());
- return json($result);
- }
- return $this->view->fetch();
- }
- }
|