Last active
March 1, 2021 11:28
-
-
Save MANISH-MAHESH-TALREJA/a200cdb1dd343dc2abb4b4f59c87795b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function add_ticket_after_payment_success() | |
{ | |
$inputs['user_id'] = $this->input->post('user_id'); | |
$inputs['order_ammount_type'] = $this->input->post('order_ammount_type'); | |
// 1 using coins ,2 online transaction payment getway | |
$inputs['transaction_id'] = $this->input->post('transaction_id'); | |
$inputs['ammount'] = $this->input->post('ammount'); | |
$data['status'] = false; | |
if ($inputs['ammount'] > 0) { | |
// code for check user total coin available amount | |
if ($inputs['order_ammount_type'] == 1) { | |
$inputs['video_id'] = $this->input->post('video_id'); | |
$userInput['user_id'] = $this->input->post('user_id'); | |
$tmp1 = $this->WelcomeModel->get_entry_single($userInput, 'user_tbl'); | |
$lastCoinAmmount = $tmp1['coin']; | |
if ($lastCoinAmmount >= $inputs['ammount']) { | |
// minus coin ammount from user table and intry in userCoin table | |
$afterParchesRemaingCoin = $lastCoinAmmount - $inputs['ammount']; | |
$userUpdate['coin'] = $afterParchesRemaingCoin; | |
$this->WelcomeModel->update_query($userUpdate, 'user_tbl', $userInput); | |
$userCoinInput['coinAmmount'] = $inputs['ammount']; | |
$userCoinInput['beforeAddCointAmmount'] = $lastCoinAmmount; | |
$userCoinInput['afterAddCoinAmmount'] = $afterParchesRemaingCoin; | |
$userCoinInput['transactionType'] = 'minus'; | |
$userCoinInput['user_id'] = $this->input->post('user_id'); | |
$userCoinInput['video_id'] = $this->input->post('video_id'); | |
$this->WelcomeModel->create_entry($userCoinInput, 'userCoine'); | |
// create order table information code | |
$orderInputInfo['user_id'] = $this->input->post('user_id'); | |
$orderInputInfo['video_id'] = $this->input->post('video_id'); | |
$orderInputInfo['order_ammount_type'] = '1'; | |
$orderInputInfo['transaction_id'] = $this->input->post('transaction_id'); | |
$orderInputInfo['ammount'] = $this->input->post('ammount'); | |
$orderInputInfo['transaction_date'] = date("Y-m-d H:i:s"); | |
// delete old record | |
$deleteOldRecord['user_id'] = $this->input->post('user_id'); | |
$deleteOldRecord['video_id'] = $this->input->post('video_id'); | |
$this->WelcomeModel->del_entry($deleteOldRecord, 'user_order'); | |
// create record | |
$this->WelcomeModel->create_entry($orderInputInfo, 'user_order'); | |
$data['status'] = true; | |
$data['message'] = "Video successfully added"; | |
} else { | |
$data['message'] = "You have not sufficient coin for get this order"; | |
$data['status'] = false; | |
// code for error message -> user have not -- coin amount please add more ammount | |
} | |
} else { | |
if ($inputs['order_ammount_type'] == 2) { | |
// echo 'hello'; | |
// create order table information code | |
$orderInputInfo['user_id'] = $this->input->post('user_id'); | |
$orderInputInfo['order_ammount_type'] = '2'; | |
$orderInputInfo['transaction_id'] = $this->input->post('transaction_id'); | |
$orderInputInfo['ammount'] = $this->input->post('ammount'); | |
$orderInputInfo['orderStatus'] = $this->input->post('orderStatus'); | |
$orderInputInfo['transaction_date'] = date("Y-m-d"); | |
$this->WelcomeModel->create_entry($orderInputInfo, 'user_order'); | |
if ($this->input->post('orderStatus') == 'success') { | |
//add coin into user account | |
$userInput['user_id'] = $this->input->post('user_id'); | |
$tmp1 = $this->WelcomeModel->get_entry_single($userInput, 'user_tbl'); | |
$lastCoinAmmount = $tmp1['coin']; | |
$cointAmmount = $this->input->post('ammount'); | |
$inputs3['coinAmmount'] = $cointAmmount; | |
$inputs3['beforeAddCointAmmount'] = $lastCoinAmmount; | |
$inputs3['afterAddCoinAmmount'] = $lastCoinAmmount + $cointAmmount; | |
$inputs3['transactionType'] = 'add'; | |
// code for update coin ammount in user table | |
$userUpdate['coin'] = $lastCoinAmmount + $cointAmmount; | |
$this->WelcomeModel->update_query($userUpdate, 'user_tbl', $userInput); | |
// code for create coin data into coin table | |
$this->WelcomeModel->create_entry($inputs3, 'userCoine'); | |
$userInput['user_id'] = $this->input->post('user_id'); | |
$tmp1 = $this->WelcomeModel->get_entry_single($userInput, 'user_tbl'); | |
$data['status'] = true; | |
$data['message'] = "Coin successfully added"; | |
} else { | |
$data['status'] = true; | |
$data['message'] = "Order add successfully"; | |
} | |
} else { | |
$data['message'] = "Need to add payment method code information"; | |
$data['status'] = false; | |
} | |
} | |
} else { | |
//echo "hello2"; | |
} | |
echo json_encode($data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function loginUsingMobileNumber() | |
{ | |
$inputs['mobile'] = $this->input->post('mobile'); | |
$data['status'] = false; | |
$data['message'] = "Please Enter Data"; | |
if($this->input->post('password')) | |
{ | |
$inputs['password'] = $this->input->post('password'); | |
} | |
$tmp1 = $this->WelcomeModel->get_entry_single($inputs, 'user_tbl'); | |
if ($tmp1 != NULL) | |
{ | |
if (strcmp($tmp1['mobile'], $this->input->post('mobile')) == 0) | |
{ | |
if (strcmp($tmp1['type'], 'admin') != 0) | |
{ | |
$data['status'] = true; | |
$data['user_data'] = $tmp1; | |
$data['message'] = "LOGIN SUCCESSFUL"; | |
if ($tmp1['user_id']) | |
{ | |
$user_id = $tmp1['user_id']; | |
$membersShipCheck['user_id'] = $user_id; | |
$membersShipCheck['isActive'] = 1; | |
$current_membership_info = $this->WelcomeModel->get_entry_multiple('user_membership_tbl', $membersShipCheck, NULL, NULL, NULL, NULL, NULL); | |
if ($current_membership_info) | |
{ | |
$endDate = $current_membership_info[0]['endDate']; | |
$currentDateTime = date("Y-m-d"); | |
$endDate = strtotime($endDate); | |
$currentDateTime = strtotime($currentDateTime); | |
if ($endDate >= $currentDateTime) | |
{ | |
$data['isMembershipActive'] = true; | |
} | |
else | |
{ | |
$data['isMembershipActive'] = false; | |
} | |
$data['membershipInfo'] = $current_membership_info; | |
} | |
else | |
{ | |
$data['isMembershipActive'] = false; | |
$data['membershipInfo'] =[]; | |
} | |
} | |
} | |
else | |
{ | |
$data['status'] = false; | |
$data['message'] = "INVALID MOBILE NUMBER"; | |
} | |
} | |
else | |
{ | |
$data['status'] = false; | |
$data['message'] = "INVALID LOGIN CREDENTIALS"; | |
} | |
} | |
else | |
{ | |
$data['status'] = false; | |
$data['message'] = "INVALID LOGIN CREDENTIALS"; | |
} | |
echo json_encode($data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function loginUsingEmailID() | |
{ | |
$inputs['email'] = $this->input->post('email'); | |
$data['status'] = false; | |
$data['message'] = "PLEASE ENTER DATA"; | |
if($this->input->post('password')) | |
{ | |
$inputs['password'] = $this->input->post('password'); | |
} | |
$tmp1 = $this->WelcomeModel->get_entry_single($inputs, 'user_tbl'); | |
if ($tmp1 != NULL) | |
{ | |
if (strcmp($tmp1['email'], $this->input->post('email')) == 0) | |
{ | |
if (strcmp($tmp1['type'], 'admin') != 0) | |
{ | |
$data['status'] = true; | |
$data['user_data'] = $tmp1; | |
$data['message'] = "LOGIN SUCCESSFUL"; | |
if ($tmp1['user_id']) | |
{ | |
$user_id = $tmp1['user_id']; | |
$membersShipCheck['user_id'] = $user_id; | |
$membersShipCheck['isActive'] = 1; | |
$current_membership_info = $this->WelcomeModel->get_entry_multiple('user_membership_tbl', $membersShipCheck, NULL, NULL, NULL, NULL, NULL); | |
if ($current_membership_info) | |
{ | |
$endDate = $current_membership_info[0]['endDate']; | |
$currentDateTime = date("Y-m-d"); | |
$endDate = strtotime($endDate); | |
$currentDateTime = strtotime($currentDateTime); | |
if ($endDate >= $currentDateTime) | |
{ | |
$data['isMembershipActive'] = true; | |
} | |
else | |
{ | |
$data['isMembershipActive'] = false; | |
} | |
$data['membershipInfo'] = $current_membership_info; | |
} | |
else | |
{ | |
$data['isMembershipActive'] = false; | |
$data['membershipInfo'] =[]; | |
} | |
} | |
} | |
else | |
{ | |
$data['status'] = false; | |
$data['message'] = "INVALID MOBILE NUMBER"; | |
} | |
} | |
else | |
{ | |
$data['status'] = false; | |
$data['message'] = "INVALID LOGIN CREDENTIALS"; | |
} | |
} | |
else | |
{ | |
$data['status'] = false; | |
$data['message'] = "INVALID LOGIN CREDENTIALS"; | |
} | |
echo json_encode($data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function signup_now() | |
{ | |
$inputs['type'] = 'user'; | |
$inputs['name'] = $this->input->post('name'); | |
$inputs['mobile'] = $this->input->post('mobile'); | |
$inputs['password'] = $this->input->post('password'); | |
$inputs['email'] = $this->input->post('email'); | |
$inputs['image'] = ''; | |
$inputs['user_mem_id'] = '0'; | |
$inputs['user_cre_datetime'] = date('Y-m-d H:i:s'); | |
$data['status'] = false; | |
$data['message'] = "Please Enter Data"; | |
if (strlen($inputs['name']) > 0) | |
{ | |
$tst = NULL; | |
$tst['email'] = $inputs['email']; | |
$tmp0 = $this->WelcomeModel->get_entry_single($tst, 'user_tbl'); | |
if ($tmp0 == NULL) | |
{ | |
$tst1 = NULL; | |
$tst1['mobile'] = $inputs['mobile']; | |
$tmp0 = $this->WelcomeModel->get_entry_single($tst1, 'user_tbl'); | |
if ($tmp0 == NULL) | |
{ | |
$response = $this->WelcomeModel->create_entry($inputs, 'user_tbl'); | |
$tst1 = NULL; | |
$tst1['email'] = $inputs['email']; | |
$tmp0 = $this->WelcomeModel->get_entry_single($tst1, 'user_tbl'); | |
$data['status'] = true; | |
$data['user_data'] = $tmp0; | |
$data['message'] = "SIGNUP SUCCESSFUL"; | |
} | |
else | |
{ | |
$data['status'] = false; | |
$data['message'] = "MOBILE NUMBER ALREADY REGISTERED"; | |
} | |
} | |
else | |
{ | |
$data['status'] = false; | |
$data['message'] = "EMAIL ALREADY REGISTERED"; | |
} | |
} | |
echo json_encode($data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment