Commit 079a4f62 by Tobin

t : sync contact changes

parent c8f820d4
...@@ -1909,18 +1909,27 @@ class Webservice_model extends CI_Model { ...@@ -1909,18 +1909,27 @@ class Webservice_model extends CI_Model {
} }
} }
if(empty($user_ids) || empty($user_ids = implode(',',$user_ids))){ if(empty($user_ids)){
return array('status'=>0,'code'=>'920','message'=>'No User Found'); return array('status'=>0,'code'=>'920','message'=>'No User Found');
} }
$result = $this->db->query("SELECT CUST.customer_id,CUST.name,CUST.phone,CUST.profile_image, $chatUsers = array();
foreach($user_ids AS $user) {
$sql = "SELECT CUST.customer_id,CUST.name,CUST.phone,CUST.profile_image,
CUST.profile_image_qr,CHT.type AS friend_status CUST.profile_image_qr,CHT.type AS friend_status
FROM customer AS CUST FROM customer AS CUST
LEFT JOIN chats AS CHT ON ((CUST.customer_id=CHT.from_user OR CUST.customer_id=CHT.to_user) AND CHT.type IN (0,1)) LEFT JOIN chats AS CHT ON (
WHERE CUST.customer_id IN ($user_ids) ((CHT.from_user=$user AND to_user=$user_id) OR
GROUP BY CUST.customer_id"); (CHT.to_user=$user AND from_user=$user_id)) AND
$respArr['status'] = 1; CHT.type IN (0,1))
$respArr['data'] = (!empty($result) && !empty($result=$result->result_array()))?$result:[]; WHERE CUST.customer_id IN ($user)
GROUP BY CUST.customer_id";
$result = $this->db->query($sql)->row_array();
if(!empty($result)){
$chatUsers[] = $result;
}
}
$respArr = array('status'=>1,'data'=>$chatUsers);
return $respArr; return $respArr;
} }
......
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