本文整理汇总了PHP中Func::getIP方法的典型用法代码示例。如果您正苦于以下问题:PHP Func::getIP方法的具体用法?PHP Func::getIP怎么用?PHP Func::getIP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func::getIP方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: signUp
public static function signUp(array $data)
{
if (!$data) {
return false;
}
if (!isset($data['last_login_time'])) {
$data['last_login_time'] = time();
}
if (!isset($data['last_login_ip'])) {
$data['last_login_ip'] = Func::getIP();
}
if (!isset($data['login_time'])) {
$data['login_time'] = time();
}
if (!isset($data['login_ip'])) {
$data['login_ip'] = Func::getIP();
}
if (!isset($data['create_time'])) {
$data['create_time'] = time();
}
$data['login_count'] = 1;
$data['user_code'] = self::getNewUserCode();
$insertid = 0;
DB::tranBegin();
$insertid = self::insert($data);
DB::tranEnd();
return $insertid;
}
示例2: cancelOrder
public static function cancelOrder($order_code, $user)
{
$order_type = substr($order_code, -2, 2);
if ('SK' != $order_type) {
return false;
}
$order = Orders::getOne(array('order_code' => $order_code), 'id, order_status');
if (1 != $order['order_status']) {
return false;
}
$oid = $order['id'];
//DB::Debug();
$stocks = ProductsStockLock::getList("order_code='{$order_code}' AND status=0");
ABase::log("Stocks in cancelOrder: " . serialize($stocks), 'cancel_order_');
DB::tranBegin('Orders.cancelOrder');
//事务开始
OrdersLog::insert(array('order_code' => $order_code, 'ex_status' => '取消订单', 'admin' => $user, 'action' => '订单取消', 'ip' => Func::getIP(), 'create_time' => time()));
foreach ($stocks as $stock) {
$sid = $stock['id'];
$product_sku = $stock['product_sku'];
$product_num = $stock['product_num'];
$exp_date = $stock['exp_date'];
ProductsStock::increase("product_sku='{$product_sku}' AND exp_date='{$exp_date}'", "stock", $product_num);
ProductsStockLock::update($sid, array('status' => 2));
}
Orders::update($oid, array('order_status' => 7));
$commit_status = DB::tranEnd('Orders.cancelOrder');
}