本文整理汇总了PHP中Prefs::get_key_info方法的典型用法代码示例。如果您正苦于以下问题:PHP Prefs::get_key_info方法的具体用法?PHP Prefs::get_key_info怎么用?PHP Prefs::get_key_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prefs
的用法示例。
在下文中一共展示了Prefs::get_key_info方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: order_save
public function order_save($indata, $api_key, $transaction_id)
{
date_default_timezone_set('Asia/Jakarta');
$args = '';
//$api_key = $this->get('key');
//$transaction_id = $this->get('trx');
if (is_null($api_key)) {
$result = json_encode(array('status' => 'ERR:NOKEY', 'timestamp' => now()));
return $result;
} else {
$app = \Prefs::get_key_info(trim($api_key));
if ($app == false) {
$result = json_encode(array('status' => 'ERR:INVALIDKEY', 'timestamp' => now()));
return $result;
} else {
//$in = $this->input->post('transaction_detail');
//$in = file_get_contents('php://input');
$in = $indata;
//print $in;
$buyer_id = 1;
$args = 'p=' . $in;
$in = json_decode($in);
//print "order input to save: \r\n";
//print_r($in);
$is_new = false;
$in->phone = isset($in->phone) && $in->phone != '' ? \Prefs::normalphone($in->phone) : '';
$in->mobile1 = isset($in->mobile1) && $in->mobile1 != '' ? \Prefs::normalphone($in->mobile1) : '';
$in->mobile2 = isset($in->mobile2) && $in->mobile2 != '' ? \Prefs::normalphone($in->mobile2) : '';
if (isset($in->buyer_id) && $in->buyer_id != '' && $in->buyer_id > 1) {
$buyer_id = $in->buyer_id;
$is_new = false;
} else {
if ($in->email == '' || $in->email == '-' || !isset($in->email) || $in->email == 'noemail') {
$in->email = 'noemail';
$is_new = true;
if (trim($in->phone . $in->mobile1 . $in->mobile2) != '') {
if ($buyer = \Prefs::check_phone($in->phone, $in->mobile1, $in->mobile2)) {
$buyer_id = $buyer['id'];
$is_new = false;
}
}
} else {
if ($buyer = \Prefs::check_email($in->email)) {
$buyer_id = $buyer['id'];
$is_new = false;
} else {
if ($buyer = \Prefs::check_phone($in->phone, $in->mobile1, $in->mobile2)) {
$buyer_id = $buyer['id'];
$is_new = false;
}
}
}
}
if (isset($in->merchant_trans_id) && $in->merchant_trans_id != "") {
$transaction_id = $in->merchant_trans_id;
}
if ($is_new) {
$random_string = str_random(5);
$buyer_username = substr(strtolower(str_replace(' ', '', $in->buyer_name)), 0, 6) . $random_string;
$dataset['username'] = $buyer_username;
$dataset['email'] = $in->email;
$dataset['phone'] = $in->phone;
$dataset['mobile1'] = $in->mobile1;
$dataset['mobile2'] = $in->mobile2;
$dataset['fullname'] = $in->buyer_name;
$password = str_random(8);
$dataset['password'] = $password;
$dataset['created'] = date('Y-m-d H:i:s', time());
/*
$dataset['province'] =
$dataset['mobile']
*/
$dataset['street'] = $in->shipping_address;
$dataset['district'] = $in->buyerdeliveryzone;
$dataset['city'] = $in->buyerdeliverycity;
$dataset['country'] = 'Indonesia';
$dataset['zip'] = isset($in->zip) ? $in->zip : '';
//$buyer_id = $this->register_buyer($dataset);
$is_new = true;
}
$order['created'] = date('Y-m-d H:i:s', time());
$order['ordertime'] = date('Y-m-d H:i:s', time());
$order['application_id'] = $app->id;
$order['application_key'] = $app->key;
$order['buyer_id'] = $buyer_id;
$order['merchant_id'] = $app->merchant_id;
$order['merchant_trans_id'] = trim($transaction_id);
$order['buyer_name'] = $in->buyer_name;
$order['recipient_name'] = $in->recipient_name;
$order['email'] = $in->email;
$order['directions'] = $in->directions;
//$order['dir_lat'] = $in->dir_lat;
//$order['dir_lon'] = $in->dir_lon;
$order['buyerdeliverytime'] = $in->buyerdeliverytime;
$order['buyerdeliveryslot'] = $in->buyerdeliveryslot;
$order['buyerdeliveryzone'] = $in->buyerdeliveryzone;
$order['buyerdeliverycity'] = is_null($in->buyerdeliverycity) || $in->buyerdeliverycity == '' ? 'Jakarta' : $in->buyerdeliverycity;
$order['currency'] = $in->currency;
$order['total_price'] = isset($in->total_price) ? $in->total_price : 0;
$order['total_discount'] = isset($in->total_discount) ? $in->total_discount : 0;
//.........这里部分代码省略.........