|
@@ -124,18 +124,18 @@ class GoodsService
|
|
|
$goods = Goods::where('goods_id', $goodsId)
|
|
|
->select('goods_id', 'goods_attribute_json')
|
|
|
->first();
|
|
|
- $premisses = [];
|
|
|
+ $premisses = [];
|
|
|
if (!empty($goods->goods_attribute_json)) {
|
|
|
$attributeJson = json_decode($goods->goods_attribute_json, true);
|
|
|
- if(isset($attributeJson['premisses'])){
|
|
|
- $premisses = SysDept::whereIn('dept_id',$attributeJson['premisses'])
|
|
|
- ->select('dept_id','dept_name')
|
|
|
+ if (isset($attributeJson['premisses'])) {
|
|
|
+ $premisses = SysDept::whereIn('dept_id', $attributeJson['premisses'])
|
|
|
+ ->select('dept_id', 'dept_name')
|
|
|
->get()
|
|
|
->toArray();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return json_success('',$premisses);
|
|
|
+ return json_success('', $premisses);
|
|
|
}
|
|
|
|
|
|
public static function select(Request $request, $classify = "GOODS")
|
|
@@ -409,7 +409,7 @@ class GoodsService
|
|
|
public static function selectList(Request $request, $goodsClassify = "SERVICE")
|
|
|
{
|
|
|
$keywords = $request->get('keywords', '');
|
|
|
- $isSupportAppointment = $request->get('is_support_appointment', '');
|
|
|
+ $isSupportAppointment = $request->get('is_support_appointment', '');
|
|
|
// if (!$keywords){
|
|
|
// return json_success('暂无数据');
|
|
|
// }
|
|
@@ -455,9 +455,9 @@ class GoodsService
|
|
|
if (!empty($good['goods_attribute_json'])) {
|
|
|
$attributeJson = json_decode($good['goods_attribute_json'], true);
|
|
|
if (isset($attributeJson['premisses'])) {
|
|
|
- $premisses = SysDept::when(!empty($attributeJson['premisses']),function($query) use($attributeJson){
|
|
|
+ $premisses = SysDept::when(!empty($attributeJson['premisses']), function ($query) use ($attributeJson) {
|
|
|
$query->whereIn('dept_id', $attributeJson['premisses']);
|
|
|
- })->where('dept_category','营业场所')
|
|
|
+ })->where('dept_category', '营业场所')
|
|
|
->select('dept_id', 'dept_name')
|
|
|
->get();
|
|
|
$good['premisses'] = $premisses;
|
|
@@ -588,6 +588,12 @@ class GoodsService
|
|
|
$data['goods_premisses'] = $extendJson['premisses'];
|
|
|
$data['goods_premisses_str'] = SysDept::whereIn('dept_id', $extendJson['premisses'])->pluck('dept_name');
|
|
|
}
|
|
|
+ if (isset($extendJson['bg'])){
|
|
|
+ $data['goods_theme_color'] = $extendJson['bg'];
|
|
|
+ }
|
|
|
+ if (isset($extendJson['icon'])){
|
|
|
+ $data['goods_theme_icon'] = getenv('STORAGE_DOMAIN').$extendJson['icon'];
|
|
|
+ }
|
|
|
}
|
|
|
$data['appointment_times'] = [];
|
|
|
if ($data['is_support_appointment'] == 'Y' && isset($extendJson['dates'])) {
|
|
@@ -1509,6 +1515,20 @@ class GoodsService
|
|
|
} else {
|
|
|
$data['goods_json'] = '[]';
|
|
|
}
|
|
|
+ if (!empty($params['goods_theme_color']) && !empty($params['goods_theme_icon'])) {
|
|
|
+ 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']['bg'] = $params['goods_theme_color'];
|
|
|
+ $data['goods_attribute_json']['icon'] = str_replace(getenv('STORAGE_DOMAIN'), '', $params['goods_theme_icon']);
|
|
|
+ $data['goods_attribute_json'] = json_encode($data['goods_attribute_json']);
|
|
|
+ }
|
|
|
|
|
|
foreach ($data as $key => $val) {
|
|
|
$row->{$key} = $val;
|