@@ -275,7 +275,7 @@ func (u *Dashboard) GetTxAmountByDay(ctx context.Context, req *dashboard_proto.G
275275 timeSlice := getRecent7DayTimeSlice ()
276276 log .Info (timeSlice )
277277 var ret []bean.TxBean
278- var ret2 [] bean.AssetBean
278+ var ret2 bean.AssetBean
279279 var amount uint64 = 0
280280 var data []* dashboard_proto.TxAmountByDay
281281 var mgo = mgo .Session ()
@@ -289,17 +289,10 @@ func (u *Dashboard) GetTxAmountByDay(ctx context.Context, req *dashboard_proto.G
289289 if err != nil {
290290 log .Error (err )
291291 }
292- var assetIdArr []string ;
293- for _ , v := range ret {
294- assetIdArr = append (assetIdArr , v .Data .BasicInfo .AssetID )
295- }
296292
297- log .Info (assetIdArr )
298-
299- mgo .DB (config .DB_NAME ).C ("Messages" ).Find (bson.M {"type" : "assetreg" , "data.asset_id" : bson.M {"$in" : assetIdArr }}).All (& ret2 )
300- for _ , v := range ret2 {
301- log .Info (v .Data .BasicInfo .Price )
302- amount += v .Data .BasicInfo .Price
293+ for _ , v := range ret {
294+ mgo .DB (config .DB_NAME ).C ("Messages" ).Find (bson.M {"type" : "assetreg" , "data.asset_id" : v .Data .BasicInfo .AssetID }).One (& ret2 )
295+ amount += ret2 .Data .BasicInfo .Price
303296 }
304297
305298 log .Info (amount )
@@ -316,7 +309,8 @@ func (u *Dashboard) GetTxAmountByDay(ctx context.Context, req *dashboard_proto.G
316309}
317310
318311func (u * Dashboard ) GetAllTypeTotal (ctx context.Context , req * dashboard_proto.GetAllTypeTotalRequest , rsp * dashboard_proto.GetAllTypeTotalResponse ) error {
319- var accountNum , assetNum , requirementNum , txAmount , txNum int = 0 , 0 , 0 , 0 , 0
312+ var accountNum , assetNum , requirementNum , txNum int = 0 , 0 , 0 , 0
313+ var txAmount uint64 = 0
320314 min , max := query .TodayTimeSolt ()
321315 accountNum = accountNum + query .AccountNum (min , max )
322316 assetNum = assetNum + query .AssetNum (min , max )
0 commit comments