소스 검색

bug修复

121708259@qq.com 3 년 전
부모
커밋
1fb95798e7
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      app/Services/DynamicService.php

+ 4 - 2
app/Services/DynamicService.php

xqd xqd
@@ -252,8 +252,9 @@ class DynamicService
             if(!$dynamic){
                 throw new Exception("动态不存在");
             }
+            $report_id = $dynamic->id;
         }else{
-            if(!empty($userReportParam->id)&& $userReportParam->report_id>0){
+            if(!empty($userReportParam->report_id)&& $userReportParam->report_id>0){
                 $user = User::query()->where('id',$userReportParam->report_id)->first();
             }
             if(!empty($userReportParam->tencent_im_user_id)){
@@ -262,10 +263,11 @@ class DynamicService
             if(!$user){
                 throw new Exception("用户不存在");
             }
+            $report_id = $user->id;
         }
         UserReportModel::query()->create([
            "user_id"=>$userReportParam->user_id,
-           "report_id"=>$userReportParam->report_id,
+           "report_id"=>$report_id,
            "type"=>$userReportParam->type,
            "content"=>htmlspecialchars($userReportParam->content),
            "info"=>htmlspecialchars($userReportParam->info),