Commit 12addacd authored by clone's avatar clone

return id

parent 31906b5a
......@@ -202,7 +202,7 @@ class ChatService
// 判断是否创建关系没有则保存
$this->verifyRelation($target, $from);
$this->insertMsg($target_type, $target, $source, $is_user, $type, $msg_content, $from);
$msg_id = $this->insertMsg($target_type, $target, $source, $is_user, $type, $msg_content, $from);
$rPush = new RPush();
// 消息接收人必须是数组
......@@ -336,6 +336,7 @@ class ChatService
* @param $type
* @param $msg_content
* @param $from
* @return int|string
*/
private function insertMsg($target_type, $target, $source, $is_user, $type, $msg_content, $from)
{
......@@ -359,7 +360,7 @@ class ChatService
if ($target_type != "users") {
$group_id = $from;
}
$this->insetMsgExt($id, $type, $msg_content, $params["is_group"], $group_id);
return $this->insetMsgExt($id, $type, $msg_content, $params["is_group"], $group_id);
}
}
......@@ -477,6 +478,7 @@ class ChatService
return $result;
}
/**
* 记录消息body
* @param $id
......@@ -484,6 +486,7 @@ class ChatService
* @param $msg_content
* @param $is_group
* @param $group_id
* @return int|string
*/
private function insetMsgExt($id, $type, $msg_content, $is_group, $group_id)
{
......@@ -496,7 +499,7 @@ class ChatService
$param["updated_at"] = date("Y-m-d H:i:s", time());
$msgExtModel = new ChatMsgExt();
$msgExtModel->addChatMsgExt($param);
return $msgExtModel->addChatMsgExt($param);
}
......
......@@ -27,10 +27,10 @@ class ChatMsgExt extends Model
{
Db::startTrans();
try {
$this->db->insert($params);
$id = $this->db->insertGetId($params);
Db::commit();
return $id;
} catch (\Exception $e) {
dump($e);
Db::rollback();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment