更新 'src/Models/GoodsSku.php'
parent
8c81f3f2c4
commit
ffb5a6056a
|
|
@ -33,8 +33,11 @@ class GoodsSku extends Model
|
|||
{
|
||||
foreach ($params as $item) {
|
||||
foreach ($item as $key => $value) {
|
||||
$value = is_string($value) ? '"'.$value.'"' : $value;
|
||||
$q->whereRaw('json_contains(spec->>"$[*].'.$key."\", '".$value."')");
|
||||
if (in_array($key, ["name", "value"])) {
|
||||
$key = trim($key);
|
||||
$value = trim($value);
|
||||
$q->whereRaw("json_contains(spec, json_object('$key', '$value'))");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue