function order_paid($v_oid) { global $db, $timestamp, $_CFG; $order = $db->getone("select * from " . table('order') . " WHERE oid ='{$v_oid}' AND is_paid= '1' LIMIT 1 "); //判断是否支付完成(防止支付完立即关闭页面 从而导致未开通服务) if (intval($order['is_paid']) == 1) { $sql = "UPDATE " . table('order') . " SET is_paid= '2',payment_time='{$timestamp}' WHERE oid='{$v_oid}' LIMIT 1 "; if (!$db->query($sql)) { return false; } //套餐、积分支付 if ($order['pay_type'] == '1' || $order['pay_type'] == '4') { $order_name = "套餐积分订单"; $user = get_user_info($order['uid']); if ($order['amount'] == '0.00') { $ismoney = 1; } else { $ismoney = 2; } if ($order['points'] > 0) { report_deal($order['uid'], 1, $order['points']); $user_points = get_user_points($order['uid']); $notes = date('Y-m-d H:i', time()) . "通过:" . get_payment_info($order['payment_name'], true) . " 成功充值 " . $order['amount'] . "元,(+{$order['points']}),(剩余:{$user_points}),订单:{$v_oid}"; write_memberslog($order['uid'], 1, 9001, $user['username'], $notes); //会员套餐变更记录。会员购买成功。2表示:会员自己购买 write_setmeallog($order['uid'], $user['username'], $notes, 2, $order['amount'], $ismoney, 1); } elseif ($order['setmeal'] > 0) { set_members_setmeal($order['uid'], $order['setmeal']); $setmeal = get_setmeal_one($order['setmeal']); $notes = date('Y-m-d H:i', time()) . "通过:" . get_payment_info($order['payment_name'], true) . " 成功充值 " . $order['amount'] . "元并开通{$setmeal['setmeal_name']}"; write_memberslog($order['uid'], 1, 9002, $user['username'], $notes); //会员套餐变更记录。会员购买成功。2表示:会员自己购买 write_setmeallog($order['uid'], $user['username'], $notes, 2, $order['amount'], $ismoney, 2, 1); } } elseif ($order['pay_type'] == '2') { $order_name = "广告位订单"; write_memberslog($_SESSION['uid'], 1, 9001, $_SESSION['username'], "申请广告位:<strong>{$order['description']}</strong>,(花费: {$order['amount']})。", 1, 1020, "申请广告位", "-{$order['amount']}", "{$user_points}"); } elseif ($order['pay_type'] == '3') { $order_name = "短信套餐订单"; $user = get_user_info($order['uid']); if ($order['setmeal'] > 0) { //查看短信套餐 set_members_sms($order['uid'], intval($order['setmeal'])); //支付成功,向用户增加短信条数 $user_points = get_user_setmeal($order['uid']); write_memberslog($_SESSION['uid'], 1, 9003, $_SESSION['username'], "短信充值套餐:<strong>{$order['description']}</strong>,(- {$order['amount']}),(剩余:{$user_points['set_sms']})", 1, 1020, "申请广告位", "- {$order['amount']}", "{$user_points['set_sms']}"); } } //sendemail $mailconfig = get_cache('mailconfig'); if ($mailconfig['set_payment'] == "1" && $user['email_audit'] == "1" && $order['amount'] > 0) { dfopen("{$_CFG['site_domain']}{$_CFG['site_dir']}plus/asyn_mail.php?uid={$order['uid']}&key=" . asyn_userkey($order['uid']) . "&act=set_payment"); } //sms $sms = get_cache('sms_config'); if ($sms['open'] == "1" && $sms['set_payment'] == "1" && $user['mobile_audit'] == "1" && $order['amount'] > 0) { dfopen("{$_CFG['site_domain']}{$_CFG['site_dir']}plus/asyn_sms.php?uid={$order['uid']}&key=" . asyn_userkey($order['uid']) . "&act=set_payment"); } //微信通知 set_payment($order['uid'], $order_name, $order['oid'], $order['amount']); return true; } else { return true; } }
function adv_order_paid($v_oid) { global $db, $timestamp, $_CFG; $order = $db->getone("select * from " . table('adv_order') . " WHERE oid ='{$v_oid}' AND is_paid= '1' LIMIT 1 "); if ($order) { $user = get_adv_user($order['uid']); $sql = "UPDATE " . table('adv_order') . " SET is_paid= '2',payment_time='{$timestamp}' WHERE oid='{$v_oid}' LIMIT 1 "; if (!$db->query($sql)) { return false; } //填写管理员日志 write_log("后台开通订单", $_SESSION['admin_name'], 3); //发送邮件 $mailconfig = get_cache('mailconfig'); if ($mailconfig['set_payment'] == "1" && $user['email_audit'] == "1") { dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_mail.php?uid=" . $order['uid'] . "&key=" . asyn_userkey($order['uid']) . "&act=set_payment"); } //发送邮件完毕 //sms $sms = get_cache('sms_config'); if ($sms['open'] == "1" && $sms['set_payment'] == "1" && $user['mobile_audit'] == "1") { dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_sms.php?uid=" . $order['uid'] . "&key=" . asyn_userkey($order['uid']) . "&act=set_payment"); } //微信通知 set_payment($order['uid'], "广告订单", $order['oid'], $order['amount']); return true; } return true; }
function order_paid($v_oid) { global $db, $timestamp, $_CFG; $order = $db->getone("select * from " . table('order') . " WHERE oid ='{$v_oid}' AND is_paid= '1' LIMIT 1 "); if ($order['pay_type'] == '1' || $order['pay_type'] == '4') { $order_name = "套餐积分订单"; $user = get_user($order['uid']); $sql = "UPDATE " . table('order') . " SET is_paid= '2',payment_time='{$timestamp}' WHERE oid='{$v_oid}' LIMIT 1 "; if (!$db->query($sql)) { return false; } if ($order['amount'] == '0.00') { $ismoney = 1; } else { $ismoney = 2; } if ($order['points'] > 0) { report_deal($order['uid'], 1, $order['points']); $user_points = get_user_points($order['uid']); $notes = "操作人:{$_SESSION['admin_name']},说明:确认收款。收款金额:{$order['amount']} 。" . date('Y-m-d H:i', time()) . "通过:" . get_payment_info($order['payment_name'], true) . " 成功充值 " . $order['amount'] . "元,(+{$order['points']}),(剩余:{$user_points}),订单:{$v_oid}"; write_memberslog($order['uid'], 1, 9001, $user['username'], $notes); //会员套餐变更记录。管理员后台设置会员订单购买成功。4表示:管理员后台开通 write_setmeallog($order['uid'], $user['username'], $notes, 4, $order['amount'], $ismoney, 1, 1); } if ($order['setmeal'] > 0) { set_members_setmeal($order['uid'], $order['setmeal']); $setmeal = get_setmeal_one($order['setmeal']); $notes = "操作人:{$_SESSION['admin_name']},说明:确认收款,收款金额:{$order['amount']} 。" . date('Y-m-d H:i', time()) . "通过:" . get_payment_info($order['payment_name'], true) . " 成功充值 " . $order['amount'] . "元并开通{$setmeal['setmeal_name']}"; write_memberslog($order['uid'], 1, 9002, $user['username'], $notes); //会员套餐变更记录。管理员后台设置会员订单购买成功。4表示:管理员后台开通 write_setmeallog($order['uid'], $user['username'], $notes, 4, $order['amount'], $ismoney, 2, 1); } } elseif ($order['pay_type'] == '2') { $order_name = "广告位订单"; $sql = "UPDATE " . table('order') . " SET is_paid= '2',payment_time='{$timestamp}' WHERE oid='{$v_oid}' LIMIT 1 "; //is_paid =2 为确定支付 if (!$db->query($sql)) { return false; } write_memberslog($_SESSION['uid'], 1, 9001, $_SESSION['username'], "申请广告位:<strong>{$order['description']}</strong>,(花费: {$order['amount']})。", 1, 1020, "申请广告位", "-{$order['amount']}", "{$user_points}"); } elseif ($order['pay_type'] == '3') { $order_name = "短信订单"; $user = get_user($order['uid']); $sql = "UPDATE " . table('order') . " SET is_paid= '2',payment_time='{$timestamp}' WHERE oid='{$v_oid}' LIMIT 1 "; if (!$db->query($sql)) { return false; } if ($order['setmeal'] > 0) { //查看短信套餐 set_members_sms($order['uid'], intval($order['setmeal'])); //支付成功,向用户增加短信条数 $user_points = get_user_setmeal($order['uid']); write_memberslog($_SESSION['uid'], 1, 9003, $_SESSION['username'], "短信充值套餐:<strong>{$order['description']}</strong>,(- {$order['amount']}),(剩余:{$user_points['set_sms']})", 1, 1020, "申请广告位", "- {$order['amount']}", "{$user_points['set_sms']}"); } } elseif ($order['pay_type'] == '7') { if ($order['amount'] == '0.00') { $ismoney = 1; } else { $ismoney = 2; } balance_deal($order['uid'], 1, $order['amount']); $user_balance = get_user_balance($order['uid']); $sql = "UPDATE " . table('order') . " SET is_paid= '2',payment_time='{$timestamp}' WHERE oid='{$v_oid}' LIMIT 1 "; //is_paid =2 为确定支付 if (!$db->query($sql)) { return false; } $note = "余额充值:<strong>{$order['description']}</strong>,(: {$order['amount']})。当前余额为:{$user_balance}"; write_memberslog($_SESSION['uid'], 1, 9101, $_SESSION['username'], $note, 4, $order['amount'], $ismoney, 1, 1); } elseif ($order['pay_type'] == '9') { if ($order['amount'] == '0.00') { $ismoney = 1; } else { $ismoney = 2; } if (get_user_can_balance($order['uid']) < $order['amount']) { adminmsg('余额不足', 1); return false; } balance_deal($order['uid'], 2, $order['amount']); $user_balance = get_user_balance($order['uid']); $sql = "UPDATE " . table('order') . " SET is_paid= '2',payment_time='{$timestamp}' WHERE oid='{$v_oid}' LIMIT 1 "; //is_paid =2 为确定支付 if (!$db->query($sql)) { return false; } $note = "余额提现:<strong>{$order['description']}</strong>,(: {$order['amount']})。当前余额为:{$user_balance}"; write_memberslog($_SESSION['uid'], 1, 9101, $_SESSION['username'], $note, 4, $order['amount'], $ismoney, 1, 1); } //发送邮件 $mailconfig = get_cache('mailconfig'); if ($mailconfig['set_payment'] == "1" && $user['email_audit'] == "1") { dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_mail.php?uid=" . $order['uid'] . "&key=" . asyn_userkey($order['uid']) . "&act=set_payment"); } //发送邮件完毕 //sms $sms = get_cache('sms_config'); if ($sms['open'] == "1" && $sms['set_payment'] == "1" && $user['mobile_audit'] == "1") { dfopen($_CFG['site_domain'] . $_CFG['site_dir'] . "plus/asyn_sms.php?uid=" . $order['uid'] . "&key=" . asyn_userkey($order['uid']) . "&act=set_payment"); } //微信通知 set_payment($order['uid'], $order_name, $order['oid'], $order['amount']); write_log("将订单号为" . $v_oid . "的订单设置为确认收款", $_SESSION['admin_name'], 3); return true; }