Withdrawals.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. namespace app\admin\controller\bonus;
  3. use app\common\controller\Backend;
  4. /**
  5. *
  6. *
  7. * @icon fa fa-circle-o
  8. */
  9. class Withdrawals extends Backend
  10. {
  11. /**
  12. * Withdrawals模型对象
  13. * @var \app\admin\model\Withdrawals
  14. */
  15. protected $model = null;
  16. public function _initialize()
  17. {
  18. parent::_initialize();
  19. $this->model = new \app\admin\model\Withdrawals;
  20. }
  21. /**
  22. * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  23. * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  24. * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  25. */
  26. /**
  27. * 查看
  28. */
  29. public function index()
  30. {
  31. //当前是否为关联查询
  32. $this->relationSearch = false;
  33. //设置过滤方法
  34. $this->request->filter(['strip_tags']);
  35. if ($this->request->isAjax())
  36. {
  37. //如果发送的来源是Selectpage,则转发到Selectpage
  38. if ($this->request->request('keyField'))
  39. {
  40. return $this->selectpage();
  41. }
  42. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  43. $total = $this->model
  44. ->where($where)
  45. ->order($sort, $order)
  46. ->count();
  47. $list = $this->model
  48. ->where($where)
  49. ->order($sort, $order)
  50. ->limit($offset, $limit)
  51. ->select();
  52. foreach ($list as $k=>$row) {
  53. $list[$k]['money_type_name']=get_money_name_byident($row['money_type']);
  54. $list[$k]['status_desc']=get_recharge_status($row['process_status']);
  55. }
  56. $result = array("total" => $total, "rows" => $list);
  57. return json($result);
  58. }
  59. return $this->view->fetch();
  60. }
  61. /* 审核 */
  62. function view()
  63. {
  64. $ids = input('ids');
  65. $info=$this->model->where(['id'=>$ids,'process_status'=>1])->find();
  66. if(!$info)
  67. {
  68. $this->error("信息不存在,或已审核");
  69. }else{
  70. $res=$this->model->where(array('id'=>$ids))->update(['process_status'=>2,'confirm_date'=>time()]);
  71. if($res)
  72. {
  73. $this->success('审核完成');
  74. }else{
  75. $this->error('审核失败');
  76. }
  77. }
  78. }
  79. /*拒绝 */
  80. function refuse()
  81. {
  82. if ($this->request->isPost()) {
  83. $params = $this->request->post();
  84. $info=$this->model->where('id',$params['id'])->find();
  85. if(empty($info))
  86. {
  87. $this->error("信息不存在");
  88. }
  89. $res1=$this->model->where('id',$params['id'])->update(['process_status'=>-1,'remark'=>$params['remark'],'confirm_date'=>time()]);
  90. $changedata=[
  91. 'type'=>5,
  92. 'money'=>$info['amount'],
  93. 'userid'=>$info['userid'],
  94. 'relevant_userid'=>-1,
  95. 'remark'=>'拒绝提现返还',
  96. ];
  97. $res=caiwu($changedata, $info['money_type']);
  98. if($res && $res1)
  99. {
  100. $this->success('审核完成');
  101. }else{
  102. $this->error('审核失败');
  103. }
  104. }
  105. $ids=input('ids');
  106. $this->view->assign('id',$ids);
  107. return $this->view->fetch();
  108. }
  109. function toshow()
  110. {
  111. $ids=input('ids');
  112. $info=$this->model->where('id',$ids)->find();
  113. $this->view->assign('prc',$info['prc']);
  114. return $this->view->fetch();
  115. }
  116. }