xiaogang 4 年之前
父節點
當前提交
5c7529474c
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      app/Http/Controllers/Api/UserController.php

+ 2 - 2
app/Http/Controllers/Api/UserController.php

@@ -190,8 +190,8 @@ class UserController extends Controller
         try {
         try {
             $user = auth('api')->user();
             $user = auth('api')->user();
             $userinfo = DB::table('users_info')->where(['user_id'=>$user->id])->select('photo','video')->first();
             $userinfo = DB::table('users_info')->where(['user_id'=>$user->id])->select('photo','video')->first();
-            $userinfo->photo = json_decode($userinfo->photo,true);
-            $userinfo->video = json_decode($userinfo->video,true);
+            $userinfo->photo = !empty($userinfo->photo)?json_decode($userinfo->photo,true):[];
+            $userinfo->video = !empty($userinfo->video)?json_decode($userinfo->video,true):[];
         }catch (\Exception $exception){
         }catch (\Exception $exception){
             return $this->response->errorForbidden($exception->getMessage());
             return $this->response->errorForbidden($exception->getMessage());
         }
         }