本文整理匯總了PHP中modify_account函數的典型用法代碼示例。如果您正苦於以下問題:PHP modify_account函數的具體用法?PHP modify_account怎麽用?PHP modify_account使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了modify_account函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用戶名或郵箱
$pwd = strim($GLOBALS['request']['pwd']);
//密碼
//檢查用戶,用戶密碼
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
$root['user_login_status'] = 1;
$order_id = intval($_REQUEST['id']);
$order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where order_status = 0 and user_id = " . intval($GLOBALS['user_info']['id']) . " and id = " . $order_id);
if (!$order_info) {
$root['info'] = '無效的訂單';
} else {
$money = $order_info['credit_pay'];
$GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_order where id = " . $order_id . " and user_id = " . intval($GLOBALS['user_info']['id']) . " and order_status = 0");
if ($GLOBALS['db']->affected_rows() > 0) {
if ($money > 0) {
require_once APP_ROOT_PATH . "system/libs/user.php";
modify_account(array("money" => $money), intval($GLOBALS['user_info']['id']), "刪除" . $order_info['deal_name'] . "項目支付,退回支付款。");
}
}
$root['response_code'] = 1;
$root['info'] = '刪除成功';
}
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登錄";
$root['user_login_status'] = 0;
}
output($root);
}
示例2: cash_save
public function cash_save()
{
$data['integral'] = intval($_REQUEST['integral']);
$data['user_id'] = $GLOBALS['user_info']['id'];
require APP_ROOT_PATH . 'system/libs/user.php';
$userinfo = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "user WHERE id='" . $GLOBALS['user_info']['id'] . "' ");
if ($userinfo['vip_id'] == 0) {
showErr("您還不是VIP會員,不可兌換積分!", 0);
}
if ($data['integral'] == 0 || $data['integral'] == "") {
showErr("請輸入正確的兌換積分!", 0);
}
if ($data['integral'] > $userinfo['score']) {
showErr("該積分超過了用戶積分", 0);
} else {
if ($data['integral'] % 1000 != 0) {
showErr("該積分不是1000的倍數積分", 0);
} else {
$vininfo = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "vip_setting WHERE vip_id='" . $userinfo['vip_id'] . "' ");
$excmoney = $data['integral'] * $vininfo['coefficient'] / 100;
modify_account(array('money' => $excmoney, 'nmc_amount' => $excmoney, 'score' => -$data['integral']), $GLOBALS['user_info']['id'], '積分兌現', 22);
}
}
$data['vip_id'] = $userinfo['vip_id'];
$data['exchange_date'] = to_date(TIME_UTC, "Y-m-d");
$data['cash'] = $excmoney;
$GLOBALS['db']->autoExecute(DB_PREFIX . "score_exchange_record", $data, "INSERT");
if ($GLOBALS['db']->affected_rows()) {
showSuccess("兌現成功", 0);
} else {
showErr("兌現失敗", 0);
}
}
示例3: payment_paid
/**
* 付款單的支付
* @param unknown_type $payment_notice_id
* 當超額付款時在此進行退款處理
*/
function payment_paid($payment_notice_id, $outer_notice_sn = '')
{
$payment_notice_id = intval($payment_notice_id);
$now = TIME_UTC;
$GLOBALS['db']->query("update " . DB_PREFIX . "payment_notice set pay_time = " . $now . ", pay_date = '" . to_date($now, 'Y-m-d') . "',outer_notice_sn = '" . $outer_notice_sn . "',is_paid = 1 where id = " . $payment_notice_id . " and is_paid = 0");
$rs = $GLOBALS['db']->affected_rows();
if ($rs) {
$payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
$payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where id = " . $payment_notice['payment_id']);
$GLOBALS['db']->query("update " . DB_PREFIX . "payment set total_amount = total_amount + " . $payment_notice['money'] . " where class_name = '" . $payment_info['class_name'] . "'");
if (intval($payment_notice['order_id']) == 0) {
//充值
require_once APP_ROOT_PATH . "system/libs/user.php";
if ($payment_info['online_pay'] == 0) {
$msg = '線下充值';
// sprintf($GLOBALS['lang']['PAYMENT_INCHARGE'],$payment_notice['notice_sn']);
} else {
$msg = '在線充值';
// sprintf($GLOBALS['lang']['PAYMENT_INCHARGE'],$payment_notice['notice_sn']);
}
$fee_amount = $payment_notice['fee_amount'];
$money = $payment_notice['money'];
modify_account(array('money' => $money - $fee_amount, 'fee_amount' => $fee_amount, 'score' => 0), $payment_notice['user_id'], $msg, 1);
//在此處開始生成付款的短信及郵件
send_payment_sms($payment_notice_id);
send_payment_mail($payment_notice_id);
}
}
return $rs;
}
示例4: payment_paid
/**
* 付款單的支付
* @param unknown_type $payment_notice_id
* 當超額付款時在此進行退款處理
*/
function payment_paid($payment_notice_id, $outer_notice_sn = '')
{
$payment_notice_id = intval($payment_notice_id);
$now = TIME_UTC;
$GLOBALS['db']->query("update " . DB_PREFIX . "payment_notice set pay_time = " . $now . ", pay_date = " . to_date($now, 'Y-m-d') . ",outer_notice_sn = '" . $outer_notice_sn . "',is_paid = 1 where id = " . $payment_notice_id . " and is_paid = 0");
$rs = $GLOBALS['db']->affected_rows();
if ($rs) {
$payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
$payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where id = " . $payment_notice['payment_id']);
$GLOBALS['db']->query("update " . DB_PREFIX . "payment set total_amount = total_amount + " . $payment_notice['money'] . " where class_name = '" . $payment_info['class_name'] . "'");
//if (intval($payment_notice['order_id']) == 0){
//充值
require_once APP_ROOT_PATH . "system/libs/user.php";
$msg = sprintf($GLOBALS['lang']['PAYMENT_INCHARGE'], $payment_notice['notice_sn']);
modify_account(array('money' => $payment_notice['money'], 'score' => 0), $payment_notice['user_id'], $msg, 1);
// 充值獎勵
if ($payment_notice['money'] > intval(app_conf("USER_RECHARGE_LIMIT_MONEY"))) {
$award = $payment_notice['money'] * floatval(app_conf("USER_RECHARGE_PERCENT")) * 0.01;
modify_account(array('money' => $award, 'score' => 0), $payment_notice['user_id'], "充值獎勵", 1);
}
//在此處開始生成付款的短信及郵件
send_payment_sms($payment_notice_id);
send_payment_mail($payment_notice_id);
//}
}
return $rs;
}
示例5: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用戶名或郵箱
$pwd = strim($GLOBALS['request']['pwd']);
//密碼
$page = intval($GLOBALS['request']['page']);
$dltid = intval($GLOBALS['request']['dltid']);
$status = intval($GLOBALS['request']['status']);
//檢查用戶,用戶密碼
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
require APP_ROOT_PATH . 'app/Lib/uc_func.php';
require APP_ROOT_PATH . 'system/libs/user.php';
$root['user_login_status'] = 1;
$root['response_code'] = 1;
$nmc_amount = $GLOBALS['db']->getOne("SELECT nmc_amount FROM " . DB_PREFIX . "user where id = " . intval($GLOBALS['user_info']['id']));
if ($status == 0) {
$GLOBALS['db']->query("UPDATE " . DB_PREFIX . "user_carry SET status=4 where id=" . $dltid . " and status=0 and user_id = " . intval($GLOBALS['user_info']['id']));
if ($GLOBALS['db']->affected_rows()) {
$data = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "user_carry where id=" . $dltid . " and status=4 and user_id = " . intval($GLOBALS['user_info']['id']));
modify_account(array('money' => $data['money'], 'lock_money' => -$data['money']), $data['user_id'], "撤銷提現,提現金額", 8);
modify_account(array('money' => $data['fee'], 'lock_money' => -$data['fee']), $data['user_id'], "撤銷提現,提現手續費", 9);
$root['show_err'] = "撤銷操作成功";
} else {
$root['show_err'] = "撤銷操作失敗";
}
output($root);
} elseif ($status == 4) {
$data = $GLOBALS['db']->getRow("SELECT user_id,money,fee FROM " . DB_PREFIX . "user_carry where id=" . $dltid . " and status=4 and user_id = " . intval($GLOBALS['user_info']['id']));
if ((double) $data['money'] + (double) $data['fee'] + (double) $GLOBALS['user_info']['nmc_amount'] > (double) $GLOBALS['user_info']['money']) {
$root['show_err'] = "繼續申請提現失敗,金額不足";
}
$sql = "UPDATE " . DB_PREFIX . "user_carry SET status=0 where id=" . $dltid . " and (money + fee + {$nmc_amount}) <= " . (double) $GLOBALS['user_info']['money'] . " and status=4 and user_id = " . intval($GLOBALS['user_info']['id']) . " ";
$root['sql'] = $sql;
$GLOBALS['db']->query($sql);
if ($GLOBALS['db']->affected_rows()) {
modify_account(array('money' => -$data['money'], 'lock_money' => $data['money']), $data['user_id'], "提現申請", 8);
modify_account(array('money' => -$data['fee'], 'lock_money' => $data['fee']), $data['user_id'], "提現手續費", 9);
$root['show_err'] = "繼續申請提現成功";
} else {
$root['show_err'] = "繼續申請提現失敗";
}
output($root);
} else {
$root['show_err'] = "操作失敗";
output($root);
}
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登錄";
$root['user_login_status'] = 0;
}
$root['program_title'] = "提現操作";
output($root);
}
示例6: get_payment_code
public function get_payment_code($payment_notice_id)
{
$rs = payment_paid($payment_notice_id);
if ($rs) {
$payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
$order_sn = $GLOBALS['db']->getOne("select order_sn from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']);
require_once APP_ROOT_PATH . "system/model/user.php";
$msg = sprintf('%s訂單付款,付款單號%s', $order_sn, $payment_notice['notice_sn']);
modify_account(array('money' => "-" . $payment_notice['money'], 'score' => 0), $payment_notice['user_id'], $msg);
}
}
示例7: index
public function index()
{
require_once APP_ROOT_PATH . "system/libs/user.php";
//print_r($email);echo"<br />";print_r($pwd);exit;
//檢查用戶,用戶密碼
$user_return = $GLOBALS['user_info'];
$user = $user_return;
$user_id = intval($user['id']);
//print_r($user_id);exit;
$uname = strim($GLOBALS['request']['uname']);
if ($user_id == 0) {
$root['status'] = 0;
$root['info'] = "請先登錄";
$root['user_login_status'] = 0;
//用戶登陸狀態:1:成功登陸;0:未成功登陸
output($root);
} else {
$ecvtype_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "ecv_type where uname= '" . $uname . "'");
if (!$ecvtype_info) {
$root['status'] = 0;
$root['info'] = "代金券不存在";
output($root);
}
$id = intval($ecvtype_info['id']);
$is_use = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "ecv where ecv_type_id=" . $id . " and user_id=" . $user_id);
if ($is_use > 0) {
$root['status'] = 0;
$root['info'] = "您已經領取過了";
output($root);
}
if ($ecvtype_info['end_time'] > 0 && $ecvtype_info['end_time'] < get_gmtime()) {
$root['status'] = 0;
$root['info'] = "代金券已過期";
output($root);
}
$GLOBALS['db']->query("update " . DB_PREFIX . "ecv set user_id = " . $user_id . " where user_id = 0 and ecv_type_id = " . $id . " limit 1");
if ($GLOBALS['db']->affected_rows() > 0) {
$root['status'] = 1;
$root['info'] = "您已成功領取紅包" . round($ecvtype_info['money'], 2) . "元";
$root['id'] = $id;
modify_account(array('money' => round($ecvtype_info['money'], 2)), $user_id, "成功領取紅包" . round($ecvtype_info['money'], 2) . "元");
} else {
$root['status'] = 0;
$root['info'] = "剩餘數量不足";
output($root);
}
}
output($root);
}
示例8: delete_order
public function delete_order()
{
$id = intval($_REQUEST['id']);
$total_score = intval($_REQUEST['total_score']);
$count_sql = "SELECT count(*) from " . DB_PREFIX . "goods_order where id=" . $id . " and order_status =0 and user_id=" . $GLOBALS['user_info']['id'];
$order_count = $GLOBALS['db']->getOne($count_sql);
if (!$order_count) {
showErr('訂單取消失敗', 0, url("index", "uc_goods_order"));
}
require_once APP_ROOT_PATH . "system/libs/user.php";
modify_account(array('score' => $total_score), $GLOBALS['user_info']['id'], "用戶取消訂單積分返還", 22);
$GLOBALS['db']->query("update " . DB_PREFIX . "goods_order set order_status = 3 where id = " . $id);
if ($GLOBALS['db']->affected_rows() == 0) {
showErr('訂單取消失敗', 0, url("index", "uc_goods_order"));
} else {
showSuccess('訂單取消成功', 0, url("index", "uc_goods_order"));
}
}
示例9: edit_dsffreezer
public function edit_dsffreezer()
{
$id = intval($_REQUEST['id']);
$now = get_gmtime();
$dsffreezer = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "money_freeze where id = " . $id);
$deal_name = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $dsffreezer['deal_id']);
$user_xinxi = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $dsffreezer['platformUserNo']);
$log_info = $user_xinxi['name'];
$GLOBALS['db']->query("update " . DB_PREFIX . "money_freeze set status=2,create_time ={$now} where id=" . $id);
require_once APP_ROOT_PATH . "system/libs/user.php";
if ($GLOBALS['db']->affected_rows()) {
modify_account(array('money' => $dsffreezer['amount']), $dsffreezer['platformUserNo'], '凍結資金解凍-凍結號碼:' . $id);
}
syn_mortgate($dsffreezer['platformUserNo']);
//$GLOBALS['db']->query("update ".DB_PREFIX."user set money=$money,score=$score,point=$point where id=".$dsffreezer['platformUserNo']);
//save_log($log_info.L("INSERT_SUCCESS"),1);
$this->success(L("INSERT_SUCCESS"));
}
示例10: refund
public function refund()
{
$id = intval($_REQUEST['id']);
$order_info = M("DealOrder")->getById($id);
if ($order_info) {
if ($order_info['is_refund'] == 0) {
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set is_refund = 1 where id = " . $id . " and is_refund = 0");
if ($GLOBALS['db']->affected_rows() > 0) {
require_once APP_ROOT_PATH . "system/libs/user.php";
modify_account(array("money" => $order_info['total_price']), $order_info['user_id'], $order_info['deal_name'] . "退款");
}
$this->success("成功退款到會員餘額");
} else {
$this->error("已經退款");
}
} else {
$this->error("沒有該項目的支持");
}
}
示例11: confirm
public function confirm()
{
$id = intval($_REQUEST['id']);
$refund_data = M("UserRefund")->getById($id);
if ($refund_data) {
if ($refund_data['is_pay'] == 1) {
$this->error("已經提現過");
}
$refund_user = M("User")->where("id=" . $refund_data['user_id'] . " and is_effect = 1")->find();
if ($refund_user['money'] < $refund_data['money']) {
$this->error("會員餘額不足,不能提現");
}
$reply = strim($_REQUEST['reply']);
require_once APP_ROOT_PATH . "system/libs/user.php";
modify_account(array("money" => "-" . $refund_data['money']), $refund_data['user_id'], "管理員確認提現:" . $reply);
$refund_data['reply'] = $reply;
$refund_data['is_pay'] = 1;
$refund_data['pay_time'] = get_gmtime();
M("UserRefund")->save($refund_data);
$this->success("提現確認成功");
} else {
$this->error("沒有提現數據");
}
}
示例12: doexchange
public function doexchange()
{
if ($this->allow_exchange) {
$user_pwd = md5(addslashes(trim($_REQUEST['password'])));
$user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . intval($GLOBALS['user_info']['id']));
if ($user_info['user_pwd'] == "") {
//判斷是否為初次整合
//載入會員整合
$integrate_code = trim(app_conf("INTEGRATE_CODE"));
if ($integrate_code != '') {
$integrate_file = APP_ROOT_PATH . "system/integrate/" . $integrate_code . "_integrate.php";
if (file_exists($integrate_file)) {
require_once $integrate_file;
$integrate_class = $integrate_code . "_integrate";
$integrate_obj = new $integrate_class();
}
}
if ($integrate_obj) {
$result = $integrate_obj->login($user_info['user_name'], $user_pwd);
if ($result['status']) {
$GLOBALS['db']->query("update " . DB_PREFIX . "user set user_pwd = '" . $user_pwd . "' where id = " . $user_info['id']);
$user_info['user_pwd'] = $user_pwd;
}
}
}
if ($user_info['user_pwd'] == $user_pwd) {
$cfg = $this->creditsettings[addslashes(trim($_REQUEST['key']))];
if ($cfg) {
$amount = floor($_REQUEST['amountdesc']);
$use_amount = floor($amount * $cfg['ratio']);
//消耗的本係統積分
$field = $this->credits_CFG[$cfg['creditsrc']]['field'];
if ($user_info[$field] < $use_amount) {
$data = array("status" => false, "message" => $cfg['srctitle'] . "不足,不能兌換");
ajax_return($data);
}
include_once APP_ROOT_PATH . 'uc_client/client.php';
$res = call_user_func_array("uc_credit_exchange_request", array($user_info['integrate_id'], $cfg['creditsrc'], $cfg['creditdesc'], $cfg['appiddesc'], $amount));
if ($res) {
//兌換成功
$use_amount = 0 - $use_amount;
$credit_data = array($field => $use_amount);
require_once APP_ROOT_PATH . "system/libs/user.php";
modify_account($credit_data, $user_info['id'], "ucenter兌換支出");
$data = array("status" => true, "message" => "兌換成功");
ajax_return($data);
} else {
$data = array("status" => false, "message" => "兌換失敗");
ajax_return($data);
}
} else {
$data = array("status" => false, "message" => "非法的兌換請求");
ajax_return($data);
}
} else {
$data = array("status" => false, "message" => "登錄密碼不正確");
ajax_return($data);
}
} else {
$data = array("status" => false, "message" => "未開啟兌換功能");
ajax_return($data);
}
}
示例13: deal_redempte
function deal_redempte($redempte_id, $status, $earn_money, $fee = 0, $organiser_fee = 0, $pay_type = 0, $web_type = 0)
{
require_once APP_ROOT_PATH . 'system/libs/user.php';
$info = array('status' => 1, 'info' => '');
$licai = array();
if ($web_type == 1 || $web_type == 2) {
$redempte = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "licai_redempte where id={$redempte_id}");
if ($redempte['status'] == 0) {
if ($status == 1) {
//審核通過
if (true) {
//最終的金額
$money = $redempte['money'] + $organiser_fee + $earn_money;
$order = $GLOBALS['db']->getRow("select dorder.money,dorder.site_buy_fee,dorder.redempte_money,dorder.user_id as consumer_id,d.user_id as organiser_id,d.name as licai_name,d.id as licai_id,d.service_fee_rate from " . DB_PREFIX . "licai_order as dorder left join " . DB_PREFIX . "licai as d on dorder.licai_id=d.id where dorder.id=" . $redempte['order_id']);
if ($redempte['money'] > $order['money'] - $order['redempte_money']) {
$info['status'] = 0;
$info['info'] = '您贖回的金額超過了您購買的金額(您的購買金額是' . $order['money'] . ',已贖回' . $order['redempte_money'] . ")";
return $info;
}
/*if($order['service_fee_rate']>0){
$organiser_fee=$redempte['money']*$order['service_fee_rate'];
}else{
$organiser_fee=0;
}*/
//$money=$redempte['money']+$organiser_fee+$earn_money;
$licai['url'] = url("licai#deal", array("id" => $order['licai_id']));
$licai['name'] = $order['licai_name'];
//對發起人進行扣款操作,有凍結金額mortgage_money 先用凍結金額,沒有再用餘額money,如果餘額也不夠,就生成墊付單
if ($order['consumer_id'] && $order['organiser_id']) {
//$organiser_user=$GLOBALS['db']->getRow("select * from ".DB_PREFIX."user where id=".$order['organiser_id']);
require_once APP_ROOT_PATH . 'system/libs/user.php';
$organiser_user = get_user_info("*", "id = " . $order['organiser_id']);
if ($organiser_user['money'] >= $money) {
//modify_account(array('money'=>'-'.$money,'ben_money'=>'-'.$redempte['money'],'earn_money'=>'-'.$earn_money,'organiser_fee'=>'-'.$organiser_fee),$order['organiser_id'],"發放用戶要贖回的理財產品“<a href=\"".$licai['url']."\">".$licai['name']."</a>”",39);
//贖回本金
modify_account(array('money' => '-' . $redempte['money']), $order['organiser_id'], "發放用戶要贖回的理財產品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 39);
//收益
modify_account(array('money' => '-' . $earn_money), $order['organiser_id'], "發放用戶要贖回的理財產品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 40);
//平台手續費
modify_account(array('money' => '-' . $organiser_fee), $order['organiser_id'], "發放用戶要贖回的理財產品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 45);
//if(!$re){
/* $info['status']=0;
$info['info']='資金修改錯誤';
return $info;
*/
//}
} elseif ($organiser_user['mortgage_money'] >= $money) {
//贖回本金
modify_account(array('money' => '-' . $redempte['money']), $order['organiser_id'], "發放用戶要贖回的理財產品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 39);
//贖回手續費
modify_account(array('money' => '-' . $earn_money), $order['organiser_id'], "發放用戶要贖回的理財產品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 40);
//贖回平台手續費
modify_account(array('money' => '-' . $organiser_fee), $order['organiser_id'], "發放用戶要贖回的理財產品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 45);
//if(!$re){
/* $info['status']=0;
$info['info']='資金修改錯誤';
return $info;*/
//}
} elseif ($organiser_user['money'] + $organiser_user['mortgage_money'] >= $money) {
$ye_money = $money - $organiser_user['mortgage_money'];
//贖回本金
modify_account(array('money' => '-' . $redempte['money']), $order["organiser_id"], "發放用戶要贖回的理財產品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 39);
//贖回收益
modify_account(array('money' => '-' . $earn_money), $order["organiser_id"], "發放用戶要贖回的理財產品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 40);
//平台手續費
modify_account(array('money' => '-' . $organiser_fee), $order["organiser_id"], "發放用戶要贖回的理財產品“<a href=\"" . $licai['url'] . "\">" . $licai['name'] . "</a>”", 45);
//if(!$re){
/* $info['status']=0;
$info['info']='資金修改錯誤';
return $info;*/
//}
} else {
if ($pay_type == 1) {
//生成墊付單
$re = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "licai_advance where redempte_id=" . $redempte_id);
if ($re) {
$info['status'] = 0;
$info['info'] = '發起人已經生成墊付單';
return $info;
} else {
$advance['redempte_id'] = $redempte_id;
$advance['user_id'] = $organiser_user['id'];
$advance['user_name'] = $organiser_user['user_name'];
$advance['money'] = $redempte['money'];
$advance['earn_money'] = $earn_money;
$advance['fee'] = $fee;
$advance['organiser_fee'] = $organiser_fee;
$advance['real_money'] = $organiser_user['money'] + $organiser_user['mortgage_money'];
$advance['advance_money'] = $redempte['money'] + $advance['earn_money'] + $advance['organiser_fee'] - $advance['real_money'];
$advance['status'] = 1;
$advance['type'] = $redempte['type'];
$advance['create_date'] = to_date(NOW_TIME);
$advance['update_date'] = to_date(NOW_TIME);
$re = $GLOBALS['db']->autoExecute(DB_PREFIX . "licai_advance", $advance);
if (!$re) {
$info['status'] = 0;
$info['info'] = '發起人生成墊付單錯誤';
return $info;
} else {
//贖回本金
//.........這裏部分代碼省略.........
示例14: index
public function index()
{
$email = strim($GLOBALS['request']['email']);
//用戶名或郵箱
$pwd = strim($GLOBALS['request']['pwd']);
//密碼
//檢查用戶,用戶密碼
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
$root = array();
if ($user_id > 0) {
$order_id = intval($GLOBALS['request']['order_id']);
$credit = doubleval($_REQUEST['credit']);
$payment_id = intval($_REQUEST['payment']);
$memo = strim($_REQUEST['memo']);
$root['user_login_status'] = 1;
$root['show_pay_btn'] = 0;
//0:不顯示,支付按鈕; 1:顯示支付按鈕
$order = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where user_id = {$user_id} and id = " . $order_id);
if (empty($order)) {
// $root['order_status'] = 1;
$root['pay_info'] = '訂單不存在.';
$root['show_pay_btn'] = 0;
output($root);
}
if ($order['order_status'] == 2) {
$root['order_status'] = 1;
$root['pay_code'] = '';
$root['order_id'] = $order_id;
$root['order_sn'] = $order['order_sn'];
$root['response_code'] = 1;
$root['pay_info'] = '訂單已支付成功.';
$root['show_pay_btn'] = 0;
output($root);
}
if ($payment_id == 0) {
$payment_id = intval($order['payment_id']);
}
$deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id= " . $order['deal_id']);
if ($credit > 0) {
$sql = $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set credit_pay = credit_pay + " . $credit . " where id = " . $order_id);
require_once APP_ROOT_PATH . "system/libs/user.php";
modify_account(array("money" => "-" . $credit), intval($user_id), "支持" . $deal_info['name'] . "項目支付");
}
$result = pay_order($order_id);
if ($order['credit_pay'] = $order['total_price']) {
$root['response_code'] = 1;
$root['info'] = "餘額全部支付";
}
if ($order['credit_pay'] < $order['total_price'] && $order['credit_pay'] > 0) {
$root['response_code'] = 2;
$root['info'] = "餘額部分支付";
}
if ($order['credit_pay'] = 0) {
$root['response_code'] = 3;
$root['info'] = "餘額未支付";
}
if ($result['status'] == 0) {
$payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where id=" . $payment_id);
$pay_code = strtolower($payment_info['class_name']);
/*online_pay 支付方式:1:在線支付;0:線下支付;2:手機wap;3:手機sdk */
$online_pay = intval($payment_info['online_pay']);
$root['online_pay'] = $online_pay;
if ($online_pay != 2) {
$root['response_code'] = 0;
$root['pay_info'] = '手機版本不支付,無法在手機上支付.' . $pay_code;
$root['show_pay_btn'] = 0;
output($root);
}
if ($online_pay = 2) {
$money = $result['money'];
$payment_notice['create_time'] = NOW_TIME;
$payment_notice['user_id'] = intval($GLOBALS['user_info']['id']);
$payment_notice['payment_id'] = $payment_id;
$payment_notice['money'] = $money;
// $payment_notice['bank_id'] = strim($_REQUEST['bank_id']);
$payment_notice['order_id'] = $order_id;
$payment_notice['memo'] = $memo;
$payment_notice['deal_id'] = $deal_info['id'];
$payment_notice['deal_item_id'] = $order['deal_item_id'];
$payment_notice['deal_name'] = $deal_info['name'];
do {
$payment_notice['notice_sn'] = to_date(NOW_TIME, "Ymd") . rand(100, 999);
$GLOBALS['db']->autoExecute(DB_PREFIX . "payment_notice", $payment_notice, "INSERT", "", "SILENT");
$notice_id = $GLOBALS['db']->insert_id();
} while ($notice_id == 0);
}
//創建了支付單號,通過支付接口創建支付數據
require_once APP_ROOT_PATH . "system/payment/" . $payment_info['class_name'] . "_payment.php";
$payment_class = $payment_info['class_name'] . "_payment";
$payment_object = new $payment_class();
$pay = $payment_object->get_payment_code($notice_id);
$root['is_wap'] = intval($pay['is_wap']);
$root['pay_money_format'] = $pay['total_fee_format'];
$root['pay_money'] = $pay['total_fee'];
$root['pay_info'] = $pay['body'];
$root['pay_wap'] = $pay['notify_url'];
if ($root['pay_money'] > 0) {
$root['show_pay_btn'] = 1;
}
//.........這裏部分代碼省略.........
示例15: do_refund
/**
* 退款執行流:
* 1. 退還金額至會員賬戶
* 2. 更新商家賬戶
* 3. 更新訂單及訂單關聯表的相關狀態
* 3. 更新平台報表
* 4. 更新訂單緩存
* 5. 為訂單重新分片
*/
public function do_refund()
{
$order_item_id = intval($_REQUEST['order_item_id']);
$coupon_id = intval($_REQUEST['coupon_id']);
$price = floatval($_REQUEST['price']);
$balance_price = floatval($_REQUEST['balance_price']);
$content = strim($_REQUEST['content']);
if ($price < 0 || $balance_price < 0) {
$this->error("金額出錯", 1);
}
if ($order_item_id) {
$oi = $order_item_id;
$data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order_item where id = " . $order_item_id);
if ($data['refund_status'] == 2) {
$this->error("已退款", 1);
}
if ($data) {
$order_id = $data['order_id'];
$supplier_id = $data['supplier_id'];
}
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order_item set refund_status = 2,is_arrival = 0 where id = " . $order_item_id);
$refund_item_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_order_item where (refund_status = 1 or is_arrival = 2) and order_id = " . $order_id);
$coupon_item_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_coupon where refund_status = 1 and order_id = " . $order_id);
if ($refund_item_count == 0 && $coupon_item_count == 0) {
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set refund_amount = refund_amount + " . $price . ",refund_money = refund_money + " . $price . ",refund_status = 2,after_sale = 1,is_refuse_delivery=0 where id = " . $order_id);
} else {
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set refund_amount = refund_amount + " . $price . ",refund_money = refund_money + " . $price . ",is_refuse_delivery=0 where id = " . $order_id);
}
} elseif ($coupon_id) {
$data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_coupon where id = " . $coupon_id);
if ($data['refund_status'] == 2) {
$this->error("已退款", 1);
}
if ($data) {
$oi = $data['order_deal_id'];
$order_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order_item where id = " . $data['order_deal_id']);
$data['name'] = $order_item['name'];
$order_id = $data['order_id'];
$supplier_id = $data['supplier_id'];
}
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_coupon set refund_status = 2 where id = " . $coupon_id);
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order_item set refund_status = 2 where id = " . $data['order_deal_id']);
$refund_item_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_order_item where (refund_status = 1 or is_arrival = 2) and order_id = " . $order_id);
$coupon_item_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_coupon where refund_status = 1 and order_id = " . $order_id);
if ($refund_item_count == 0 && $coupon_item_count == 0) {
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set refund_amount = refund_amount + " . $price . ",refund_money = refund_money + " . $price . ",refund_status = 2,after_sale = 1 where id = " . $order_id);
} else {
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set refund_amount = refund_amount + " . $price . ",refund_money = refund_money + " . $price . " where id = " . $order_id);
}
}
$order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where id = " . $order_id);
if ($price > 0) {
require_once APP_ROOT_PATH . "system/model/user.php";
modify_account(array("money" => $price), $order_info['user_id'], $data['name'] . "退款成功");
modify_statements($price, 6, $data['name'] . "用戶退款");
}
if ($balance_price > 0) {
require_once APP_ROOT_PATH . "system/model/supplier.php";
modify_supplier_account("-" . $balance_price, $supplier_id, 1, $data['name'] . "用戶退款");
//凍結資金減少
modify_supplier_account($balance_price, $supplier_id, 4, $data['name'] . "用戶退款");
//退款增加
modify_statements($balance_price, 7, $data['name'] . "用戶退款");
}
require_once APP_ROOT_PATH . "system/model/deal_order.php";
order_log($data['name'] . "退款成功 " . format_price($price) . " " . $content, $order_id);
auto_over_status($order_id);
update_order_cache($order_id);
distribute_order($order_id);
send_msg($order_info['user_id'], $data['name'] . "退款成功 " . format_price($price) . " " . $content, "orderitem", $oi);
$this->success("退款成功", 1);
}