|
|
@@ -312,4 +312,80 @@ public class tagents extends Controller {
|
|
|
Rows rows = dbConnect.runSqlQuery(sql.getSQL());
|
|
|
return getSucReturnObject().setData(rows).saveToDataPool().toString();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加热门商户
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws P2Exception
|
|
|
+ */
|
|
|
+ public String addHotAgents() throws P2Exception {
|
|
|
+
|
|
|
+ String tagentsid = content.getString("tagentsid");
|
|
|
+ String frownum = content.getString("frownum");
|
|
|
+
|
|
|
+ PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("texcellentagents", "tagentsid = '" + tagentsid + "' OR frownum = '" + frownum + "'", "changedate");
|
|
|
+ if (paoSetRemote.isEmpty()) {
|
|
|
+ PaoRemote paoRemote = paoSetRemote.addAtEnd();
|
|
|
+ paoRemote.setValue("texcellentagentsid", paoRemote.getUniqueIDValue(), 11L);
|
|
|
+ paoRemote.setValue("tagentsid", tagentsid);
|
|
|
+ paoRemote.setValue("frownum", frownum);
|
|
|
+ paoSetRemote.save();
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ } else {
|
|
|
+ return getErrReturnObject().setErrMsg("商户已存在或者当前排序以设置对应商户").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除热门商户
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String deleteHotAgents() {
|
|
|
+ String texcellentagentsid = content.getString("texcellentagentsid");
|
|
|
+
|
|
|
+ String sql = "DELETE FROM texcellentagents WHERE texcellentagentsid = '" + texcellentagentsid + "'";
|
|
|
+
|
|
|
+ String response = dbConnect.runSqlUpdate(sql);
|
|
|
+ if (response.equals("true")) {
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ } else {
|
|
|
+ return getErrReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取热门商户列表
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getHotAgentsList() {
|
|
|
+ SQLFactory agentlistSql = null;
|
|
|
+ if (content.containsKey("saleprodclass") && !"".equals(content.getString("saleprodclass"))) {
|
|
|
+ String saleprodclass = content.getString("saleprodclass");
|
|
|
+ agentlistSql = new SQLFactory(this, "热门商户列表", pageSize, pageNumber, "t1.frownum");
|
|
|
+ agentlistSql.addParameter("saleprodclass", saleprodclass);
|
|
|
+ agentlistSql.addParameter("siteid", siteid);
|
|
|
+ } else {
|
|
|
+ agentlistSql = new SQLFactory(this, "热门商户列表_全部", pageSize, pageNumber, "t1.frownum");
|
|
|
+ agentlistSql.addParameter("siteid", siteid);
|
|
|
+ }
|
|
|
+
|
|
|
+ System.err.println(agentlistSql.getSQL());
|
|
|
+ Rows rows = dbConnect.runSqlQuery(agentlistSql.getSQL());
|
|
|
+ RowsMap map = getAttachmentUrl("tagents", rows.toArrayList("tagentsid"));
|
|
|
+ for (Row row : rows) {
|
|
|
+ row.put("attinfos", map.get(row.getString("tagentsid")));
|
|
|
+ row.put("saleprodclass", JSONArray.parseArray(row.getString("saleprodclass")));
|
|
|
+ }
|
|
|
+ return getSucReturnObject().setData(rows).saveToDataPool(10).toString();
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|