application/models/mobile_api/Common_model.php
/*Get the device token of tribe member which user accepted invitation*/
Get the device token of tribe member which user accepted invitation
Get the device token of tribe member which user accepted invitation
public function rate_tribe_users_device_tokens($post_data){
        $userId =  $post_data['loginUserId'];
        $searchId =  $post_data['searchId'];
        $sql = "SELECT u.userId,u.firstName,u.email,u.deviceToken,u.deleteFlag  
                FROM users u where (u.userId in (SELECT t.touserId FROM tribe t where t.searchId=$searchId AND t.touserId !=$userId AND t.status = 'accept' AND t.deleteFlag !=1 )
                OR u.userId in (SELECT t.fromuserId FROM tribe t where t.searchId=$searchId AND t.fromuserId!=$userId)) AND u.deleteFlag !=1";
        $record = $this->db->query($sql);           
        if($record->num_rows() > 0)
        {
             return $record->result_array();
        }
    }
public function rate_tribe_users_device_tokens ( $ post_data ) { $ userId = $ post_data [ 'loginUserId' ] ; $ searchId = $ post_data [ 'searchId' ] ; $ sql = " SELECT u.userId,u.firstName,u.email,u.deviceToken,u.deleteFlag  
                FROM users u where (u.userId in (SELECT t.touserId FROM tribe t where t.searchId= $ searchId  AND t.touserId != $ userId  AND t.status = 'accept' AND t.deleteFlag !=1 )
                OR u.userId in (SELECT t.fromuserId FROM tribe t where t.searchId= $ searchId  AND t.fromuserId!= $ userId )) AND u.deleteFlag !=1 " ; $ record = $ this -> db -> query ( $ sql ) ; if ( $ record -> num_rows ( ) > 0 ) { return $ record -> result_array ( ) ; } }
Get the device token of tribe member which user accepted invitation
Get the device token of tribe member which user accepted invitation
/*$sql = "SELECT t.*,u.userId,u.firstName,u.deviceToken,u.email   
                FROM tribe t 
                LEFT JOIN users u  ON u.userId = t.fromuserId OR u.userId = t.touserId  
                WHERE  t.status = 'accept' AND t.touserId!= $userId AND t.deleteFlag !=1 AND u.deleteFlag !=1  AND t.searchId = $searchId GROUP BY t.touserId
                ";
        */