Explorar o código

#1416 复制句子,保留原作者信息

visuddhinanda %!s(int64=3) %!d(string=hai) anos
pai
achega
9ea2931d24
Modificáronse 1 ficheiros con 14 adicións e 2 borrados
  1. 14 2
      app/Http/Controllers/SentenceController.php

+ 14 - 2
app/Http/Controllers/SentenceController.php

@@ -259,13 +259,25 @@ class SentenceController extends Controller
             $row->strlen = mb_strlen($sent['content'],"UTF-8");
             $row->strlen = mb_strlen($sent['content'],"UTF-8");
             $row->language = $channel->lang;
             $row->language = $channel->lang;
             $row->status = $channel->status;
             $row->status = $channel->status;
-            $row->editor_uid = $user["user_uid"];
+            if($request->has('copy')){
+                //复制句子,保留原作者信息
+                $row->editor_uid = $sent["editor_uid"];
+                $row->acceptor_uid = $user["user_uid"];
+                $row->pr_edit_at = $sent["updated_at"];
+            }else{
+                $row->editor_uid = $user["user_uid"];
+            }
             $row->create_time = time()*1000;
             $row->create_time = time()*1000;
             $row->modify_time = time()*1000;
             $row->modify_time = time()*1000;
             $row->save();
             $row->save();
 
 
             //保存历史记录
             //保存历史记录
-            $this->saveHistory($row->uid,$user["user_uid"],$sent['content']);
+            if($request->has('copy')){
+                $this->saveHistory($row->uid,$sent["editor_uid"],$sent['content']);
+            }else{
+                $this->saveHistory($row->uid,$user["user_uid"],$sent['content']);
+            }
+
         }
         }
         if($sentFirst !== null){
         if($sentFirst !== null){
             Mq::publish('progress',['book'=>$sentFirst['book_id'],
             Mq::publish('progress',['book'=>$sentFirst['book_id'],