|
@@ -99,7 +99,9 @@ class PledgeLogic
|
|
|
$total = bcmul($reta, $inter, 6) * $rows->num; //累计收益
|
|
$total = bcmul($reta, $inter, 6) * $rows->num; //累计收益
|
|
|
$rows->total_self= bcadd($total, $rows->total_self, 6);
|
|
$rows->total_self= bcadd($total, $rows->total_self, 6);
|
|
|
|
|
|
|
|
- $model->whereIn('order_no', $rows->order_no)->setField('status', $model::Paid);
|
|
|
|
|
|
|
+ //修改状态
|
|
|
|
|
+ $detail =json_decode($rows->details, true);
|
|
|
|
|
+ $model->whereIn('order_no', array_column($detail, 'order_no'))->setField('status', $model::Paid);
|
|
|
|
|
|
|
|
$rows->status = $model::Remove;
|
|
$rows->status = $model::Remove;
|
|
|
$rows->last_time = $time;
|
|
$rows->last_time = $time;
|
|
@@ -111,14 +113,12 @@ class PledgeLogic
|
|
|
//(60*60*24)*(当前时间-最后一次收取时间)
|
|
//(60*60*24)*(当前时间-最后一次收取时间)
|
|
|
public static function getPledgeCollect(int $user_id)
|
|
public static function getPledgeCollect(int $user_id)
|
|
|
{
|
|
{
|
|
|
- //$user_id = 1275;
|
|
|
|
|
$model = Loader::model('UserPledge');
|
|
$model = Loader::model('UserPledge');
|
|
|
$list = $model::where('user_id', $user_id)->where('status', '>', $model::Close)->select();
|
|
$list = $model::where('user_id', $user_id)->where('status', '>', $model::Close)->select();
|
|
|
if(empty($list)) throw new Exception('暂无质押订单');
|
|
if(empty($list)) throw new Exception('暂无质押订单');
|
|
|
$day = 86400;
|
|
$day = 86400;
|
|
|
$total = 0; //当前累计收益
|
|
$total = 0; //当前累计收益
|
|
|
$time = time();
|
|
$time = time();
|
|
|
-
|
|
|
|
|
foreach ($list as $item)
|
|
foreach ($list as $item)
|
|
|
{
|
|
{
|
|
|
//解冻
|
|
//解冻
|
|
@@ -126,7 +126,6 @@ class PledgeLogic
|
|
|
$total = $item->total_self;
|
|
$total = $item->total_self;
|
|
|
$item->status = $model::Close; //关闭
|
|
$item->status = $model::Close; //关闭
|
|
|
}else{
|
|
}else{
|
|
|
- dump(111);die;
|
|
|
|
|
$reta = bcdiv($item->day_num, $day, 6); //天数
|
|
$reta = bcdiv($item->day_num, $day, 6); //天数
|
|
|
$inter = ($item->last_time == 0) ? $time - $item->create_time: $time - $item->last_time; //最后收取时间
|
|
$inter = ($item->last_time == 0) ? $time - $item->create_time: $time - $item->last_time; //最后收取时间
|
|
|
$total = bcmul($reta, $inter, 6) * $item->num; //累计收益
|
|
$total = bcmul($reta, $inter, 6) * $item->num; //累计收益
|