|
@@ -657,18 +657,18 @@ class GoodsService
|
|
|
];
|
|
|
}
|
|
|
}
|
|
|
- if (isset($extendJson['teachers'])){
|
|
|
- $data['teachers'] = $extendJson['teachers'];
|
|
|
- }
|
|
|
- if (isset($extendJson['address'])) {
|
|
|
- $data['address'] = $extendJson['address'];
|
|
|
- }
|
|
|
- if (isset($extendJson['min-count'])){
|
|
|
- $data['min_count'] = $extendJson['min-count'];
|
|
|
- }
|
|
|
- if (isset($extendJson['position'])) {
|
|
|
- $data['position'] = $extendJson['position'];
|
|
|
- }
|
|
|
+ // if (isset($extendJson['teachers'])){
|
|
|
+ // $data['teachers'] = $extendJson['teachers'];
|
|
|
+ // }
|
|
|
+ // if (isset($extendJson['address'])) {
|
|
|
+ // $data['address'] = $extendJson['address'];
|
|
|
+ // }
|
|
|
+ // if (isset($extendJson['min-count'])){
|
|
|
+ // $data['min_count'] = $extendJson['min-count'];
|
|
|
+ // }
|
|
|
+ // if (isset($extendJson['position'])) {
|
|
|
+ // $data['position'] = $extendJson['position'];
|
|
|
+ // }
|
|
|
if (isset($extendJson['label'])) {
|
|
|
$data['appointment_label'] = $extendJson['label'];
|
|
|
}
|
|
@@ -714,6 +714,18 @@ class GoodsService
|
|
|
}
|
|
|
$data['goods_json'] = $goodsJsonNew;
|
|
|
}
|
|
|
+ if (isset($extendJson['teachers'])){
|
|
|
+ $data['teachers'] = $extendJson['teachers'];
|
|
|
+ }
|
|
|
+ if (isset($extendJson['address'])) {
|
|
|
+ $data['address'] = $extendJson['address'];
|
|
|
+ }
|
|
|
+ if (isset($extendJson['min-count'])){
|
|
|
+ $data['min_count'] = $extendJson['min-count'];
|
|
|
+ }
|
|
|
+ if (isset($extendJson['position'])) {
|
|
|
+ $data['position'] = $extendJson['position'];
|
|
|
+ }
|
|
|
|
|
|
$data['goods_on_addtimes'] = date('Y-m-d\TH:i:s.u\Z', $data['goods_on_addtimes'] - 60 * 60 * 8);
|
|
|
|
|
@@ -1251,31 +1263,31 @@ class GoodsService
|
|
|
$attributeJsonDate = $currentDate . '至' . $lastDate;
|
|
|
}
|
|
|
|
|
|
- if (isset($params['work_time'])){
|
|
|
- $workTimeStart = date('H:i',strtotime($params['work_time'][0]));
|
|
|
- $workTimeEnd = date('H:i',strtotime($params['work_time'][1]));
|
|
|
- $attributeJsonTime = $workTimeStart.'至'.$workTimeEnd;
|
|
|
- }
|
|
|
+ // if (isset($params['work_time'])){
|
|
|
+ // $workTimeStart = date('H:i',strtotime($params['work_time'][0]));
|
|
|
+ // $workTimeEnd = date('H:i',strtotime($params['work_time'][1]));
|
|
|
+ // $attributeJsonTime = $workTimeStart.'至'.$workTimeEnd;
|
|
|
+ // }
|
|
|
|
|
|
$attributeJson = [
|
|
|
'icon' => $model->goods_cover,
|
|
|
'date' => $attributeJsonDate,
|
|
|
- 'time' => $attributeJsonTime,
|
|
|
+ // 'time' => $attributeJsonTime,
|
|
|
'dates' => $newDates ? array_values($newDates) : [],
|
|
|
'times' => $times,
|
|
|
'person' => $personTotal
|
|
|
];
|
|
|
- if(isset($params['address'])){
|
|
|
- $attributeJson['address'] = $params['address'];
|
|
|
- }
|
|
|
- if (isset($params['min_count'])){
|
|
|
- $attributeJson['min-count'] = $params['min_count'];
|
|
|
- }else{
|
|
|
- $attributeJson['min-count'] = 1;
|
|
|
- }
|
|
|
- if (isset($params['teachers'])){
|
|
|
- $attributeJson['teachers'] = $params['teachers'];
|
|
|
- }
|
|
|
+ // if(isset($params['address'])){
|
|
|
+ // $attributeJson['address'] = $params['address'];
|
|
|
+ // }
|
|
|
+ // if (isset($params['min_count'])){
|
|
|
+ // $attributeJson['min-count'] = $params['min_count'];
|
|
|
+ // }else{
|
|
|
+ // $attributeJson['min-count'] = 1;
|
|
|
+ // }
|
|
|
+ // if (isset($params['teachers'])){
|
|
|
+ // $attributeJson['teachers'] = $params['teachers'];
|
|
|
+ // }
|
|
|
if (!empty($params['appointment_label'])) {
|
|
|
$attributeJson['label'] = $params['appointment_label'];
|
|
|
}
|
|
@@ -1409,7 +1421,38 @@ class GoodsService
|
|
|
$attributeJson['service_premises_id'] = $params['goods_service_premises'];
|
|
|
$model->goods_attribute_json = json_encode($attributeJson);
|
|
|
}
|
|
|
+ if (isset($params['min_count'])){
|
|
|
+ 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['min-count'] = $params['min_count'];
|
|
|
+ $model->goods_attribute_json = json_encode($attributeJson);
|
|
|
+ }
|
|
|
+ if (isset($params['teachers'])){
|
|
|
+ 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['teacherst'] = $params['teachers'];
|
|
|
+ $model->goods_attribute_json = json_encode($attributeJson);
|
|
|
+ }
|
|
|
+ if (isset($params['work_time'])){
|
|
|
+ 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 = [];
|
|
|
+ }
|
|
|
|
|
|
+ $workTimeStart = date('H:i',strtotime($params['work_time'][0]));
|
|
|
+ $workTimeEnd = date('H:i',strtotime($params['work_time'][1]));
|
|
|
+ $attributeJsonTime = $workTimeStart.'至'.$workTimeEnd;
|
|
|
+
|
|
|
+ $attributeJson['time'] = $attributeJsonTime;
|
|
|
+ $model->goods_attribute_json = json_encode($attributeJson);
|
|
|
+ }
|
|
|
if ($model->save()) {
|
|
|
return $model->goods_id;
|
|
|
}
|
|
@@ -1688,11 +1731,6 @@ class GoodsService
|
|
|
$attributeJson['times'] = $times;
|
|
|
$attributeJson['person'] = $personTotal;
|
|
|
|
|
|
- if (isset($params['work_time'])){
|
|
|
- $workTimeStart = date('H:i',strtotime($params['work_time'][0]));
|
|
|
- $workTimeEnd = date('H:i',strtotime($params['work_time'][1]));
|
|
|
- $attributeJson['time'] = $workTimeStart.'至'.$workTimeEnd;
|
|
|
- }
|
|
|
if (!empty($params['appointment_label'])) {
|
|
|
$attributeJson['label'] = $params['appointment_label'];
|
|
|
}
|
|
@@ -1705,14 +1743,19 @@ class GoodsService
|
|
|
// if (isset($params['goods_service_premises'])){
|
|
|
// $attributeJson['service_premises_id'] = $params['goods_service_premises'];
|
|
|
// }
|
|
|
- if (isset($params['min_count'])){
|
|
|
- $attributeJson['min-count'] = $params['min_count'];
|
|
|
- }else{
|
|
|
- $attributeJson['min-count'] = 1;
|
|
|
- }
|
|
|
- if (isset($params['teachers'])){
|
|
|
- $attributeJson['teachers'] = $params['teachers'];
|
|
|
- }
|
|
|
+ // if (isset($params['work_time'])){
|
|
|
+ // $workTimeStart = date('H:i',strtotime($params['work_time'][0]));
|
|
|
+ // $workTimeEnd = date('H:i',strtotime($params['work_time'][1]));
|
|
|
+ // $attributeJson['time'] = $workTimeStart.'至'.$workTimeEnd;
|
|
|
+ // }
|
|
|
+ // if (isset($params['min_count'])){
|
|
|
+ // $attributeJson['min-count'] = $params['min_count'];
|
|
|
+ // }else{
|
|
|
+ // $attributeJson['min-count'] = 1;
|
|
|
+ // }
|
|
|
+ // if (isset($params['teachers'])){
|
|
|
+ // $attributeJson['teachers'] = $params['teachers'];
|
|
|
+ // }
|
|
|
$data['goods_attribute_json'] = json_encode($attributeJson, JSON_UNESCAPED_UNICODE);
|
|
|
}
|
|
|
|
|
@@ -1839,6 +1882,50 @@ class GoodsService
|
|
|
$data['goods_attribute_json']['service_premises_id'] = $params['goods_service_premises'];
|
|
|
$data['goods_attribute_json'] = json_encode($data['goods_attribute_json']);
|
|
|
}
|
|
|
+ if (isset($params['work_time'])){
|
|
|
+ if (!empty($data['goods_attribute_json']) && !is_array($data['goods_attribute_json'])) {
|
|
|
+ if (is_json($data['goods_attribute_json'])) {
|
|
|
+ $data['goods_attribute_json'] = json_decode($data['goods_attribute_json'], true);
|
|
|
+ } else {
|
|
|
+ $data['goods_attribute_json'] = [];
|
|
|
+ }
|
|
|
+ } elseif (empty($data['goods_attribute_json'])) {
|
|
|
+ $data['goods_attribute_json'] = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ $workTimeStart = date('H:i',strtotime($params['work_time'][0]));
|
|
|
+ $workTimeEnd = date('H:i',strtotime($params['work_time'][1]));
|
|
|
+
|
|
|
+ $data['goods_attribute_json']['time'] = $workTimeStart.'至'.$workTimeEnd;
|
|
|
+ $data['goods_attribute_json'] = json_encode($data['goods_attribute_json']);
|
|
|
+
|
|
|
+ }
|
|
|
+ if (isset($params['min_count'])){
|
|
|
+ if (!empty($data['goods_attribute_json']) && !is_array($data['goods_attribute_json'])) {
|
|
|
+ if (is_json($data['goods_attribute_json'])) {
|
|
|
+ $data['goods_attribute_json'] = json_decode($data['goods_attribute_json'], true);
|
|
|
+ } else {
|
|
|
+ $data['goods_attribute_json'] = [];
|
|
|
+ }
|
|
|
+ } elseif (empty($data['goods_attribute_json'])) {
|
|
|
+ $data['goods_attribute_json'] = [];
|
|
|
+ }
|
|
|
+ $data['goods_attribute_json']['min-count'] = $params['min_count'];
|
|
|
+ $data['goods_attribute_json'] = json_encode($data['goods_attribute_json']);
|
|
|
+ }
|
|
|
+ if (isset($params['teachers'])){
|
|
|
+ if (!empty($data['goods_attribute_json']) && !is_array($data['goods_attribute_json'])) {
|
|
|
+ if (is_json($data['goods_attribute_json'])) {
|
|
|
+ $data['goods_attribute_json'] = json_decode($data['goods_attribute_json'], true);
|
|
|
+ } else {
|
|
|
+ $data['goods_attribute_json'] = [];
|
|
|
+ }
|
|
|
+ } elseif (empty($data['goods_attribute_json'])) {
|
|
|
+ $data['goods_attribute_json'] = [];
|
|
|
+ }
|
|
|
+ $data['goods_attribute_json']['teachers'] = $params['teachers'];
|
|
|
+ $data['goods_attribute_json'] = json_encode($data['goods_attribute_json']);
|
|
|
+ }
|
|
|
|
|
|
foreach ($data as $key => $val) {
|
|
|
$row->{$key} = $val;
|