正在显示
1 个修改的文件
包含
4 行增加
和
0 行删除
| @@ -32,6 +32,7 @@ class APublicModel extends Base | @@ -32,6 +32,7 @@ class APublicModel extends Base | ||
| 32 | */ | 32 | */ |
| 33 | public static function getNumByProjectId($project_id){ | 33 | public static function getNumByProjectId($project_id){ |
| 34 | ProjectServer::useProject($project_id); | 34 | ProjectServer::useProject($project_id); |
| 35 | + try { | ||
| 35 | $data = Cache::get('product_blog_news_'.$project_id); | 36 | $data = Cache::get('product_blog_news_'.$project_id); |
| 36 | if(!$data){ | 37 | if(!$data){ |
| 37 | $productNumber = DB::connection('custom_mysql')->table('gl_product') | 38 | $productNumber = DB::connection('custom_mysql')->table('gl_product') |
| @@ -51,6 +52,9 @@ class APublicModel extends Base | @@ -51,6 +52,9 @@ class APublicModel extends Base | ||
| 51 | $data = ['product'=>$productNumber,'blog'=>$blogNumber,'news'=>$newsNumber,'key'=>$keyNumber,'inquiry'=>$inquiryNumber]; | 52 | $data = ['product'=>$productNumber,'blog'=>$blogNumber,'news'=>$newsNumber,'key'=>$keyNumber,'inquiry'=>$inquiryNumber]; |
| 52 | Cache::add('product_blog_news_'.$project_id,$data,30 * 60); | 53 | Cache::add('product_blog_news_'.$project_id,$data,30 * 60); |
| 53 | } | 54 | } |
| 55 | + }catch (\Exception $e){ | ||
| 56 | + return []; | ||
| 57 | + } | ||
| 54 | DB::disconnect('custom_mysql'); | 58 | DB::disconnect('custom_mysql'); |
| 55 | return $data; | 59 | return $data; |
| 56 | } | 60 | } |
-
请 注册 或 登录 后发表评论