|
@@ -121,6 +121,9 @@ class CmsContentTemplateSetRepository
|
|
if (isset($v['link_type'])) {
|
|
if (isset($v['link_type'])) {
|
|
$rules[$k]['link_type'] = intval($v['link_type']);
|
|
$rules[$k]['link_type'] = intval($v['link_type']);
|
|
}
|
|
}
|
|
|
|
+ if (isset($v['link_url'])) {
|
|
|
|
+ $rules[$k]['link_url'] = trim($v['link_url']);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
$templateSet = [
|
|
$templateSet = [
|
|
@@ -144,7 +147,7 @@ class CmsContentTemplateSetRepository
|
|
|
|
|
|
if ($template_id->apply_type == 2) {
|
|
if ($template_id->apply_type == 2) {
|
|
if (!$subject || $subject->is_open != 1 || $subject->used_mall != 0) {
|
|
if (!$subject || $subject->is_open != 1 || $subject->used_mall != 0) {
|
|
- throw new HttpException(500, '所填专题已关闭或不是兑换商城专题');
|
|
|
|
|
|
+ throw new HttpException(500, '所填专题已关闭或不是兑换专区专题');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -177,7 +180,7 @@ class CmsContentTemplateSetRepository
|
|
$subject = $this->cmsSubject->where('id', intval($v['link_url']))->first();
|
|
$subject = $this->cmsSubject->where('id', intval($v['link_url']))->first();
|
|
if ($template_id->apply_type == 2) {
|
|
if ($template_id->apply_type == 2) {
|
|
if (!$subject || $subject->is_open != 1 || $subject->used_mall != 0) {
|
|
if (!$subject || $subject->is_open != 1 || $subject->used_mall != 0) {
|
|
- throw new HttpException(500, '所填专题已关闭或不是兑换商城专题');
|
|
|
|
|
|
+ throw new HttpException(500, '所填专题已关闭或不是兑换专区专题');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$subject->used_count += 1;
|
|
$subject->used_count += 1;
|
|
@@ -210,7 +213,7 @@ class CmsContentTemplateSetRepository
|
|
$subject = $this->cmsSubject->where('id', intval($request['rule']['link_url']))->first();
|
|
$subject = $this->cmsSubject->where('id', intval($request['rule']['link_url']))->first();
|
|
if ($request['apply_type'] == 2) {
|
|
if ($request['apply_type'] == 2) {
|
|
if (!$subject || $subject->is_open != 1 || $subject->used_mall != 0) {
|
|
if (!$subject || $subject->is_open != 1 || $subject->used_mall != 0) {
|
|
- throw new HttpException(500, '所填专题已关闭或不是兑换商城专题');
|
|
|
|
|
|
+ throw new HttpException(500, '所填专题已关闭或不是兑换专区专题');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$subject->used_count += 1;
|
|
$subject->used_count += 1;
|
|
@@ -228,7 +231,7 @@ class CmsContentTemplateSetRepository
|
|
$subject = $this->cmsSubject->where('id', intval($request['rule']['link_url']))->first();
|
|
$subject = $this->cmsSubject->where('id', intval($request['rule']['link_url']))->first();
|
|
if ($request['apply_type'] == 2) {
|
|
if ($request['apply_type'] == 2) {
|
|
if (!$subject || $subject->is_open != 1 || $subject->used_mall != 0) {
|
|
if (!$subject || $subject->is_open != 1 || $subject->used_mall != 0) {
|
|
- throw new HttpException(500, '所填专题已关闭或不是兑换商城专题');
|
|
|
|
|
|
+ throw new HttpException(500, '所填专题已关闭或不是兑换专区专题');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$subject->used_count += 1;
|
|
$subject->used_count += 1;
|
|
@@ -262,6 +265,12 @@ class CmsContentTemplateSetRepository
|
|
public function advertisementSet($request)
|
|
public function advertisementSet($request)
|
|
{
|
|
{
|
|
$advertisement_id = $request['id'] ?? '';
|
|
$advertisement_id = $request['id'] ?? '';
|
|
|
|
+ if (isset($request['rule']['link_type'])) {
|
|
|
|
+ $request['rule']['link_type'] = intval($request['rule']['link_type']);
|
|
|
|
+ }
|
|
|
|
+ if (isset($request['rule']['link_url'])) {
|
|
|
|
+ $request['rule']['link_url'] = trim($request['rule']['link_url']);
|
|
|
|
+ }
|
|
$subject = [
|
|
$subject = [
|
|
'tpl_id' => $request['tpl_id'],
|
|
'tpl_id' => $request['tpl_id'],
|
|
'rule' => json_encode($request['rule']),
|
|
'rule' => json_encode($request['rule']),
|
|
@@ -299,6 +308,9 @@ class CmsContentTemplateSetRepository
|
|
if (isset($request['rule']['link_type'])) {
|
|
if (isset($request['rule']['link_type'])) {
|
|
$request['rule']['link_type'] = intval($request['rule']['link_type']);
|
|
$request['rule']['link_type'] = intval($request['rule']['link_type']);
|
|
}
|
|
}
|
|
|
|
+ if (isset($request['rule']['link_url'])) {
|
|
|
|
+ $request['rule']['link_url'] = trim($request['rule']['link_url']);
|
|
|
|
+ }
|
|
if (isset($request['rule']['show_num'])) {
|
|
if (isset($request['rule']['show_num'])) {
|
|
$request['rule']['show_num'] = intval($request['rule']['show_num']);
|
|
$request['rule']['show_num'] = intval($request['rule']['show_num']);
|
|
}
|
|
}
|
|
@@ -318,7 +330,7 @@ class CmsContentTemplateSetRepository
|
|
$subject = $this->cmsSubject->where('id', intval($request['rule']['link_url']))->first();
|
|
$subject = $this->cmsSubject->where('id', intval($request['rule']['link_url']))->first();
|
|
if ($template_id->apply_type == 2) {
|
|
if ($template_id->apply_type == 2) {
|
|
if (!$subject || $subject->is_open != 1 || $subject->used_mall != 0) {
|
|
if (!$subject || $subject->is_open != 1 || $subject->used_mall != 0) {
|
|
- throw new HttpException(500, '所填专题已关闭或不是兑换商城专题');
|
|
|
|
|
|
+ throw new HttpException(500, '所填专题已关闭或不是兑换专区专题');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -347,6 +359,12 @@ class CmsContentTemplateSetRepository
|
|
public function categorySet($request)
|
|
public function categorySet($request)
|
|
{
|
|
{
|
|
$category_id = $request['id'] ?? '';
|
|
$category_id = $request['id'] ?? '';
|
|
|
|
+ if (isset($request['rule']['link_type'])) {
|
|
|
|
+ $request['rule']['link_type'] = intval($request['rule']['link_type']);
|
|
|
|
+ }
|
|
|
|
+ if (isset($request['rule']['link_url'])) {
|
|
|
|
+ $request['rule']['link_url'] = trim($request['rule']['link_url']);
|
|
|
|
+ }
|
|
$subject = [
|
|
$subject = [
|
|
'tpl_id' => $request['tpl_id'],
|
|
'tpl_id' => $request['tpl_id'],
|
|
'rule' => json_encode($request['rule']),
|
|
'rule' => json_encode($request['rule']),
|
|
@@ -409,7 +427,7 @@ class CmsContentTemplateSetRepository
|
|
//同一个城市同一个模板(团购/菜市场) 只能有一种状态(草稿/发布),已发布的一旦被编辑把之前的直接删掉
|
|
//同一个城市同一个模板(团购/菜市场) 只能有一种状态(草稿/发布),已发布的一旦被编辑把之前的直接删掉
|
|
$template = $this->cmsContentTemplate->select('id', 'city_name', 'city_id', 'title', 'apply_type', 'is_open', 'status')->where('id', $request['tpl_id'])->first();
|
|
$template = $this->cmsContentTemplate->select('id', 'city_name', 'city_id', 'title', 'apply_type', 'is_open', 'status')->where('id', $request['tpl_id'])->first();
|
|
|
|
|
|
- //兑换商城检测banner是否设置
|
|
|
|
|
|
+ //兑换专区检测banner是否设置
|
|
if ($template->apply_type == 2) {
|
|
if ($template->apply_type == 2) {
|
|
$testing_banner = $this->cmsContentTemplateSet->select('rule')->where(['tpl_id' => $request['tpl_id'], 'area_type' => 0])->first();
|
|
$testing_banner = $this->cmsContentTemplateSet->select('rule')->where(['tpl_id' => $request['tpl_id'], 'area_type' => 0])->first();
|
|
$testing_banner = $testing_banner->toArray();
|
|
$testing_banner = $testing_banner->toArray();
|
|
@@ -611,7 +629,7 @@ class CmsContentTemplateSetRepository
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * v0.3兑换商城内容预览
|
|
|
|
|
|
+ * v0.3兑换专区内容预览
|
|
*/
|
|
*/
|
|
public function exchangeMall($request)
|
|
public function exchangeMall($request)
|
|
{
|
|
{
|