方法一:使用where方法参数传查询数组(此方法可以举一反三写出更复杂的查询条件)
//多条件查询 使用数组形式
//生成查询条件:`third_order_id` = ? and `shopify_order_id` is not null
$where = [
'third_order_id' => 299926302085545,
["shopify_order_id","<>",null]
];
//select * from `union_orders` where (`third_order_id` = ? and `shopify_order_id` is not null) limit 1
$data = UnionOrderModel::query()
->where($where)
->first();
方法二:使用whereNotNull方法,参数传查询的字段名
$data = UnionOrderModel::query()
->where("third_order_id","=",299926302085545)
->whereNotNull("shopify_order_id")
->first();
//select * from `union_orders` where `third_order_id` = ? and `shopify_order_id` is not null limit 1