|
@@ -440,6 +440,15 @@ class GoodsService
|
|
|
|
|
|
$data['appointment_times'] = $times;
|
|
|
}
|
|
|
+ if (isset($extendJson['address'])) {
|
|
|
+ $data['address'] = $extendJson['address'];
|
|
|
+ }
|
|
|
+ if (isset($extendJson['position'])) {
|
|
|
+ $data['position'] = $extendJson['position'];
|
|
|
+ }
|
|
|
+ if (isset($extendJson['label'])) {
|
|
|
+ $data['appointment_label'] = $extendJson['label'];
|
|
|
+ }
|
|
|
}
|
|
|
if (!empty($data['goods_json']) && $data['join_goods_category_id'] == 65) {
|
|
|
foreach ($data['goods_json'] as $key => $datum) {
|
|
@@ -1091,11 +1100,19 @@ class GoodsService
|
|
|
'duration' => $time['appointmentTimeStart'] . '-' . $time['appointmentTimeEnd']
|
|
|
];
|
|
|
}
|
|
|
- $data['goods_attribute_json'] = json_encode([
|
|
|
+ $attributeJson = [
|
|
|
'icon' => '',
|
|
|
'dates' => $params['dates'] ?? [],
|
|
|
'times' => $times
|
|
|
- ]);
|
|
|
+ ];
|
|
|
+ if (!empty($params['appointment_label'])) {
|
|
|
+ $attributeJson['label'] = $params['appointment_label'];
|
|
|
+ }
|
|
|
+ if (!empty($params['address'])) {
|
|
|
+ $attributeJson['address'] = $params['address'];
|
|
|
+ $attributeJson['position'] = $params['position'];
|
|
|
+ }
|
|
|
+ $data['goods_attribute_json'] = json_encode($attributeJson);
|
|
|
}
|
|
|
if (!empty($data['goods_json']) && $data['join_goods_category_id'] == 65) {
|
|
|
$goodsJson = json_decode($data['goods_json'], true);
|
|
@@ -1120,6 +1137,8 @@ class GoodsService
|
|
|
$data['goods_json'] = '[]';
|
|
|
}
|
|
|
|
|
|
+ dump($data);
|
|
|
+
|
|
|
foreach ($data as $key => $val) {
|
|
|
$row->{$key} = $val;
|
|
|
}
|
|
@@ -1153,6 +1172,9 @@ class GoodsService
|
|
|
$detail = GoodsDetail::where('join_detail_goods_id', $params['goods_id'])->first();
|
|
|
if ($detail) {
|
|
|
self::doUpdate($detail->join_detail_goods_id, $data, new GoodsDetail());
|
|
|
+ } else {
|
|
|
+ $data['join_detail_goods_id'] = $params['goods_id'];
|
|
|
+ GoodsDetail::insert($data);
|
|
|
}
|
|
|
} catch (BusinessException $e) {
|
|
|
throw new BusinessException($e->getMessage());
|
|
@@ -1175,14 +1197,19 @@ class GoodsService
|
|
|
{
|
|
|
try {
|
|
|
$data = self::inputFilter($params, new GoodsLabel());
|
|
|
+ dump($data);
|
|
|
// 根据goods_id 查详情ID
|
|
|
$detail = GoodsLabel::where('join_label_goods_id', $params['goods_id'])->first();
|
|
|
if ($detail) {
|
|
|
self::doUpdate($detail->goods_label_id, $data, new GoodsLabel());
|
|
|
+ }else{
|
|
|
+ $data['join_label_goods_id'] = $params['goods_id'];
|
|
|
+ GoodsLabel::insert($data);
|
|
|
}
|
|
|
} catch (BusinessException $e) {
|
|
|
throw new BusinessException($e->getMessage());
|
|
|
} catch (\Exception $e) {
|
|
|
+ dump($e->getMessage());
|
|
|
throw new BusinessException('数据更新异常~3');
|
|
|
}
|
|
|
}
|
|
@@ -1233,6 +1260,10 @@ class GoodsService
|
|
|
}
|
|
|
if ($detail) {
|
|
|
self::doUpdate($detail->join_running_goods_id, $data, new GoodsRunning());
|
|
|
+ } else {
|
|
|
+ // 兼容老数据……
|
|
|
+ $data['join_running_goods_id'] = $params['goods_id'];
|
|
|
+ GoodsRunning::insert($data);
|
|
|
}
|
|
|
|
|
|
} catch (BusinessException $e) {
|