ecshop网店系统客户请求客服在后台修正了订单金额,客户再次付款时就是报错了,提示如下
该疑问的解决办法是找到admin/order.php中的以下代码 /** * 更新订单对应的 pay_log * 假如未付出,修正付出金额;不然,生成新的付出log * @param int $order_id 订单id */ function update_pay_log($order_id) { $order_id = intval($order_id); if ($order_id > 0) { $sql = "SELECT order_amount FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '$order_id'"; $order_amount = $GLOBALS['db']->getOne($sql); if (!is_null($order_amount)) { $sql = "SELECT log_id FROM " . $GLOBALS['ecs']->table('pay_log') . " WHERE order_id = '$order_id'" . " AND order_type = '" . PAY_ORDER . "'" . " AND is_paid = 0"; $log_id = intval($GLOBALS['db']->getOne($sql)); if ($log_id > 0) { /* 未付款,更新付出金额 */ $sql = "UPDATE " . $GLOBALS['ecs']->table('pay_log') . " SET order_amount = '$order_amount' " . "WHERE log_id = '$log_id' LIMIT 1"; } else { /* 已付款,生成新的pay_log */ $sql = "INSERT INTO " . $GLOBALS['ecs']->table('pay_log') . " (order_id, order_amount, order_type, is_paid)" . "VALUES('$order_id', '$order_amount', '" . PAY_ORDER . "', 0)"; } $GLOBALS['db']->query($sql); } } } 用以下代码将其覆盖 /** * 更新订单对应的 pay_log * 假如未付出,修正付出金额;不然,生成新的付出log * @param int $order_id 订单id */ function update_pay_log($order_id) { $order_id = intval($order_id); if ($order_id > 0) { $sql = "SELECT order_amount FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '$order_id'"; $order_amount = $GLOBALS['db']->getOne($sql); if (!is_null($order_amount)) { $sql = "SELECT log_id, order_amount FROM " . $GLOBALS['ecs']->table('pay_log') . " WHERE order_id = '$order_id'" . " AND order_type = '" . PAY_ORDER . "'" . " AND is_paid = 0"; $log_info =$GLOBALS['db']->GetRow($sql); if ($log_info && $log_info['order_amount'] == $order_amount) { $log_id = intval($log_info['log_id']); /* 未付款,更新付出金额 */ $sql = "UPDATE " . $GLOBALS['ecs']->table('pay_log') . " SET order_amount = '$order_amount' " . "WHERE log_id = '$log_id' LIMIT 1"; } else { /* 已付款,生成新的pay_log */ $sql = "INSERT INTO " . $GLOBALS['ecs']->table('pay_log') . " (order_id, order_amount, order_type, is_paid)" . "VALUES('$order_id', '$order_amount', '" . PAY_ORDER . "', 0)"; } $GLOBALS['db']->query($sql); } } } 找到includes/lib_clips.php的get_paylog_id函数,修正成 /** * 获得前次未付出的pay_lig_id * * @access public * @param array $surplus_id 余额记录的ID * @param array $pay_type 付出的类型:预付款/订单付出 * * @return int */ function get_paylog_id($surplus_id, $pay_type = PAY_SURPLUS) { $sql = 'SELECT log_id FROM' .$GLOBALS['ecs']->table('pay_log'). " WHERE order_id = '$surplus_id' AND order_type = '$pay_type' AND is_paid = 0 order by log_id desc "; return $GLOBALS['db']->getOne($sql); }
今后客户在后台怎么调整都可以付款了, |