Xzlog.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. namespace app\admin\controller\informational;
  3. use app\common\model\ShopCategory;
  4. use app\admin\traits\Curd;
  5. use app\common\controller\AdminController;
  6. use app\common\model\WithDrawLogModel;
  7. use app\common\model\XzLogModel;
  8. use EasyAdmin\annotation\ControllerAnnotation;
  9. use EasyAdmin\annotation\NodeAnotation;
  10. use think\App;
  11. use think\facade\Db;
  12. use think\Model;
  13. /**
  14. * Class Admin
  15. * @package app\admin\controller\system
  16. * @ControllerAnnotation(title="星钻转赠记录")
  17. */
  18. class Xzlog extends AdminController
  19. {
  20. use Curd;
  21. public function __construct (App $app, XzLogModel $model)
  22. {
  23. parent::__construct($app);
  24. $this->model = $model;
  25. }
  26. /**
  27. * 提现列表
  28. * @return mixed|\think\response\Json
  29. * @throws \think\db\exception\DataNotFoundException
  30. * @throws \think\db\exception\DbException
  31. * @throws \think\db\exception\ModelNotFoundException
  32. */
  33. public function index ()
  34. {
  35. if ($this->request->isAjax()) {
  36. if (input('selectFields')) {
  37. return $this->selectList();
  38. }
  39. list($page, $limit, $where) = $this->buildTableParames();
  40. foreach ($where as $key=>$val){
  41. if ($val[0] == 'status'){
  42. $where[$key][0] = 'o.status';
  43. }
  44. if ($val[0] == 'create_at'){
  45. $where[$key][0] = 'create_at';
  46. $where[$key][2] = sr_getcurtime($where[$key][2]);
  47. }
  48. }
  49. $count = $this->model
  50. ->where('type', 'in',[6])
  51. ->withJoin('user', 'INNER')
  52. ->where($this->user_map)
  53. ->where($where)
  54. ->count();
  55. $list = $this->model
  56. ->where('type', 'in',[6])
  57. ->withJoin('user', 'INNER')
  58. ->where($this->user_map)
  59. ->where($where)
  60. ->page($page, $limit)
  61. ->order($this->sort)
  62. ->select();
  63. foreach ($list as $key=>$val){
  64. $list[$key]['mobile2'] = Db::name('user')->where('id', $val['uid2'])->value('mobile');
  65. }
  66. $data = [
  67. 'code' => 0,
  68. 'msg' => '',
  69. 'count' => $count,
  70. 'data' => $list,
  71. ];
  72. return json($data);
  73. }
  74. return $this->fetch();
  75. }
  76. }