|
@@ -1249,15 +1249,6 @@ class GoodsService
|
|
|
if (!empty($params['appointment_label'])) {
|
|
|
$attributeJson['label'] = $params['appointment_label'];
|
|
|
}
|
|
|
- if (!empty($params['address'])) {
|
|
|
- $attributeJson['address'] = $params['address'];
|
|
|
- }
|
|
|
- if (!empty($params['position'])){
|
|
|
- $attributeJson['position'] = $params['position'];
|
|
|
- }
|
|
|
- if (isset($params['goods_service_premises'])){
|
|
|
- $attributeJson['service_premises_id'] = $params['goods_service_premises'];
|
|
|
- }
|
|
|
$model->goods_attribute_json = json_encode($attributeJson, JSON_UNESCAPED_UNICODE);
|
|
|
|
|
|
// $times = [];
|
|
@@ -1352,6 +1343,34 @@ class GoodsService
|
|
|
$attributeJson['icon'] = str_replace(getenv('STORAGE_DOMAIN'), '', $params['goods_theme_icon']);
|
|
|
$model->goods_attribute_json = json_encode($attributeJson);
|
|
|
}
|
|
|
+
|
|
|
+ if (!empty($params['address'])) {
|
|
|
+ if (!empty($model->goods_attribute_json) && !is_array($model->goods_attribute_json)) {
|
|
|
+ $attributeJson = json_decode($model->goods_attribute_json, true);
|
|
|
+ } elseif (empty($model->goods_attribute_json)) {
|
|
|
+ $attributeJson = [];
|
|
|
+ }
|
|
|
+ $attributeJson['address'] = $params['address'];
|
|
|
+ $model->goods_attribute_json = json_encode($attributeJson);
|
|
|
+ }
|
|
|
+ if (!empty($params['position'])){
|
|
|
+ if (!empty($model->goods_attribute_json) && !is_array($model->goods_attribute_json)) {
|
|
|
+ $attributeJson = json_decode($model->goods_attribute_json, true);
|
|
|
+ } elseif (empty($model->goods_attribute_json)) {
|
|
|
+ $attributeJson = [];
|
|
|
+ }
|
|
|
+ $attributeJson['position'] = $params['position'];
|
|
|
+ $model->goods_attribute_json = json_encode($attributeJson);
|
|
|
+ }
|
|
|
+ if (isset($params['goods_service_premises'])){
|
|
|
+ if (!empty($model->goods_attribute_json) && !is_array($model->goods_attribute_json)) {
|
|
|
+ $attributeJson = json_decode($model->goods_attribute_json, true);
|
|
|
+ } elseif (empty($model->goods_attribute_json)) {
|
|
|
+ $attributeJson = [];
|
|
|
+ }
|
|
|
+ $attributeJson['service_premises_id'] = $params['goods_service_premises'];
|
|
|
+ $model->goods_attribute_json = json_encode($attributeJson);
|
|
|
+ }
|
|
|
|
|
|
if ($model->save()) {
|
|
|
return $model->goods_id;
|