本文整理汇总了PHP中Table::UpdateCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::UpdateCache方法的具体用法?PHP Table::UpdateCache怎么用?PHP Table::UpdateCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table::UpdateCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UseCard
public static function UseCard($order, $card_id)
{
if ($order['card_id']) {
return self::ERR_ORDER;
}
$card = Table::Fetch('card', $card_id);
if (!$card) {
return self::ERR_NOCARD;
}
if ($card['consume'] == 'Y') {
return self::ERR_USED;
}
$today = strtotime(date('Y-m-d'));
if ($card['begin_time'] > $today || $card['end_time'] < $today) {
return self::ERR_EXPIRE;
}
$team = Table::Fetch('team', $order['team_id']);
if ($card['partner_id'] > 0 && $card['partner_id'] != $team['partner_id']) {
return self::ERR_TEAM;
}
if ($team['card'] < $card['credit']) {
return self::ERR_CREDIT;
}
$finalcard = $card['credit'] > $order['origin'] ? $order['origin'] : $card['credit'];
Table::UpdateCache('order', $order['id'], array('card_id' => $card_id, 'card' => $finalcard, 'origin' => array("origin - {$finalcard}")));
Table::UpdateCache('card', $card_id, array('consume' => 'Y', 'team_id' => $team['id'], 'order_id' => $order['id'], 'ip' => Utility::GetRemoteIp()));
return true;
}
示例2: Consume
static public function Consume($coupon,$store_id,$doer_id,$verifytype=4) {
if ( !$coupon['consume']=='N' ) return false;
$u = array(
'ip' => Utility::GetRemoteIp(),
'consume_time' => time(),
'consume' => 'Y',
'verifytype'=>$verifytype,
'store_id'=>$store_id,
'doer_id'=>$doer_id,
);
DB::Update('order',$coupon['order_id'],array('had_consume'=>1));
Table::UpdateCache('coupon', $coupon['id'], $u);
//判断是否点评返利成功,点评并返利成功的订单的消费券可以继续返利
$orderdp=DB::LimitQuery('order_dp',array(
'condition'=>array('order_id'=>$coupon['order_id'],'has_return'=>1)
));
if(!empty($orderdp)){
ZFlow::CreateFromCoupon($coupon);
}
ZCredit::CreateFromConsume($coupon);
return true;
}
示例3: sms_coupon
function sms_coupon($coupon, $mobile = null)
{
global $INI;
if ($coupon['consume'] == 'Y' || $coupon['expire_time'] < strtotime(date('Y-m-d'))) {
return $INI['system']['couponname'] . '已失效';
}
$user = Table::Fetch('user', $coupon['user_id']);
$order = Table::Fetch('order', $coupon['order_id']);
if (!Utility::IsMobile($mobile)) {
$mobile = $order['mobile'];
if (!Utility::IsMobile($mobile)) {
$mobile = $user['mobile'];
}
}
if (!Utility::IsMobile($mobile)) {
return '请设置合法的手机号码,以便接受短信';
}
$team = Table::Fetch('team', $coupon['team_id']);
$partner = Table::Fetch('partner', $coupon['partner_id']);
$coupon['end'] = date('Y-n-j', $coupon['expire_time']);
$coupon['name'] = $team['product'];
$content = render('manage_tpl_smscoupon', array('partner' => $partner, 'coupon' => $coupon, 'user' => $user));
if (true === ($code = sms_send($mobile, $content))) {
Table::UpdateCache('coupon', $coupon['id'], array('sms' => array('`sms` + 1'), 'sms_time' => time()));
return true;
}
return $code;
}
示例4: Create
public static function Create($user_row, $uc = true)
{
if (function_exists('zuitu_uc_register') && $uc) {
$pp = $user_row['password'];
$em = $user_row['email'];
$un = $user_row['username'];
$ret = zuitu_uc_register($em, $un, $pp);
if (!$ret) {
return false;
}
}
$user_row['password'] = self::GenPassword($user_row['password']);
$user_row['create_time'] = $user_row['login_time'] = time();
$user_row['ip'] = Utility::GetRemoteIp();
$user_row['secret'] = md5(rand(1000000, 9999999) . time() . $user_row['email']);
$user_row['id'] = DB::Insert('user', $user_row);
$_rid = abs(intval(cookieget('_rid')));
if ($_rid) {
$r_user = Table::Fetch('user', $_rid);
if ($r_user) {
ZInvite::Create($r_user, $user_row);
}
}
if ($user_row['id'] == 1) {
Table::UpdateCache('user', $user_row['id'], array('manager' => 'Y', 'secret' => ''));
}
return $user_row['id'];
}
示例5: Secret
public static function Secret($mobile, $secret = null)
{
$secret = $secret ? $secret : Utility::VerifyCode();
$sms = Table::Fetch('smssubscribe', $mobile, 'mobile');
if ($sms) {
Table::UpdateCache('smssubscribe', $sms['id'], array('secret' => $secret));
}
return $secret;
}
示例6: Consume
public static function Consume($coupon)
{
if (!$coupon['consume'] == 'N') {
return false;
}
$u = array('ip' => Utility::GetRemoteIp(), 'consume_time' => time(), 'consume' => 'Y');
Table::UpdateCache('coupon', $coupon['id'], $u);
ZFlow::CreateFromCoupon($coupon);
return true;
}
示例7: CashIt
public static function CashIt($order)
{
global $login_user_id;
if (!$order['state'] == 'pay') {
return 0;
}
//update order
Table::UpdateCache('order', $order['id'], array('state' => 'pay', 'service' => 'cash', 'admin_id' => $login_user_id, 'money' => $order['origin'], 'pay_time' => time()));
$order = Table::FetchForce('order', $order['id']);
ZTeam::BuyOne($order);
}
示例8: Create
public static function Create($score, $user_id, $action = 'charge', $detail_id = 0)
{
if (!$score || !$user_id) {
return 0;
}
//update user score;
$user = Table::Fetch('user', $user_id);
Table::UpdateCache('user', $user_id, array('score' => array("`score`+{$score}")));
$u = array('user_id' => $user_id, 'admin_id' => 0, 'score' => $score, 'action' => $action, 'detail_id' => $detail_id, 'create_time' => time());
return DB::Insert('credit', $u);
}
示例9: SetOrderState
public static function SetOrderState($team)
{
if ($team->close_time == 0) {
return;
}
$c = array('team_id' => $team['id'], 'state' => 'unpay');
$os = DB::LimitQuery('order', array('condition' => $condition));
$ids = Utility::GetColumn($os, 'id');
foreach ($ids as $id) {
Table::UpdateCache('order', $id, array('state' => 'expire'));
}
}
示例10: CreateFromStore
public static function CreateFromStore($user_id = 0, $money = 0)
{
$money = abs(intval($money));
if ($money <= 0 || $user_id <= 0) {
return;
}
//update user money;
$user = Table::Fetch('user', $user_id);
Table::UpdateCache('user', $user_id, array('money' => array("money + {$money}")));
$u = array('user_id' => $user_id, 'money' => $money, 'direction' => 'income', 'action' => 'store', 'detail_id' => 0, 'create_time' => time());
return DB::Insert('flow', $u);
}
示例11: CashIt
public static function CashIt($order)
{
if (!$order['state'] == 'pay') {
return 0;
}
//update user money;
$user = Table::Fetch('user', $order['user_id']);
Table::UpdateCache('user', $order['user_id'], array('money' => moneyit($user['money'] - $order['credit'])));
//update order
Table::UpdateCache('order', $order['id'], array('state' => 'pay', 'service' => 'cash', 'money' => $order['origin']));
$order = Table::FetchForce('order', $order['id']);
ZTeam::BuyOne($order);
}
示例12: Assign
static function Assign($order)
{
$ccon = array('order_id' => $order['id']);
$count = Table::Count('voucher', $ccon);
while ($count < $order['quantity']) {
$voucher = self::GetValidVoucher($order['team_id']);
if (!$voucher) {
break;
}
Table::UpdateCache('voucher', $voucher['id'], array('user_id' => $order['user_id'], 'order_id' => $order['id']));
$count = Table::Count('voucher', $ccon);
}
}
示例13: UsePayCard
public static function UsePayCard($paycard)
{
global $login_user_id;
if (!$paycard['consume'] == 'N') {
return false;
}
$u = array('user_id' => $login_user_id, 'recharge_time' => time(), 'consume' => 'Y');
Table::UpdateCache('paycard', $paycard['id'], $u);
Table::UpdateCache('user', $login_user_id, array('money' => array("money + {$paycard['value']}")));
$l = array('user_id' => $login_user_id, 'admin_id' => 0, 'money' => $paycard['value'], 'direction' => 'income', 'action' => 'cardstore', 'detail_id' => $paycard['id'], 'create_time' => time());
DB::Insert('flow', $l);
return true;
}
示例14: uc_api_updatepw
function uc_api_updatepw($get, $post)
{
$username = $get['username'];
$password = ZUser::GenPassword($get['password']);
if (strtolower(UC_CHARSET) != 'utf-8') {
$username = mb_convert_encoding($username, 'UTF-8', UC_CHARSET);
}
$u = Table::Fetch('user', $username, 'username');
if ($u && $u['password'] != $password) {
Table::UpdateCache('user', $u['id'], array('password' => $password));
if ($_SESSION['user_id'] && $_SESSION['user_id'] == $u['id']) {
unset($_SESSION['user_id']);
}
}
return API_RETURN_SUCCEED;
}
示例15: BuyOne
public static function BuyOne($order)
{
$order = Table::FetchForce('order', $order['id']);
$team = Table::FetchForce('team', $order['team_id']);
$plus = $team['conduser'] == 'Y' ? 1 : $order['quantity'];
$team['now_number'] += $plus;
if ($team['max_number'] > 0 && $team['now_number'] >= $team['max_number']) {
$team['close_time'] = time();
}
Table::UpdateCache('team', $team['id'], array('close_time' => $team['close_time'], 'now_number' => array("`now_number` + {$plus}")));
/* cash flow */
ZFlow::CreateFromOrder($order);
/* order : send coupon ? */
ZCoupon::CheckOrder($order);
/* order : invite buy */
ZInvite::CheckInvite($order);
}