|
|
@@ -107,22 +107,21 @@ class PledgeLogic
|
|
|
->where('a.user_id', $user_id)
|
|
|
->where('a.id', $pledge_id)
|
|
|
->where('a.status', $model::Ongoing)
|
|
|
- ->where('a.end_time', '<', $time)
|
|
|
+ ->where('a.end_time', '>', $time)
|
|
|
->field('a.*,b.day_num')
|
|
|
->find();
|
|
|
if(empty($rows)) throw new Exception('暂无质押订单');
|
|
|
- //修改状态
|
|
|
+
|
|
|
$orderId = explode(',', $order_id);
|
|
|
- $detail = array_column(json_decode($rows->details, true), 'id');
|
|
|
- $diff = array_diff($detail, $orderId);
|
|
|
+ $detail = json_decode($rows->details, true);
|
|
|
+ $count = count($orderId);
|
|
|
$num = $rows->num;
|
|
|
- if(empty($diff)) {
|
|
|
+ if(count($orderId) == count($detail)) {
|
|
|
$rows->status = $model::Remove;
|
|
|
}else{
|
|
|
- $rows->num = count($diff);
|
|
|
- $num = count($orderId);
|
|
|
+ $rows->num = count($detail) - $count;
|
|
|
+ $num = $count;
|
|
|
}
|
|
|
-
|
|
|
$day = 86400;
|
|
|
$total = 0; //当前累计收益
|
|
|
$reta = bcdiv($rows->day_num, $day, 6); //天数
|
|
|
@@ -149,7 +148,7 @@ class PledgeLogic
|
|
|
->join('product_pledge b', 'a.pledge_id = b.id', 'left')
|
|
|
->where('a.user_id', $user_id)
|
|
|
->where('a.status', '>', $model::Close)
|
|
|
- ->where('a.end_time', '<', $time)
|
|
|
+ ->where('a.end_time', '>', $time)
|
|
|
->field('a.*,b.day_num')
|
|
|
->select();
|
|
|
|