find($user_id); $balance_data=[ 'user_id' => $user_id , 'money' => $balance , 'before' => $user_info['money'] , 'after' => bcadd($user_info['money'],$balance,2) , 'source' => $source , 'memo' => $desc , 'create_time' => date('Y-m-d H:i:s'), 'related_id' => $related_id, 'from_user' => $from_user, ]; Db::startTrans(); try { Db::table('fa_user')->where('id',$user_id)->update(['money'=>$balance_data['surplus']]); MoneyLog::create($balance_data); }catch (Exception $e){ Db::rollback(); } }