Xzlog.php 2.4 KB

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