Merge remote-tracking branch 'origin/master' into akun
正在显示
9 个修改的文件
包含
86 行增加
和
39 行删除
| @@ -297,13 +297,16 @@ class VideoTask extends Command | @@ -297,13 +297,16 @@ class VideoTask extends Command | ||
| 297 | break; | 297 | break; |
| 298 | } | 298 | } |
| 299 | $keyword_ids = implode(',',$item->keyword_id); | 299 | $keyword_ids = implode(',',$item->keyword_id); |
| 300 | + $keyword_video_ids = implode(',',$item->keyword_video_id); | ||
| 300 | if (strpos(','.$keyword_ids.',', ','.$keyword_id.',') === false) { | 301 | if (strpos(','.$keyword_ids.',', ','.$keyword_id.',') === false) { |
| 301 | - //不包含 | ||
| 302 | - $productModel = new Product(); | ||
| 303 | - $keyword_ids = !empty($keyword_ids) ? ','.$keyword_ids.',' : ',' ; | ||
| 304 | - $keyword_id_str = $keyword_ids . $keyword_id.','; | ||
| 305 | - KeywordRelated::saveRelated($item->id,explode(',',trim($keyword_id_str,','))); | ||
| 306 | - $productModel->edit(['keyword_id'=>$keyword_id_str],['id'=>$item->id]); | 302 | + if(strpos(','.$keyword_video_ids.',', ','.$keyword_id.',') === false){ |
| 303 | + //不包含 | ||
| 304 | + $productModel = new Product(); | ||
| 305 | + $keyword_video_ids = !empty($keyword_video_ids) ? ','.$keyword_video_ids.',' : ',' ; | ||
| 306 | + $keyword_video_id_str = $keyword_video_ids . $keyword_id.','; | ||
| 307 | + $productModel->edit(['keyword_video_id'=>$keyword_video_id_str],['id'=>$item->id]); | ||
| 308 | + KeywordRelated::saveRelated($item->id,$keyword_video_ids,2); | ||
| 309 | + } | ||
| 307 | } | 310 | } |
| 308 | $data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title]; | 311 | $data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title]; |
| 309 | } | 312 | } |
| @@ -26,6 +26,7 @@ use App\Models\File\Image as ImageModel; | @@ -26,6 +26,7 @@ use App\Models\File\Image as ImageModel; | ||
| 26 | use App\Models\News\News; | 26 | use App\Models\News\News; |
| 27 | use App\Models\News\NewsCategory; | 27 | use App\Models\News\NewsCategory; |
| 28 | use App\Models\Product\Keyword; | 28 | use App\Models\Product\Keyword; |
| 29 | +use App\Models\Product\KeywordRelated; | ||
| 29 | use App\Models\Product\Product; | 30 | use App\Models\Product\Product; |
| 30 | use App\Models\Project\DeployOptimize; | 31 | use App\Models\Project\DeployOptimize; |
| 31 | use App\Models\Project\MinorLanguages; | 32 | use App\Models\Project\MinorLanguages; |
| @@ -61,33 +62,59 @@ class Demo extends Command | @@ -61,33 +62,59 @@ class Demo extends Command | ||
| 61 | protected $description = 'demo'; | 62 | protected $description = 'demo'; |
| 62 | 63 | ||
| 63 | public function handle(){ | 64 | public function handle(){ |
| 64 | -// $projectModel = new Project(); | ||
| 65 | -// $list = $projectModel->list(['id'=>1659]); | ||
| 66 | -// foreach ($list as $v){ | ||
| 67 | -// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | ||
| 68 | -// ProjectServer::useProject($v['id']); | ||
| 69 | -// $this->getProduct(); | ||
| 70 | -// DB::disconnect('custom_mysql'); | ||
| 71 | -// } | ||
| 72 | - return $this->savePurchaserInfo(); | 65 | + $keywordVideoModel = new KeywordVideoTask(); |
| 66 | + $list = $keywordVideoModel->list(); | ||
| 67 | + foreach ($list as $v){ | ||
| 68 | + echo date('Y-m-d H:i:s') . 'project_id:'.$v['project_id'] . PHP_EOL; | ||
| 69 | + ProjectServer::useProject($v['project_id']); | ||
| 70 | + $this->getProduct(); | ||
| 71 | + DB::disconnect('custom_mysql'); | ||
| 72 | + } | ||
| 73 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 73 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | + /** | ||
| 77 | + * @remark :更新产品 | ||
| 78 | + * @name :getProduct | ||
| 79 | + * @author :lyh | ||
| 80 | + * @method :post | ||
| 81 | + * @time :2024/11/27 15:40 | ||
| 82 | + */ | ||
| 76 | public function getProduct(){ | 83 | public function getProduct(){ |
| 77 | $productModel = new Product(); | 84 | $productModel = new Product(); |
| 78 | - $lists = $productModel->list(['status'=>['!=',2]]); | 85 | + $lists = $productModel->list(['status'=>['!=',3]]); |
| 79 | if(!empty($lists)){ | 86 | if(!empty($lists)){ |
| 80 | foreach ($lists as $v){ | 87 | foreach ($lists as $v){ |
| 81 | - if(!empty($v['route'])){ | ||
| 82 | - echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | ||
| 83 | - $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | ||
| 84 | - $productModel->edit(['route'=>$route],['id'=>$v['id']]); | 88 | + if(!empty($v['keyword_video_id'])){ |
| 89 | + foreach ($v['keyword_video_id'] as $val){ | ||
| 90 | + $keywordRelaModel = new KeywordRelated(); | ||
| 91 | + echo date('Y-m-d H:i:s') . 'keyword_id :'.$val . 'product_id :'.$v['id'] . PHP_EOL; | ||
| 92 | + $keywordRelaModel->edit(['type'=>2],['keyword_id'=>$val,'product_id'=>$v['id']]); | ||
| 93 | + } | ||
| 85 | } | 94 | } |
| 86 | } | 95 | } |
| 87 | } | 96 | } |
| 88 | } | 97 | } |
| 89 | 98 | ||
| 90 | /** | 99 | /** |
| 100 | + * @remark :复制表及结构 | ||
| 101 | + * @name :copyProduct | ||
| 102 | + * @author :lyh | ||
| 103 | + * @method :post | ||
| 104 | + * @time :2024/11/27 16:09 | ||
| 105 | + */ | ||
| 106 | + public function copyProduct(){ | ||
| 107 | + $tableName = 'gl_product'; | ||
| 108 | + $copyTableName = 'gl_product_c'; | ||
| 109 | + if (Schema::connection('custom_mysql')->hasTable($copyTableName)) { | ||
| 110 | + DB::connection('custom_mysql')->statement("DROP TABLE {$copyTableName}"); | ||
| 111 | + } | ||
| 112 | + // 创建新表并复制数据 | ||
| 113 | + DB::connection('custom_mysql')->statement("CREATE TABLE {$copyTableName} LIKE {$tableName}"); | ||
| 114 | + DB::connection('custom_mysql')->statement("INSERT INTO {$copyTableName} SELECT * FROM {$tableName}"); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + /** | ||
| 91 | * @remark :保存供应商详情 | 118 | * @remark :保存供应商详情 |
| 92 | * @name :savePurchaserInfo | 119 | * @name :savePurchaserInfo |
| 93 | * @author :lyh | 120 | * @author :lyh |
| @@ -12,6 +12,7 @@ namespace App\Console\Commands\Update; | @@ -12,6 +12,7 @@ namespace App\Console\Commands\Update; | ||
| 12 | use App\Models\Domain\DomainInfo; | 12 | use App\Models\Domain\DomainInfo; |
| 13 | use App\Models\Product\Keyword; | 13 | use App\Models\Product\Keyword; |
| 14 | use App\Models\Product\KeywordPage; | 14 | use App\Models\Product\KeywordPage; |
| 15 | +use App\Models\Product\Product; | ||
| 15 | use App\Services\ProjectServer; | 16 | use App\Services\ProjectServer; |
| 16 | use Illuminate\Console\Command; | 17 | use Illuminate\Console\Command; |
| 17 | use Illuminate\Support\Facades\DB; | 18 | use Illuminate\Support\Facades\DB; |
| @@ -106,4 +107,19 @@ class UpdateKeyword extends Command | @@ -106,4 +107,19 @@ class UpdateKeyword extends Command | ||
| 106 | shell_exec('curl -k "'.$url.'"'); | 107 | shell_exec('curl -k "'.$url.'"'); |
| 107 | return true; | 108 | return true; |
| 108 | } | 109 | } |
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * @remark :更新产品关键词 | ||
| 113 | + * @name :updatedProductKeyword | ||
| 114 | + * @author :lyh | ||
| 115 | + * @method :post | ||
| 116 | + * @time :2024/11/27 14:26 | ||
| 117 | + */ | ||
| 118 | + public function updatedProductKeyword(){ | ||
| 119 | + $productModel = new Product(); | ||
| 120 | + $lists = $productModel->list(); | ||
| 121 | + foreach ($lists as $k => $v){ | ||
| 122 | + | ||
| 123 | + } | ||
| 124 | + } | ||
| 109 | } | 125 | } |
| @@ -230,7 +230,7 @@ class AdsController extends BaseController | @@ -230,7 +230,7 @@ class AdsController extends BaseController | ||
| 230 | public function fbInquiryChart(Request $request) | 230 | public function fbInquiryChart(Request $request) |
| 231 | { | 231 | { |
| 232 | $start_date = $request->input('start_date', date('Y-m-d', strtotime('-1 month'))); | 232 | $start_date = $request->input('start_date', date('Y-m-d', strtotime('-1 month'))); |
| 233 | - $end_date = $request->input('end', date('Y-m-d')); | 233 | + $end_date = $request->input('end_date', date('Y-m-d')); |
| 234 | $result = ReInquiryForm::select(DB::raw('DATE(inquiry_date) as date'), DB::raw('COUNT(*) as count')) | 234 | $result = ReInquiryForm::select(DB::raw('DATE(inquiry_date) as date'), DB::raw('COUNT(*) as count')) |
| 235 | ->whereBetween('inquiry_date', [$start_date, date('Y-m-d', strtotime($end_date . ' +1 day'))]) | 235 | ->whereBetween('inquiry_date', [$start_date, date('Y-m-d', strtotime($end_date . ' +1 day'))]) |
| 236 | ->groupBy(DB::raw('DATE(inquiry_date)')) | 236 | ->groupBy(DB::raw('DATE(inquiry_date)')) |
| @@ -31,7 +31,7 @@ class KeywordController extends BaseController | @@ -31,7 +31,7 @@ class KeywordController extends BaseController | ||
| 31 | public function index(Keyword $keyword) | 31 | public function index(Keyword $keyword) |
| 32 | { | 32 | { |
| 33 | $this->map = $this->searchParam($this->map); | 33 | $this->map = $this->searchParam($this->map); |
| 34 | - $filed = ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at','route','keyword_title']; | 34 | + $filed = ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at','route','keyword_title','is_video_keyword']; |
| 35 | $data = $keyword->lists($this->map,$this->page,$this->row,$this->order,$filed); | 35 | $data = $keyword->lists($this->map,$this->page,$this->row,$this->order,$filed); |
| 36 | if(!empty($data)){ | 36 | if(!empty($data)){ |
| 37 | foreach ($data['list'] as &$v){ | 37 | foreach ($data['list'] as &$v){ |
| @@ -391,17 +391,6 @@ class TranslateController extends BaseController | @@ -391,17 +391,6 @@ class TranslateController extends BaseController | ||
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | /** | 393 | /** |
| 394 | - * @remark :获取默认数据 | ||
| 395 | - * @name :getDefaultData | ||
| 396 | - * @author :lyh | ||
| 397 | - * @method :post | ||
| 398 | - * @time :2024/7/16 15:28 | ||
| 399 | - */ | ||
| 400 | - public function getDefaultData(){ | ||
| 401 | - | ||
| 402 | - } | ||
| 403 | - | ||
| 404 | - /** | ||
| 405 | * @remark : | 394 | * @remark : |
| 406 | * @name :pageList | 395 | * @name :pageList |
| 407 | * @author :lyh | 396 | * @author :lyh |
| @@ -24,19 +24,20 @@ class KeywordRelated extends Base | @@ -24,19 +24,20 @@ class KeywordRelated extends Base | ||
| 24 | * @author zbj | 24 | * @author zbj |
| 25 | * @date 2023/5/4 | 25 | * @date 2023/5/4 |
| 26 | */ | 26 | */ |
| 27 | - public static function saveRelated($product_id, $keyword_ids) | 27 | + public static function saveRelated($product_id, $keyword_ids,$type = 1) |
| 28 | { | 28 | { |
| 29 | if(!is_array($keyword_ids)){ | 29 | if(!is_array($keyword_ids)){ |
| 30 | $keyword_ids = array_filter(Arr::splitFilterToArray($keyword_ids), 'intval'); | 30 | $keyword_ids = array_filter(Arr::splitFilterToArray($keyword_ids), 'intval'); |
| 31 | } | 31 | } |
| 32 | //先删除 | 32 | //先删除 |
| 33 | - self::where('product_id', $product_id)->delete(); | 33 | + self::where('product_id', $product_id)->where('type',$type)->delete(); |
| 34 | 34 | ||
| 35 | //批量保存 | 35 | //批量保存 |
| 36 | $data = []; | 36 | $data = []; |
| 37 | if(!empty($keyword_ids)){ | 37 | if(!empty($keyword_ids)){ |
| 38 | foreach ($keyword_ids as $keyword_id){ | 38 | foreach ($keyword_ids as $keyword_id){ |
| 39 | $data[] = [ | 39 | $data[] = [ |
| 40 | + 'type' => $type, | ||
| 40 | 'product_id' => $product_id, | 41 | 'product_id' => $product_id, |
| 41 | 'keyword_id' => $keyword_id, | 42 | 'keyword_id' => $keyword_id, |
| 42 | 'created_at'=>date('Y-m-d H:i:s'), | 43 | 'created_at'=>date('Y-m-d H:i:s'), |
| @@ -196,7 +196,9 @@ class Product extends Base | @@ -196,7 +196,9 @@ class Product extends Base | ||
| 196 | public function getKeywordIdAttribute($value){ | 196 | public function getKeywordIdAttribute($value){ |
| 197 | return Arr::setToArr(trim($value,',')); | 197 | return Arr::setToArr(trim($value,',')); |
| 198 | } | 198 | } |
| 199 | - | 199 | + public function getKeywordVideoIdAttribute($value){ |
| 200 | + return Arr::setToArr(trim($value,',')); | ||
| 201 | + } | ||
| 200 | public function getRelatedProductIdAttribute($value){ | 202 | public function getRelatedProductIdAttribute($value){ |
| 201 | return Arr::setToArr($value); | 203 | return Arr::setToArr($value); |
| 202 | } | 204 | } |
| @@ -310,13 +310,22 @@ class SyncSubmitTaskService | @@ -310,13 +310,22 @@ class SyncSubmitTaskService | ||
| 310 | //过滤内容 | 310 | //过滤内容 |
| 311 | if(!empty($data['data']['message'])) { | 311 | if(!empty($data['data']['message'])) { |
| 312 | //过滤内容关键字 | 312 | //过滤内容关键字 |
| 313 | - if (!empty($config['filter_contents'])){ | 313 | + if (!empty($config['filter_contents'])) { |
| 314 | foreach ($config['filter_contents'] as $filter_content) { | 314 | foreach ($config['filter_contents'] as $filter_content) { |
| 315 | - if (Str::contains(strtolower($data['data']['message']), strtolower($filter_content))) { | ||
| 316 | - throw new InquiryFilterException('过滤内容:' . $filter_content); | 315 | + //中文直接包含 |
| 316 | + if (preg_match("/^[\x{4e00}-\x{9fa5}]+$/u", $filter_content)) { | ||
| 317 | + if (Str::contains($data['data']['message'], $filter_content)) { | ||
| 318 | + throw new InquiryFilterException('过滤内容:' . $filter_content); | ||
| 319 | + } | ||
| 320 | + } else { | ||
| 321 | + //英文要指定词才过滤 | ||
| 322 | + if (preg_match("/\b" . preg_quote($filter_content, "/") . "\b/i", $data['data']['message'])) { | ||
| 323 | + throw new InquiryFilterException('过滤内容:' . $filter_content); | ||
| 324 | + } | ||
| 317 | } | 325 | } |
| 318 | } | 326 | } |
| 319 | } | 327 | } |
| 328 | + | ||
| 320 | //是否允许包含链接 | 329 | //是否允许包含链接 |
| 321 | if(isset($config['is_allow_link']) && !$config['is_allow_link']){ | 330 | if(isset($config['is_allow_link']) && !$config['is_allow_link']){ |
| 322 | if (Str::contains(strtolower($data['data']['message']), ['http://', 'https://', 'www.'])) { | 331 | if (Str::contains(strtolower($data['data']['message']), ['http://', 'https://', 'www.'])) { |
-
请 注册 或 登录 后发表评论