Browse Source

优化购物车数量更新逻辑,当取不到qty字段时默认为1

沈静伟 1 year ago
parent
commit
0ebd2ae03c
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/custom/restcontroller/sale/shoppingcart/ShoppingCart.java

+ 2 - 2
src/custom/restcontroller/sale/shoppingcart/ShoppingCart.java

@@ -83,7 +83,7 @@ public class ShoppingCart extends Controller {
     @CACHEING_CLEAN(apiversions = {R.ID20220924095302.class})
     public String updateQty() throws YosException {
         Long sa_shoppingcartid = content.getLong("sa_shoppingcartid");
-        BigDecimal qty = content.getBigDecimal("qty");
+        BigDecimal qty = content.getBigDecimalValue("qty", 1);
 
         ArrayList<String> sqlList = new ArrayList<>();
 
@@ -170,7 +170,7 @@ public class ShoppingCart extends Controller {
             }
             try {
                 ItemPrice itemPrice = ItemPrice.getItemPrice(this, sys_enterpriseid, row.getLong("itemid"));
-                row.put("oldprice",  istool == 0 ?itemPrice.getContractprice():itemPrice.getMarketprice());
+                row.put("oldprice", istool == 0 ? itemPrice.getContractprice() : itemPrice.getMarketprice());
 //                row.put("gradeprice", istool == 0 ?itemPrice.getContractprice():itemPrice.getMarketprice());
             } catch (Exception e) {
                 e.printStackTrace();