Commit b61980c6 by Tobin

guest user login

parent 6892ae7f
......@@ -570,5 +570,15 @@ class Webservice extends CI_Controller {
$this->errorResponse($res['code'],$res['message']);
}
}
public function create_guest_user() {
$res = $this->Webservice_model->createGuestUser();
if($res['status'] == 'success'){
$this->response($res['data']);
}
else{
$this->errorResponse($res['code'],$res['message']);
}
}
}
?>
......@@ -168,7 +168,8 @@ class Validation_app_model extends CI_Model {
'message' => 'Total Cost is null or empty'
)
)
)
),
'create_guest_user' => array()
);
public function validation_check($method_name, $parms) {
......
......@@ -2039,5 +2039,22 @@ class Webservice_model extends CI_Model {
$this->image_lib->initialize($config);
$this->image_lib->resize();
}
public function createGuestUser(){
$res = array('status'=>0,'message'=>'Something went wrong','code'=>'ER10');
$status = $this->db->insert('users',array('display_name'=>'Guest','user_type'=>'6'));
if(!$status || empty($guest_id = $this->db->insert_id())){
return $res;
}
$guestInfo = array('customer_id'=>$guest_id,'name'=>'Guest','phone_verified'=>'1');
$status = $this->db->insert('customer',$guestInfo);
if(!$status){
return $res;
}
$auth_token = md5(microtime().rand());
$this->generateAuth($guest_id,$auth_token);
return array('status'=>'success','data'=>array('auth_token'=>$auth_token));
}
}
?>
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