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