123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- namespace app\admin\controller;
- use app\common\controller\Backend;
- use think\Db;
- class Userwallet extends Backend
- {
-
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\admin\model\Userwallet;
- $this->view->assign("introLevelList", $this->model->getIntroLevelList());
- }
-
-
- 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'])
- ->where($where)
- ->order($sort, $order)
- ->paginate($limit);
- foreach ($list as $row) {
-
- $row->getRelation('user')->visible(['nickname','mobile','avatar']);
- }
- $result = array("total" => $list->total(), "rows" => $list->items());
- return json($result);
- }
- return $this->view->fetch();
- }
-
- public function updatemoney(){
- $id = input('id');
- $info = Db::name('user_wallet')
- ->where('id',$id)
- ->find();
- if ($this->request->isPost()) {
- $user_id = input('user_id');
- $money = input('money');
- $remark = input('remark','后台调节');
- Db::startTrans();
- $rs = model('wallet')->lockChangeAccountRemain($user_id,'money',$money,1,$remark);
- if($rs['status'] === false){
- Db::rollback();
- $this->error($rs['msg']);
- }
- Db::commit();
- $this->success('充值完成');
- }
- $this->assign('row',$info);
- return $this->view->fetch();
- }
- }
|