Commit e5cf251e by Jansa Jose

J : wallet transaction history pagination

parent 57942c8c
......@@ -2239,7 +2239,16 @@ class Webservice_model extends CI_Model {
$user_id = $this->auth_token_get($data['auth_token']);
if($user_id > 0){
$countryData = $this->getCountryData($user_id);
$sql = "SELECT transaction_code AS transaction_number,amount,transaction_type,created_date,status FROM wallet_transactions WHERE customer_id='$user_id'";
$sql = "SELECT id FROM wallet_transactions WHERE customer_id='$user_id'";
$count = $this->db->query($sql)->num_rows();
if($count > 0){
$perPage = 10;
$page = (isset($data['page']) && $data['page'] != 0)?$data['page']:1;
$limit = ($page - 1) * $perPage;
$meta = array('total_pages'=>ceil($count/$perPage),'total_items'=>$count,
'current_page'=>$page,'items_per_page'=>$perPage);
$sql = "SELECT transaction_code AS transaction_number,amount,transaction_type,created_date,status FROM wallet_transactions WHERE customer_id='$user_id' LIMIT $limit,$perPage";
$query = $this->db->query($sql);
if(empty($query) || empty($walletHistory = $query->result_array())){
$res = array('status'=>'error','message'=>'No History Found','code'=>'ER13');
......@@ -2248,7 +2257,10 @@ class Webservice_model extends CI_Model {
foreach($walletHistory AS $walletKey => $walletValue){
$walletHistory[$walletKey]['currency_symbol'] = $countryData['currency_symbol'];
}
$res = array('status'=>'success','data'=>$walletHistory);
$res = array('status'=>'success','data'=>array('wallet'=>$walletHistory,'meta'=>$meta));
} else{
$res = array('status'=>'error','message'=>'No Data found','code'=>'ER10');
}
}else{
$res = array('status'=>'error','message'=>'User authentication Error','code'=>'ER10');
}
......
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