白俊遥博客 以updateOrCreate 为例,伪代码:
$result = OfflineDevelopResultModel::query()->updateOrCreate([
'task_id' => $id,
],[
'project' => $project,
'flow' => $flow,
'type' => 2,
'node_association' => $node_association,
]);
//判断是否为更新操作用到关键词wasRecentlyCreated
if ($result->wasRecentlyCreated) {
//插入
} esle {
//更新操作
}
本文为码上有钱原创文章,转载无需和我联系,但请注明来自码上有钱博客https://oldcai688.com
最新评论