|
|
@@ -103,34 +103,33 @@ public class products extends Controller {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 添加热门商品
|
|
|
+ * 添加热门商品(关注榜)
|
|
|
*
|
|
|
* @return
|
|
|
* @throws P2Exception
|
|
|
*/
|
|
|
public String addHotProducts() throws P2Exception {
|
|
|
|
|
|
- String tagentsid = content.getString("tagentsid");
|
|
|
- String tagents_productid = content.getString("tagents_productid");
|
|
|
+ String fname = content.getString("fname");
|
|
|
+ String ftype = content.getString("ftype");
|
|
|
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();
|
|
|
- }
|
|
|
+ PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("texcellenproducts");
|
|
|
+
|
|
|
+ PaoRemote paoRemote = paoSetRemote.addAtEnd();
|
|
|
+ paoRemote.setValue("texcellenproductid", paoRemote.getUniqueIDValue(), 11L);
|
|
|
+ paoRemote.setValue("fname", fname);
|
|
|
+ paoRemote.setValue("ftype", ftype);
|
|
|
+ paoRemote.setValue("frownum", frownum);
|
|
|
+ paoRemote.setValue("siteid", siteid);
|
|
|
+ paoSetRemote.save();
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 删除热门商品
|
|
|
+ * 删除热门商品(关注榜)
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -148,21 +147,50 @@ public class products extends Controller {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 更新热门商品(关注榜)
|
|
|
+ * @return
|
|
|
+ * @throws P2Exception
|
|
|
+ */
|
|
|
+ public String updateHotProducts() throws P2Exception {
|
|
|
+ String texcellenproductid = content.getString("texcellenproductid");
|
|
|
+ String fname = content.getString("fname");
|
|
|
+ String ftype = content.getString("ftype");
|
|
|
+ String frownum = content.getString("frownum");
|
|
|
+
|
|
|
+ PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("texcellenproducts", " texcellenproductid = '" + texcellenproductid + "'");
|
|
|
+ if (!paoSetRemote.isEmpty()) {
|
|
|
+ PaoRemote paoRemote = paoSetRemote.getPao(0);
|
|
|
+ paoRemote.setValue("fname", fname);
|
|
|
+ paoRemote.setValue("ftype", ftype);
|
|
|
+ paoRemote.setValue("siteid", siteid);
|
|
|
+ paoRemote.setValue("frownum", frownum);
|
|
|
+ paoSetRemote.save();
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ } else {
|
|
|
+ return getErrReturnObject().setErrMsg("未找到对应的数据").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
- * 获取热门商品列表
|
|
|
+ * 获取热门商品列表(关注榜)
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public String getHotAgentsList() {
|
|
|
-
|
|
|
- SQLFactory prodlistSql = new SQLFactory(this, "热门商品列表", pageSize, pageNumber, "t1.frownum");
|
|
|
+ public String getHotProductsList() {
|
|
|
+ String ftype = content.getString("ftype");
|
|
|
+ if (ftype == null) {
|
|
|
+ ftype = "";
|
|
|
+ }
|
|
|
+ SQLFactory prodlistSql = new SQLFactory(this, "热门商品列表", pageSize, pageNumber, "t1.ftype,t1.frownum");
|
|
|
prodlistSql.addParameter("siteid", siteid);
|
|
|
-
|
|
|
+ prodlistSql.addParameter("ftype", "%" + ftype + "%");
|
|
|
+ System.err.println(prodlistSql.getSQL());
|
|
|
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")));
|
|
|
+ row.put("attinfos", getAttachmentUrl("texcellenproducts", row.getString("texcellenproductid")));
|
|
|
}
|
|
|
return getSucReturnObject().setDataByPaging(rows).saveToDataPool(10).toString();
|
|
|
|