findOrEmpty($shopId); if ($shop->isEmpty()) { return false; } $leftAmount = $shop->money; if(ShopAccountLogEnum::DEPOSIT == $changeObject){ $leftAmount = $shop->deposit; } $data = [ 'sn' => generate_sn((new ShopAccountLog()), 'sn', 20), 'shop_id' => $shopId, 'change_object' => $changeObject, 'change_type' => $changeType, 'action' => $action, 'left_amount' => $leftAmount, 'change_amount' => $changeAmount, 'source_sn' => $sourceSn, 'remark' => $remark, 'extra' => $extra ? json_encode($extra, JSON_UNESCAPED_UNICODE) : '', 'admin_id' => $adminId ]; return ShopAccountLog::create($data); } }