|
@@ -334,11 +334,13 @@ class BookTest extends Command
|
|
$result = [];
|
|
$result = [];
|
|
$chapter_model = new ChapterOrder();
|
|
$chapter_model = new ChapterOrder();
|
|
foreach ($info as $item){
|
|
foreach ($info as $item){
|
|
- $to_bids = YqUserBidRelation::where('uid',$item->uid)->select('to_bid','created_at')->get()->pluck('created_at','to_bid')->all();
|
|
|
|
- $from_bid = YqUserBidRelation::where('uid',$item->uid)->select('from_bid','created_at')->get()->pluck('created_at','from_bid')->all();
|
|
|
|
|
|
+ $to_bids = YqUserBidRelation::where('uid',$item->uid)->select('to_bid','created_at')->get();
|
|
|
|
+ $from_bids = YqUserBidRelation::where('uid',$item->uid)->where('from_bid','>',0)->select('from_bid','created_at')->get();
|
|
$chapter_model->setCurrentTable($item->uid);
|
|
$chapter_model->setCurrentTable($item->uid);
|
|
if($to_bids){
|
|
if($to_bids){
|
|
- foreach ($to_bids as $to_bid=>$time){
|
|
|
|
|
|
+ foreach ($to_bids as $v){
|
|
|
|
+ $to_bid = $v->to_bid;
|
|
|
|
+ $time = $to_bids->created_at->format('Y-m-d H:i:s');
|
|
if(!$to_bid) continue;
|
|
if(!$to_bid) continue;
|
|
$fee = $chapter_model->where('uid',$item->uid)
|
|
$fee = $chapter_model->where('uid',$item->uid)
|
|
->where('bid',$to_bid)
|
|
->where('bid',$to_bid)
|
|
@@ -366,21 +368,23 @@ class BookTest extends Command
|
|
$result = [];
|
|
$result = [];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- if($from_bid){
|
|
|
|
- foreach ($from_bid as $to_bid=>$time){
|
|
|
|
|
|
+ $to_bid = null;
|
|
|
|
+ if($from_bids){
|
|
|
|
+ foreach ($from_bids as $from_bid){
|
|
|
|
+ $bid = $from_bid->from_bid;
|
|
|
|
+ $time = $from_bid->created_at->format('Y-m-d H:i:s');
|
|
if(!$to_bid) continue;
|
|
if(!$to_bid) continue;
|
|
$fee = $chapter_model->where('uid',$item->uid)
|
|
$fee = $chapter_model->where('uid',$item->uid)
|
|
- ->where('bid',$to_bid)
|
|
|
|
|
|
+ ->where('bid',$bid)
|
|
->where('created_at','>=',$time)
|
|
->where('created_at','>=',$time)
|
|
->sum('fee');
|
|
->sum('fee');
|
|
$amount = Order::where('uid',$item->uid)
|
|
$amount = Order::where('uid',$item->uid)
|
|
- ->where('from_bid',$to_bid)
|
|
|
|
|
|
+ ->where('from_bid',$bid)
|
|
->where('created_at','>=',$time)
|
|
->where('created_at','>=',$time)
|
|
->where('status','PAID')
|
|
->where('status','PAID')
|
|
->sum('price');
|
|
->sum('price');
|
|
$result[] = [
|
|
$result[] = [
|
|
- 'bid'=>$to_bid,
|
|
|
|
|
|
+ 'bid'=>$bid,
|
|
'uid'=>$item->uid,
|
|
'uid'=>$item->uid,
|
|
'fee'=>$fee,
|
|
'fee'=>$fee,
|
|
'amount'=>$amount,
|
|
'amount'=>$amount,
|