本文整理汇总了PHP中UserModel::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::getByID方法的具体用法?PHP UserModel::getByID怎么用?PHP UserModel::getByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel::getByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Scan
public function Scan()
{
$userId = $_GET["user_id"];
$qr = $_GET["QR"];
$qrs = new QRModel();
//////validate QR Code
$resQrs = $qrs->getWhere("textQR='{$qr}'");
if (count($resQrs) == 1) {
if ($resQrs[0]->status == 0) {
$this->error("Unasigned QR Code!");
}
} else {
$this->error("Wrong QR Code!");
}
///////fetch user details
$user = new UserModel();
$user->getByID($userId);
// pr($user);
if ($user->user_name == null || $user->user_name == "") {
$this->error("Who Are You ?!");
}
///////validate Table
$ta = new MasterTableModel();
$arr = $ta->getWhere("QR='{$qr}'");
if (count($arr) == 1) {
//status 0 = OCCUPIED
if ($arr[0]->status == 0) {
if ($arr[0]->id_order == 0) {
$this->error("Empty Order ID");
} else {
$this->requestJoinTable($user, $arr[0]->id_order);
}
} else {
$this->requestRestoPermission($user, $arr[0]);
}
} else {
$this->error("Wrong Table!");
}
die;
}
示例2: scan
public function scan()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$id_user = isset($_GET['id_user']) ? addslashes($_GET['id_user']) : "";
if (!$id_user) {
Generic::errorMsg("Please login!");
}
if (!User::checkUserID($id_user)) {
Generic::errorMsg("ID User not found!");
}
$QR = Generic::mustCheck($_GET['QR'], "No QR found!");
$objOrder = new MasterOrderModel();
// check, QR validapakah table free
// table status = 0, occupied, 1 is free
if (!Mastertable::isQRValid($QR)) {
Generic::errorMsg("Invalid QR Code");
}
$objUser = new UserModel();
$objUser->getByID($id_user);
$objTable = Mastertable::getTableBYQR($QR);
$id_table = $objTable[0]->id_table;
$objTable = Mastertable::getTableID($id_table);
$isTableFree = MasterTable::isTableFree($objTable);
// Table free
if ($isTableFree) {
$paymentMethod = Generic::mustCheck($_GET['payment_method'], "Payment Method Required");
$this->requestRestoPermission($objUser, $objTable, $paymentMethod);
} else {
$objOrder = MasterOrder::getActiveOrderByTableID($id_table);
Generic::checkCountWithMsg($objOrder, "Empty ID Order!");
$this->requestJoinTable($objUser, $objOrder);
}
die;
}
示例3: transaction
public function transaction()
{
Veritrans_Config::$serverKey = 'VT-server-tHdPoLZ5B9msOwJBt-tN7jOE';
Veritrans_Config::$isProduction = false;
if (Veritrans_Config::$serverKey == '<your server key>') {
echo "<code>";
echo "<h4>Please set real server key from sandbox</h4>";
echo "In file: " . __FILE__;
echo "<br>";
echo "<br>";
echo htmlspecialchars('Veritrans_Config::$serverKey = \'<your server key>\';');
die;
}
$objUser = new UserModel();
$objUser->getByID('2');
$saved_token_id = $objUser->braintree_id;
$transaction_details = array('order_id' => time(), 'gross_amount' => 300000);
// Populate customer's info
$customer_details = array('first_name' => "Andri", 'last_name' => "Litani", 'email' => "andri@litani.com", 'phone' => "081122334455");
// Transaction data to be sent
$transaction_data = array('payment_type' => 'credit_card', 'credit_card' => array('token_id' => $saved_token_id), 'transaction_details' => $transaction_details, 'customer_details' => $customer_details);
try {
$response = Veritrans_VtDirect::charge($transaction_data);
// pr($response);
} catch (Exception $e) {
echo $e->getMessage();
die;
}
}
示例4: getBTToken
public function getBTToken()
{
$aCustomerId = $_POST["id_user"];
$user = new UserModel();
$user->getByID($aCustomerId);
if ($user->device_ids == null || $user->device_ids == "") {
if (!$this->createCust($user)) {
Generic::errorMsg("error user not created");
die;
}
} else {
$customer = Braintree_Customer::find($aCustomerId);
pr($customer);
$aCustomerId = $customer->id;
// die();
}
$clientToken = Braintree_ClientToken::generate(["customerId" => $aCustomerId]);
echo "{\"status_code\":1,\"results\":{\"btok\":\"{$clientToken}\"}}";
die;
}
示例5: save
function save()
{
//IMBAuth::checkOAuth();
$device_id = addslashes($_POST['device_id']);
$type = addslashes($_POST['type']);
//completion check
if ($device_id == "" || $type == "") {
$json['status_code'] = 0;
$json['status_message'] = "Incomplete Request";
echo json_encode($json);
die;
}
//check account..
$acc = isset($_POST['acc_id']) ? addslashes($_POST['acc_id']) : 0;
$res_id = isset($_POST['res_id']) ? addslashes($_POST['res_id']) : 0;
// IMBAuth::checkOAuth();
$dn = new DeviceModel();
$dnquery = new DeviceModel();
// langkah 1 , device ID ada device type ada
$arrs = $dnquery->getWhere("device_id = '{$device_id}' AND device_type = '{$type}'");
$dn = $arrs[0];
if ($dn->did == "") {
$dn = new DeviceModel();
$dn->device_id = $device_id;
$dn->device_type = $type;
$dn->acc_id = $acc;
$dn->firstlogin = leap_mysqldate();
$dn->dev_res_id = $res_id;
} else {
//kalau device id ada, acc di update
$dn->load = 1;
$dn->acc_id = $acc;
$dn->dev_res_id = $res_id;
}
$dn->dev_lng = addslashes($_POST['lng']);
$dn->dev_lat = addslashes($_POST['lat']);
$dn->logindate = leap_mysqldate();
//save user latlong to MasterUser -- 10 May 2016 sendy
if (isset($_POST['lat']) && isset($_POST['lng']) && $acc != 0) {
$user = new UserModel();
$user->getByID($acc);
$user->logindate = leap_mysqldate();
$user->latitude = addslashes($_POST['lat']);
$user->longitude = addslashes($_POST['lng']);
$user->save();
}
//save user District and City to LocationModel -- 26 May 2016 sendy
Generic::saveDistrictCityFromLatLng(addslashes($_POST['lat']), addslashes($_POST['lng']), $acc, $type == "cashier");
if ($dn->save()) {
$json['save_status'] = 1;
$json['version'] = Efiwebsetting::getData('App_Version_' . strtolower($type));
$json['url'] = Efiwebsetting::getData('App_URL_' . strtolower($type));
//logged all device login 19 nov 2015 roy
// $logged = new DeviceLogger();
// $logged->log_acc_id = $dn->acc_id;
// $logged->log_date = leap_mysqldate();
// $logged->log_dev_id = $dn->device_id;
// $logged->log_dev_type = $dn->device_type;
// $logged->save();
} else {
$json['save_status'] = 0;
}
$json['status_code'] = 1;
if ($_POST['do_not_die']) {
return $json;
} else {
echo json_encode($json);
die;
}
}
示例6: getOrderDetailsByIDOrderAndUserID
public static function getOrderDetailsByIDOrderAndUserID($id_order, $id_user)
{
$objOrderDetails = new OrderDetailModel();
$objUser = new UserModel();
$objUser->getByID($id_user);
$arrOrderDetails = $objOrderDetails->getWhere("id_order='{$id_order}' AND id_user='{$id_user}'");
// MasterDish::checkCount($arrOrderDetails);
if (count($arrOrderDetails) > 0) {
$exp = explode(",", str_replace(" ", "", $objOrderDetails->crud_webservice_allowed));
$orderdetails = array();
foreach ($arrOrderDetails as $order) {
$sem = array();
foreach ($exp as $attr) {
$sem[$attr] = stripslashes($order->{$attr});
}
$sem['name'] = MasterDish::getDishNameByID($order->id_dish);
$sem['image_user'] = _BPATH . _PHOTOURL . $objUser->pic;
$orderdetails[] = $sem;
}
}
return $orderdetails;
}
示例7: createUserInstance
public static function createUserInstance($idUser, $note, $idOrderDetail)
{
$user = new UserModel();
$user->getByID($idUser);
$u["id_order_detail"] = $idOrderDetail;
$u["id_user"] = $idUser;
$u["user_name"] = $user->user_name;
$u["pic"] = _BPATH . _PHOTOURL . $user->pic;
$u["note"] = $note;
return $u;
}
示例8: emailReceipt
public function emailReceipt()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$idOrder = Generic::mustCheck($_POST['id_order'], "No ID Order");
$order = new MasterOrderModel();
$order->getByID($idOrder);
if (Generic::IsNullOrEmptyString($order->id_order)) {
Generic::errorMsg("Order Not Found");
}
if (Generic::IsNullOrEmptyString($_POST['user_email'])) {
if ($order->id_user != "0" || $order->id_user != "") {
Generic::errorMsg("No Email Found");
} else {
$user = new UserModel();
$user->getByID($order->id_user);
$email = $user->email;
}
} else {
$email = $_POST['user_email'];
}
//TODO MAIL RECEIPT TO $email
Generic::success("Success");
}
示例9: getUserDWBalance
public function getUserDWBalance()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
if (Generic::IsNullOrEmptyString($_GET['id_user'])) {
$results['balance'] = doubleval(0);
Generic::finish($results);
}
$idUser = addslashes($_GET['id_user']);
$user = new UserModel();
$user->getByID($idUser);
$results["pic"] = Generic::insertImageUrl($user->pic);
$allowDokuWallet = Efiwebsetting::getData('App_Allow_Doku_Wallet') == 'yes';
if (Generic::IsNullOrEmptyString($user->payment_id) || $user->payment_id == 0) {
$results['balance'] = doubleval(0);
} else {
if ($allowDokuWallet) {
$doku = new PaymentDoku();
$results['balance'] = $doku->checkBalance($user->payment_id);
} else {
$results['balance'] = doubleval(0);
}
}
Generic::finish($results);
}
示例10: saveDistrictCityFromLatLng
public static function saveDistrictCityFromLatLng($lat, $lng, $accId, $isCashier)
{
$lat = trim($lat);
$lng = trim($lng);
if (self::IsNullOrEmptyString($lat) || self::IsNullOrEmptyString($lng)) {
return;
}
$url = "https://maps.googleapis.com/maps/api/geocode/json?latlng={$lat},{$lng}&result_type=administrative_area_level_3&key=" . self::$geoCodingServerKey;
$json = json_decode(file_get_contents($url), true);
$addressComponents = $json['results'][0]['address_components'];
if (count($addressComponents) < 2) {
return;
}
$district = strtoupper($addressComponents[0]['long_name']);
$city = strtoupper($addressComponents[1]['long_name']);
$loc = new LocationModel();
$arrLoc = $loc->getWhere("district='{$district}' AND city='{$city}'");
if (count($arrLoc) == 0) {
$l = new LocationModel();
$l->district = $district;
$l->city = $city;
if ($isCashier) {
$l->cashier_visit_count = 1;
$l->user_visit_count = 0;
} else {
$l->cashier_visit_count = 0;
$l->user_visit_count = 1;
}
$l->visit_count = 1;
$l->save();
} else {
$l = new LocationModel();
$l->getByID($arrLoc[0]->id_location);
if ($isCashier) {
$l->cashier_visit_count = $l->cashier_visit_count + 1;
} else {
$l->user_visit_count = $l->user_visit_count + 1;
}
$l->save();
}
if ($accId != 0 && !$isCashier) {
$user = new UserModel();
$user->getByID($accId);
$user->last_lat = $lat;
$user->last_long = $lng;
$user->last_city = $city;
$user->last_district = $district;
if (Generic::IsNullOrEmptyString($user->latitude)) {
$user->latitude = $lat;
}
if (Generic::IsNullOrEmptyString($user->longitude)) {
$user->longitude = $lng;
}
if (Generic::IsNullOrEmptyString($user->district)) {
$user->district = $district;
}
if (Generic::IsNullOrEmptyString($user->city)) {
$user->city = $city;
}
$user->save();
}
}
示例11: userUpdateProfile
public function userUpdateProfile()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$idUser = Generic::mustCheck($_POST['id_user'], "ID user required");
$fullName = Generic::mustCheck($_POST['full_name'], "Empty Full Name");
$userName = Generic::mustCheck($_POST['user_name'], "Empty User Name");
$email = Generic::mustCheck($_POST['email'], "Empty Email");
$password = Generic::mustCheck($_POST['pwd'], "Empty Password");
$idCuisine = Generic::mustCheck($_POST['pref_cuisine'], "Cuisine Not Selected");
$birthday = Generic::mustCheck($_POST['birthday'], "Empty Birthday");
$phoneNo = Generic::mustCheck($_POST['phone_no'], "Empty Phone Number");
$fbId = Generic::IsNullOrEmptyString($_POST['fb_id']) ? "" : $_POST['fb_id'];
$latitude = Generic::IsNullOrEmptyString($_POST['lat']) ? "" : $_POST['lat'];
$longitude = Generic::IsNullOrEmptyString($_POST['long']) ? "" : $_POST['long'];
$district = Generic::IsNullOrEmptyString($_POST['district']) ? "" : $_POST['district'];
$city = Generic::IsNullOrEmptyString($_POST['city']) ? "" : $_POST['city'];
$pic = Generic::IsNullOrEmptyString($_POST['pic']) ? "" : MasterRestaurant::savePic($_POST['pic']);
///START OF LOVELY VALIDATION TIME
if (!Generic::isValidUserName($userName)) {
Generic::errorMsg("Username must only contains alphanumeric (and/or) \\'.\\', \\'-\\', \\'_\\'");
}
if (!Generic::isValidUserNameLength($userName)) {
Generic::errorMsg("Max username length is 20");
}
if (!Generic::isValidEmail($email)) {
Generic::errorMsg("Email format not valid");
}
if (!Generic::isValidPassword($password)) {
Generic::errorMsg("Password must contain minimum 5 character and no whitespace");
}
$user = new UserModel();
$user->getByID($idUser);
if ($birthday != $user->birthday) {
Generic::errorMsg("Birthday cannot be changed");
}
if ($userName != $user->user_name) {
Generic::errorMsg("Username cannot be changed");
}
if (!Generic::IsNullOrEmptyString($user->fb_id) && $fbId != $user->fb_id) {
Generic::errorMsg("Facebook cannot be changed");
} else {
$user->fb_id = $fbId;
}
///END OF LOVELY VALIDATION TIME, HOW SAD :(
$user->full_name = $fullName;
$user->email = $email;
$user->password = $password;
$user->id_cuisine = $idCuisine;
$user->phone_no = $phoneNo;
if (!Generic::IsNullOrEmptyString($pic)) {
$user->pic = $pic;
}
if (!Generic::IsNullOrEmptyString($latitude)) {
$user->latitude = $latitude;
$user->last_lat = $latitude;
}
if (!Generic::IsNullOrEmptyString($longitude)) {
$user->longitude = $longitude;
$user->last_long = $longitude;
}
if (!Generic::IsNullOrEmptyString($district)) {
$user->district = $district;
$user->last_district = $district;
}
if (!Generic::IsNullOrEmptyString($city)) {
$user->city = $city;
$user->last_city = $city;
}
$user->status = "1";
$uid = $user->save();
if (!$uid) {
Generic::errorMsg("Failed Creating User");
} else {
$json['status_code'] = 1;
$json['results']['fb_id'] = $user->fb_id;
$json['results']['id_user'] = $idUser;
$json['results']['user_name'] = $user->user_name;
$json['results']['full_name'] = $user->full_name;
$json['results']['email'] = $user->email;
$json['results']['pic'] = Generic::insertImageUrl($user->pic);
echo json_encode($json);
die;
}
}
示例12: getNormalDineInOrderByRestoId
public function getNormalDineInOrderByRestoId()
{
$id_restaurant = Generic::mustCheck($_GET["id_restaurant"], "No ID Restaurant Found!");
$status_progress = Generic::mustCheck($_GET["status_progress"], "No Status Progress Found!");
$type_order = Generic::mustCheck($_GET["type_order"], "No Type Order Found");
$date = $_GET["date"];
$json['status_code'] = 1;
$queryBuilder = "id_restaurant='{$id_restaurant}' AND status_progress='{$status_progress}' AND type_order ='{$type_order}' ";
if (isset($date)) {
$queryBuilder .= " AND datetime_order LIKE '{$date}% '";
}
$queryBuilder .= " ORDER BY datetime_order DESC ";
$o = new MasterOrderModel();
$arrOrder = $o->getWhere($queryBuilder);
$isDineIn = $type_order == "0" || $type_order == "1" ? true : false;
$isAppOrder = $type_order == "1" || $type_order == "3" ? true : false;
$c = array();
foreach ($arrOrder as $order) {
$table = new MasterTableModel();
$table->getByID($order->id_table);
$user = new UserModel();
$user->getByID($order->id_user);
$isPaid = $order->status_payment == "1" ? true : false;
$allUsersIds = trim($order->id_user . $order->user_guest_id);
if (count($allUsersIds) > 0) {
foreach ($allUsersIds as $userId) {
$u[] = User::getUser($userId);
}
} else {
}
$c[] = array('table_number' => $table->table_number, 'type_order' => $order->type_order, 'server_name' => $order->server_name, 'datetime_order' => $order->datetime_order, 'id_restaurant' => $order->id_restaurant, 'id_user' => $order->id_user, 'user_guest_id' => $order->user_guest_id, 'full_name' => $user->full_name, 'grand_total' => $order->grand_total, 'status_progress' => $order->status_progress, 'status_payment' => $order->status_payment, 'status' => $order->status, 'allUsersIds' => $allUsersIds, 'isDineIn' => $isDineIn, 'IsAppOrder' => $isAppOrder, 'isPaid' => $isPaid, 'detail_orders' => OrderDetail::getOrderDetailsByIDOrder($order->id_order));
}
$json['results']["orders"] = $c;
echo json_encode($json);
die;
}
示例13: doPayment
public function doPayment($orderModel)
{
if (!$orderModel instanceof MasterOrderModel) {
return;
}
$user = new UserModel();
$user->getByID($orderModel->id_user);
$this->WORDS = Util::sha1HMAC($this->getDataDoPayment($this->DUMMY_AMOUNT, $this->DP_MALL_ID, $this->DUMMY_TRANSACTION_ID), $this->CLIENT_SECRET);
// $params = array(
// $this->KEY_CLIENT_ID => $this->CLIENT_ID,
// $this->KEY_ACCESS_TOKEN => $this->ACCESS_TOKEN,
// $this->KEY_ACCOUNT_ID => $this->DUMMY_CUST_DOKU_ID,
// $this->KEY_DP_MALL_ID => $this->DP_MALL_ID,
// $this->KEY_AMOUNT => $this->DUMMY_AMOUNT,
// $this->KEY_TRANSACTION_ID => $this->DUMMY_TRANSACTION_ID,
// $this->KEY_BASKET => $this->DUMMY_BASKET,
// $this->KEY_WORDS => $this->WORDS
// );
$basket = "payment_for_order_ {$orderModel->id_order},{$orderModel->grand_total},1,{$orderModel->grand_total}";
$params = array($this->KEY_CLIENT_ID => $this->CLIENT_ID, $this->KEY_ACCESS_TOKEN => $this->ACCESS_TOKEN, $this->KEY_ACCOUNT_ID => $user->payment_id, $this->KEY_DP_MALL_ID => $this->DP_MALL_ID, $this->KEY_AMOUNT => $orderModel->grand_total, $this->KEY_TRANSACTION_ID => $orderModel->id_order, $this->KEY_BASKET => $basket, $this->KEY_WORDS => $this->WORDS);
$results = Util::httpPost($this->API_DO_PAYMENT, $params);
echo $results;
die;
}
示例14: assignValue
public function assignValue()
{
//pajak itu setelah semua discount dan service
$this->valDiscRestaurant = Util::percentOrDiscount($this->subTotal, $this->discRestaurant);
$this->valDiscMR = Util::percentOrDiscount($this->subTotal, $this->valDiscMR);
$this->valDiscBank = Util::percentOrDiscount($this->subTotal, $this->discBank);
$this->valServiceCharge = Util::percentOrDiscount($this->subTotal, $this->serviceCharge);
$this->valOtherCharge = Util::percentOrDiscount($this->subTotal, $this->otherCharge);
//TODO kasi initial discount diambil dari user
if ($this->paymentMethod == Keys::$PAYMENT_TYPE_CREDIT_CARD) {
$user = new UserModel();
$user->getByID($this->idUser);
$this->valInitialDiscount = $user->credit;
} else {
$this->valInitialDiscount = 0;
}
//TODO val before tax di masukkan initial discount
$this->valBeforeTax = $this->subTotal + $this->valServiceCharge + $this->valOtherCharge - $this->valDiscRestaurant - $this->valDiscMR - $this->valDiscBank - $this->valInitialDiscount;
$this->valTaxCharge = Util::percentOrDiscount($this->valBeforeTax, $this->taxCharge);
$this->grandTotal = $this->valBeforeTax + $this->valTaxCharge;
$this->valFeeMR = Util::percentOrDiscount($this->grandTotal, $this->feeMR);
$this->valPercentFeeBank = Util::percentOrDiscount($this->grandTotal, $this->feePercentBank);
$this->valNominalFeeBank = $this->feeNominalBank;
$this->valFeeBank = $this->feeNominalBank + $this->feePercentBank;
}
示例15: settlePayment
public function settlePayment()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$id_order = $_GET["id_order"];
$id_user = $_GET["id_user"];
$user = new UserModel();
$user->getByID($id_user);
$order = new MasterOrderModel();
$order->getByID($id_order);
$objResto = new MasterRestaurantModel();
$objResto->getByID($order->id_restaurant);
if ($user->payment_id == null || $user->payment_id == "0") {
Generic::errorMsg("No Payment Method");
}
try {
$result = Braintree_PaymentMethodNonce::create($user->braintree_id);
$nonce = $result->paymentMethodNonce->nonce;
$resultSale = Braintree_Transaction::sale(['amount' => $order->grand_total, 'paymentMethodNonce' => $nonce, 'options' => ['submitForSettlement' => True]]);
} catch (Exception $e) {
Generic::errorMsg($e->getMessage());
}
// $transaction = $resultSale->transaction;
// $order->transaction_id = $transaction->id;
// $order->load = 1;
// $order->status_payment = '1';
// $orderObj->nonce_cc = $nonce;
// $order->isPaid = '1';
// $order->save();
pr($resultSale);
// $json['results'] = "Your Payment was successful with ID Order " . $id_order;
// echo json_encode($json);
//,
// 'descriptor' => [
// 'name' => $objResto->name . " - " . $objResto->order_number
// ]
// die();
}