Browse Source

广告查询支持效果图小程序推荐

eganwu 1 year ago
parent
commit
59a2caa137
1 changed files with 29 additions and 2 deletions
  1. 29 2
      src/custom/restcontroller/common/adspace/adspace.java

+ 29 - 2
src/custom/restcontroller/common/adspace/adspace.java

@@ -1,6 +1,7 @@
 package restcontroller.common.adspace;
 
 import beans.attachment.Attachment;
+import beans.parameter.Parameter;
 import beans.user.User;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -9,6 +10,7 @@ import common.YosException;
 import common.annotation.API;
 import common.data.*;
 import common.parameter.parameter;
+import org.apache.commons.lang.StringUtils;
 import restcontroller.R;
 
 import java.util.ArrayList;
@@ -58,7 +60,7 @@ public class adspace extends Controller {
         QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_ad")
                 .setTableAlias("t1");
         querySQL.addJoinTable(JOINTYPE.left, "sys_adspace", "t2", "t2.sys_adspaceid=t1.sys_adspaceid"
-                , "location","dimensional");
+                , "location", "dimensional");
         querySQL.setSiteid(siteid);
         querySQL.setWhere("t2.systemclient='" + systemclient + "'");
         querySQL.setWhere("t1.isused=1");
@@ -70,8 +72,33 @@ public class adspace extends Controller {
         for (Row row : adRows) {
             row.put("attinfos", attinfosRowsMap.getOrDefault(row.getString("sys_adid"), new Rows()));
         }
+        Rows appletRows = new Rows();
+        if (locations.contains("indexBottom")) {
+            QuerySQL sqlFactory = SQLFactory.createQuerySQL(this, "sat_sharematerial", "sat_sharematerialid").setTableAlias("t1");
+            sqlFactory.setSiteid(siteid);
+            sqlFactory.setWhere("classid", 4);
+            sqlFactory.setWhere("isapplet", 1);
+            Rows rows = sqlFactory.query();
 
-        return getSucReturnObject().setData(adRows.toRowsMap("location")).toString();
+            ArrayList<Long> ids = rows.toArrayList("sat_sharematerialid", new ArrayList<>());
+            // 附件
+            RowsMap RowsMap = getAttachmentUrl("sat_sharematerial", ids);
+
+            for (Row row : rows) {
+                Rows attinfos = RowsMap.getOrDefault(row.getString("sat_sharematerialid"), new Rows());
+                if (attinfos.size() > 0) {
+                    appletRows.add(attinfos.get(0));
+                }
+            }
+
+        }
+        RowsMap adRowsMap = adRows.toRowsMap("location");
+        if(!adRowsMap.containsKey("indexBottom")){
+            adRowsMap.put("indexBottom",new Rows());
+        }
+        adRowsMap.get("indexBottom").addAll(appletRows);
+
+        return getSucReturnObject().setData(adRowsMap).toString();
     }
 
 }