调整
This commit is contained in:
@ -22,14 +22,21 @@ class InterestTreasure extends Command
|
||||
{
|
||||
// 指令执行
|
||||
$this->outputInfo = $output;
|
||||
$this->closeAccount();
|
||||
|
||||
}
|
||||
|
||||
public function closeAccount()
|
||||
{
|
||||
$this->outputInfo->writeln('开始结算');
|
||||
$this->yebeveryday();
|
||||
$this->outputInfo->writeln('结算完成');
|
||||
try {
|
||||
//逻辑代码
|
||||
$this->yebeveryday();
|
||||
} catch (\Exception $exception) {
|
||||
//Log::info($exception->getMessage());
|
||||
var_dump($exception->getTrace());
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
public function yebeveryday()
|
||||
@ -44,26 +51,28 @@ class InterestTreasure extends Command
|
||||
if ($new_profit_time >= $getdoing['end_time']) {
|
||||
$new_profit_time = $getdoing['end_time'];
|
||||
}
|
||||
$second_time = $new_profit_time - $getdoing['profit_time'];
|
||||
$nowprift = ($getdoing['money'] * $getdoing['lily'] / 100) * floor($second_time / 86400);
|
||||
$seconds = floor(($new_profit_time - $getdoing['profit_time']) / 86400);
|
||||
$nowprift = ($getdoing['money'] * $getdoing['lily'] / 100) * $seconds;
|
||||
$profit = $getdoing['profit'] + $seconds;
|
||||
$id = $getdoing['id'];
|
||||
var_dump($seconds);
|
||||
var_dump($getdoing['profit_time'] + $seconds * 86400);
|
||||
if ($nowprift > 0) {
|
||||
Db::table('lc_yuebao_lists')->where('id='. $getdoing['id'])
|
||||
->update([
|
||||
'profit_time' => $getdoing['profit_time'] + $second_time,
|
||||
'profit_time' => $getdoing['profit_time'] + $seconds * 86400,
|
||||
'nowprofit' => $getdoing['nowprofit'] + $nowprift,
|
||||
'profit' => $getdoing['profit'] + floor(($nowtime - $getdoing['start_time']) / 86400)
|
||||
'profit' => $getdoing['profit'] + $seconds
|
||||
]);
|
||||
$keepnum = $keepnum + 1;
|
||||
//获取用户余额;
|
||||
addFinance($getdoing['uid'], $nowprift, 1, "余额宝利息返利");
|
||||
$getuserinfo = Db::table('lc_user')->where('id=' . $getdoing['uid'])->find();
|
||||
//记录日志!
|
||||
$id = $getdoing['id'];
|
||||
unset($getdoing['id']);
|
||||
unset($getdoing['profit_time']);
|
||||
unset($getdoing['profit']);
|
||||
$getdoing['status'] = 2;
|
||||
$getdoing['end_time'] = time();
|
||||
$getdoing['nowprofit'] = $nowprift;
|
||||
$getdoing['balance'] = $getuserinfo['money'];
|
||||
$getdoing['closetime'] = time();
|
||||
@ -72,13 +81,12 @@ class InterestTreasure extends Command
|
||||
//更新用户余额
|
||||
$newbalance = $getuserinfo['money'] + $nowprift;
|
||||
Db::table('lc_user')->where('id=' . $getdoing['uid'])->update(['money' => $newbalance]);
|
||||
|
||||
}
|
||||
//第二步,已到期待结算
|
||||
if ($new_profit_time >= $getdoing['end_time']) {
|
||||
if ($profit >= $getdoing['days']) {
|
||||
//更新参保状态。
|
||||
Db::table('lc_yuebao_lists')->where('id=' . $id)
|
||||
->update(['status' => 2, 'end_time' => $nowtime]);
|
||||
->update(['status' => 2]);
|
||||
//获取用户余额;
|
||||
addFinance($getdoing['uid'], $getdoing['money'], 1, "余额宝返还本金");
|
||||
$getuserinfo = Db::table('lc_user')->where('id=' . $getdoing['uid'])->find();
|
||||
@ -98,9 +106,10 @@ class InterestTreasure extends Command
|
||||
$closenum = $closenum + 1;
|
||||
}
|
||||
}catch (\Exception $e){
|
||||
var_dump($e->getTraceAsString());
|
||||
$this->outputInfo->error("结算失败,ID: " . $getdoing['id'] . " 错误信息: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
$this->outputInfo->writeln('结算成功:' . $keepnum . '条,结算失败:' . $closenum . '条');
|
||||
$this->outputInfo->writeln('结算成功:' . $keepnum . '条,到期:' . $closenum . '条');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user