|
|
@@ -142,7 +142,9 @@ class StoreProduct extends AuthController
|
|
|
public function create($id = 0)
|
|
|
{
|
|
|
$this->assign('id', (int)$id);
|
|
|
- $this->assign('lucky_id', Config::get('activity.lucky_cate_id'));
|
|
|
+ $luckies = get_luckies();
|
|
|
+ $this->assign('lucky_id', json_encode($luckies));
|
|
|
+ $this->assign('lucky_spec_name', Config::get('activity.lucky_spec_name') );
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
|
|
|
@@ -287,6 +289,8 @@ class StoreProduct extends AuthController
|
|
|
$data['activity'][$k] = 3;
|
|
|
}
|
|
|
}
|
|
|
+ $lucky_spec_name = Config::get('activity.lucky_spec_name');
|
|
|
+ $lucky_spec_items = Config::get('activity.lucky_spec_items');
|
|
|
$data['activity'] = implode(',', $data['activity']);
|
|
|
$detail = $data['attrs'];
|
|
|
$data['price'] = min(array_column($detail, 'price'));
|
|
|
@@ -338,15 +342,13 @@ class StoreProduct extends AuthController
|
|
|
$detail[0]['value1'] = '规格';
|
|
|
$detail[0]['detail'] = ['规格' => '默认'];
|
|
|
} else {
|
|
|
- if ($cate_id[0] == Config::get('activity.lucky_cate_id')) {
|
|
|
- if (!array_search('幸运', array_column($attr, 'value'))) {
|
|
|
+ if ( in_array($cate_id[0], get_luckies()) ) {
|
|
|
+ if (!array_search($lucky_spec_name, array_column($attr, 'value'))) {
|
|
|
$attr[] = [
|
|
|
- 'value' => '幸运',
|
|
|
+ 'value' => $lucky_spec_name,
|
|
|
'detailValue' => '',
|
|
|
'attrHidden' => '',
|
|
|
- 'detail' => [
|
|
|
- 20, 21
|
|
|
- ],
|
|
|
+ 'detail' => $lucky_spec_items,
|
|
|
];
|
|
|
}
|
|
|
}
|
|
|
@@ -383,14 +385,12 @@ class StoreProduct extends AuthController
|
|
|
$detail[0]['value1'] = '规格';
|
|
|
$detail[0]['detail'] = ['规格' => '默认'];
|
|
|
} else {
|
|
|
- if ($cate_id[0] == Config::get('activity.lucky_cate_id')) {
|
|
|
+ if ( in_array($cate_id[0], get_luckies()) ) {
|
|
|
$attr[] = [
|
|
|
- 'value' => '幸运',
|
|
|
+ 'value' => $lucky_spec_name,
|
|
|
'detailValue' => '',
|
|
|
'attrHidden' => '',
|
|
|
- 'detail' => [
|
|
|
- 20, 21
|
|
|
- ],
|
|
|
+ 'detail' => $lucky_spec_items,
|
|
|
];
|
|
|
}
|
|
|
}
|
|
|
@@ -548,15 +548,15 @@ class StoreProduct extends AuthController
|
|
|
if (is_array($cate_id)) {
|
|
|
return Json::fail('产品只能属于一个分类');
|
|
|
}
|
|
|
- if ($cate_id == Config::get('activity.lucky_cate_id')) {
|
|
|
- if (!array_search('幸运', array_column($data['attrs'], 'value'))) {
|
|
|
+ $lucky_spec_name = Config::get('activity.lucky_spec_name');
|
|
|
+ $lucky_spec_items = Config::get('activity.lucky_spec_items');
|
|
|
+ if ( in_array($cate_id, get_luckies()) ) {
|
|
|
+ if (!array_search($lucky_spec_name, array_column($data['attrs'], 'value'))) {
|
|
|
$data['attrs'][] = [
|
|
|
- 'value' => '幸运',
|
|
|
+ 'value' => $lucky_spec_name,
|
|
|
'detailValue' => '',
|
|
|
'attrHidden' => '',
|
|
|
- 'detail' => [
|
|
|
- 20, 21
|
|
|
- ],
|
|
|
+ 'detail' => $lucky_spec_items,
|
|
|
];
|
|
|
}
|
|
|
}
|