Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/dev1.1.1' into dev1.1.1

wangkaiyue 3 anni fa
parent
commit
c1aeb9783e
1 ha cambiato i file con 13 aggiunte e 0 eliminazioni
  1. 13 0
      test/shareToaward_test.go

+ 13 - 0
test/shareToaward_test.go

@@ -3,9 +3,14 @@ package test
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/mongodb"
+	"fmt"
+	"strings"
 	"testing"
+	"time"
 )
 
+const SkTimes = "-" //-默认全部 1653877526-1653877526开始时间-结束时间 开始时间不传默认0结束时间不传默认当前时间 -必加
+
 func Test_Award(t *testing.T) {
 	Mgo := &mongodb.MongodbSim{
 		MongodbAddr: "192.168.3.206:27080",
@@ -28,11 +33,19 @@ func Test_Award(t *testing.T) {
 	}
 	q := map[string]interface{}{}
 	ndatas := []map[string]interface{}{}
+	skTimes := strings.Split(SkTimes, "-")
+	stime := skTimes[0]
+	etime := skTimes[1]
+	fmt.Println(common.Int64All(stime), common.If(common.Int64All(etime) == 0, time.Now().Unix(), common.Int64All(etime)))
 	for _, u := range users {
 		q["$or"] = []map[string]interface{}{
 			{"share_uid": u},
 			{"shared_uid": u},
 		}
+		q["createtime"] = map[string]interface{}{
+			"$gte": common.Int64All(stime),
+			"$lt":  common.If(common.Int64All(etime) == 0, time.Now().Unix(), common.Int64All(etime)),
+		}
 		data, _ := Mgo.Find("user_share", q, `{"createtime":1}`, `{"_id":1,"createtime":1,"shared_uid":1}`, false, 0, 4)
 		if len(*data) > 0 {
 			for _, vv := range *data {