Commit 962cfbc7 by Jansa Jose

language changes in api

parent c11da653
......@@ -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'),
'email'=>array('code'=>'ER03', 'message'=>'Invalid Email id')),
'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'),
'email'=>array('code'=>'ER03', 'message'=>'Invalid Email id')),
'phone'=>array('required'=>array('code'=>'ER07', 'message'=>'Phone no is null or empty'),
......
......@@ -30,21 +30,26 @@ class Webservice_model extends CI_Model {
function login($data){
try{
$this->db->select("region.id AS city_id,region.name AS city,
customer.name AS user_name,customer.phone,
customer.email,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,
users.id AS user_id");
$this->db->where('users.status',1);
$this->db->where('users.password',md5($data['password']));
$this->db->where('customer.email',$data['email']);
$this->db->from('users');
$this->db->join('customer','customer.customer_id=users.id');
$this->db->join('region','region.id=customer.city','left');
$result = $this->db->get()->row();
$sql = "SELECT region.id AS city_id, customer.name AS user_name,customer.phone, customer.email,
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,
users.id AS user_id
FROM users
INNER JOIN customer ON (customer.customer_id=users.id)
LEFT JOIN region ON (region.id=customer.city)
WHERE users.status = 1
AND users.password = '".md5($data['password'])."'
AND customer.email = '".$data['email']."'";
$result = $this->db->query($sql)->row();
if($result){
$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 != ''){
$cityId = $result->city_id;
$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