コード例 #1
0
 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);
 }
コード例 #2
0
ファイル: ZTeam.class.php プロジェクト: noikiy/mdwp
	static public function BuyOne($order) {
		$order = Table::FetchForce('order', $order['id']);
		$order_id = abs(intval($order['id']));
		$team_id = abs(intval($order['team_id']));
		$team = Table::FetchForce('team', $order['team_id']);
		$plus = $team['conduser']=='Y' ? 1 : $order['quantity'];
		$team['now_number'] += $plus;

		/* close time */
		if ( $team['max_number']>0 
				&& $team['now_number'] >= $team['max_number'] ) {
			$team['close_time'] = time();
		}

		/* reach time */
		if ( $team['now_number']>=$team['min_number']
			&& $team['reach_time'] == 0 ) {
			$team['reach_time'] = time();
		}

		Table::UpdateCache('team', $team['id'], array(
			'close_time' => $team['close_time'],
			'reach_time' => $team['reach_time'],
			'now_number' => array( "`now_number` + {$plus}", ),
		));
		
		//UPDATE buy_id
		$SQL = "UPDATE `order` o,(SELECT max(buy_id)+1 AS c FROM `order` WHERE state = 'pay' and team_id = '{$team_id}') AS c SET o.buy_id = c.c, o.luky_id = 100000 + floor(rand()*100000) WHERE o.id = '{$order_id}' AND buy_id = 0;";
		DB::Query($SQL);
		/* send sms Immediately  */
		if(option_yes('buycouponsms')) sms_buy($order);
		/* cash flow */
		ZFlow::CreateFromOrder($order);
		/* order : send coupon ? */
		ZCoupon::CheckOrder($order);
		/* order : send voucher ? */
		ZVoucher::CheckOrder($order);
        /* order : send express sms ? */
		ZExpress::CheckOrder($order);
		/* order : invite buy */
		ZInvite::CheckInvite($order);
		
		ZCredit::UpdateFromOrder($order);
	}
コード例 #3
0
ファイル: ZTeam.class.php プロジェクト: jowino/bd786110cact
 public static function BuyOne($order)
 {
     $order = Table::FetchForce('order', $order['id']);
     $team = Table::FetchForce('team', $order['team_id']);
     $team['now_number'] += $order['quantity'];
     if ($team['max_number'] > 0 && $team['now_number'] >= $team['max_number']) {
         $team['state'] = 'soldout';
         $team['close_time'] = time();
     }
     $table = new Table('team', $team);
     $table->update(array('end_time', 'state', 'now_number'));
     ZFlow::CreateFromOrder($order);
     ZCoupon::CheckOrder($order);
     ZInvite::CheckInvite($order);
     $partner = Table::Fetch('partner', $team['partner_id']);
     $city = Table::Fetch('category', $team['city_id']);
     $user = Table::Fetch('user', $order['user_id']);
     mail_purchase($city, $team, $partner, $order, $user);
 }