Просмотр исходного кода

商品新增修改增加上下架字段

沈静伟 4 лет назад
Родитель
Сommit
5f599b2483
1 измененных файлов с 16 добавлено и 6 удалено
  1. 16 6
      src/dsb/com/cnd3b/restcontroller/customer/products/products.java

+ 16 - 6
src/dsb/com/cnd3b/restcontroller/customer/products/products.java

@@ -105,7 +105,8 @@ public class products extends Controller {
         String fintroduction = content.getString("fintroduction", "tagents_product.fintroduction", "产品介绍");
         String fnotes = content.getString("fnotes", "tagents_product.fnotes", "备注");
         String ftag = content.getString("ftag", "tagents_product.ftag", "标签");
-        if(!isJSONArray(ftag)){
+        boolean fisonsale = content.getBooleanValue("fisonsale");
+        if (!isJSONArray(ftag)) {
             return new D3BReturnObject_Err().setErrMsg("ftag不是有效的JSONArray格式").toString();
         }
         PaoSetRemote tagents_productSet = getP2ServerSystemPaoSet("tagents_product", "siteid='" + siteid + "' and tagentsid='" + tagentsid + "' and tagents_productid='" + tagents_productid + "'");
@@ -128,8 +129,17 @@ public class products extends Controller {
         tagents_product.setValue("fnotes", fnotes, 11L);//备注
         tagents_product.setValue("changeby", username, 11L);//修改人
         tagents_product.setValue("changedate", sysdate, 11L);//修改时间
+
+        if (tagents_product.getBoolean("fisonsale") && !fisonsale) {
+            tagents_product.setValue("foffsaleby", username, 11L);
+            tagents_product.setValue("foffsaledate", sysdate, 11L);
+        } else if (!tagents_product.getBoolean("fisonsale") && fisonsale) {
+            tagents_product.setValue("fonsaleby", username, 11L);
+            tagents_product.setValue("fonsaledate", sysdate, 11L);
+        }
+        tagents_product.setValue("fisonsale", fisonsale, 11L);
+
         content.put("tagents_productid", tagents_product.getUniqueIDValue());
-        saveDataLog(tagents_product);
         tagents_productSet.save();
         return query_productsMain();
     }
@@ -177,10 +187,10 @@ public class products extends Controller {
         if (!rows.isEmpty() && rows.get(0).getBoolean("fisonsale")) {
             return getErrReturnObject().setErrMsg("上架商品不可删除").toString();
         }
-        SQLFactory sqlFactory=new SQLFactory(this,"商品删除");
-        sqlFactory.addParameter("siteid",siteid);
-        sqlFactory.addParameter("tagentsid",tagentsid);
-        sqlFactory.addParameter("tagents_productid",tagents_productid);
+        SQLFactory sqlFactory = new SQLFactory(this, "商品删除");
+        sqlFactory.addParameter("siteid", siteid);
+        sqlFactory.addParameter("tagentsid", tagentsid);
+        sqlFactory.addParameter("tagents_productid", tagents_productid);
 
         String status = dbConnect.runSqlUpdate(sqlFactory.getSQL());
         if ("true".equals(status)) {