You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.5 KiB

7 years ago
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Http\Controllers\Admin\CommonController;
  4. use DB;
  5. use App\Http\Model\UserWithdraw;
  6. class UserWithdrawController extends CommonController
  7. {
  8. public function __construct()
  9. {
  10. parent::__construct();
  11. }
  12. public function index()
  13. {
  14. $posts = parent::pageList('user_withdraw',array('is_delete'=>0));
  15. if($posts)
  16. {
  17. foreach($posts as $k=>$v)
  18. {
  19. $posts[$k]->user = DB::table('user')->where('id', $v->id)->first();
  20. $posts[$k]->status_text = UserWithdraw::getStatusText(['status'=>$v->status]);
  21. }
  22. }
  23. $data['posts'] = $posts;
  24. return view('admin.UserWithdraw.index', $data);
  25. }
  26. public function edit()
  27. {
  28. if(!empty($_GET["id"])){$id = $_GET["id"];}else{$id="";}
  29. if(preg_match('/[0-9]*/',$id)){}else{exit;}
  30. $data['id'] = $id;
  31. $data['post'] = object_to_array(DB::table('user_withdraw')->where('id', $id)->first(), 1);
  32. return view('admin.UserWithdraw.edit', $data);
  33. }
  34. public function doedit()
  35. {
  36. if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else {$id="";exit;}
  37. unset($_POST["_token"]);
  38. if(DB::table('user_withdraw')->where('id', $id)->update($_POST))
  39. {
  40. success_jump('修改成功!', route('admin_user'));
  41. }
  42. else
  43. {
  44. error_jump('修改失败!');
  45. }
  46. }
  47. }