| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace app\admin\controller\ledger;
- use app\common\controller\Backend;
- use app\common\model\UserModel;
- use fast\Action;
- use fast\RechargeStatus;
- use fast\RechargeType;
- use think\exception\DbException;
- use think\response\Json;
- /**
- * Teac变动明细管理
- *
- * @icon fa fa-circle-o
- */
- class LedgerTeacChange extends Backend
- {
- /**
- * LedgerPowerChange模型对象
- * @var \app\admin\model\LedgerPowerChange
- */
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\common\model\LedgerTeacChangeModel;
- }
- /**
- * 查看
- *
- * @return string|Json
- * @throws \think\Exception
- * @throws DbException
- */
- public function index()
- {
- //设置过滤方法
- $this->request->filter(['strip_tags', 'trim']);
- if (false === $this->request->isAjax()) {
- return $this->view->fetch();
- }
- //如果发送的来源是 Selectpage,则转发到 Selectpage
- if ($this->request->request('keyField')) {
- return $this->selectpage();
- }
- [$where, $sort, $order, $offset, $limit] = $this->buildparams();
- $list = $this->model->alias('r')
- ->join('user u','r.user_id=u.id','LEFT')
- ->where($where)
- ->field('r.*,u.address')
- ->order($sort, $order)
- ->paginate($limit);
- foreach ($list as $k => $v) {
- $list[$k]['address'] = (new UserModel())->getById($v['user_id'])['address'];
- }
- $result = ['total' => $list->total(), 'rows' => $list->items()];
- return json($result);
- }
- }
|