瀏覽代碼

修改消息

lip 1 月之前
父節點
當前提交
7aba19a88c

+ 1 - 1
app/admin/command/UserQueue.php

@@ -79,7 +79,7 @@ class UserQueue extends Command
                 $robot_id = $friend->friend_user_id;
                 $friend->friend_user_id = $cs_uid;
                 $friend->save();
-                $chat_identify = $cs_uid . '-' . $user_id;
+                $chat_identify = chat_identify($cs_uid,$user_id);
                 Message::where(['from_user' => $user_id, 'to_user' => $robot_id])->update(['to_user' => $cs_uid, 'chat_identify' => $chat_identify, 'is_read' => 1]);
                 Message::where(['from_user' => $robot_id, 'to_user' => $user_id])->update(['from_user' => $cs_uid, 'chat_identify' => $chat_identify, 'is_read' => 1]);
             }

+ 3 - 3
app/admin/controller/Kefu.php

@@ -236,7 +236,7 @@ class Kefu extends BaseController
                 $robot_id = $friend->friend_user_id;
                 $friend->friend_user_id = $cs_uid;
                 $friend->save();
-                $chat_identify = $cs_uid . '-' . $user_id;
+                $chat_identify = chat_identify($cs_uid,$user_id);
                 Message::where(['from_user' => $user_id, 'to_user' => $robot_id])->update(['to_user' => $cs_uid, 'chat_identify' => $chat_identify, 'is_read' => 1]);
                 Message::where(['from_user' => $robot_id, 'to_user' => $user_id])->update(['from_user' => $cs_uid, 'chat_identify' => $chat_identify, 'is_read' => 1]);
             }
@@ -288,7 +288,7 @@ class Kefu extends BaseController
                 $friend->friend_user_id = $cs_uid;
                 $friend->save();
                 
-                $chat_identify = $cs_uid . '-' . $user_id;
+                $chat_identify = chat_identify($cs_uid,$user_id);
                 Message::where(['from_user' => $user_id, 'to_user' => $old_cs_uid])->update(['to_user' => $cs_uid, 'chat_identify' => $chat_identify, 'is_read' => 1]);
                 Message::where(['from_user' => $old_cs_uid, 'to_user' => $user_id])->update(['from_user' => $cs_uid, 'chat_identify' => $chat_identify, 'is_read' => 1]);
                 KefuTime::endData($admin_id, 3, $old_cs_uid); //结束接线时间
@@ -374,7 +374,7 @@ class Kefu extends BaseController
                     $friend->friend_user_id = $cs_uid;
                     $friend->save();
                     
-                    $chat_identify = $cs_uid . '-' . $user_id;
+                    $chat_identify = chat_identify($cs_uid,$user_id);
                     Message::where(['from_user' => $user_id, 'to_user' => $old_cs_uid])->update(['to_user' => $cs_uid, 'chat_identify' => $chat_identify, 'is_read' => 1]);
                     Message::where(['from_user' => $old_cs_uid, 'to_user' => $user_id])->update(['from_user' => $cs_uid, 'chat_identify' => $chat_identify, 'is_read' => 1]);
                 }

+ 1 - 1
app/admin/model/User.php

@@ -128,7 +128,7 @@ class User extends BaseModel
                 $friend->friend_user_id = $cs_uid;
                 $friend->save();
                 
-                $chat_identify = $cs_uid . '-' . $user_id;
+                $chat_identify = chat_identify($cs_uid,$user_id);
                 Message::where(['from_user' => $user_id, 'to_user' => $old_cs_uid])->update(['to_user' => $cs_uid, 'chat_identify' => $chat_identify, 'is_read' => 1]);
                 Message::where(['from_user' => $old_cs_uid, 'to_user' => $user_id])->update(['from_user' => $cs_uid, 'chat_identify' => $chat_identify, 'is_read' => 1]);
             }

+ 2 - 0
app/admin/model/UserSession.php

@@ -7,4 +7,6 @@ use app\BaseModel;
 
 class UserSession extends BaseModel
 {
+    
+    protected $table = 'bot_user_session';
 }

+ 16 - 16
app/enterprise/model/Message.php

@@ -123,22 +123,22 @@ class Message extends BaseModel
                 //     return false;
                 // }
                 // 如果是单聊,并且是社区模式和不是自己的客服、需要判断是否是好友
-                if ($globalConfig['sysInfo']['runMode'] == 2 && $csUid != $param['toContactId'] && !$manage) {
-                    // 判断我是不是对方的客服
-                    $cus = User::where(['user_id' => $param['toContactId']])->value('cs_uid');
-                    if ($cus != $uid) {
-                        $friend = Friend::where(['friend_user_id' => $uid, 'create_user' => $param['toContactId']])->find();
-                        if (!$friend) {
-                            $this->error=lang('im.notFriend');
-                            return false;
-                        }
-                        $otherFriend = Friend::where(['friend_user_id' => $param['toContactId'], 'create_user' => $uid])->find();
-                        if (!$otherFriend) {
-                            $this->error=lang('im.friendNot');
-                            return false;
-                        }
-                    }
-                }
+                // if ($globalConfig['sysInfo']['runMode'] == 2 && $csUid != $param['toContactId'] && !$manage) {
+                //     // 判断我是不是对方的客服
+                //     $cus = User::where(['user_id' => $param['toContactId']])->value('cs_uid');
+                //     if ($cus != $uid) {
+                //         $friend = Friend::where(['friend_user_id' => $uid, 'create_user' => $param['toContactId']])->find();
+                //         if (!$friend) {
+                //             $this->error=lang('im.notFriend');
+                //             return false;
+                //         }
+                //         $otherFriend = Friend::where(['friend_user_id' => $param['toContactId'], 'create_user' => $uid])->find();
+                //         if (!$otherFriend) {
+                //             $this->error=lang('im.friendNot');
+                //             return false;
+                //         }
+                //     }
+                // }
 
                 //判断是否给机器人客服发送消息
                 $autoCsUid = getAutoCsUid();