判断表中某字段是否为null再更新字段
// 优化方案:一次数据库操作完成“判断+更新”(推荐)
DB::table('bx_users')
->where('open_id', $request->openid)
->whereNull('shouci') // 直接在查询条件中判断 shouci 为 NULL
->update(['jifen' => $cp->danjia])
最近访问时间:2025-12-03 10:27:41