diff --git a/app/Http/Controllers/Admin/FeedbackController.php b/app/Http/Controllers/Admin/FeedbackController.php new file mode 100644 index 0000000..b25aa80 --- /dev/null +++ b/app/Http/Controllers/Admin/FeedbackController.php @@ -0,0 +1,82 @@ +insert(array_filter($_POST))) + { + success_jump('添加成功!', route('admin_feedback')); + } + else + { + error_jump('添加失败!请修改后重新添加'); + } + } + + public function edit() + { + if(!empty($_GET["id"])){$id = $_GET["id"];}else{$id="";} + if(preg_match('/[0-9]*/',$id)){}else{exit;} + + $data['id'] = $id; + $data['post'] = object_to_array(DB::table('feedback')->where('id', $id)->first(), 1); + + return view('admin.feedback.edit', $data); + } + + public function doedit() + { + if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else{$id="";exit;} + + if(isset($_POST['editorValue'])){unset($_POST['editorValue']);} + unset($_POST["_token"]); + + if(DB::table('feedback')->where('id', $id)->update($_POST)) + { + success_jump('修改成功!', route('admin_slide')); + } + else + { + error_jump('修改失败!'); + } + } + + public function del() + { + if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump('删除失败!请重新提交');} + + if(DB::table('feedback')->whereIn("id", explode(',', $id))->delete()) + { + success_jump('删除成功'); + } + else + { + error_jump('删除失败!请重新提交'); + } + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 39e5bf2..3bf7479 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Admin\CommonController; use DB; +use App\Http\Model\User; class UserController extends CommonController { @@ -15,11 +16,42 @@ class UserController extends CommonController { $posts = parent::pageList('user'); - $data['posts'] = $posts; + if($posts) + { + foreach($posts as $k=>$v) + { + $posts[$k]->sex_text = User::getSexText(['sex'=>$v->sex]); + $posts[$k]->status_text = User::getStatusText(['status'=>$v->status]); + } + } + $data['posts'] = $posts; return view('admin.user.index', $data); } + //会员账户记录 + public function money() + { + $where = ''; + if(isset($_REQUEST["user_id"])) + { + $where['user_id'] = $_REQUEST["user_id"]; + } + + $posts = parent::pageList('user_money',$where); + + if($posts) + { + foreach($posts as $k=>$v) + { + $posts[$k]->user = DB::table('user')->where('id', $v->user_id)->first(); + } + } + + $data['posts'] = $posts; + return view('admin.user.money', $data); + } + public function add() { return view('admin.user.add'); @@ -68,7 +100,7 @@ class UserController extends CommonController { if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump('删除失败!请重新提交');} - if(DB::table('user')->whereIn("id", explode(',', $id))->delete()) + if(DB::table('user')->whereIn("id", explode(',', $id))->update(['status' => 2])) { success_jump('删除成功'); } diff --git a/app/Http/Controllers/Admin/UserWithdrawController.php b/app/Http/Controllers/Admin/UserWithdrawController.php new file mode 100644 index 0000000..ca27563 --- /dev/null +++ b/app/Http/Controllers/Admin/UserWithdrawController.php @@ -0,0 +1,57 @@ +0)); + + if($posts) + { + foreach($posts as $k=>$v) + { + $posts[$k]->user = DB::table('user')->where('id', $v->id)->first(); + $posts[$k]->status_text = UserWithdraw::getStatusText(['status'=>$v->status]); + } + } + + $data['posts'] = $posts; + return view('admin.UserWithdraw.index', $data); + } + + public function edit() + { + if(!empty($_GET["id"])){$id = $_GET["id"];}else{$id="";} + if(preg_match('/[0-9]*/',$id)){}else{exit;} + + $data['id'] = $id; + $data['post'] = object_to_array(DB::table('user_withdraw')->where('id', $id)->first(), 1); + + return view('admin.UserWithdraw.edit', $data); + } + + public function doedit() + { + if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else {$id="";exit;} + + unset($_POST["_token"]); + if(DB::table('user_withdraw')->where('id', $id)->update($_POST)) + { + success_jump('修改成功!', route('admin_user')); + } + else + { + error_jump('修改失败!'); + } + } +} \ No newline at end of file diff --git a/app/Http/Model/User.php b/app/Http/Model/User.php index 9152165..28a0a81 100644 --- a/app/Http/Model/User.php +++ b/app/Http/Model/User.php @@ -223,4 +223,44 @@ class User extends BaseModel return $res; } + + //获取性别文字:0未知,1男,2女 + public static function getSexText($where) + { + $res = ''; + if($where['sex'] === 0) + { + $res = '未知'; + } + elseif($where['sex'] === 1) + { + $res = '男'; + } + elseif($where['sex'] === 2) + { + $res = '女'; + } + + return $res; + } + + //获取用户状态文字:1正常 2 删除 3锁定 + public static function getStatusText($where) + { + $res = ''; + if($where['status'] === 1) + { + $res = '正常'; + } + elseif($where['status'] === 2) + { + $res = '删除'; + } + elseif($where['status'] === 3) + { + $res = '锁定'; + } + + return $res; + } } \ No newline at end of file diff --git a/resources/views/admin/UserWithdraw/add.blade.php b/resources/views/admin/UserWithdraw/add.blade.php new file mode 100644 index 0000000..772a67f --- /dev/null +++ b/resources/views/admin/UserWithdraw/add.blade.php @@ -0,0 +1,64 @@ +@extends('admin.layouts.app') +@section('title', '管理员添加') + +@section('content') +