|
@@ -25,7 +25,7 @@ class CmsContentTemplateSetRepository {
|
|
*/
|
|
*/
|
|
public function set($request)
|
|
public function set($request)
|
|
{
|
|
{
|
|
- $template = $this->cmsContentTemplate->select('id','city_name','city_id','title','apply_type','is_open')->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();
|
|
$templates = $template->toArray();
|
|
$templates = $template->toArray();
|
|
$where = [
|
|
$where = [
|
|
'city_id'=>$templates['city_id'],
|
|
'city_id'=>$templates['city_id'],
|
|
@@ -36,7 +36,7 @@ class CmsContentTemplateSetRepository {
|
|
$request = [];
|
|
$request = [];
|
|
$need_create=true;
|
|
$need_create=true;
|
|
foreach ($copys_template as $k=>$v) {
|
|
foreach ($copys_template as $k=>$v) {
|
|
- if ($v['is_open'] == 0) {
|
|
|
|
|
|
+ if ($v['status'] == 0) {
|
|
$need_create = false;
|
|
$need_create = false;
|
|
$request['type'] = $v['apply_type'];
|
|
$request['type'] = $v['apply_type'];
|
|
$request['tpl_id'] = $v['id'];
|
|
$request['tpl_id'] = $v['id'];
|
|
@@ -49,7 +49,8 @@ class CmsContentTemplateSetRepository {
|
|
'city_id' => $templates['city_id'],
|
|
'city_id' => $templates['city_id'],
|
|
'city_name' => $templates['city_name'],
|
|
'city_name' => $templates['city_name'],
|
|
'apply_type' => $templates['apply_type'],
|
|
'apply_type' => $templates['apply_type'],
|
|
- 'is_open' => 0,
|
|
|
|
|
|
+ 'status' => 0,
|
|
|
|
+ 'is_open' => $templates['is_open'],
|
|
];
|
|
];
|
|
DB::beginTransaction();
|
|
DB::beginTransaction();
|
|
try {
|
|
try {
|
|
@@ -218,7 +219,7 @@ class CmsContentTemplateSetRepository {
|
|
//同一个城市同一个模板(团购/菜市场) 只能有一种状态(草稿/发布),已发布的一旦被编辑把之前的直接删掉
|
|
//同一个城市同一个模板(团购/菜市场) 只能有一种状态(草稿/发布),已发布的一旦被编辑把之前的直接删掉
|
|
$templateSet = $this->cmsContentTemplateSet->where('tpl_id',$request['tpl_id'])->select('id','status')->get();
|
|
$templateSet = $this->cmsContentTemplateSet->where('tpl_id',$request['tpl_id'])->select('id','status')->get();
|
|
$tem_array = $templateSet->toArray();
|
|
$tem_array = $templateSet->toArray();
|
|
- $template = $this->cmsContentTemplate->select('id','city_name','city_id','title','apply_type','is_open')->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();
|
|
$where = [
|
|
$where = [
|
|
'city_id'=>$template->city_id,
|
|
'city_id'=>$template->city_id,
|
|
'title'=>$template->title,
|
|
'title'=>$template->title,
|
|
@@ -227,12 +228,12 @@ class CmsContentTemplateSetRepository {
|
|
$templates = $this->cmsContentTemplate->where($where)->get();
|
|
$templates = $this->cmsContentTemplate->where($where)->get();
|
|
$update_is_open_ids=[];
|
|
$update_is_open_ids=[];
|
|
foreach ($templates->toArray() as $k=>$v) {
|
|
foreach ($templates->toArray() as $k=>$v) {
|
|
- if ($v['is_open'] == 1) {
|
|
|
|
|
|
+ if ($v['status'] == 1) {
|
|
$update_is_open_ids[]=$v['id'];
|
|
$update_is_open_ids[]=$v['id'];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- $update_tpl = $this->cmsContentTemplate->where('id', $request['tpl_id'])->update(['is_open' => 1]);
|
|
|
|
|
|
+ $update_tpl = $this->cmsContentTemplate->where('id', $request['tpl_id'])->update(['status' => 1,'is_open'=>1]);
|
|
if (!$update_tpl) {
|
|
if (!$update_tpl) {
|
|
throw new HttpException(500, '修改失败,请重试');
|
|
throw new HttpException(500, '修改失败,请重试');
|
|
}
|
|
}
|