Merge remote-tracking branch 'origin/master' into akun
正在显示
13 个修改的文件
包含
84 行增加
和
11 行删除
| @@ -177,7 +177,7 @@ class UpdateSeoTdk extends Command | @@ -177,7 +177,7 @@ class UpdateSeoTdk extends Command | ||
| 177 | if(!Redis::setnx($cache_key, 1)){ | 177 | if(!Redis::setnx($cache_key, 1)){ |
| 178 | continue; | 178 | continue; |
| 179 | } | 179 | } |
| 180 | - Redis::expire($cache_key, 300); | 180 | + Redis::expire($cache_key, 120); |
| 181 | 181 | ||
| 182 | echo date('Y-m-d H:i:s') . '更新--' . $table . ': 项目id' . $project_id . ':id' . $v['id'] . PHP_EOL; | 182 | echo date('Y-m-d H:i:s') . '更新--' . $table . ': 项目id' . $project_id . ':id' . $v['id'] . PHP_EOL; |
| 183 | $v = DB::connection('custom_mysql')->table($table)->where('id', $v['id'])->first(); | 183 | $v = DB::connection('custom_mysql')->table($table)->where('id', $v['id'])->first(); |
| @@ -83,7 +83,6 @@ class OnlineController extends BaseController | @@ -83,7 +83,6 @@ class OnlineController extends BaseController | ||
| 83 | 'gl_project_deploy_optimize.assist_mid AS optimize_assist_mid', | 83 | 'gl_project_deploy_optimize.assist_mid AS optimize_assist_mid', |
| 84 | 'gl_project_deploy_optimize.tech_mid AS optimize_tech_mid', | 84 | 'gl_project_deploy_optimize.tech_mid AS optimize_tech_mid', |
| 85 | 'gl_project_deploy_optimize.domain AS domain', | 85 | 'gl_project_deploy_optimize.domain AS domain', |
| 86 | - 'gl_project_payment.amount AS amount', | ||
| 87 | ]; | 86 | ]; |
| 88 | return $select; | 87 | return $select; |
| 89 | } | 88 | } |
| @@ -206,6 +206,9 @@ class ProjectController extends BaseController | @@ -206,6 +206,9 @@ class ProjectController extends BaseController | ||
| 206 | if(isset($this->map['channel_id']) && !empty($this->map['channel_id'])){ | 206 | if(isset($this->map['channel_id']) && !empty($this->map['channel_id'])){ |
| 207 | $query->where('gl_project.channel','like','%"channel_id": "'.$this->map['channel_id'].'"%'); | 207 | $query->where('gl_project.channel','like','%"channel_id": "'.$this->map['channel_id'].'"%'); |
| 208 | } | 208 | } |
| 209 | + if(isset($this->map['user_id']) && !empty($this->map['user_id'])){ | ||
| 210 | + $query->where('gl_project.channel','like','%"user_id": "'.$this->map['channel_id'].'"%'); | ||
| 211 | + } | ||
| 209 | return $query; | 212 | return $query; |
| 210 | } | 213 | } |
| 211 | 214 |
| @@ -24,7 +24,7 @@ class BlogController extends BaseController | @@ -24,7 +24,7 @@ class BlogController extends BaseController | ||
| 24 | * @time :2023/9/14 10:45 | 24 | * @time :2023/9/14 10:45 |
| 25 | */ | 25 | */ |
| 26 | public function lists(BlogModel $blogModel){ | 26 | public function lists(BlogModel $blogModel){ |
| 27 | - $filed = ['id','category_id','operator_id','status','created_at','label_id','image','updated_at','name','sort','url']; | 27 | + $filed = ['id','category_id','operator_id','status','created_at','label_id','image','updated_at','name','sort','url','release_at']; |
| 28 | $this->order = 'sort'; | 28 | $this->order = 'sort'; |
| 29 | $query = $blogModel->orderBy($this->order ,'desc')->orderBy('id','desc'); | 29 | $query = $blogModel->orderBy($this->order ,'desc')->orderBy('id','desc'); |
| 30 | $query = $this->searchParam($query); | 30 | $query = $this->searchParam($query); |
| @@ -24,7 +24,7 @@ class NewsController extends BaseController | @@ -24,7 +24,7 @@ class NewsController extends BaseController | ||
| 24 | * @method | 24 | * @method |
| 25 | */ | 25 | */ |
| 26 | public function lists(NewsModel $news){ | 26 | public function lists(NewsModel $news){ |
| 27 | - $filed = ['id','category_id','operator_id','status','created_at','image','updated_at','name','sort','url']; | 27 | + $filed = ['id','category_id','operator_id','status','created_at','image','updated_at','name','sort','url', 'release_at']; |
| 28 | $this->order = 'sort'; | 28 | $this->order = 'sort'; |
| 29 | $query = $news->orderBy($this->order ,'desc')->orderBy('id','desc'); | 29 | $query = $news->orderBy($this->order ,'desc')->orderBy('id','desc'); |
| 30 | $query = $this->searchParam($query); | 30 | $query = $this->searchParam($query); |
| @@ -54,15 +54,16 @@ class KeywordLogic extends BaseLogic | @@ -54,15 +54,16 @@ class KeywordLogic extends BaseLogic | ||
| 54 | $this->param = $this->handleSaveParam($this->param); | 54 | $this->param = $this->handleSaveParam($this->param); |
| 55 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 55 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 56 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 56 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 57 | + $id = $this->param['id']; | ||
| 57 | }else{ | 58 | }else{ |
| 58 | $this->param['project_id'] = $this->user['project_id']; | 59 | $this->param['project_id'] = $this->user['project_id']; |
| 59 | $this->param['created_at'] = date('Y-m-d H:i:s'); | 60 | $this->param['created_at'] = date('Y-m-d H:i:s'); |
| 60 | $this->param['updated_at'] = $this->param['created_at']; | 61 | $this->param['updated_at'] = $this->param['created_at']; |
| 61 | $id = $this->model->insertGetId($this->param); | 62 | $id = $this->model->insertGetId($this->param); |
| 62 | - //路由映射 | ||
| 63 | - $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); | ||
| 64 | - $this->model->edit(['route'=>$route],['id'=>$id]); | ||
| 65 | } | 63 | } |
| 64 | + //路由映射 | ||
| 65 | + $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); | ||
| 66 | + $this->model->edit(['route'=>$route],['id'=>$id]); | ||
| 66 | //清除缓存 | 67 | //清除缓存 |
| 67 | Common::del_user_cache('product_keyword',$this->user['project_id']); | 68 | Common::del_user_cache('product_keyword',$this->user['project_id']); |
| 68 | DB::commit(); | 69 | DB::commit(); |
| @@ -92,6 +93,12 @@ class KeywordLogic extends BaseLogic | @@ -92,6 +93,12 @@ class KeywordLogic extends BaseLogic | ||
| 92 | if(isset($param['keyword_video']) && !empty($param['keyword_video'])){ | 93 | if(isset($param['keyword_video']) && !empty($param['keyword_video'])){ |
| 93 | $param['keyword_video'] = Arr::a2s($param['keyword_video']); | 94 | $param['keyword_video'] = Arr::a2s($param['keyword_video']); |
| 94 | } | 95 | } |
| 96 | + if(!empty($param['related_news_ids'])){ | ||
| 97 | + $param['related_news_ids'] = Arr::arrToSet($param['related_news_ids']); | ||
| 98 | + } | ||
| 99 | + if(!empty($param['related_blog_ids'])){ | ||
| 100 | + $param['related_blog_ids'] = Arr::arrToSet($param['related_blog_ids']); | ||
| 101 | + } | ||
| 95 | return $param; | 102 | return $param; |
| 96 | } | 103 | } |
| 97 | 104 |
| @@ -136,6 +136,16 @@ class ProductLogic extends BaseLogic | @@ -136,6 +136,16 @@ class ProductLogic extends BaseLogic | ||
| 136 | public function editList(){ | 136 | public function editList(){ |
| 137 | $this->param['category_id'] = $this->getLastCategory($this->param['category_id']); | 137 | $this->param['category_id'] = $this->getLastCategory($this->param['category_id']); |
| 138 | $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']); | 138 | $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']); |
| 139 | + if(isset($this->param['gallery']) && !empty($this->param['gallery'])){ | ||
| 140 | + foreach ($this->param['gallery'] as $k => $v){ | ||
| 141 | + $v['url'] = str_replace_url($v['url']); | ||
| 142 | + $this->param['gallery'][$k] = $v; | ||
| 143 | + } | ||
| 144 | + $this->param['thumb'] = Arr::a2s($this->param['gallery'][0] ?? []); | ||
| 145 | + $this->param['gallery'] = Arr::a2s($this->param['gallery'] ?? []); | ||
| 146 | + }else{ | ||
| 147 | + $this->param['thumb'] = []; | ||
| 148 | + } | ||
| 139 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 149 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 140 | return $this->success(); | 150 | return $this->success(); |
| 141 | } | 151 | } |
| @@ -191,6 +201,8 @@ class ProductLogic extends BaseLogic | @@ -191,6 +201,8 @@ class ProductLogic extends BaseLogic | ||
| 191 | } | 201 | } |
| 192 | $param['thumb'] = Arr::a2s($param['gallery'][0] ?? []); | 202 | $param['thumb'] = Arr::a2s($param['gallery'][0] ?? []); |
| 193 | $param['gallery'] = Arr::a2s($param['gallery'] ?? []); | 203 | $param['gallery'] = Arr::a2s($param['gallery'] ?? []); |
| 204 | + }else{ | ||
| 205 | + $param['thumb'] = []; | ||
| 194 | } | 206 | } |
| 195 | $param['attrs'] = Arr::a2s($param['attrs'] ?? []); | 207 | $param['attrs'] = Arr::a2s($param['attrs'] ?? []); |
| 196 | $param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? ''); | 208 | $param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? ''); |
| @@ -201,6 +201,7 @@ class UserLoginLogic | @@ -201,6 +201,7 @@ class UserLoginLogic | ||
| 201 | $info['upload_config'] = $project['upload_config']; | 201 | $info['upload_config'] = $project['upload_config']; |
| 202 | $info['image_max'] = $project['image_max']; | 202 | $info['image_max'] = $project['image_max']; |
| 203 | $info['configuration'] = $project['deploy_build']['configuration']; | 203 | $info['configuration'] = $project['deploy_build']['configuration']; |
| 204 | + $info['type'] = $project['type']; | ||
| 204 | if($info['is_customized'] == 1){ | 205 | if($info['is_customized'] == 1){ |
| 205 | $info['is_visualization'] = json_decode($project['is_visualization']); | 206 | $info['is_visualization'] = json_decode($project['is_visualization']); |
| 206 | } | 207 | } |
| @@ -34,6 +34,8 @@ class KeywordRequest extends FormRequest | @@ -34,6 +34,8 @@ class KeywordRequest extends FormRequest | ||
| 34 | 'seo_title'=>'max:200', | 34 | 'seo_title'=>'max:200', |
| 35 | 'seo_keywords'=>'max:200', | 35 | 'seo_keywords'=>'max:200', |
| 36 | 'seo_description'=>'max:200', | 36 | 'seo_description'=>'max:200', |
| 37 | + 'related_news_ids'=>'array|max:2', | ||
| 38 | + 'related_blog_ids'=>'array|max:2', | ||
| 37 | ]; | 39 | ]; |
| 38 | } | 40 | } |
| 39 | 41 | ||
| @@ -45,6 +47,8 @@ class KeywordRequest extends FormRequest | @@ -45,6 +47,8 @@ class KeywordRequest extends FormRequest | ||
| 45 | 'seo_title.max' => 'SEO标题不能超过200个字符', | 47 | 'seo_title.max' => 'SEO标题不能超过200个字符', |
| 46 | 'seo_keywords.max' => 'SEO关键词不能超过200个字符', | 48 | 'seo_keywords.max' => 'SEO关键词不能超过200个字符', |
| 47 | 'seo_description.max' => 'SEO描述不能超过200个字符', | 49 | 'seo_description.max' => 'SEO描述不能超过200个字符', |
| 50 | + 'related_news_ids.max' => '关联新闻不能超过两条', | ||
| 51 | + 'related_blog_ids.max' => '关联博客不能超过两条', | ||
| 48 | ]; | 52 | ]; |
| 49 | } | 53 | } |
| 50 | 54 |
| @@ -14,6 +14,14 @@ class Blog extends Base | @@ -14,6 +14,14 @@ class Blog extends Base | ||
| 14 | public function user(){ | 14 | public function user(){ |
| 15 | return $this->hasMany(User::class,'operator_id','id'); | 15 | return $this->hasMany(User::class,'operator_id','id'); |
| 16 | } | 16 | } |
| 17 | + | ||
| 18 | + public function getReleaseAtAttribute($value){ | ||
| 19 | + if(!$value){ | ||
| 20 | + return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at'))); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + return $value; | ||
| 24 | + } | ||
| 17 | } | 25 | } |
| 18 | 26 | ||
| 19 | 27 |
| @@ -15,4 +15,12 @@ class News extends Base | @@ -15,4 +15,12 @@ class News extends Base | ||
| 15 | public static function getNumByProjectId($project_id){ | 15 | public static function getNumByProjectId($project_id){ |
| 16 | return self::where('project_id', $project_id)->where('status', 1)->count(); | 16 | return self::where('project_id', $project_id)->where('status', 1)->count(); |
| 17 | } | 17 | } |
| 18 | + | ||
| 19 | + public function getReleaseAtAttribute($value){ | ||
| 20 | + if(!$value){ | ||
| 21 | + return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at'))); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + return $value; | ||
| 25 | + } | ||
| 18 | } | 26 | } |
| @@ -56,4 +56,30 @@ class Keyword extends Base | @@ -56,4 +56,30 @@ class Keyword extends Base | ||
| 56 | } | 56 | } |
| 57 | return $value; | 57 | return $value; |
| 58 | } | 58 | } |
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * @param $value | ||
| 62 | + * @return array|mixed | ||
| 63 | + * @author zbj | ||
| 64 | + * @date 2023/11/21 | ||
| 65 | + */ | ||
| 66 | + public function getRelatedNewsIdsAttribute($value){ | ||
| 67 | + if(!empty($value)){ | ||
| 68 | + $value = Arr::setToArr($value); | ||
| 69 | + } | ||
| 70 | + return $value; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * @param $value | ||
| 75 | + * @return array|false|mixed|string[] | ||
| 76 | + * @author zbj | ||
| 77 | + * @date 2023/11/21 | ||
| 78 | + */ | ||
| 79 | + public function getRelatedBlogIdsAttribute($value){ | ||
| 80 | + if(!empty($value)){ | ||
| 81 | + $value = Arr::setToArr($value); | ||
| 82 | + } | ||
| 83 | + return $value; | ||
| 84 | + } | ||
| 59 | } | 85 | } |
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | namespace App\Models\RouteMap; | 3 | namespace App\Models\RouteMap; |
| 4 | 4 | ||
| 5 | use App\Helper\Translate; | 5 | use App\Helper\Translate; |
| 6 | +use App\Http\Logic\Aside\Project\ProjectLogic; | ||
| 6 | use App\Models\Base; | 7 | use App\Models\Base; |
| 7 | 8 | ||
| 8 | /** | 9 | /** |
| @@ -106,6 +107,14 @@ class RouteMap extends Base | @@ -106,6 +107,14 @@ class RouteMap extends Base | ||
| 106 | } | 107 | } |
| 107 | try { | 108 | try { |
| 108 | $route_map = self::where('project_id', $project_id)->where('source_id', $source_id)->where('source', $source)->first(); | 109 | $route_map = self::where('project_id', $project_id)->where('source_id', $source_id)->where('source', $source)->first(); |
| 110 | + //上线项目 不能修改链接了 | ||
| 111 | + if($route_map){ | ||
| 112 | + $project = ProjectLogic::instance()->getInfo($project_id); | ||
| 113 | + if($project['type'] !== Project::STATUS_ONE){ | ||
| 114 | + return $route_map->route; | ||
| 115 | +// throw new \Exception('站点已上线,禁止修改链接'); | ||
| 116 | + } | ||
| 117 | + } | ||
| 109 | if(!$route_map){ | 118 | if(!$route_map){ |
| 110 | $route_map = new self(); | 119 | $route_map = new self(); |
| 111 | $route_map->source = $source; | 120 | $route_map->source = $source; |
| @@ -119,12 +128,8 @@ class RouteMap extends Base | @@ -119,12 +128,8 @@ class RouteMap extends Base | ||
| 119 | } | 128 | } |
| 120 | if($source == self::SOURCE_NEWS){ | 129 | if($source == self::SOURCE_NEWS){ |
| 121 | $route_map->path = self::SOURCE_NEWS; | 130 | $route_map->path = self::SOURCE_NEWS; |
| 122 | - }elseif($source == self::SOURCE_NEWS_CATE){ | ||
| 123 | - $route_map->path = self::PATH_NEWS_CATE; | ||
| 124 | }elseif ($source == self::SOURCE_BLOG){ | 131 | }elseif ($source == self::SOURCE_BLOG){ |
| 125 | $route_map->path = self::SOURCE_BLOG; | 132 | $route_map->path = self::SOURCE_BLOG; |
| 126 | - }elseif ($source == self::SOURCE_BLOG_CATE){ | ||
| 127 | - $route_map->path = self::PATH_BLOG_CATE; | ||
| 128 | } | 133 | } |
| 129 | $route_map->route = $route; | 134 | $route_map->route = $route; |
| 130 | $route_map->save(); | 135 | $route_map->save(); |
-
请 注册 或 登录 后发表评论