Commit 962cfbc7 by Jansa Jose

language changes in api

parent c11da653
...@@ -5,7 +5,7 @@ class Validation_app_model extends CI_Model { ...@@ -5,7 +5,7 @@ class Validation_app_model extends CI_Model {
'login'=> array('email'=>array('required'=>array('code'=>'ER02', 'message'=>'Email id is null or empty'), 'login'=> array('email'=>array('required'=>array('code'=>'ER02', 'message'=>'Email id is null or empty'),
'email'=>array('code'=>'ER03', 'message'=>'Invalid Email id')), 'email'=>array('code'=>'ER03', 'message'=>'Invalid Email id')),
'password'=>array('required'=>array('code'=>'ER04', 'message'=>'Password is null or empty')), 'password'=>array('required'=>array('code'=>'ER04', 'message'=>'Password is null or empty')),
'language'=>array('required'=>array('code'=>'ER05','message'=>'Language is null or empty'))), 'country_id'=>array('required'=>array('code'=>'ER05','message'=>'Country Id is null or empty'))),
'check_email_availability'=> array('email'=>array('required'=>array('code'=>'ER02', 'message'=>'Email id is null or empty'), 'check_email_availability'=> array('email'=>array('required'=>array('code'=>'ER02', 'message'=>'Email id is null or empty'),
'email'=>array('code'=>'ER03', 'message'=>'Invalid Email id')), 'email'=>array('code'=>'ER03', 'message'=>'Invalid Email id')),
'phone'=>array('required'=>array('code'=>'ER07', 'message'=>'Phone no is null or empty'), 'phone'=>array('required'=>array('code'=>'ER07', 'message'=>'Phone no is null or empty'),
......
...@@ -30,21 +30,26 @@ class Webservice_model extends CI_Model { ...@@ -30,21 +30,26 @@ class Webservice_model extends CI_Model {
function login($data){ function login($data){
try{ try{
$this->db->select("region.id AS city_id,region.name AS city, $sql = "SELECT region.id AS city_id, customer.name AS user_name,customer.phone, customer.email,
customer.name AS user_name,customer.phone, customer.profile_image AS profile_photo, IF(customer.phone_verified=0,'false', 'true') AS is_phone_verified, IF(customer.city='', 'false', 'true') AS is_location_updated,
customer.email,customer.profile_image AS profile_photo, users.id AS user_id
IF(customer.phone_verified=0,'false','true') AS is_phone_verified, FROM users
IF(customer.city='','false','true') AS is_location_updated, INNER JOIN customer ON (customer.customer_id=users.id)
users.id AS user_id"); LEFT JOIN region ON (region.id=customer.city)
$this->db->where('users.status',1); WHERE users.status = 1
$this->db->where('users.password',md5($data['password'])); AND users.password = '".md5($data['password'])."'
$this->db->where('customer.email',$data['email']); AND customer.email = '".$data['email']."'";
$this->db->from('users'); $result = $this->db->query($sql)->row();
$this->db->join('customer','customer.customer_id=users.id');
$this->db->join('region','region.id=customer.city','left');
$result = $this->db->get()->row();
if($result){ if($result){
$auth_token = md5(microtime().rand()); $auth_token = md5(microtime().rand());
$countryData = $this->getCountryData($result->user_id);
$lang = $countryData['language_code'];
if(!empty($lanTrans = langTranslator($result->city_id,'REG',$lang))){
$result->city = $lanTrans['region_name'];
}
if($result->city_id != ''){ if($result->city_id != ''){
$cityId = $result->city_id; $cityId = $result->city_id;
$cityName = $result->city; $cityName = $result->city;
......
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