李帅

优化接口,修改bug

...@@ -157,11 +157,12 @@ class AuthController extends Controller ...@@ -157,11 +157,12 @@ class AuthController extends Controller
157 $validator = Validator::make($request->all(), [ 157 $validator = Validator::make($request->all(), [
158 'email' => 'required|email|unique:users|max:255', 158 'email' => 'required|email|unique:users|max:255',
159 'password' => 'required|min:6', 159 'password' => 'required|min:6',
160 - 'verify_code' => 'required' 160 + 'verify_code' => 'required',
161 + 'nickname' => 'required',
161 ]); 162 ]);
162 163
163 if ($validator->fails()) { 164 if ($validator->fails()) {
164 - return Response::fail('', 500, $validator->errors()); 165 + return Response::fail('参数错误', 500, $validator->errors());
165 } 166 }
166 167
167 try { 168 try {
......
...@@ -162,8 +162,10 @@ class ImmerseController extends Controller ...@@ -162,8 +162,10 @@ class ImmerseController extends Controller
162 if ($collects->count()){ 162 if ($collects->count()){
163 foreach ($collects as $collect){ 163 foreach ($collects as $collect){
164 if ($collect->immerse){ // 避免删除过临境的还存在收藏列表里 164 if ($collect->immerse){ // 避免删除过临境的还存在收藏列表里
165 + $data['id'] = $collect->id;
165 $data['user_id'] = $collect->user_id; 166 $data['user_id'] = $collect->user_id;
166 $data['immerse_id'] = $collect->immerse_id; 167 $data['immerse_id'] = $collect->immerse_id;
168 + $data['poem_id'] = $collect->immerse->poem_id;
167 $data['content'] = $collect->immerse->content; 169 $data['content'] = $collect->immerse->content;
168 $data['thumbnail'] = $collect->immerse->thumbnail; 170 $data['thumbnail'] = $collect->immerse->thumbnail;
169 $data['url'] = $collect->immerse->url; 171 $data['url'] = $collect->immerse->url;
...@@ -209,8 +211,10 @@ class ImmerseController extends Controller ...@@ -209,8 +211,10 @@ class ImmerseController extends Controller
209 if ($collects->count()){ 211 if ($collects->count()){
210 foreach ($collects as $collect){ 212 foreach ($collects as $collect){
211 if ($collect->immerse){ // 避免删除过临境的还存在收藏列表里 213 if ($collect->immerse){ // 避免删除过临境的还存在收藏列表里
214 + $data['id'] = $collect->id;
212 $data['user_id'] = $collect->user_id; 215 $data['user_id'] = $collect->user_id;
213 $data['immerse_id'] = $collect->immerse_id; 216 $data['immerse_id'] = $collect->immerse_id;
217 + $data['poem_id'] = $collect->immerse->poem_id;
214 $data['content'] = $collect->immerse->content; 218 $data['content'] = $collect->immerse->content;
215 $data['thumbnail'] = $collect->immerse->thumbnail; 219 $data['thumbnail'] = $collect->immerse->thumbnail;
216 $data['url'] = $collect->immerse->url; 220 $data['url'] = $collect->immerse->url;
......
...@@ -51,7 +51,7 @@ class UserController extends Controller ...@@ -51,7 +51,7 @@ class UserController extends Controller
51 51
52 public function videos(Request $request) 52 public function videos(Request $request)
53 { 53 {
54 - $type = $request->get('type'); 54 + $type = $request->get('type','all');
55 55
56 $page = $request->get('page',1); 56 $page = $request->get('page',1);
57 $page_size = $request->get('page_size',20); 57 $page_size = $request->get('page_size',20);
......
...@@ -18,9 +18,12 @@ class AlterUserProfiles extends Migration ...@@ -18,9 +18,12 @@ class AlterUserProfiles extends Migration
18 $table->string('intro')->after('user_id')->default("")->comment('简介'); 18 $table->string('intro')->after('user_id')->default("")->comment('简介');
19 $table->date('birthday')->after('intro')->default("2023-01-01")->comment('生日'); 19 $table->date('birthday')->after('intro')->default("2023-01-01")->comment('生日');
20 20
21 - $table->unsignedInteger('follow_count')->after('video_count')->default(0)->comment('关注数量'); 21 +// $table->unsignedInteger('follow_count')->after('video_count')->default(0)->comment('关注数');
22 - $table->unsignedInteger('fans_count')->after('follow_count')->default(0)->comment('粉丝数量'); 22 +// $table->unsignedInteger('fans_count')->after('follow_count')->default(0)->comment('粉丝数');
23 - $table->unsignedInteger('popular_count')->after('fans_count')->default(0)->comment('人气数量'); 23 +// $table->unsignedInteger('popular_count')->after('fans_count')->default(0)->comment('人气数');
24 +
25 + $table->unsignedInteger('praised_count')->after('video_count')->default(0)->comment('被点赞数');
26 + $table->unsignedInteger('collected_count')->after('praised_count')->default(0)->comment('被收藏数');
24 27
25 }); 28 });
26 } 29 }
...@@ -34,5 +37,6 @@ class AlterUserProfiles extends Migration ...@@ -34,5 +37,6 @@ class AlterUserProfiles extends Migration
34 { 37 {
35 // 38 //
36 Schema::dropColumns('user_profiles', ['intro','birthday','follow_count','fans_count','popular_count']); 39 Schema::dropColumns('user_profiles', ['intro','birthday','follow_count','fans_count','popular_count']);
40 +// Schema::dropColumns('user_profiles', ['intro','birthday','praised_count','collected_count']);
37 } 41 }
38 } 42 }
......