Commit b3b16dcd authored by hujun's avatar hujun

user_id

parent 77a245c6
......@@ -210,8 +210,13 @@ class ChatService
$userExt = new ChatUserExt();
$where['only_id'] = $target;
$user_id = 0;
if ($is_user) {
$m_user = new ChatUser();
$user_where['only_id'] = $from;
$user_where['status'] = 1;
$user_arr = $m_user->getChatUserOne('user_id', $user_where);
$user_id = empty($user_arr['user_id']) ? 0:$user_arr['user_id'] ;
$where['type'] = 2;
} else {
$where['type'] = 1;
......@@ -226,7 +231,7 @@ class ChatService
foreach ($info as $item) {
array_push($push_id, $item["push_id"]);
}
$rPush->send($user_name, $target_type, $target, $msg_content, $from, $is_user, $type, $accessToken, [ $this, 'saveSendStatus' ], $push_id, $msg_id, $info[0]['user_id']);
$rPush->send($user_name, $target_type, $target, $msg_content, $from, $is_user, $type, $accessToken, [ $this, 'saveSendStatus' ], $push_id, $msg_id, $user_id);
return true;
}
......
......@@ -18,11 +18,21 @@ class ChatUser extends Model
protected $table = 'chat_user';
protected $db;
/**
* ChatUser constructor.
*/
public function __construct()
{
$this->db = Db($this->table);
}
/**
* @param $params
* @param string $field
* @return mixed
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function getChatUser($params, $field = "only_id,phone")
{
$data = $this->db->field($field)
......@@ -44,4 +54,18 @@ class ChatUser extends Model
return $res;
}
/**
* @param $field
* @param $params
* @return mixed
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function getChatUserOne($field, $params) {
$data = $this->db->field($field)
->where($params)
->find();
return $data;
}
}
\ No newline at end of file
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