Пример #1
0
	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;
	}
Пример #2
0
 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;
 }
Пример #3
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()));
     /* cash flow */
     $order = Table::FetchForce('order', $order['id']);
     ZFlow::CreateFromStore($order['user_id'], $order['origin']);
     ZTeam::BuyOne($order);
 }
Пример #4
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);
 }
Пример #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);
	}
Пример #6
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);
 }
Пример #7
0
$remark1 = trim($_POST['remark1']);
//备注字段1
$remark2 = trim($_POST['remark2']);
//备注字段2
$v_md5str = trim($_POST['v_md5str']);
//拼凑后的MD5校验值
/* 重新计算md5的值 */
$text = "{$v_oid}{$v_pstatus}{$v_amount}{$v_moneytype}{$key}";
$md5string = strtoupper(md5($text));
/* 判断返回信息,如果支付成功,并且支付结果可信,则做进一步的处理 */
if ($v_md5str == $md5string) {
    list($_, $order_id, $city_id, $_) = explode('-', $v_oid, 4);
    if ($v_pstatus == "20") {
        /* charge */
        if ($_ == 'charge') {
            @(list($_, $user_id, $create_time, $_) = explode('-', $v_oid, 4));
            $service = 'chinabank';
            if (ZFlow::CreateFromCharge($v_amount, $user_id, $create_time, $service)) {
                Session::Set('notice', "网银在线充值{$v_amount}元成功!");
            }
            redirect(WEB_ROOT . '/credit/index.php');
        }
        /* end charge */
        $currency = 'CNY';
        $service = 'chinabank';
        $bank = mb_convert_encoding($v_pmode, 'UTF-8', 'GBK');
        ZOrder::OnlineIt($order_id, $v_oid, $v_amount, $currency, $service, $bank);
        redirect(WEB_ROOT . "/order/pay.php?id={$order_id}");
    }
}
include template('order_return_error');
Пример #8
0
    $daytime = strtotime(date('Y-m-d'));
    //判断今天是否为1、3、5、7
    $today = Utility::GetDate();
    $weeks = array('星期一', '星期三', '星期五', '星期天');
    if (in_array($today['week'], $weeks)) {
        json('今天不能签到', 'alert');
    }
    $condition = array('user_id' => $user_id, 'create_time' => $daytime);
    $have = DB::GetTableRow('daysign', $condition);
    if ($have) {
        json(array(array('type' => 'eval', 'data' => 'jQuery("#sign_info").replaceWith(\'' . '<div class="signinfo">您已经签到过了</div>\');')), 'mix');
    }
    $money = abs(strval($INI['system']['givemoney']));
    $credit = abs(strval($INI['system']['givecredit']));
    if (option_yes('givecredit')) {
        ZCredit::Create($credit, $user_id, 'daysign');
    }
    if (option_yes('givemoney')) {
        ZFlow::CreateFromDaysign($user_id, $money);
    }
    if ($money == '0' && $credit == '0') {
        json('暂未设置签到赠送值', 'alert');
    }
    $u = array('user_id' => $user_id, 'credit' => $credit, 'money' => $money, 'create_time' => $daytime);
    DB::Insert('daysign', $u);
    $today = Utility::GetDate();
    $count = Table::Count('daysign', array('user_id' => $user_id));
    $income_money = Table::Count('daysign', array('user_id' => $user_id), 'money');
    $income_credit = Table::Count('daysign', array('user_id' => $user_id), 'credit');
    json(array(array('type' => 'eval', 'data' => 'jQuery("#sign_info").replaceWith(\'' . '<div class="signinfo-tscg"><span>签到成功</span></div>' . '<div class="sign_info" id="sign_info_a"></div>\');'), array('type' => 'eval', 'data' => 'jQuery("#sign_info_a").replaceWith(\'<div class="sign_info" id="sign_info"></div>' . '<div class="signinfo-ljqd">累计签到' . $count . '次' . ' <a href="http://www.milituan.net/account/loginup.php"  target="_blank">[查看]</a></div>\');' . 'jQuery("#nowsign").replaceWith(\'<div class="havesign" id="nowsign">' . '<div class="weekday">' . $today['week'] . '</div></div>\');' . 'jQuery("#showSignTips").replaceWith(\'<div class="signtip" id="showSignTips">今日已签到</div>\');')), 'mix');
}
Пример #9
0
                    } else {
                        if ($action == 'withdraw_submit') {
                            need_auth('caiwu_dowithdraw');
                            $apply = Table::Fetch('apply', $id);
                            $user = Table::Fetch('user', $apply['user_id']);
                            $direction = strval($_GET['direction']);
                            $withdrawpay = strval($_GET['withdrawpay']);
                            $withdrawcontent = strval($_GET['c']);
                            $money = moneyit($_GET['withdrawmoney']);
                            if ($money > 0) {
                                log_admin('caiwu', $user['email'] . '充值' . $money . '元失败 - 本次操作仅限提现');
                                json('充值失败 - 本次操作仅限提现', 'alert');
                            } elseif ($money < 0 && $user['money'] + $money < 0) {
                                json('提现失败 - 用户余额不足', 'alert');
                            }
                            Table::UpdateCache('apply', $id, array('direction' => 'yuanlu', 'withdraw_direction' => $direction, 'withdrawpay' => $withdrawpay, 'content' => $withdrawcontent, 'done_time' => time(), 'admin_name' => $login_user['realname'], 'admin_id' => $login_user_id));
                            if (ZFlow::CreateFromStore($apply['user_id'], $money)) {
                                Table::UpdateCache('apply', $id, array('status' => 'be', 'done_time' => time(), 'admin_name' => $login_user['realname'], 'admin_id' => $login_user_id));
                                log_admin('caiwu', '[提现申请]' . $user['username'] . '提现' . $money . '元');
                                if (option_yes('chongtisms')) {
                                    sms_withdraw($id);
                                }
                                json(array(array('data' => "用户提现{$money}元成功", 'type' => 'alert'), array('data' => null, 'type' => 'refresh')), 'mix');
                            }
                        }
                    }
                }
            }
        }
    }
}
Пример #10
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/app.php';
$key = $INI['tenpay']['sec'];
$resHandler = new PayResponseHandler();
$resHandler->setKey($key);
if ($resHandler->isTenpaySign()) {
    $v_oid = $resHandler->getParameter("sp_billno");
    $v_amount = moneyit($resHandler->getParameter("total_fee") * 0.01);
    $pay_result = $resHandler->getParameter("pay_result");
    list($_, $order_id, $city_id, $_) = explode('-', $v_oid, 4);
    if ("0" == $pay_result) {
        /* charge */
        if ($_ == 'charge') {
            @(list($_, $user_id, $create_time, $_) = explode('-', $v_oid, 4));
            if (ZFlow::CreateFromCharge($v_amount, $user_id, $create_time, 'tenpay')) {
                Session::Set('notice', "财付通充值{$v_amount}元成功!");
            }
            redirect(WEB_ROOT . '/credit/index.php');
        }
        /* end charge */
        $currency = 'CNY';
        $service = 'tenpay';
        $bank = '财付通';
        ZOrder::OnlineIt($order_id, $v_oid, $v_amount, $currency, $service, $bank);
        $show = WEB_ROOT . "/order/pay.php?id={$order_id}";
        $resHandler->doShow($show);
        die(0);
    }
}
include template('order_return_error');
Пример #11
0
        }
        $card = DB::GetTableRow('mcard', array('card_no' => $card_no));
        if (empty($card)) {
            DB::Update('card_log', $log_id, array('result' => '卡号信息不存在'));
            echo "done=false#result=卡号信息不存在";
            die;
        }
        $user = Table::Fetch('user', $card['user_id']);
        //	验证密码
        if ($card['pay_password'] != md5($paypassword)) {
            DB::Update('card_log', $log_id, array('result' => '支付密码不正确'));
            echo "done=false#result=支付密码不正确";
            die;
        } else {
            if ($money > $user['money']) {
                DB::Update('card_log', $log_id, array('result' => '余额不足'));
                echo "done=false#result=余额不足";
                die;
            }
        }
        if (ZFlow::CreateFromPOS($user['id'], $money)) {
            $money = abs($money);
            //	new
            $arr = array('bizer_id' => $store['id'], 'type' => 'mobile', 'user_id' => $card['user_id'], 'state' => 0, 'create_time' => time(), 'money' => $money);
            DB::Insert('mcard_order', $arr);
            DB::Update('card_log', $log_id, array('result' => '消费成功'));
        }
        echo "done=true#result=ok";
        die;
    }
}
Пример #12
0
             redirect(WEB_ROOT . '/credit/index.php');
         }
         /* end charge */
         $currency = 'CNY';
         $service = 'yeepay';
         $bank = '易宝';
         ZOrder::OnlineIt($order_id, $r6_Order, $r3_Amt, $currency, $service, $bank);
         redirect(WEB_ROOT . "/order/pay.php?id={$order_id}");
     } else {
         if ($r9_BType == "2") {
             //如果需要应答机制则必须回写流,以success开头,大小写不敏感.
             /* charge */
             if ($_ == 'charge') {
                 @(list($_, $order_id, $create_time, $_) = explode('-', $r6_Order, 4));
                 $service = 'yeepay';
                 if (ZFlow::CreateFromCharge($r3_Amt, $order_id, $create_time, $service)) {
                     Session::Set('notice', "在线充值{$v_amount}元成功!");
                 }
                 redirect(WEB_ROOT . '/credit/index.php');
             }
             /* end charge */
             $currency = 'CNY';
             $service = 'yeepay';
             $bank = '易宝';
             ZOrder::OnlineIt($order_id, $r6_Order, $r3_Amt, $currency, $service, $bank);
             //redirect(WEB_ROOT . "/order/pay.php?id={$order_id}");
             ob_end_clean();
             die('SUCCESS');
         }
     }
 }
Пример #13
0
$v_moneytype = trim($_POST['v_moneytype']); //订单实际支付币种    
$remark1   = trim($_POST['remark1' ]);      //备注字段1
$remark2   = trim($_POST['remark2' ]);     //备注字段2
$v_md5str  = trim($_POST['v_md5str' ]);   //拼凑后的MD5校验值  

/* 重新计算md5的值 */
$text = "{$v_oid}{$v_pstatus}{$v_amount}{$v_moneytype}{$key}";
$md5string = strtoupper(md5($text));

/* 判断返回信息,如果支付成功,并且支付结果可信,则做进一步的处理 */
if ($v_md5str == $md5string) {
	list($_, $order_id, $city_id, $_) = explode('-', $v_oid, 4);
	if($v_pstatus=="20") {

		/* charge */
		if ( $_ == 'charge' ) {
			@list($_, $user_id, $create_time, $_) = explode('-', $v_oid, 4);
			ZFlow::CreateFromCharge($v_amount, $user_id, $create_time, 'chinabank');
			die('ok');
		}
		/* end charge */
		$currency = 'CNY';
		$service = 'chinabank';
		$bank = mb_convert_encoding($v_pmode,'UTF-8','GBK');
		ZOrder::OnlineIt($order_id, $v_oid, $v_amount, $currency, $service, $bank);
		die('ok');
	} 
}
die('error');
?>
Пример #14
0
// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
if (eregi("VERIFIED", $result)) {
    $out_trade_no = $item_number;
    $total_fee = $payment_amount;
    @(list($_, $order_id, $city_id, $_) = explode('-', $out_trade_no, 4));
    if ($_ == 'charge') {
        @(list($_, $user_id, $create_time, $_) = explode('-', $out_trade_no, 4));
        ZFlow::CreateFromCharge($total_fee, $user_id, $create_time, 'paypal');
    } else {
        $currency = $payment_currency;
        $service = 'paypal';
        $bank = 'PayPal';
        ZOrder::OnlineIt($order_id, $out_trade_no, $total_fee, $currency, $service, $bank);
    }
}
function fsockPost($url, $data)
{
    //Parse url
    $web = parse_url($url);
    //build post string
    foreach ($data as $i => $v) {
        $postdata .= $i . "=" . urlencode($v) . "&";
    }
Пример #15
0
$signData = $merchantId . $payNo . $requestId . $returnCode . $message . $sigTyp . $type . $version . $amount . $banks . $contractName . $invoiceTitle . $mobile . $orderId . $payDate . $reserved . $status;
// if($version == "1.0.1")
$signData = $merchantId . $payNo . $requestId . $returnCode . $message . $sigTyp . $type . $version . $amount . $banks . $contractName . $invoiceTitle . $mobile . $orderId . $payDate . $reserved . $status . $amtItem;
$hash = hmac("", $signData);
$newhmac = hmac($signKey, $hash);
RecordLog("YGM", "###hmac" . $hmac . "###");
RecordLog("YGM", "###newhmac" . $newhmac . "###");
@(list($_, $order_id, $city_id, $_) = explode('-', $orderId, 4));
if (Table::Fetch('pay', $orderId)) {
    die('SUCCESS');
}
$v_amount = $amount / 100;
if ($_ == 'charge') {
    if ($newhmac == $hmac) {
        @(list($_, $user_id, $create_time, $_) = explode('-', $orderId, 4));
        ZFlow::CreateFromCharge($v_amount, $user_id, $create_time, 'cmpay');
        // 记录日志
        RecordMyLog("流水号:" . $payNo);
        RecordMyLog("支付金额:" . $amount);
        RecordMyLog("金额明细:" . $amtItem);
        RecordMyLog("支付银行:" . $banks);
        RecordMyLog("送货信息:" . $contractName);
        RecordMyLog("发票抬头:" . $invoiceTitle);
        RecordMyLog("支付人:" . $mobile);
        RecordMyLog("支付时间:" . $payDate);
        RecordMyLog("保留字段:" . $reserved);
        RecordMyLog("支付结果:" . $status);
    }
    die("SUCCESS");
}
if ($newhmac == $hmac) {
Пример #16
0
Файл: dp.php Проект: noikiy/mdwp
	}else{
		//已消费的券
		$coupon_consume_list=DB::LimitQuery('coupon',array(
					'condition'=>array('order_id'=>$order_id,'consume'=>'Y'),
					'order'=>' order by create_time '
			));
		//判断是否已消费一张以上券
		if(count($coupon_consume_list)>=1){
			$insert_id = DB::Insert("order_dp",$dp_arr);
			$isdptrue=1;
			//判断是否消费后七天之内点评
			$timeup=-$coupon_consume_list[0]['create_time'];
			if($timeup<=(7*24*60*60)){
				//点评之后消费返利
				foreach ($coupon_consume_list as $coupon) {
					ZFlow::CreateFromCoupon($coupon);
				}
				DB::Update("order_dp",$insert_id,array('has_return'=>1));
			}
		}
	}
	if($isdptrue){
		//	更新
		DB::Delete("order_dp_item",array('order_id'=>$order_id));
		foreach($scoreList as $key=>$score){
			$arr = array(
					'score'=>$score,
					'tpl_item_id'=>$key,
					'order_id'=>$order_id,
					'score'=>$score,
			);
Пример #17
0
$signString = $amount . "|" . $payamount . "|" . $orderid . "|" . $serialno . "|" . $status . "|" . $merid . "|" . $paychannel . "|" . $discount . "|" . $signtype . "|" . $paytime . "|" . $ctype . "|" . $prono . "|" . $prodesc . "|" . $remark1 . "|" . $remark2 . "|" . $ex;
if ($signtype == "2") {
    $md5key = $INI['sdopay']['sec'];
    $mac2 = md5($signString . "|" . $md5key);
    $ok = strtoupper($mac) == strtoupper($mac2);
}
@(list($_, $order_id, $city_id, $_) = explode('-', $orderid, 4));
if (Table::Fetch('pay', $orderid)) {
    die('OK');
}
//echo $order_id;
//exit;
if ($_ == 'charge') {
    if ($ok == 1) {
        @(list($_, $user_id, $create_time, $_) = explode('-', $orderid, 4));
        ZFlow::CreateFromCharge($amount, $user_id, $create_time, 'sdopay', $serialno);
        die("OK");
        //必须输出且只能输出"OK"
    }
}
if ($ok == 1) {
    $currency = 'CNY';
    $service = 'sdopay';
    $bank = '盛付通';
    ZOrder::OnlineIt($order_id, $orderid, $amount, $currency, $service, $bank, $serialno);
    die('OK');
    //必须输出且只能输出"OK"
} elseif ($ok == 0) {
    die('bad');
} else {
    die('ugly, error checking signature');
Пример #18
0
$transport = 'http';
/* very import, this value is add by my phpframewrok */
unset($_GET['param']);
/* end */
$alipay = new AlipayNotify($partner, $security_code, $sign_type, $_input_charset, $transport);
$verify_result = $alipay->return_verify();
$out_trade_no = $_GET['out_trade_no'];
//获取订单号
$total_fee = $_GET['total_fee'];
//获取总价格
@(list($_, $order_id, $city_id, $_) = explode('-', $out_trade_no, 4));
if ($_ == 'charge') {
    if ($verify_result) {
        if ($_GET['trade_status'] == 'TRADE_FINISHED' || $_GET['trade_status'] == 'TRADE_SUCCESS') {
            @(list($_, $user_id, $create_time, $_) = explode('-', $out_trade_no, 4));
            if (ZFlow::CreateFromCharge($total_fee, $user_id, $create_time, 'alipay')) {
                Session::Set('notice', "支付宝充值{$total_fee}元成功!");
            }
        }
    }
    redirect(WEB_ROOT . '/credit/index.php');
}
if ($verify_result) {
    if ($_GET['trade_status'] == 'TRADE_FINISHED' || $_GET['trade_status'] == 'TRADE_SUCCESS') {
        $currency = 'CNY';
        $service = 'alipay';
        $bank = '支付宝';
        ZOrder::OnlineIt($order_id, $out_trade_no, $total_fee, $currency, $service, $bank);
        redirect(WEB_ROOT . "/order/pay.php?id={$order_id}");
    } else {
        if ($_GET['trade_status'] == 'WAIT_SELLER_SEND_GOODS') {
Пример #19
0
<div id="order-pay-dialog" class="order-pay-dialog-c" style="width:680px;">
	<h3><span id="order-pay-dialog-close" class="close" onclick="return X.boxClose();">关闭</span>用户资金流水记录</h3>
	<div style="height:500px; overflow-y:scroll;overflow-x:hidden;">
	<table width="94%" class="coupons-table">
		<tr>
		<th width="150">时间</th>
		<th>详情</th>
		<th width="80">收支</th>
		<th width="80">金额</th>
		</tr>
	<?php if(is_array($flows)){foreach($flows AS $index=>$one) { ?>
		<tr <?php echo $index%2?'':'class="alt"'; ?>>
		<td><?php echo date('Y-m-d H:i', $one['create_time']); ?></td>
		<td valign="middle"><?php echo ZFlow::Explain($one); ?></td>
		<td><?php echo $one['direction']=='income'?'收入':'支出'; ?></td>
		<td valign="middle"><?php echo moneyit($one['money']); ?></td>
		</tr>
	<?php }}?>
	</table>
	</div>
</div>
Пример #20
0
     $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);
                 Session::Set('notice', "邮件地址:{$subscribe['email']}退订成功");
Пример #21
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/app.php';
if ($_POST) {
    need_login(true);
    $gift_card = Table::Fetch('gift_card', $_POST['code'], 'code');
    if (!$gift_card || $gift_card['status'] == 'used') {
        Session::Set('error', 'Gift code is not valid.');
        Utility::Redirect($_SERVER['HTTP_REFERER']);
    }
    $money = $gift_card['amount'];
    if (ZFlow::CreateFromStore($login_user_id, $money)) {
        $table = new Table('gift_card', $gift_card);
        $update_array = array('redeem_time', 'status');
        $table->redeem_time = time();
        $table->status = 'used';
        $flag = $table->update($update_array);
        Session::Set('notice', 'Your account is updated.');
        Utility::Redirect($_SERVER['HTTP_REFERER']);
    }
}
Пример #22
0
require_once dirname(dirname(dirname(__FILE__))) . '/app.php';
require_once dirname(dirname(dirname(__FILE__))) . "/cplatform/service/PayService.php";
$_input_charset = 'utf-8';
$partner = $INI['alipay']['mid'];
$security_code = $INI['alipay']['sec'];
$sign_type = 'MD5';
$transport = 'http';
$alipay = new AlipayNotify($partner, $security_code, $sign_type, $_input_charset, $transport);
$verify_result = $alipay->notify_verify();
$out_trade_no = $_POST['out_trade_no'];
$total_fee = $_POST['total_fee'];
@(list($_, $order_id, $quantity, $_) = explode('-', $out_trade_no, 4));
if ($_ == 'charge') {
    if ($_POST['trade_status'] == 'TRADE_FINISHED' || $_POST['trade_status'] == 'TRADE_SUCCESS') {
        @(list($_, $user_id, $create_time, $_) = explode('-', $out_trade_no, 4));
        if (ZFlow::CreateFromCharge($total_fee, $user_id, $create_time, 'chinabank')) {
            Phplog::RecordChargeLog("网银充值{$total_fee}元成功!支付订单号:{$out_trade_no}");
        }
    }
    die('success');
}
if ($verify_result) {
    if ($_POST['trade_status'] == 'TRADE_FINISHED' || $_POST['trade_status'] == 'TRADE_SUCCESS') {
        $order = Table::Fetch('order', $order_id);
        if (!$order) {
            Phplog::RecordOrderFailLog(" 订单不存在 团购订单号:" . $order_id);
            die("success");
        }
        $is_ok = false;
        if ($order['state'] == 'unpay') {
            //查找团购
Пример #23
0
				                </tr>

					            <?php if(is_array($flows)){foreach($flows AS $index=>$one) { ?>

					            <tr >

					              <td height="30" align="left" class="b-bottom"><div class="orderid"><?php echo date('Y-m-d H:i', $one['create_time']); ?></div></td>

					              <td valign="middle" class="b-bottom"><div class="xq">

					                <table border="0" cellpadding="0" cellspacing="0">

					                  <tr>

					                    <td height="40" colspan="3" valign="middle" class="c666" ><?php echo ZFlow::Explain($one); ?></td>

				                      </tr>

				                    </table>

					              </div></td>

					              <td align="center"  class="<?php echo $one['direction']; ?> b-bottom del-b"><?php echo $one['direction']=='income'?'收入':'支出'; ?></td>

					              <td align="center" class="<?php echo $one['direction']; ?> b-bottom del-b" ><?php echo moneyit($one['money']); ?></td>

	                  </tr>

					            <?php }}?>
Пример #24
0
$sign_type = 'MD5';
$transport = 'http';
$alipay = new AlipayNotify($partner, $security_code, $sign_type, $_input_charset, $transport);
$verify_result = $alipay->notify_verify();
$out_trade_no = $_POST['out_trade_no'];
$trade_no = strval($_POST['trade_no']);
$total_fee = $_POST['total_fee'];
@(list($_, $order_id, $city_id, $_) = explode('-', $out_trade_no, 4));
if (Table::Fetch('pay', $out_trade_no)) {
    die('success');
}
if ($_ == 'charge') {
    if ($verify_result) {
        if ($_POST['trade_status'] == 'TRADE_FINISHED' || $_POST['trade_status'] == 'TRADE_SUCCESS') {
            @(list($_, $user_id, $create_time, $_) = explode('-', $out_trade_no, 4));
            ZFlow::CreateFromCharge($total_fee, $user_id, $create_time, 'alipay', $trade_no);
        }
    }
    die('success');
}
if ($verify_result) {
    //$guarantee = strtoupper($INI['alipay']['guarantee']) == 'Y';
    $guaranteewait = strtoupper($INI['alipay']['guaranteesuccess']) == 'N';
    $guarantee = $guaranteewait && $_POST['trade_status'] == 'WAIT_SELLER_SEND_GOODS';
    if ($_POST['trade_status'] == 'TRADE_FINISHED' || $_POST['trade_status'] == 'TRADE_SUCCESS' || $guarantee) {
        $currency = 'CNY';
        $service = 'alipay';
        $bank = '支付宝';
        ZOrder::OnlineIt($order_id, $out_trade_no, $total_fee, $currency, $service, $bank, $trade_no);
        die('success');
    }
Пример #25
0
     return false;
 }
 $cids = explode(',', $cid);
 $order = Table::Fetch('order', $id);
 if ($order['card_id']) {
     Table::UpdateCache('order', $order['id'], array('rstate' => 'norefund'));
     json(array(array('data' => '该订单为使用代金券订单,不支持分券退款!', 'type' => 'alert'), array('data' => 'X.boxClose();', 'type' => 'eval'), array('data' => 'null', 'type' => 'refresh')), 'mix');
 }
 if ($rid == 'norefund') {
     Table::UpdateCache('order', $order['id'], array('rstate' => 'norefund'));
     json(array(array('data' => '设置成功,该申请未通过!', 'type' => 'alert'), array('data' => 'X.boxClose();', 'type' => 'eval'), array('data' => 'null', 'type' => 'refresh')), 'mix');
 } else {
     if ($rid == 'credit') {
         ZFlow::CouponRefund($order, $cids);
     } else {
         ZFlow::CouponOtherRefund($order, $cids);
     }
 }
 /* team -- */
 $team = Table::Fetch('team', $order['team_id']);
 team_state($team);
 if ($team['state'] != 'failure') {
     $minus = $team['conduser'] == 'Y' ? 1 : count($cids);
     Table::UpdateCache('team', $team['id'], array('now_number' => array("now_number - {$minus}")));
 }
 /* coupons delete*/
 foreach ($cids as $key => $value) {
     Table::Delete('coupon', $value);
 }
 Session::Set('notice', '退款成功');
 json(null, 'refresh');
Пример #26
0
$isLocked = $_REQUEST["isLocked"];
$feeAmt = $_REQUEST["feeAmt"];
$respCode = $_REQUEST["respCode"];
$VerficationCode = $INI['gopay']['code'];
$signValue = $_REQUEST["signValue"];
$orderId = preg_replace('/_/', '-', $merOrderNum);
$str = "tranCode=[{$tranCode}]merchantID=[{$merchantID}]merOrderNum=[{$merOrderNum}]tranAmt=[{$tranAmt}]ticketAmt=[{$ticketAmt}]tranDateTime=[{$tranDateTime}]currencyType=[{$currencyType}]merURL=[{$merURL}]customerEMail=[{$customerEMail}]authID=[{$authID}]orgOrderNum=[{$orgOrderNum}]orgtranDateTime=[{$orgtranDateTime}]orgtranAmt=[{$orgtranAmt}]orgTxnType=[{$orgTxnType}]orgTxnStat=[{$orgTxnStat}]msgExt=[{$msgExt}]virCardNo=[{$virCardNo}]virCardNoIn=[{$virCardNoIn}]tranIP=[{$tranIP}]isLocked=[{$isLocked}]feeAmt=[{$feeAmt}]respCode=[{$respCode}]VerficationCode=[{$VerficationCode}]";
$newSign = MD5($str);
@(list($_, $order_id, $city_id, $_) = explode('-', $orderId, 4));
if (Table::Fetch('pay', $orderId)) {
    die('SUCCESS');
}
if ($newSign == $signValue && $respCode == '0000') {
    /* charge */
    if ($_ == 'charge') {
        @(list($_, $user_id, $create_time, $_) = explode('-', $orderId, 4));
        ZFlow::CreateFromCharge($tranAmt, $user_id, $create_time, 'gopay', $tranCode);
        Session::Set('notice', "国付宝充值{$tranAmt}元成功!");
        redirect(WEB_ROOT . '/credit/index.php');
        die('success');
    }
    /* end charge */
    $currency = 'CNY';
    $service = 'gopay';
    $bank = '国付宝';
    ZOrder::OnlineIt($order_id, $orderId, $tranAmt, $currency, $service, $bank, $tranCode);
    //Session::Set('notice', "购买成功!");
    redirect(WEB_ROOT . "/order/pay.php?id={$order_id}");
    die('success');
}
include template('order_return_error');
Пример #27
0
    }
    /* remove order */
    $orders = Table::Fetch('order', array($id), 'team_id');
    foreach ($orders as $one) {
        Table::Delete('order', $one['id']);
    }
    /* end */
    Session::Set('notice', "团购 {$team['product']} 删除成功!");
    json(null, 'refresh');
} elseif ('orderrefund' == $action) {
    $order = Table::Fetch('order', $id);
    $team = Table::Fetch('team', $order['team_id']);
    need_auth($team['partner_id'] == $partner_id);
    $rid = strtolower(strval($_GET['rid']));
    if ($rid == 'credit') {
        ZFlow::CreateFromRefund($order);
    } else {
        Table::UpdateCache('order', $id, array('service' => 'cash', 'state' => 'unpay'));
    }
    /* team -- */
    $team = Table::Fetch('team', $order['team_id']);
    team_state($team);
    if ($team['state'] != 'failure') {
        $minus = $team['conduser'] == 'Y' ? 1 : $order['quantity'];
        Table::UpdateCache('team', $team['id'], array('now_number' => array("now_number - {$minus}")));
    }
    /* card refund */
    if ($order['card_id']) {
        Table::UpdateCache('card', $order['card_id'], array('consume' => 'N', 'team_id' => 0, 'order_id' => 0));
    }
    /* coupons */