Jelajahi Sumber

勾选是否展示小程序标的的展示

xingzai 2 tahun lalu
induk
melakukan
aa3d1e8ae1
2 mengubah file dengan 44 tambahan dan 19 penghapusan
  1. 42 17
      controllers/resource.go
  2. 2 2
      models/activity.go

+ 42 - 17
controllers/resource.go

@@ -1,7 +1,6 @@
 package controllers
 
 import (
-	"fmt"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/services"
 	"hongze/hongze_cygx/utils"
@@ -95,19 +94,45 @@ func (this *ResourceController) Upload() {
 	return
 }
 
-type ChartPermissionRepMore struct {
-	PermissionName string `description:"名称"`
-}
-
-func init() {
-	var list []*ChartPermissionRepMore
-	Lista := []*ChartPermissionRepMore{{PermissionName: "A"}, {PermissionName: "A"}, {PermissionName: "A"}, {PermissionName: "A"}}
-	Listb := []*ChartPermissionRepMore{{PermissionName: "B"}, {PermissionName: "B"}, {PermissionName: "B"}, {PermissionName: "B"}}
-
-	for _, v := range Lista {
-		list = append(list, v)
-	}
-	fmt.Println("来了呀")
-	fmt.Println(Listb)
-	fmt.Println(list)
-}
+//type ChartPermissionRepMore struct {
+//	PermissionName string `description:"名称"`
+//}
+//
+//func init() {
+//	var list []*ChartPermissionRepMore
+//	//lista := []*ChartPermissionRepMore{{PermissionName: "A1"}}
+//	lista := []*ChartPermissionRepMore{{PermissionName: "A1"}, {PermissionName: "A2"}, {PermissionName: "A3"}, {PermissionName: "A4"}, {PermissionName: "A5"}, {PermissionName: "A6"}, {PermissionName: "A7"}, {PermissionName: "A8"}, {PermissionName: "A9"}, {PermissionName: "A10"}}
+//	//listb := []*ChartPermissionRepMore{{PermissionName: "B1"}, {PermissionName: "B2"}, {PermissionName: "B3"}, {PermissionName: "B4"}, {PermissionName: "B5"}, {PermissionName: "B6"}, {PermissionName: "B7"}, {PermissionName: "B8"}, {PermissionName: "B9"}, {PermissionName: "B10"}, {PermissionName: "11"}, {PermissionName: "B12"}}
+//	listb := []*ChartPermissionRepMore{{PermissionName: "B1"}, {PermissionName: "B2"}, {PermissionName: "B3"}, {PermissionName: "B4"}, {PermissionName: "B5"}, {PermissionName: "B6"}, {PermissionName: "B7"}, {PermissionName: "B8"}, {PermissionName: "B9"}, {PermissionName: "B10"}}
+//
+//	if len(lista) == 0 {
+//		list = listb
+//	} else if len(listb) == 0 {
+//		list = lista
+//	} else {
+//		var maxNum, forMinNum int
+//		if len(lista)-1 >= len(listb) {
+//			maxNum = len(lista)
+//		} else {
+//			maxNum = len(listb)
+//		}
+//		list = append(list, lista[0])
+//
+//		forMinNum = maxNum / 2
+//		for i := 0; i <= forMinNum; i++ {
+//			for k, v := range listb {
+//				if k/2 < i+1 && k/2 >= i {
+//					list = append(list, v)
+//				}
+//			}
+//			for k, v := range lista {
+//				if k > 2*i && k <= 2*(i+1) && k != 0 {
+//					list = append(list, v)
+//				}
+//			}
+//		}
+//	}
+//	for _, v := range list {
+//		fmt.Println(v)
+//	}
+//}

+ 2 - 2
models/activity.go

@@ -474,7 +474,7 @@ type CygxActivityLabelList struct {
 //主题列表
 func GetActivityLabelListAll(condition, sortTime string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityLabelList, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT	label, MAX( art.activity_time ) AS timesort, MIn( art.activity_time ) AS mintimesort 
+	sql := `SELECT	label,is_show_subject_name, MAX( art.activity_time ) AS timesort, MIn( art.activity_time ) AS mintimesort 
 		FROM cygx_activity as art WHERE 1= 1 `
 	if condition != "" {
 		sql += condition
@@ -567,7 +567,7 @@ func GetAskEmail() (item []*AskEmailRep, err error) {
 //主题列表
 func GetActivityLabelSpecialListAll(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityLabelList, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT	label,activity_id
+	sql := `SELECT	label,activity_id,is_show_subject_name
 		FROM cygx_activity_special as art WHERE 1= 1 `
 	if condition != "" {
 		sql += condition