Takecash.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. namespace app\admin\controller\agent;
  3. use app\common\controller\Backend;
  4. use Think\Db;
  5. /**
  6. * 提现申请
  7. *
  8. * @icon fa fa-circle-o
  9. */
  10. class Takecash extends Backend
  11. {
  12. /**
  13. * Takecash模型对象
  14. * @var \app\admin\model\Takecash
  15. */
  16. protected $model = null;
  17. public function _initialize()
  18. {
  19. parent::_initialize();
  20. $this->model = new \app\admin\model\Takecash;
  21. $this->view->assign("statusList", $this->model->getStatusList());
  22. $this->view->assign("typeList", $this->model->getTypeList());
  23. }
  24. public function import()
  25. {
  26. parent::import();
  27. }
  28. /**
  29. * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  30. * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  31. * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  32. */
  33. /**
  34. * 查看
  35. */
  36. public function index()
  37. {
  38. //当前是否为关联查询
  39. $this->relationSearch = true;
  40. //设置过滤方法
  41. $this->request->filter(['strip_tags', 'trim']);
  42. if ($this->request->isAjax()) {
  43. //如果发送的来源是Selectpage,则转发到Selectpage
  44. if ($this->request->request('keyField')) {
  45. return $this->selectpage();
  46. }
  47. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  48. /*$user_ids = Db::name('admin')->where(['user_id' => ['gt', 0]])->column('user_id');
  49. $user_ids = $user_ids ? : [];
  50. $map['user_id'] = ['in', $user_ids];
  51. if ($this->auth->id != 1 && $this->auth->id != 11) {
  52. $map['user_id'] = $this->auth->user_id;
  53. }*/
  54. $map = [];
  55. if ($this->auth->id != 1 && $this->auth->id != 11) {
  56. if ($this->auth->user_id > 0) {
  57. $user_ids = Db::name('user')->where(['intro_uid' => $this->auth->user_id])->column('id');
  58. $user_ids = $user_ids ? : [];
  59. $map['user_id'] = ['in', $user_ids];
  60. } else {
  61. $map['user_id'] = -100;
  62. }
  63. }
  64. $list = $this->model
  65. ->with(['user','withdrawalconfig','userto'])
  66. ->where($where)
  67. ->where($map)
  68. ->order($sort, $order)
  69. ->paginate($limit);
  70. $mt_admin = Db::name('admin');
  71. foreach ($list as &$row) {
  72. $row->getRelation('user')->visible(['nickname','mobile']);
  73. $row->getRelation('withdrawalconfig')->visible(['money']);
  74. $row->getRelation('userto')->visible(['nickname','mobile']);
  75. // $admin_info = $mt_admin->field('nickname, id')->where(['user_id' => $row['user_id']])->find();
  76. // $row['nickname'] = $admin_info['nickname'];
  77. // $row['pingtai_id'] = $admin_info['id'];
  78. }
  79. $result = array("total" => $list->total(), "rows" => $list->items());
  80. return json($result);
  81. }
  82. return $this->view->fetch();
  83. }
  84. }