红包巨大bug,最小订单金额限制无效

2016-07-07 14:55 来源:www.chinab4c.com 作者:ecshop专家

无论是线下发布的,还是注册会员发的红包,最小金额限制都无效。所有订单都可以抵扣售价。

回答:
应该只是你自已系统的bug,我给别人做过很多红包类的二次功能开发,还没发现这么巨型的bug

我的是2.7.2
程序代码如下

  1. /* 验证红包序列号 */
  2. elseif ($_REQUEST['step'] == 'validate_bonus')
  3. {
  4. $bonus_sn = trim($_REQUEST['bonus_sn']);
  5. if (is_numeric($bonus_sn))
  6. {
  7. $bonus = bonus_info(0, $bonus_sn);
  8. }
  9. else
  10. {
  11. $bonus = array();
  12. }
  13. // if (empty($bonus) || $bonus['user_id'] > 0 || $bonus['order_id'] > 0)
  14. // {
  15. //die($_LANG['bonus_sn_error']);
  16. // }
  17. // if ($bonus['min_goods_amount'] > cart_amount())
  18. // {
  19. //die(sprintf($_LANG['bonus_min_amount_error'], price_format($bonus['min_goods_amount'], false)));
  20. // }
  21. // die(sprintf($_LANG['bonus_is_ok'], price_format($bonus['type_money'], false)));
  22. $bonus_kill = price_format($bonus['type_money'], false);
  23. include_once('includes/cls_json.php');
  24. $result = array('error' => '', 'content' => '');
  25. /* 取得购物类型 */
  26. $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS;
  27. /* 获得收货人信息 */
  28. $c**ignee = get_c**ignee($_SESSION['user_id']);
  29. /* 对商品信息赋值 */
  30. $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计
  31. if (empty($cart_goods) || !check_c**ignee_info($c**ignee, $flow_type))
  32. {
  33. $result['error'] = $_LANG['no_goods_in_cart'];
  34. }
  35. else
  36. {
  37. /* 取得购物流程设置 */
  38. $smarty->assign('config', $_CFG);
  39. /* 取得订单信息 */
  40. $order = flow_order_info();

  41. if (((!empty($bonus) && $bonus['user_id'] == $_SESSION['user_id']) || ($bonus['type_money'] > 0 && empty($bonus['user_id']))) && $bonus['order_id'] <= 0)
  42. {
  43. //$order['bonus_kill'] = $bonus['type_money'];
  44. $now = gmtime();
  45. if ($now > $bonus['use_end_date'])
  46. {
  47. $order['bonus_id'] = '';
  48. $result['error']=$_LANG['bonus_use_expire'];
  49. }
  50. else
  51. {
  52. $order['bonus_id'] = $bonus['bonus_id'];
  53. $order['bonus_sn'] = $bonus_sn;
  54. }
  55. }
  56. else
  57. {
  58. //$order['bonus_kill'] = 0;
  59. $order['bonus_id'] = '';
  60. $result['error'] = $_LANG['invalid_bonus'];
  61. }
  62. /* 计算订单的费用 */
  63. $total = order_fee($order, $cart_goods, $c**ignee);
  64. $smarty->assign('total', $total);
  65. /* 团购标志 */
  66. if ($flow_type == CART_GROUP_BUY_GOODS)
  67. {
  68. $smarty->assign('is_group_buy', 1);
  69. }
  70. $result['content'] = $smarty->fetch('library/order_total.lbi');
  71. }
  72. $json = new JSON();
  73. die($json->encode($result));
  74. }
复制代码

不知道谁有用过线下红包出现过像我这样的问题的