|
@@ -1,16 +1,18 @@
|
|
package entity
|
|
package entity
|
|
|
|
|
|
import (
|
|
import (
|
|
- "app.yhyue.com/moapp/jyResourcesCenter/rpc/resourcesCenterclient"
|
|
|
|
- qu "app.yhyue.com/moapp/jybase/common"
|
|
|
|
- . "app.yhyue.com/moapp/jybase/date"
|
|
|
|
- . "bp.jydev.jianyu360.cn/BaseService/pushpkg/p"
|
|
|
|
"fmt"
|
|
"fmt"
|
|
- "github.com/gogf/gf/v2/util/gconv"
|
|
|
|
"log"
|
|
"log"
|
|
. "resourceBrushLibrary/config"
|
|
. "resourceBrushLibrary/config"
|
|
"sync"
|
|
"sync"
|
|
"time"
|
|
"time"
|
|
|
|
+
|
|
|
|
+ "app.yhyue.com/moapp/jyResourcesCenter/rpc/resourcesCenterclient"
|
|
|
|
+ qu "app.yhyue.com/moapp/jybase/common"
|
|
|
|
+ . "app.yhyue.com/moapp/jybase/date"
|
|
|
|
+ . "app.yhyue.com/moapp/jybase/mongodb"
|
|
|
|
+ . "bp.jydev.jianyu360.cn/BaseService/pushpkg/p"
|
|
|
|
+ "github.com/gogf/gf/v2/util/gconv"
|
|
)
|
|
)
|
|
|
|
|
|
func OrderResource() {
|
|
func OrderResource() {
|
|
@@ -26,7 +28,9 @@ func OrderResourceRun(now time.Time, end int64) {
|
|
grantDate := gconv.Int64(grantDateStr)
|
|
grantDate := gconv.Int64(grantDateStr)
|
|
pool := make(chan bool, Config.GivePool)
|
|
pool := make(chan bool, Config.GivePool)
|
|
wait := &sync.WaitGroup{}
|
|
wait := &sync.WaitGroup{}
|
|
- it := Mgo_qfw.GetMgoConn().DB("qfw").C("user").Find(map[string]interface{}{
|
|
|
|
|
|
+ sess := Mgo_qfw.GetMgoConn()
|
|
|
|
+ defer Mgo_qfw.DestoryMongoConn(sess)
|
|
|
|
+ it := sess.DB("qfw").C("user").Find(map[string]interface{}{
|
|
"i_appid": 2,
|
|
"i_appid": 2,
|
|
"i_vip_status": map[string]interface{}{
|
|
"i_vip_status": map[string]interface{}{
|
|
"$gt": 0,
|
|
"$gt": 0,
|
|
@@ -59,7 +63,7 @@ func OrderResourceRun(now time.Time, end int64) {
|
|
wait.Done()
|
|
wait.Done()
|
|
}()
|
|
}()
|
|
//每个用户生成10个附件下载包
|
|
//每个用户生成10个附件下载包
|
|
- userId := qu.InterfaceToStr(user["_id"])
|
|
|
|
|
|
+ userId := BsonIdToSId(user["_id"])
|
|
l_vip_endtime := qu.Int64All(user["l_vip_endtime"])
|
|
l_vip_endtime := qu.Int64All(user["l_vip_endtime"])
|
|
Purchase.PurchaseUserBalance(resourcesCenterclient.Resources{
|
|
Purchase.PurchaseUserBalance(resourcesCenterclient.Resources{
|
|
AppId: "10000",
|
|
AppId: "10000",
|
|
@@ -74,15 +78,18 @@ func OrderResourceRun(now time.Time, end int64) {
|
|
Model: 3,
|
|
Model: 3,
|
|
})
|
|
})
|
|
//数据打标记
|
|
//数据打标记
|
|
- Mgo_qfw.UpdateById("user", userId, map[string]interface{}{
|
|
|
|
|
|
+ cc := Mgo_qfw.UpdateById("user", userId, map[string]interface{}{
|
|
"$set": map[string]interface{}{
|
|
"$set": map[string]interface{}{
|
|
"i_grantDate": grantDate,
|
|
"i_grantDate": grantDate,
|
|
}})
|
|
}})
|
|
|
|
+ log.Println("user表更新成功", cc, userId, user)
|
|
|
|
+
|
|
}(m)
|
|
}(m)
|
|
|
|
+ m = make(map[string]interface{})
|
|
}
|
|
}
|
|
//企业版超级订阅处理
|
|
//企业版超级订阅处理
|
|
log.Println("ent_user", TaskConfig.LastTime, end)
|
|
log.Println("ent_user", TaskConfig.LastTime, end)
|
|
- itEnt := Mgo_qfw.GetMgoConn().DB("qfw").C("ent_user").Find(map[string]interface{}{
|
|
|
|
|
|
+ itEnt := sess.DB("qfw").C("ent_user").Find(map[string]interface{}{
|
|
"i_vip_status": map[string]interface{}{
|
|
"i_vip_status": map[string]interface{}{
|
|
"$gt": 0,
|
|
"$gt": 0,
|
|
},
|
|
},
|
|
@@ -105,8 +112,7 @@ func OrderResourceRun(now time.Time, end int64) {
|
|
}).Iter()
|
|
}).Iter()
|
|
log.Println("ent_user", itEnt)
|
|
log.Println("ent_user", itEnt)
|
|
for m := make(map[string]interface{}); itEnt.Next(&m); {
|
|
for m := make(map[string]interface{}); itEnt.Next(&m); {
|
|
- id := qu.InterfaceToStr(m["_id"])
|
|
|
|
- log.Println(2222, id, m)
|
|
|
|
|
|
+ log.Println(2222, m)
|
|
pool <- true
|
|
pool <- true
|
|
wait.Add(1)
|
|
wait.Add(1)
|
|
go func(user map[string]interface{}) {
|
|
go func(user map[string]interface{}) {
|
|
@@ -120,6 +126,7 @@ func OrderResourceRun(now time.Time, end int64) {
|
|
log.Println("没有找到该用户身份信息", user)
|
|
log.Println("没有找到该用户身份信息", user)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ id := BsonIdToSId(user["_id"])
|
|
//每个用户生成10个附件下载包
|
|
//每个用户生成10个附件下载包
|
|
l_vip_endtime := qu.Int64All(user["l_vip_endtime"])
|
|
l_vip_endtime := qu.Int64All(user["l_vip_endtime"])
|
|
Purchase.PurchaseUserBalance(resourcesCenterclient.Resources{
|
|
Purchase.PurchaseUserBalance(resourcesCenterclient.Resources{
|
|
@@ -139,6 +146,7 @@ func OrderResourceRun(now time.Time, end int64) {
|
|
"i_grantDate": grantDate,
|
|
"i_grantDate": grantDate,
|
|
}}), 333)
|
|
}}), 333)
|
|
}(m)
|
|
}(m)
|
|
|
|
+ m = make(map[string]interface{})
|
|
}
|
|
}
|
|
wait.Wait()
|
|
wait.Wait()
|
|
}
|
|
}
|