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