我正在建立一个新网站,我有这个 cron 作业脚本来自动更新所有投资
错误似乎来自 http 控制器(行:)$rLog['amount'] = round(($rep->invest->amount * $rep->invest->plan->percent) / 100,$basic->deci);。
但我不知道如何修复它,因为我对 Laravel 完全陌生
if ($basic->repeat_status == 1){
$repeats = Repeat::whereStatus(0)->get();
foreach ($repeats as $rep){
if ($rep->repeat_time < Carbon::now()){
$rLog['user_id'] = $rep->user_id;
$rLog['trx_id'] = strtoupper(Str::random(20));
$rLog['investment_id'] = $rep->investment_id;
$rLog['made_time'] = Carbon::now();
$rLog['amount'] = round(($rep->invest->amount * $rep->invest->plan->percent) / 100,$basic->deci);
RepeatLog::create($rLog);
$rep->total_repeat = $rep->total_repeat + 1;
$rep->made_time = Carbon::now();
$rep->repeat_time = Carbon::parse()->addHours($rep->invest->plan->compound->compound);
if ($rep->total_repeat == $rep->invest->plan->time){
$rep->status = 1;
$inv = Investment::findOrFail($rep->investment_id);
$inv->status = 1;
$inv->save();
}
$rep->save();
我希望 cron 作业脚本运行,结果应该是用户对原始投资的更新
慕姐4208626
温温酱