|
@@ -15,29 +15,105 @@ class CmsContentTemplateSetRepository {
|
|
/**
|
|
/**
|
|
* banner配置
|
|
* banner配置
|
|
*/
|
|
*/
|
|
- public function create($request)
|
|
|
|
|
|
+ public function bannerSet($request)
|
|
{
|
|
{
|
|
|
|
|
|
- if ($request['rule'] && is_array($request['rule'])){
|
|
|
|
$rules = json_decode($request['rule'],true);
|
|
$rules = json_decode($request['rule'],true);
|
|
|
|
+ if (is_array($rules)){
|
|
if (count($rules)>10) {
|
|
if (count($rules)>10) {
|
|
throw new HttpException(500, '最多只能添加10个banner海报');
|
|
throw new HttpException(500, '最多只能添加10个banner海报');
|
|
}
|
|
}
|
|
|
|
+ $subject = [
|
|
|
|
+ 'tpl_id' => $request['tpl_id'],
|
|
|
|
+ 'rule' => $request['rule'],
|
|
|
|
+ 'area_type' => $request['area_type'],
|
|
|
|
+ 'status' => $request['status'],
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ if (!$this->cmsContentTemplateSet->create($subject)) {
|
|
|
|
+ throw new HttpException(500, '添加失败');
|
|
|
|
+ }
|
|
|
|
|
|
}else{
|
|
}else{
|
|
- throw new HttpException(500, '参数有误');
|
|
|
|
|
|
+ throw new HttpException(500, '参数格式有误');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 专题广告配置
|
|
|
|
+ */
|
|
|
|
+ public function advertisementSet($request)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ $rules = json_decode($request['rule'],true);
|
|
|
|
+ if (is_array($rules)){
|
|
|
|
+ $subject = [
|
|
|
|
+ 'tpl_id' => $request['tpl_id'],
|
|
|
|
+ 'rule' => $request['rule'],
|
|
|
|
+ 'area_type' => $request['area_type'],
|
|
|
|
+ 'status' => $request['status'],
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ if (!$this->cmsContentTemplateSet->create($subject)) {
|
|
|
|
+ throw new HttpException(500, '添加失败');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+ throw new HttpException(500, '参数格式有误');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 商品楼层配置
|
|
|
|
+ */
|
|
|
|
+ public function floorSet($request)
|
|
|
|
+ {
|
|
|
|
+ $rules = json_decode($request['rule'],true);
|
|
|
|
+ if (is_array($rules)){
|
|
|
|
+ $subject = [
|
|
|
|
+ 'tpl_id' => $request['tpl_id'],
|
|
|
|
+ 'rule' => $request['rule'],
|
|
|
|
+ 'area_type' => $request['area_type'],
|
|
|
|
+ 'status' => $request['status'],
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ if (!$this->cmsContentTemplateSet->create($subject)) {
|
|
|
|
+ throw new HttpException(500, '添加失败');
|
|
}
|
|
}
|
|
|
|
|
|
- $subject = [
|
|
|
|
- 'tpl_id' => $request['tpl_id'],
|
|
|
|
- 'rule' => $request['rule'],
|
|
|
|
- 'area_type' => $request['area_type'],
|
|
|
|
- 'status' => $request['status'],
|
|
|
|
- ];
|
|
|
|
|
|
+ }else{
|
|
|
|
+ throw new HttpException(500, '参数格式有误');
|
|
|
|
+ }
|
|
|
|
|
|
- if (!$this->cmsContentTemplateSet->create($subject)) {
|
|
|
|
- throw new HttpException(500, '添加失败');
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 分类专题配置
|
|
|
|
+ */
|
|
|
|
+ public function categorySet($request)
|
|
|
|
+ {
|
|
|
|
+ $rules = json_decode($request['rule'],true);
|
|
|
|
+ if (is_array($rules)){
|
|
|
|
+ $subject = [
|
|
|
|
+ 'tpl_id' => $request['tpl_id'],
|
|
|
|
+ 'rule' => $request['rule'],
|
|
|
|
+ 'area_type' => $request['area_type'],
|
|
|
|
+ 'status' => $request['status'],
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ if (!$this->cmsContentTemplateSet->create($subject)) {
|
|
|
|
+ throw new HttpException(500, '添加失败');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+ throw new HttpException(500, '参数格式有误');
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|