|
@@ -20,8 +20,6 @@ class CmsContentTemplateSetRepository {
|
|
//banner模板选专题-被使用计数
|
|
//banner模板选专题-被使用计数
|
|
public function countSubject($request)
|
|
public function countSubject($request)
|
|
{
|
|
{
|
|
- Log::debug(json_encode($request));
|
|
|
|
-
|
|
|
|
if ($request['type'] == 0){
|
|
if ($request['type'] == 0){
|
|
$rule = json_decode($request['rule'],true);
|
|
$rule = json_decode($request['rule'],true);
|
|
if ($rule['link_type'] == 1){
|
|
if ($rule['link_type'] == 1){
|
|
@@ -31,25 +29,26 @@ class CmsContentTemplateSetRepository {
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
$subject_id_array = json_decode($request['old_rule'],true);
|
|
$subject_id_array = json_decode($request['old_rule'],true);
|
|
- if ($subject_id_array['link_type'] == 1 && $request['rule']['link_type'] == 1){//链接方式都为专题
|
|
|
|
- if ($subject_id_array['link_url'] != $request['rule']['link_url']){
|
|
|
|
|
|
+ $rule = json_decode($request['rule'],true);
|
|
|
|
+ if ($subject_id_array['link_type'] == 1 && $rule['link_type'] == 1){//链接方式都为专题
|
|
|
|
+ if ($subject_id_array['link_url'] != $rule['link_type']){
|
|
$templates = $this->cmsSubject->where('id',intval($subject_id_array['link_url']))->first();
|
|
$templates = $this->cmsSubject->where('id',intval($subject_id_array['link_url']))->first();
|
|
$update_template = [
|
|
$update_template = [
|
|
$templates->used_count -=1
|
|
$templates->used_count -=1
|
|
];
|
|
];
|
|
$templates->update($update_template);
|
|
$templates->update($update_template);
|
|
|
|
|
|
- $templates = $this->cmsSubject->where('id',intval($request['rule']['link_url']))->first();
|
|
|
|
|
|
+ $templates = $this->cmsSubject->where('id',intval($rule['link_type']))->first();
|
|
$templates->used_count +=1;
|
|
$templates->used_count +=1;
|
|
$templates->save();
|
|
$templates->save();
|
|
}
|
|
}
|
|
- }elseif ($subject_id_array['link_type'] == 1 && $request['rule']['link_type'] != 1){
|
|
|
|
|
|
+ }elseif ($subject_id_array['link_type'] == 1 && $rule['link_type'] != 1){
|
|
$templates = $this->cmsSubject->where('id',intval($subject_id_array['link_url']))->first();
|
|
$templates = $this->cmsSubject->where('id',intval($subject_id_array['link_url']))->first();
|
|
$update_template = [
|
|
$update_template = [
|
|
$templates->used_count -=1
|
|
$templates->used_count -=1
|
|
];
|
|
];
|
|
$templates->update($update_template);
|
|
$templates->update($update_template);
|
|
- }elseif ($subject_id_array['link_type'] != 1 && $request['rule']['link_type'] == 1){
|
|
|
|
|
|
+ }elseif ($subject_id_array['link_type'] != 1 && $rule['link_type'] == 1){
|
|
$templates = $this->cmsSubject->where('id',intval($request['rule']['link_url']))->first();
|
|
$templates = $this->cmsSubject->where('id',intval($request['rule']['link_url']))->first();
|
|
$templates->used_count +=1;
|
|
$templates->used_count +=1;
|
|
$templates->save();
|
|
$templates->save();
|