Recharge.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 Recharge extends Backend
  10. {
  11. /**
  12. * Recharge模型对象
  13. * @var \app\admin\model\Recharge
  14. */
  15. protected $model = null;
  16. public function _initialize()
  17. {
  18. parent::_initialize();
  19. $this->model = new \app\admin\model\Recharge;
  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['status']);
  55. $list[$k]['type']=get_paytype($row['paytype']);
  56. }
  57. $result = array("total" => $total, "rows" => $list);
  58. return json($result);
  59. }
  60. return $this->view->fetch();
  61. }
  62. /* 审核 */
  63. function view()
  64. {
  65. $ids = input('ids');
  66. $status=input('status');
  67. $info=$this->model->where(['id'=>$ids,'status'=>1])->find();
  68. if(!$info)
  69. {
  70. $this->error("信息不存在,或已审核");
  71. }else{
  72. if($status == 1)
  73. {#审核
  74. $res1=$this->model->where('id',$ids)->update(['status'=>2,'utime'=>time()]);
  75. $changedata=[
  76. 'type'=>4,
  77. 'money'=>$info['money'],
  78. 'userid'=>$info['userid'],
  79. 'relevant_userid'=>$info['userid'],
  80. 'remark'=>'充值',
  81. ];
  82. $res=caiwu($changedata, $info['money_type']);
  83. if($res && $res1)
  84. {
  85. $this->success('审核完成');
  86. }else{
  87. $this->error('审核失败');
  88. }
  89. }else{
  90. $res1=$this->model->where('id',$ids)->update(['status'=>-1,'utime'=>time()]);
  91. if($res1)
  92. {
  93. $this->success('审核完成');
  94. }else{
  95. $this->error('审核失败');
  96. }
  97. }
  98. }
  99. }
  100. }