oak 2 年之前
父節點
當前提交
bfff28ffdc
共有 1 個文件被更改,包括 38 次插入2 次删除
  1. 38 2
      hhh_index/genjson/gen_realtime.py

+ 38 - 2
hhh_index/genjson/gen_realtime.py

@@ -505,14 +505,50 @@ WHERE homepage_set.onoff='Y' and outer_set=1 and (NOW() BETWEEN homepage_set.sta
 #                     a = {'imgUrl': timg, 'link': c['url'], 'title': ccaption,
 #                         'description': cdescription, 'video': tid}
 #                 x["data"].append(a)
+        # # 推薦設計師
+        # if x['id'] == 5:
+        #     records = ExecuteQuery("""SELECT hdesigner_id,title,img_path,name FROM _hdesigner where onoff=1 order by dorder limit 12;
+        #                         """)
+
+        #     x["data"] = []
+        #     for c in records:
+        #         a = {'imgUrl': c['img_path'],'name': c['title'] ,'designers_name':c['name'],'link': "/HHH_NEW/designers/index_designerList.php?cid=" + str(c['hdesigner_id'])}
+        #         x["data"].append(a)
         # 推薦設計師
         if x['id'] == 5:
-            records = ExecuteQuery("""SELECT hdesigner_id,title,img_path,name FROM _hdesigner where onoff=1 order by dorder limit 12;
-                                """)
+            records_for_custom = ExecuteQuery(""" SELECT  hd.hdesigner_id,hd.title,hd.img_path,hd.name
+                            FROM homepage_set
+                            LEFT JOIN _hdesigner hd ON mapping_id = hd.hdesigner_id
+                            
+                            WHERE outer_set=9  AND hd.onoff='1' 
+                            AND homepage_set.onoff='Y'
+                            AND(NOW() BETWEEN homepage_set.start_time AND homepage_set.end_time OR(homepage_set.start_time='0000-00-00 00:00:00' and homepage_set.end_time='0000-00-00 00:00:00') or (homepage_set.start_time is null and homepage_set.end_time is NULL))
+                            ORDER BY inner_sort limit 6""")
+            #加入不重複id
+            id_use = []
+            for g in records_for_custom:
+                id_use.append(g['hdesigner_id'])
+            id_len = 12 - len(id_use)
+            print(id_use)
+            str_id_use=''
+            for k in id_use:
+                str_id_use+=' and hdesigner_id!=%s '%k
+
+
+
+            records = ExecuteQuery("""SELECT hdesigner_id,title,img_path,name FROM _hdesigner where onoff=1 """+str_id_use +""" order by dorder limit """+ str(id_len) +""" """)
 
             x["data"] = []
+            count_k=1
             for c in records:
                 a = {'imgUrl': c['img_path'],'name': c['title'] ,'designers_name':c['name'],'link': "/HHH_NEW/designers/index_designerList.php?cid=" + str(c['hdesigner_id'])}
+                if count_k==7:
+                    for d in records_for_custom:
+                        q = {'imgUrl': d['img_path'],'name': d['title'] ,'designers_name':d['name'],'link': "/HHH_NEW/designers/index_designerList.php?cid=" + str(d['hdesigner_id'])}
+                        x["data"].append(q)
+                count_k+=1
+
+
                 x["data"].append(a)
 #=======================================================================================================================
         # 加好物API