|
|
@@ -102,4 +102,70 @@ public class products extends Controller {
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 添加热门商品
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws P2Exception
|
|
|
+ */
|
|
|
+ public String addHotProducts() throws P2Exception {
|
|
|
+
|
|
|
+ String tagentsid = content.getString("tagentsid");
|
|
|
+ String tagents_productid = content.getString("tagents_productid");
|
|
|
+ String frownum = content.getString("frownum");
|
|
|
+
|
|
|
+ PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("texcellenproducts", "tagents_productid = '" + tagents_productid + "' OR frownum = '" + frownum + "'", "changedate");
|
|
|
+ if (paoSetRemote.isEmpty()) {
|
|
|
+ PaoRemote paoRemote = paoSetRemote.addAtEnd();
|
|
|
+ paoRemote.setValue("texcellenproductid", paoRemote.getUniqueIDValue(), 11L);
|
|
|
+ paoRemote.setValue("tagentsid", tagentsid);
|
|
|
+ paoRemote.setValue("tagents_productid", tagents_productid);
|
|
|
+ paoRemote.setValue("frownum", frownum);
|
|
|
+ paoSetRemote.save();
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ } else {
|
|
|
+ return getErrReturnObject().setErrMsg("商品已存在或者当前排序以设置对应商品").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除热门商品
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String deleteHotProducts() {
|
|
|
+ String texcellenproductsid = content.getString("texcellenproductsid");
|
|
|
+
|
|
|
+ String sql = "DELETE FROM texcellenproducts WHERE texcellenproductid = '" + texcellenproductsid + "'";
|
|
|
+
|
|
|
+ String response = dbConnect.runSqlUpdate(sql);
|
|
|
+ if (response.equals("true")) {
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ } else {
|
|
|
+ return getErrReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取热门商品列表
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getHotAgentsList() {
|
|
|
+
|
|
|
+ SQLFactory prodlistSql = new SQLFactory(this, "热门商品列表", pageSize, pageNumber, "t1.frownum");
|
|
|
+ prodlistSql.addParameter("siteid", siteid);
|
|
|
+
|
|
|
+ Rows rows = prodlistSql.runSqlQuery();
|
|
|
+ RowsMap map = getAttachmentUrl("tagents_product", rows.toArrayList("tagents_productid"));
|
|
|
+ for (Row row : rows) {
|
|
|
+ row.put("attinfos", map.get(row.getString("tagents_productid")));
|
|
|
+ }
|
|
|
+ return getSucReturnObject().setDataByPaging(rows).saveToDataPool(10).toString();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|