This commit is contained in:
邓皓元 2019-04-11 18:26:04 +08:00
parent 946dcc5066
commit 3e5851edf1
2 changed files with 3 additions and 1 deletions

View File

@ -60,7 +60,7 @@ class ProductRepository extends Repository
} }
if (isset($conditions['type'])) { if (isset($conditions['type'])) {
$conditions['type'] = array_wrap($conditions['type']); $conditions['type'] = array_map('intval', array_wrap($conditions['type']));
$query->whereIn('type', $conditions['type']); $query->whereIn('type', $conditions['type']);
} }

View File

@ -154,6 +154,8 @@ class ProductService extends Service
return $node; return $node;
} else { } else {
$attributes['sn'] = self::sn($package['sn'], $attributes['company_id']); $attributes['sn'] = self::sn($package['sn'], $attributes['company_id']);
$attributes['created_at'] = date('Y-m-d H:i:s');
$attributes['updated_at'] = date('Y-m-d H:i:s');
$node = $this->productRepository->upsert($attributes, ['sn', 'deleted_at']); $node = $this->productRepository->upsert($attributes, ['sn', 'deleted_at']);
} }