find(); $income = new BrokerIncomeModel(); $income->save([ 'brokerid' => $broker_id, 'workerid' => $broker['workerid'], 'agentid' => $broker['agentid'], 'title' => $title, 'origin_value' => $broker['income'], 'value' => $value, 'remark' => $remark, 'createtime' => time(), 'yeartime' => date("Y"), 'monthtime' => date("Ym"), ]); //修改收益 $worker = WorkerModel::where('id', $broker['workerid'])->find(); $worker->income += $value; $agent = AgentModel::where('id', $broker['agentid'])->find(); $agent->income += $value; $broker->income += $value; //修改累计收益 if ($value > 0) { $broker->income_total += $value; $worker->income_total += $value; $agent->income_total += $value; } $broker->save(); $worker->save(); $agent->save(); } }