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); }
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); }
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); }
//查找用户 $user = Table::Fetch('user', $order["user_id"], 'id'); $order_type = '3'; //更新支付状态 PayService::afterPayDoSomething($team, $order, $user, $area, $out_trade_no, $order_type); Phplog::RecordOrderSuccessLog(" 流水号:" . $_POST['trade_no'] . " 通知id:" . $_POST['notify_id'] . " 团购订单号:" . $order_id . " 支付金额:" . $total_fee . " 通知时间时间:" . $_POST['notify_time']); $is_ok = true; } else { Phplog::RecordOrderFailLog(" 流水号:" . $payNo . " 团购订单号:" . $orderId . " 支付金额:" . $amount . " 支付银行:" . $banks . " 送货信息:" . $contractName . " 发票抬头:" . $invoiceTitle . " 支付人:" . $mobile . " 支付时间:" . $payDate . " 保留字段:" . $reserved); } } $team = Table::Fetch('team', $order['team_id'], 'id'); //团购结束或者数量已经卖完关闭没有完成支付的订单 if ($team['end_time'] < time() || $team['max_number'] > 0 && $team['now_number'] >= $team['max_number']) { //关闭没有完成支付的订单 ZTeam::CloseTrade($order['team_id']); //将团购权重置为0 Table::UpdateCache('team', $order['team_id'], array('sort' => 0)); } if ($is_ok) { if ($sso_login_type == "baidu" || $_COOKIE['hao123_tn'] && $_COOKIE['hao123_baiduid']) { $partner = Table::Fetch('partner', $team['partner_id']); //hao123 baidu api 这个接口要放到最后,因为有重定义加载方法 require_once DIR_LIBARAY . "/hao123OpenApi/BaiduOpenAPI.inc.php"; customSaveOrder($order, $team, $partner, $sso_login_type, $_COOKIE['hao123_baiduid'], $_COOKIE['hao123_tn']); } } die("success"); } } echo "fail";
$clear++; } else { $unclear++; } } json("操作成功,清空缓存文件{$clear}个,未清空{$unclear}个", 'alert'); } elseif ('teamauditno' == $action) { need_auth('team'); $team = Table::Fetch('team', $id); ZTeam::AuditTeam($id, 0); Session::Set('notice', "团购 {$id} 取消审核成功!"); json(null, 'refresh'); } elseif ('teamaudityes' == $action) { need_auth('team'); $team = Table::Fetch('team', $id); ZTeam::AuditTeam($id, 1); Session::Set('notice', "团购 {$id} 审核成功!"); json(null, 'refresh'); } elseif ('partnerauthenticateyes' == $action) { $partner = Table::Fetch('partner', $id); $auth = $partner['authenticate'] == 0 ? 1 : 0; Table::UpdateCache('partner', $id, array('authenticate' => $auth)); $tip = $auth ? '设置商户认证成功' : '取消商户认证成功'; Session::Set('notice', $tip); json(null, 'refresh'); } else { if ('changenownumber' == $action) { $team = Table::Fetch('team', $id); $html = render('manage_ajax_dialog_changenownumber'); json($html, 'dialog'); } else {
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'));
/* teamcoupon */ $team['teamcoupon'] = $team['noticesms'] && $buycount > $couponcount; $team['needline'] = $team['noticesms'] || $team['noticesubscribe'] || $team['teamcoupon']; /* 处理多城市id */ $team['city_ids'] = array_filter(explode('@', $team['city_ids'])); $html = render('manage_ajax_dialog_teamdetail'); json($html, 'dialog'); } else { if ('teamremove' == $action) { need_rbac_auth('team_delete', true); $team = Table::Fetch('team', $id); $order_count = Table::Count('order', array('team_id' => $id, 'state' => 'pay')); if ($order_count > 0) { json('本团购包含付款订单,不能删除', 'alert'); } ZTeam::DeleteTeam($id); /* remove coupon */ $coupons = Table::Fetch('coupon', array($id), 'team_id'); foreach ($coupons as $one) { Table::Delete('coupon', $one['id']); } /* remove order */ $orders = Table::Fetch('order', array($id), 'team_id'); foreach ($orders as $one) { Table::Delete('order', $one['id']); } /* end */ Session::Set('notice', "团购 {$id} 删除成功!"); json(null, 'refresh'); } else { if ('cardremove' == $action) {