Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
	static public 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(),
					));
                /* cash flow */
		$order = Table::FetchForce('order', $order['id']);
                ZFlow::CreateFromStore($order['user_id'], $order['origin']);
		ZTeam::BuyOne($order);
	}
Ejemplo n.º 4
0
 public static function CheckOrder($order)
 {
     $team = Table::FetchForce('team', $order['team_id']);
     if ($team['now_number'] >= $team['min_number']) {
         //init coupon create;
         if ($team['now_number'] == $team['min_number']) {
             self::TipSuccess($order);
         }
         if ($team['now_number'] - $team['min_number'] < 5) {
             $orders = DB::LimitQuery('order', array('condition' => array('team_id' => $order['team_id'], 'state' => 'pay')));
             foreach ($orders as $order) {
                 self::Create($order);
             }
         } else {
             self::Create($order);
         }
     }
 }
Ejemplo n.º 5
0
	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);
	}
Ejemplo n.º 6
0
 public static function CheckOrder($order)
 {
     $coupon_array = array('coupon', 'pickup');
     $team = Table::FetchForce('team', $order['team_id']);
     if (!in_array($team['delivery'], $coupon_array)) {
         return;
     }
     if ($team['now_number'] >= $team['min_number']) {
         //init coupon create;
         if ($team['now_number'] - $team['min_number'] < 5) {
             $orders = DB::LimitQuery('order', array('condition' => array('team_id' => $order['team_id'], 'state' => 'pay')));
             foreach ($orders as $order) {
                 self::Create($order);
             }
         } else {
             self::Create($order);
         }
     }
 }
Ejemplo n.º 7
0
 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);
 }
Ejemplo n.º 8
0
 public static function CheckOrder($order)
 {
     $coupon_array = array('express');
     $team = Table::FetchForce('team', $order['team_id']);
     if (!in_array($team['delivery'], $coupon_array) || !option_yes('expressbuysms')) {
         return;
     }
     if ($team['now_number'] >= $team['min_number']) {
         //init express sms;
         $last = $team['conduser'] == 'Y' ? 1 : $order['quantity'];
         if ($team['now_number'] - $team['min_number'] < $last) {
             $orders = DB::LimitQuery('order', array('condition' => array('team_id' => $order['team_id'], 'state' => 'pay')));
             foreach ($orders as $order) {
                 sms_express_buy($order);
             }
         } else {
             sms_express_buy($order);
         }
     }
 }
 public static function CheckOrder($order)
 {
     $coupon_array = array('thirdpart');
     $team = Table::FetchForce('team', $order['team_id']);
     if (!in_array($team['delivery'], $coupon_array)) {
         return;
     }
     if ($team['now_number'] >= $team['min_number']) {
         //init coupon create;
         $last = $team['conduser'] == 'Y' ? 1 : $order['quantity'];
         $offset = max(5, $last);
         if ($team['now_number'] - $team['min_number'] < $last) {
             $orders = DB::LimitQuery('order', array('condition' => array('team_id' => $order['team_id'], 'state' => 'pay')));
             foreach ($orders as $order) {
                 self::Create($order);
             }
         } else {
             self::Create($order);
         }
     }
 }
Ejemplo n.º 10
0
function zuitu_uc_login($email, $pass)
{
    if (!function_exists('uc_user_login')) {
        return array();
    }
    if (!defined('UC_API')) {
        return array();
    }
    $isuid = strpos($email, '@') ? 2 : 0;
    if (strtolower(UC_CHARSET) != 'utf-8') {
        $email = mb_convert_encoding($email, UC_CHARSET, 'UTF-8');
    }
    $ucresult = uc_user_login($email, $pass, $isuid, 0);
    $uckey = array('uid', 'username', 'password', 'email', 'duplicate');
    $ucresult = array_combine($uckey, $ucresult);
    $ucresult = zuitu_encode_array($ucresult);
    $ucresult = zuitu_encode_detect($ucresult);
    DB::Query('SET NAMES UTF8;');
    if ($ucresult['uid'] > 0 && $ucresult['email']) {
        $eu = Table::Fetch('user', $ucresult['email'], 'email');
        if ($eu) {
            if ($eu['username'] != $ucresult['username']) {
                $epass = ZUser::GenPassword($ucresult['password']);
                Table::UpdateCache('user', $eu['id'], array('username' => $ucresult['username'], 'password' => $epass));
                return Table::FetchForce('user', $eu['id']);
            }
            return $eu;
        }
        unset($ucresult['uid']);
        unset($ucresult['duplicate']);
        zuitu_encode_array($ucresult);
        zuitu_encode_detect($ucresult);
        $newuser_id = ZUser::Create($ucresult, false);
        if ($newuser_id) {
            return Table::Fetch('user', $newuser_id);
        }
    }
    return array();
}
Ejemplo n.º 11
0
	static public function CheckOrder($order) {
		$voucher_array = array('voucher');
		$team = Table::FetchForce('team', $order['team_id']);
		if (!in_array($team['delivery'], $voucher_array)) return;
		if ( $team['now_number'] >= $team['min_number'] ) {
			//init voucher create;
			$last = ($team['conduser']=='Y') ? 1 : $order['quantity'];
			$offset = max(5, $last);
			if ( $team['now_number'] - $team['min_number'] < $last) {
				$orders = DB::LimitQuery('order', array(
							'condition' => array(
								'team_id' => $order['team_id'],
								'state' => 'pay',
								),
							));
				foreach($orders AS $order) {
					self::Assign($order);
				}
			}
			else{
				self::Assign($order);
			}
		}
	}
Ejemplo n.º 12
0
Archivo: view.php Proyecto: noikiy/mdwp
<?php
require_once(dirname(dirname(__FILE__)) . '/app.php');

need_login();
$order_id = $id = strval(intval($_GET['id']));
if(!$order_id || !($order = Table::Fetch('order', $order_id))) {
	die('404 Not Found');
}
if ( $order['user_id'] != $login_user['id']) {
	redirect( WEB_ROOT . "/team.php?id={$order['team_id']}");
}
if ( $order['state']=='unpay') {
	redirect( WEB_ROOT . "/team.php?id={$order['team_id']}");
}

$team = Table::FetchForce('team', $order['team_id']);
$partner = Table::Fetch('partner', $team['partner_id']);
$express = ($team['delivery']=='express');
if ( $express ) { $option_express = Utility::OptionArray(Table::Fetch('category', array('express'), 'zone'), 'id', 'name'); }

if ( $team['delivery'] == 'coupon' ) {
	$cc = array(
			'user_id' => $login_user['id'],
			'team_id' => $order['team_id'],
			'order_id' => $order['id'],
			);
	$coupons = DB::LimitQuery('coupon', array(
				'condition' => $cc,
				));
} else if ( $team['delivery'] == 'voucher' ) {
	$cc = array(
Ejemplo n.º 13
0
     need_auth('admin');
     $express_id = abs(intval($_GET['eid']));
     $invite = Table::Fetch('invite', $id);
     if (!$invite || $invite['pay'] != 'N') {
         json('非法操作', 'alert');
     }
     if (!$invite['team_id']) {
         json('没有发生购买行为,不能执行返利', 'alert');
     }
     $team = Table::Fetch('team', $invite['team_id']);
     $team_state = team_state($team);
     if (!in_array($team_state, array('success', 'soldout'))) {
         json('只有成功的团购才可以执行邀请返利', 'alert');
     }
     Table::UpdateCache('invite', $id, array('pay' => 'Y', 'admin_id' => $login_user_id));
     $invite = Table::FetchForce('invite', $id);
     ZFlow::CreateFromInvite($invite);
     Session::Set('notice', '邀请返利操作成功');
     json(null, 'refresh');
 } else {
     if ('inviteremove' == $action) {
         need_auth('admin');
         Table::UpdateCache('invite', $id, array('pay' => 'C', 'admin_id' => $login_user_id));
         Session::Set('notice', '不合法邀请记录取消成功!');
         json(null, 'refresh');
     } else {
         if ('subscriberemove' == $action) {
             need_auth('admin');
             $subscribe = Table::Fetch('subscribe', $id);
             if ($subscribe) {
                 ZSubscribe::Unsubscribe($subscribe);
Ejemplo n.º 14
0
                 $v[] = "{$secret}&nbsp;本卡已过期";
                 $v[] = '过期日期:' . date('Y-m-d', $paycard['expire_time']);
             } else {
                 $v[] = "{$secret}&nbsp;该卡有效";
                 $v[] = "金额:{$paycard['value']}元";
                 $v[] = "有效期至&nbsp;{$e}";
             }
         }
     }
     $v = join('<br/>', $v);
     $d = array('html' => $v, 'id' => 'coupon-dialog-display-id');
     json($d, 'updater');
 } else {
     if ($action == 'consume') {
         global $login_user_id;
         $paycard = Table::FetchForce('paycard', $secret);
         if (!$login_user_id) {
             $v[] = "登陆后才能进行充值";
             $v[] = '本次充值失败';
         } else {
             if (!$paycard) {
                 $v[] = "{$secret}&nbsp;充值卡无效";
                 $v[] = '本次充值失败';
             } else {
                 if ($paycard['id'] != $secret) {
                     $v[] = '充值密码不正确';
                     $v[] = '本次充值失败';
                 } else {
                     if ($paycard['expire_time'] < strtotime(date('Y-m-d'))) {
                         $v[] = "{$secret}&nbsp;充值卡已过期";
                         $v[] = '过期时间:' . date('Y-m-d', $paycard['expire_time']);
Ejemplo n.º 15
0
if (!($order['pay_id'] && (preg_match('#-(\\d+)-(\\d+)-#', $order['pay_id'], $m) && ($m[1] == $order['id'] && $m[2] == $order['quantity'])))) {
    $randid = strtolower(Utility::GenSecret(4, Utility::CHAR_WORD));
    $pay_id = "go-{$order['id']}-{$order['quantity']}-{$randid}";
    Table::UpdateCache('order', $order['id'], array('pay_id' => $pay_id));
    $order['pay_id'] = $pay_id;
}
/* end */
//payed order
if ($order['state'] == 'pay') {
    Session::Set('notice', '本单已支付成功');
    redirect("team.php?id={$order['team_id']}");
}
$team = Table::Fetch('team', $order['team_id']);
if ($login_user['money'] >= $order['origin']) {
    $order['service'] = 'credit';
} else {
    Session::Set('error', '余额不足,请去网页版本先行充值!');
    redirect('index.php');
}
if ($_POST['service'] == 'credit') {
    if ($order['origin'] > $login_user['money']) {
        Table::Delete('order', $order_id);
        redirect('index.php');
    }
    Table::UpdateCache('order', $order_id, array('service' => 'credit', 'money' => 0, 'state' => 'pay', 'credit' => $order['origin'], 'pay_time' => time()));
    $order = Table::FetchForce('order', $order_id);
    ZTeam::BuyOne($order);
    Session::Set('notice', '购买成功');
    redirect("order.php?id={$order_id}");
}
die(include template('wap_pay'));
Ejemplo n.º 16
0
<?php
require_once(dirname(__FILE__) . '/app.php');

$id = abs(intval($_GET['id']));
if (!$id || !$partner = Table::FetchForce('partner', $id) ) {
	redirect( WEB_ROOT . '/partner/index.php');
}
$pagetitle = $partner['title'];

$view = strtolower(strval($_GET['view']));
$view = (!in_array($view, array('team','comment'))) ? 'comment' : $view;



if ( 'team' == $view || true) {
	$daytime = time();
	$condition = array( 
			'partner_id' => $id,
			"begin_time <  {$daytime}",
			"end_time > {$daytime}",
			'OR' => array(
			"now_number >= min_number",
			"end_time > {$daytime}",
	
			
				
				),      
			);
	$teams = DB::LimitQuery('team', array(
				'condition' => $condition,
				'order' => 'ORDER BY  sort_order  DESC, id DESC',
Ejemplo n.º 17
0
$c_con = array('partner_id'=>$finance['partner_id'], 'team_id'=>$team_id, 'consume'=>'Y', 'consume_time <= '.$finance['end_time'].' AND consume_time > '.$finance['begin_time'],);
$c_count = Table::Count('coupon', $c_con);
//die(print_R($c_count));
list($pagesize, $offset, $pagestring) = pagestring($c_count, 20);
$coupons = DB::LimitQuery('coupon', array(
	'condition' => $c_con,
	'order' => 'ORDER BY consume_time DESC',
	'size' => $pagesize,
	'offset' => $offset,
));
$money = number_format($c_count * $team['cgj'], 2);

$team_ids = Utility::GetColumn($coupons, 'team_id');
$teams = Table::Fetch('team', $team_ids);

$user_ids = Utility::GetColumn($coupons, 'user_id');
$users = Table::Fetch('user', $user_ids);

$option_state = array(
	'Y' => '已消费',
	'N' => '未消费',
	'E' => '已过期',
);

$partner = Table::FetchForce('partner', $finance['partner_id']);
/* filter */
/* filter end */

include template('manage_partner_showcoupons');
Ejemplo n.º 18
0
 public static function BuyGift($order)
 {
     $order = Table::FetchForce('gift_card', $order['id']);
     $user = Table::Fetch('user', $order['user_id']);
     mail_gift($order, $user);
 }
Ejemplo n.º 19
0
Archivo: bm.php Proyecto: noikiy/mdwp
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
require_once dirname(dirname(__FILE__)) . '/waf.php';
$action = $_GET['action'];
$partner_mobile_id = abs(intval($_SESSION['partner_mobile_id']));
$mobile_login_partner = Table::Fetch('partner', $partner_mobile_id);
if ($action == 'checkcoupon') {
    $coupon_code = $_GET['coupon'];
    if (!is_numeric($coupon_code)) {
        die('hacker');
    }
    $store_id = $_GET['sid'];
    //	the info of store
    $store = Table::Fetch('store', $store_id);
    $coupon = Table::FetchForce('coupon', $coupon_code);
    $partner = Table::Fetch('partner', $coupon['partner_id']);
    $team = Table::Fetch('team', $coupon['team_id']);
    if (!$coupon) {
        $data = "#{$coupon_code}&nbsp;无效,请检查其正确性";
    } else {
        if (!$store) {
            $data = "#{$coupon_code}&nbsp;请选择一个有效分店";
        } else {
            if (strpos($team['store_ids'], '@' . $store_id . '@') === false) {
                $data = "#{$coupon_code}&nbsp;很抱歉,该分店并未进行此项目";
            } else {
                if ($coupon['expire_time'] < strtotime(date('Y-m-d'))) {
                    $data .= "#{$coupon_code}&nbsp;已过期<br/>";
                    $data .= '过期时间:' . date('Y-m-d', $coupon['expire_time']) . '<br/>';
                    $data = '本次消费失败';
Ejemplo n.º 20
0
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
need_partner();
$partner_id = abs(intval($_SESSION['partner_id']));
$login_partner = Table::Fetch('partner', $partner_id);
$finance_id = abs(intval($_GET['id']));
if (!$finance_id || !($finance = Table::FetchForce('finance', $finance_id))) {
    Session::Set('error', '结算信息不存在');
    redirect(WEB_ROOT . '/biz/finance.php');
}
if ($finance['partner_id'] != $partner_id) {
    Session::Set('error', '你无权查看该财务信息');
    redirect(WEB_ROOT . '/biz/finance.php');
}
$sql = "SELECT COUNT(*) AS num, team_id FROM `coupon` WHERE `consume_time` <= " . $finance['end_time'] . " AND `consume_time` > " . $finance['begin_time'] . " AND `partner_id` = " . $finance['partner_id'] . " AND `consume` = 'Y' GROUP BY `team_id`";
$coupons = DB::GetQueryResult($sql, false);
$coupons_count = count($coupons);
list($pagesize, $offset, $pagestring) = pagestring($coupons_count, 20);
$sql .= ' LIMIT ' . $offset . ',' . $pagesize;
$coupons = DB::GetQueryResult($sql, false);
$team_ids = Utility::GetColumn($coupons, 'team_id');
$teams = Table::Fetch('team', $team_ids);
foreach ($coupons as $key => $value) {
    $coupons[$key]['money'] = number_format($value['num'] * $teams[$value['team_id']]['cgj'], 2);
}
include template('biz_finance_con');
Ejemplo n.º 21
0
    echo json_encode($return);
    die;
}
$check_team = Table::Fetch('team', $cp['team_id']);
if (strpos($check_team['store_ids'], '@' . $store_id . '@') === false) {
    echo json_encode($return);
    die;
}
$coupons = DB::LimitQuery('coupon', array('condition' => array('order_id' => $cp['order_id'], 'consume' => 'N')));
if (!empty($coupons)) {
    foreach ($coupons as $one) {
        $coupon = Table::FetchForce('coupon', $one['id']);
        $partner = Table::Fetch('partner', $coupon['partner_id']);
        $team = Table::Fetch('team', $coupon['team_id']);
        $check = option_yes('mycoupon') || $coupon['user_id'] == $login_user_id || $coupon['partner_id'] == abs($_SESSION['partner_id']);
        if (false == $check) {
            $return[$one['id']]['result'] = -1;
        } elseif ($coupon['consume'] == 'Y') {
            $return[$one['id']]['result'] = 2;
        } else {
            if ($coupon['expire_time'] < strtotime(date('Y-m-d'))) {
                $return[$one['id']]['result'] = -2;
            } else {
                ZCoupon::Consume($coupon, $store_id, $partner_id);
                $return[$one['id']]['result'] = 1;
            }
        }
        $return[$one['id']]['coupon'] = Table::FetchForce('coupon', $one['id']);
    }
}
echo json_encode($return);
Ejemplo n.º 22
0
<?php 

	if(trim($_COOKIE['RecentlyGoods'])!=""){
		$recentView = explode(",", $_COOKIE['RecentlyGoods']);
		$allView = array();
		foreach($recentView as $key=>$value){
			$allView[$key] = Table::FetchForce('team', $value);
		}
	}

; ?>
  <script>
	$(function(){
		$(".clear-look-history").click(function(){
				$.ajax({
					type: "GET",
				   url: "/ajax/history.php",
				   dataType:"html",
				   data: "r="+Math.random(),
				   success: function(msg){
						$(".look-history").html("<div class='text  COOKIE-fl'> <span>暂无浏览记录</span></div>");
					}
				});

		})
	})
</script>


<div class="" >
Ejemplo n.º 23
0
<?php

require_once dirname(__FILE__) . '/app.php';
$id = abs(intval($_GET['id']));
if (!$id || !($news = Table::FetchForce('news', $id))) {
    redirect(WEB_ROOT . '/index.php');
}
include template('news_view');
Ejemplo n.º 24
0
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
if ($_POST) {
    $userid = $_POST['userid'];
    $update['mobile'] = $_POST['mobile'];
    $user = Table::Fetch('user', $userid, 'id');
    if ($_POST['verifycode'] && $_POST['verifycode'] == $user['mobilecode']) {
        $update['mobilecode'] = 'yes';
    }
    ZUser::Modify($user['id'], $update);
    $user = Table::FetchForce('user', $userid);
    if ($user['mobilecode'] == 'yes') {
        // Session::Set('notice', '手机验证成功');
        ZLogin::Login($user['id']);
        include template('account_bindmobilesuccess');
    } else {
        Session::Set('error', '手机验证失败');
        include template('account_signmobile');
    }
}
Ejemplo n.º 25
0
<?php
require_once(dirname(__FILE__) . '/app.php');

$id = abs(intval($_GET['id']));
if (!$id || !$news = Table::FetchForce('mltad', $id) ) {
	redirect( WEB_ROOT . '/index.php');
}

include template('mltad_view');
Ejemplo n.º 26
0
$return = array();
if (!empty($coupons)) {
    foreach ($coupons as $tcoupon) {
        //$tarray = explode('@', $tcoupon);
        $coupon = Table::Fetch('coupon', $tcoupon);
        $partner = Table::Fetch('partner', $coupon['partner_id']);
        $team = Table::Fetch('team', $coupon['team_id']);
        if (!$coupon) {
            //	不存在此券
            $return[$tcoupon]['result'] = 0;
        } elseif ($team_id && $team_id != $coupon['team_id']) {
            //	不是该项目的券
            $return[$tcoupon]['result'] = -1;
        } else {
            if ($coupon['expire_time'] < strtotime(date('Y-m-d'))) {
                //	过期了
                $return[$tcoupon]['result'] = -2;
            } else {
                if ($coupon['consume'] == 'Y') {
                    //	已经验证
                    $return[$tcoupon]['result'] = 2;
                } else {
                    ZCoupon::Consume($coupon, $store_id, $partner_id);
                    $return[$tcoupon]['result'] = 1;
                }
            }
        }
        $return[$tcoupon]['coupon'] = Table::FetchForce('coupon', $tcoupon);
    }
}
echo json_encode($return);
Ejemplo n.º 27
0
Archivo: save.php Proyecto: noikiy/mdwp
<?php
/*
此程序为flash所POST的抽奖结果保存,请勿修改
*/
require_once(dirname(dirname(__FILE__)) . '/app.php');

need_login();

$id = $_POST['num'];
$teamid = $_POST['teamid'];
$v = $_POST['v'];

$daytime = strtotime(date('Y-m-d H:i:s'));

$coupon = Table::FetchForce('coupon', $id);

if (!$coupon) {
	$msg = '券号不存在!';
}else if (!empty($coupon['is_lottery'])) {
	$msg = '该'.$INI['system']['couponname'] . '已经抽过奖啦!';
}else if ( $coupon['consume'] == 'Y' ) {
	$msg = '该'.$INI['system']['couponname'] ."已消费过,不能重复使用!";
}else{
	$uarray = array( 'is_lottery' => '1', 'lottery_time' =>$daytime,  );
	Table::UpdateCache('coupon', $id, $uarray);
	
	if (!empty($v)){
			$list = array(
					'couponid' => $id,
					'teamid' => $teamid,
					'uid' => $login_user_id,
Ejemplo n.º 28
0
Archivo: team.php Proyecto: noikiy/mdwp
<?php
require_once(dirname(__FILE__) . '/app.php');

$id = abs(intval($_GET['id']));
if (!$id || !$team = Table::FetchForce('team', $id) ) {
	redirect( WEB_ROOT . '/team/index.php');
}

getRecentGoods($id);

//	查看是否已经收藏该团购
$had_collect = false;
if ($login_user_id) {
	$collect = DB::GetTableRow("collect",array('user_id'=>$login_user_id,'team_id'=>$id));
	if($collect){
		$had_collect = true;
	}
}

/* refer */
if ($_rid = strval($_GET['r'])) {
	$_rid = udecode($_rid);
	$_user = Table::Fetch('user',$_rid,'email');
	if($_user) cookieset('_rid', abs(intval($_user['id'])));
	redirect( WEB_ROOT . "/team.php?id={$id}");
}
$teamcity = Table::Fetch('category', $team['city_id']);
$city = $teamcity ? $teamcity : $city;
$city = $city ? $city : array('id'=>0, 'name'=>'全部');

$pagetitle = $team['title'];
Ejemplo n.º 29
0
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
need_partner();
$partner_id = abs(intval($_SESSION['partner_id']));
$login_partner = Table::Fetch('partner', $partner_id);
$finance_id = abs(intval($_GET['id']));
$team_id = abs(intval($_GET['t_id']));
if (!$finance_id || !($finance = Table::FetchForce('finance', $finance_id))) {
    Session::Set('error', '结算信息不存在');
    redirect(WEB_ROOT . '/manage/partner/index.php');
}
$team = Table::FetchForce('team', $team_id);
$c_con = array('partner_id' => $finance['partner_id'], 'team_id' => $team_id, 'consume' => 'Y', 'consume_time <= ' . $finance['end_time'] . ' AND consume_time > ' . $finance['begin_time']);
$c_count = Table::Count('coupon', $c_con);
//die(print_R($c_count));
list($pagesize, $offset, $pagestring) = pagestring($c_count, 50);
$coupons = DB::LimitQuery('coupon', array('condition' => $c_con, 'order' => 'ORDER BY consume_time DESC', 'size' => $pagesize, 'offset' => $offset));
$money = number_format($c_count * $team['cgj'], 2);
$team_ids = Utility::GetColumn($coupons, 'team_id');
$teams = Table::Fetch('team', $team_ids);
$user_ids = Utility::GetColumn($coupons, 'user_id');
$users = Table::Fetch('user', $user_ids);
$option_state = array('Y' => '已消费', 'N' => '未消费', 'E' => '已过期');
include template('biz_finance_con_list');