|
@@ -7,6 +7,7 @@ use Dingo\Api\Http\Response;
|
|
|
use App\Models\CmsContentTemplate;
|
|
|
use App\Models\CmsContentTemplateSet;
|
|
|
use App\Models\CmsSubjectProduct;
|
|
|
+use Illuminate\Support\Facades\Cache;
|
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Database\QueryException;
|
|
@@ -294,6 +295,9 @@ class CmsContentTemplateSetRepository {
|
|
|
*/
|
|
|
public function release($request)
|
|
|
{
|
|
|
+ $group_key = env('REDIS_HOME_GROUP_KEY');
|
|
|
+ $market_key = env('REDIS_HOME_MARKET_KEY');
|
|
|
+
|
|
|
//同一个城市同一个模板(团购/菜市场) 只能有一种状态(草稿/发布),已发布的一旦被编辑把之前的直接删掉
|
|
|
$template = $this->cmsContentTemplate->select('id','city_name','city_id','title','apply_type','is_open','status')->where('id',$request['tpl_id'])->first();
|
|
|
$where = [
|
|
@@ -349,6 +353,15 @@ class CmsContentTemplateSetRepository {
|
|
|
return Response::create();
|
|
|
}
|
|
|
}
|
|
|
+ if ($template->apply_type == 0){
|
|
|
+ if (Cache::has($group_key)) {
|
|
|
+ Cache::forget($group_key);
|
|
|
+ }
|
|
|
+ }elseif ($template->apply_type == 1){
|
|
|
+ if (Cache::has($market_key)) {
|
|
|
+ Cache::forget($market_key);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|