123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace app\admin\controller;
- use app\common\controller\Backend;
- use think\Db;
- /**
- * 用户提现申请
- *
- * @icon fa fa-circle-o
- */
- class Usertakecash extends Backend
- {
- /**
- * Usertakecash模型对象
- * @var \app\admin\model\Usertakecash
- */
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\admin\model\Usertakecash;
- $this->view->assign("statusList", $this->model->getStatusList());
- }
- /**
- * 审核
- */
- public function audit(){
- $id = input('id');
- $info = Db::name('user_take_cash')
- ->where('id',$id)
- ->find();
- if ($this->request->isPost()) {
- $status = input('status',0);
- $data = [
- 'status' => $status,
- 'auditremark' => input('auditremark',''),
- 'audittime' => time(),
- 'updatetime' => time(),
- ];
- Db::startTrans();
- $rs = Db::name('user_take_cash')->where('id',$id)->update($data);
- if($rs === false){
- Db::rollback();
- $this->error('审核失败');
- }
- if($status == 2){
- //归还钱
- $wallet_rs = model('wallet')->lockChangeAccountRemain($info['user_id'],'money',$info['money'],5,'提现拒绝退还:'.$info['money'],'take_cash',$info['id']);
- if($wallet_rs['status'] === false){
- Db::rollback();
- $this->error($wallet_rs['msg']);
- }
- }
- Db::commit();
- $this->success('审核完成');
- }
- $this->assign('row',$info);
- return $this->view->fetch();
- }
- }
|