Commit 2f39e1d8 by Tobin

dc

parent 7faace52
...@@ -557,30 +557,21 @@ class Api_model extends CI_Model { ...@@ -557,30 +557,21 @@ class Api_model extends CI_Model {
$imgExt = strtolower($imgNameArr[1]); $imgExt = strtolower($imgNameArr[1]);
if($imgExt=='png' || $imgExt=='jpeg' || $imgExt == 'jpg' || $imgExt == 'gif'){ if($imgExt=='png' || $imgExt=='jpeg' || $imgExt == 'jpg' || $imgExt == 'gif'){
$imgPath = 'assets/uploads/user/CUST_'.$user_id.'.'.$imgExt; $imgPath = 'assets/uploads/user/CUST_'.$user_id.'.jpg';
// $imgQRPath = 'assets/uploads/user/CUST_QR_'.$user_id.'.png'; $imgQRPath = 'assets/uploads/user/CUST_QR_'.$user_id.'.jpg';
// $bagImagePath = 'assets/uploads/user/bitmoji_back.png'; $imgFramePath = 'assets/images/bitmojiFrame.jpg';
move_uploaded_file($data['file']["tmp_name"],"./".$imgPath); move_uploaded_file($data['file']["tmp_name"],"./".$imgPath);
// $imgSrc = imagecreatefrompng($imgPath); $usrImage = imagecreatefrompng($imgPath);
// $bagSrc = imagecreatefrompng($bagImagePath); $imgFrame = imagecreatefromjpeg($imgFramePath);
// $bagW = imagesx($bagSrc)/3;
// $bagH = imagesy($bagSrc)/3; imagecopy($imgFrame,$usrImage,(imagesx($imgFrame)/2)-(imagesx($usrImage)/2),(imagesy($imgFrame)/2)-(imagesy($usrImage)/2),0,0,imagesx($usrImage),imagesy($usrImage));
// $imgW = imagesx($imgSrc); imagesavealpha($imgFrame, true);
// $imgH = imagesy($imgSrc); imagepng($imgFrame,$imgPath,0);
// $scale = $imgW/$bagW; genQRcode(encode_param($user_id),$imgQRPath,$imgPath);
// $iWidth = $bagW;
// $iHeight = $imgH/$scale;
// imagecopyresampled($bagSrc,$imgSrc,$iWidth,$bagH,0,0,$iWidth,$iHeight,$imgW,$imgH);
// imagepng($bagSrc,$imgPath);
// imagealphablending($imgPath, false);
// imagesavealpha($imgPath, true);
// genQRcode(encode_param($user_id),$imgQRPath,$imgPath);
$post_data['profile_image'] = $imgPath; $post_data['profile_image'] = $imgPath;
$post_data['profile_image_qr'] = '';//$imgQRPath; $post_data['profile_image_qr'] = $imgQRPath;
$state=$this->db->where('customer_id',$user_id)->update('customer',$post_data); $state=$this->db->where('customer_id',$user_id)->update('customer',$post_data);
if($state){ if($state){
...@@ -655,7 +646,9 @@ class Api_model extends CI_Model { ...@@ -655,7 +646,9 @@ class Api_model extends CI_Model {
$rs = $this->db->insert('booking', $post_data); $rs = $this->db->insert('booking', $post_data);
if($rs){ if($rs){
$this->db->insert('promocode_used',$promocodeData); if(!empty($promocodeData)){
$this->db->insert('promocode_used',$promocodeData);
}
$res = array('status'=>1,'data'=>array('user_id'=>$user_id, $res = array('status'=>1,'data'=>array('user_id'=>$user_id,
'bookingCode'=>$post_data['bookId'])); 'bookingCode'=>$post_data['bookId']));
......
...@@ -1064,7 +1064,9 @@ class Webservice_model extends CI_Model { ...@@ -1064,7 +1064,9 @@ class Webservice_model extends CI_Model {
$id = $this->db->insert_id(); $id = $this->db->insert_id();
if($id){ if($id){
$this->db->insert('promocode_used',$promocodeData); if(!empty($promocodeData)){
$this->db->insert('promocode_used',$promocodeData);
}
$res = array('status'=>1,'data'=>array('bookingCode'=>$post_data['bookId'])); $res = array('status'=>1,'data'=>array('bookingCode'=>$post_data['bookId']));
$insertArr = array(); $insertArr = array();
$inStatus = ($post_data['status'] == 1)?'1':'0'; $inStatus = ($post_data['status'] == 1)?'1':'0';
......
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