visuddhinanda 2 سال پیش
والد
کامیت
d8ccfc5442

+ 1 - 0
app/Console/Commands/MqPr.php

@@ -107,6 +107,7 @@ class MqPr extends Command
                                 'url'=>$link,
                                 'res_type'=> 'suggestion',
                                 'res_id'=> $prData->uid,
+                                'channel'=>$prData->channel->id,
                             ]);
             if($response->failed()){
                 Log::error('send notification failed');

+ 1 - 0
app/Http/Controllers/NotificationController.php

@@ -73,6 +73,7 @@ class NotificationController extends Controller
         $new->content = $request->get('content');
         $new->res_type = $request->get('res_type');
         $new->res_id = $request->get('res_id');
+        $new->channel = $request->get('channel');
         $new->save();
 
         return $this->ok(new NotificationResource($new));

+ 2 - 3
app/Http/Resources/NotificationResource.php

@@ -8,6 +8,7 @@ use App\Http\Api\UserApi;
 use App\Models\SentPr;
 use App\Models\Sentence;
 use App\Http\Api\PaliTextApi;
+use App\Http\Api\ChannelApi;
 
 class NotificationResource extends JsonResource
 {
@@ -35,6 +36,7 @@ class NotificationResource extends JsonResource
 
         switch ($this->res_type) {
             case 'suggestion':
+                $data['channel'] = ChannelApi::getById($this->channel);
                 $prData = SentPr::where('uid',$this->res_id)->first();
                 if($prData){
                     $link = config('mint.server.dashboard_base_path')."/article/para/{$prData->book_id}-{$prData->paragraph}";
@@ -62,10 +64,7 @@ class NotificationResource extends JsonResource
                         $data['content'] = $content;
                     }
                 }
-
-
                 break;
-
             default:
                 # code...
                 break;