ziwen 2 年 前
コミット
f37e8f7f9f
2 ファイル変更4 行追加16 行削除
  1. 2 2
      controllers/activity.go
  2. 2 14
      utils/common.go

+ 2 - 2
controllers/activity.go

@@ -4702,6 +4702,7 @@ func (this *ActivityCoAntroller) OverActivityList() {
 	isPower, _ := this.GetInt("IsPower")
 	chartPermissionIds := this.GetString("ChartPermissionIds")
 	whichDay := this.GetString("WhichDay")
+	fmt.Println("whichDay:",whichDay)
 	typeName := this.GetString("TypeName")
 
 	//入参为 undefined 时的处理
@@ -4806,11 +4807,10 @@ func (this *ActivityCoAntroller) OverActivityList() {
 	//} else {
 	//	conditionOr += ` OR ( art.is_limit_people = 0 ` + condition + `) `
 	//}
-	condition += `AND art.is_limit_people = 1 ` + permissionSqlStr + sqlExport + conditionOr
 	startSize = 0
 
 	if isPower == 1 {
-		condition += permissionSqlStr
+		condition += permissionSqlStr + sqlExport + conditionOr
 	}
 	if whichDay != "" {
 		var startDate string

+ 2 - 14
utils/common.go

@@ -779,24 +779,12 @@ func GetLastWeekMonday() time.Time {
 
 // GetNowWeekSunDay 获取本周周日的时间
 func GetNowWeekSunday() time.Time {
-	offset := int(time.Sunday - time.Now().Weekday())
-	if offset == 1 { //正好是周日,但是按照中国人的理解,周日是一周最后一天,而不是一周开始的第一天
-		offset = -6
-	}
-	mondayTime := time.Now().AddDate(0, 0, offset)
-	mondayTime = time.Date(mondayTime.Year(), mondayTime.Month(), mondayTime.Day(), 0, 0, 0, 0, mondayTime.Location())
-	return mondayTime
+	return GetNowWeekMonday().AddDate(0, 0, 6)
 }
 
 // GetLastWeekSunday 获取上周周日的时间
 func GetLastWeekSunday() time.Time {
-	offset := int(time.Sunday - time.Now().Weekday())
-	if offset == 1 { //正好是周日,但是按照中国人的理解,周日是一周最后一天,而不是一周开始的第一天
-		offset = -6
-	}
-	mondayTime := time.Now().AddDate(0, 0, offset-7)
-	mondayTime = time.Date(mondayTime.Year(), mondayTime.Month(), mondayTime.Day(), 0, 0, 0, 0, mondayTime.Location())
-	return mondayTime
+	return GetLastWeekMonday().AddDate(0, 0, 6)
 }
 
 // GetNowMonthFirstDay 获取本月第一天的时间