作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

... ... @@ -177,7 +177,7 @@ class UpdateSeoTdk extends Command
if(!Redis::setnx($cache_key, 1)){
continue;
}
Redis::expire($cache_key, 300);
Redis::expire($cache_key, 120);
echo date('Y-m-d H:i:s') . '更新--' . $table . ': 项目id' . $project_id . ':id' . $v['id'] . PHP_EOL;
$v = DB::connection('custom_mysql')->table($table)->where('id', $v['id'])->first();
... ...
... ... @@ -83,7 +83,6 @@ class OnlineController extends BaseController
'gl_project_deploy_optimize.assist_mid AS optimize_assist_mid',
'gl_project_deploy_optimize.tech_mid AS optimize_tech_mid',
'gl_project_deploy_optimize.domain AS domain',
'gl_project_payment.amount AS amount',
];
return $select;
}
... ...
... ... @@ -206,6 +206,9 @@ class ProjectController extends BaseController
if(isset($this->map['channel_id']) && !empty($this->map['channel_id'])){
$query->where('gl_project.channel','like','%"channel_id": "'.$this->map['channel_id'].'"%');
}
if(isset($this->map['user_id']) && !empty($this->map['user_id'])){
$query->where('gl_project.channel','like','%"user_id": "'.$this->map['channel_id'].'"%');
}
return $query;
}
... ...
... ... @@ -24,7 +24,7 @@ class BlogController extends BaseController
* @time :2023/9/14 10:45
*/
public function lists(BlogModel $blogModel){
$filed = ['id','category_id','operator_id','status','created_at','label_id','image','updated_at','name','sort','url'];
$filed = ['id','category_id','operator_id','status','created_at','label_id','image','updated_at','name','sort','url','release_at'];
$this->order = 'sort';
$query = $blogModel->orderBy($this->order ,'desc')->orderBy('id','desc');
$query = $this->searchParam($query);
... ...
... ... @@ -24,7 +24,7 @@ class NewsController extends BaseController
* @method
*/
public function lists(NewsModel $news){
$filed = ['id','category_id','operator_id','status','created_at','image','updated_at','name','sort','url'];
$filed = ['id','category_id','operator_id','status','created_at','image','updated_at','name','sort','url', 'release_at'];
$this->order = 'sort';
$query = $news->orderBy($this->order ,'desc')->orderBy('id','desc');
$query = $this->searchParam($query);
... ...
... ... @@ -54,15 +54,16 @@ class KeywordLogic extends BaseLogic
$this->param = $this->handleSaveParam($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->model->edit($this->param,['id'=>$this->param['id']]);
$id = $this->param['id'];
}else{
$this->param['project_id'] = $this->user['project_id'];
$this->param['created_at'] = date('Y-m-d H:i:s');
$this->param['updated_at'] = $this->param['created_at'];
$id = $this->model->insertGetId($this->param);
}
//路由映射
$route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
$this->model->edit(['route'=>$route],['id'=>$id]);
}
//清除缓存
Common::del_user_cache('product_keyword',$this->user['project_id']);
DB::commit();
... ... @@ -92,6 +93,12 @@ class KeywordLogic extends BaseLogic
if(isset($param['keyword_video']) && !empty($param['keyword_video'])){
$param['keyword_video'] = Arr::a2s($param['keyword_video']);
}
if(!empty($param['related_news_ids'])){
$param['related_news_ids'] = Arr::arrToSet($param['related_news_ids']);
}
if(!empty($param['related_blog_ids'])){
$param['related_blog_ids'] = Arr::arrToSet($param['related_blog_ids']);
}
return $param;
}
... ...
... ... @@ -136,6 +136,16 @@ class ProductLogic extends BaseLogic
public function editList(){
$this->param['category_id'] = $this->getLastCategory($this->param['category_id']);
$this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']);
if(isset($this->param['gallery']) && !empty($this->param['gallery'])){
foreach ($this->param['gallery'] as $k => $v){
$v['url'] = str_replace_url($v['url']);
$this->param['gallery'][$k] = $v;
}
$this->param['thumb'] = Arr::a2s($this->param['gallery'][0] ?? []);
$this->param['gallery'] = Arr::a2s($this->param['gallery'] ?? []);
}else{
$this->param['thumb'] = [];
}
$this->model->edit($this->param,['id'=>$this->param['id']]);
return $this->success();
}
... ... @@ -191,6 +201,8 @@ class ProductLogic extends BaseLogic
}
$param['thumb'] = Arr::a2s($param['gallery'][0] ?? []);
$param['gallery'] = Arr::a2s($param['gallery'] ?? []);
}else{
$param['thumb'] = [];
}
$param['attrs'] = Arr::a2s($param['attrs'] ?? []);
$param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? '');
... ...
... ... @@ -201,6 +201,7 @@ class UserLoginLogic
$info['upload_config'] = $project['upload_config'];
$info['image_max'] = $project['image_max'];
$info['configuration'] = $project['deploy_build']['configuration'];
$info['type'] = $project['type'];
if($info['is_customized'] == 1){
$info['is_visualization'] = json_decode($project['is_visualization']);
}
... ...
... ... @@ -34,6 +34,8 @@ class KeywordRequest extends FormRequest
'seo_title'=>'max:200',
'seo_keywords'=>'max:200',
'seo_description'=>'max:200',
'related_news_ids'=>'array|max:2',
'related_blog_ids'=>'array|max:2',
];
}
... ... @@ -45,6 +47,8 @@ class KeywordRequest extends FormRequest
'seo_title.max' => 'SEO标题不能超过200个字符',
'seo_keywords.max' => 'SEO关键词不能超过200个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
'related_news_ids.max' => '关联新闻不能超过两条',
'related_blog_ids.max' => '关联博客不能超过两条',
];
}
... ...
... ... @@ -14,6 +14,14 @@ class Blog extends Base
public function user(){
return $this->hasMany(User::class,'operator_id','id');
}
public function getReleaseAtAttribute($value){
if(!$value){
return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at')));
}
return $value;
}
}
... ...
... ... @@ -15,4 +15,12 @@ class News extends Base
public static function getNumByProjectId($project_id){
return self::where('project_id', $project_id)->where('status', 1)->count();
}
public function getReleaseAtAttribute($value){
if(!$value){
return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at')));
}
return $value;
}
}
... ...
... ... @@ -56,4 +56,30 @@ class Keyword extends Base
}
return $value;
}
/**
* @param $value
* @return array|mixed
* @author zbj
* @date 2023/11/21
*/
public function getRelatedNewsIdsAttribute($value){
if(!empty($value)){
$value = Arr::setToArr($value);
}
return $value;
}
/**
* @param $value
* @return array|false|mixed|string[]
* @author zbj
* @date 2023/11/21
*/
public function getRelatedBlogIdsAttribute($value){
if(!empty($value)){
$value = Arr::setToArr($value);
}
return $value;
}
}
... ...
... ... @@ -3,6 +3,7 @@
namespace App\Models\RouteMap;
use App\Helper\Translate;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Models\Base;
/**
... ... @@ -106,6 +107,14 @@ class RouteMap extends Base
}
try {
$route_map = self::where('project_id', $project_id)->where('source_id', $source_id)->where('source', $source)->first();
//上线项目 不能修改链接了
if($route_map){
$project = ProjectLogic::instance()->getInfo($project_id);
if($project['type'] !== Project::STATUS_ONE){
return $route_map->route;
// throw new \Exception('站点已上线,禁止修改链接');
}
}
if(!$route_map){
$route_map = new self();
$route_map->source = $source;
... ... @@ -119,12 +128,8 @@ class RouteMap extends Base
}
if($source == self::SOURCE_NEWS){
$route_map->path = self::SOURCE_NEWS;
}elseif($source == self::SOURCE_NEWS_CATE){
$route_map->path = self::PATH_NEWS_CATE;
}elseif ($source == self::SOURCE_BLOG){
$route_map->path = self::SOURCE_BLOG;
}elseif ($source == self::SOURCE_BLOG_CATE){
$route_map->path = self::PATH_BLOG_CATE;
}
$route_map->route = $route;
$route_map->save();
... ...