作者 刘锟

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

... ... @@ -297,13 +297,16 @@ class VideoTask extends Command
break;
}
$keyword_ids = implode(',',$item->keyword_id);
$keyword_video_ids = implode(',',$item->keyword_video_id);
if (strpos(','.$keyword_ids.',', ','.$keyword_id.',') === false) {
//不包含
$productModel = new Product();
$keyword_ids = !empty($keyword_ids) ? ','.$keyword_ids.',' : ',' ;
$keyword_id_str = $keyword_ids . $keyword_id.',';
KeywordRelated::saveRelated($item->id,explode(',',trim($keyword_id_str,',')));
$productModel->edit(['keyword_id'=>$keyword_id_str],['id'=>$item->id]);
if(strpos(','.$keyword_video_ids.',', ','.$keyword_id.',') === false){
//不包含
$productModel = new Product();
$keyword_video_ids = !empty($keyword_video_ids) ? ','.$keyword_video_ids.',' : ',' ;
$keyword_video_id_str = $keyword_video_ids . $keyword_id.',';
$productModel->edit(['keyword_video_id'=>$keyword_video_id_str],['id'=>$item->id]);
KeywordRelated::saveRelated($item->id,$keyword_video_ids,2);
}
}
$data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title];
}
... ...
... ... @@ -26,6 +26,7 @@ use App\Models\File\Image as ImageModel;
use App\Models\News\News;
use App\Models\News\NewsCategory;
use App\Models\Product\Keyword;
use App\Models\Product\KeywordRelated;
use App\Models\Product\Product;
use App\Models\Project\DeployOptimize;
use App\Models\Project\MinorLanguages;
... ... @@ -61,33 +62,59 @@ class Demo extends Command
protected $description = 'demo';
public function handle(){
// $projectModel = new Project();
// $list = $projectModel->list(['id'=>1659]);
// foreach ($list as $v){
// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
// ProjectServer::useProject($v['id']);
// $this->getProduct();
// DB::disconnect('custom_mysql');
// }
return $this->savePurchaserInfo();
$keywordVideoModel = new KeywordVideoTask();
$list = $keywordVideoModel->list();
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['project_id'] . PHP_EOL;
ProjectServer::useProject($v['project_id']);
$this->getProduct();
DB::disconnect('custom_mysql');
}
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
/**
* @remark :更新产品
* @name :getProduct
* @author :lyh
* @method :post
* @time :2024/11/27 15:40
*/
public function getProduct(){
$productModel = new Product();
$lists = $productModel->list(['status'=>['!=',2]]);
$lists = $productModel->list(['status'=>['!=',3]]);
if(!empty($lists)){
foreach ($lists as $v){
if(!empty($v['route'])){
echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
$route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
$productModel->edit(['route'=>$route],['id'=>$v['id']]);
if(!empty($v['keyword_video_id'])){
foreach ($v['keyword_video_id'] as $val){
$keywordRelaModel = new KeywordRelated();
echo date('Y-m-d H:i:s') . 'keyword_id :'.$val . 'product_id :'.$v['id'] . PHP_EOL;
$keywordRelaModel->edit(['type'=>2],['keyword_id'=>$val,'product_id'=>$v['id']]);
}
}
}
}
}
/**
* @remark :复制表及结构
* @name :copyProduct
* @author :lyh
* @method :post
* @time :2024/11/27 16:09
*/
public function copyProduct(){
$tableName = 'gl_product';
$copyTableName = 'gl_product_c';
if (Schema::connection('custom_mysql')->hasTable($copyTableName)) {
DB::connection('custom_mysql')->statement("DROP TABLE {$copyTableName}");
}
// 创建新表并复制数据
DB::connection('custom_mysql')->statement("CREATE TABLE {$copyTableName} LIKE {$tableName}");
DB::connection('custom_mysql')->statement("INSERT INTO {$copyTableName} SELECT * FROM {$tableName}");
}
/**
* @remark :保存供应商详情
* @name :savePurchaserInfo
* @author :lyh
... ...
... ... @@ -12,6 +12,7 @@ namespace App\Console\Commands\Update;
use App\Models\Domain\DomainInfo;
use App\Models\Product\Keyword;
use App\Models\Product\KeywordPage;
use App\Models\Product\Product;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
... ... @@ -106,4 +107,19 @@ class UpdateKeyword extends Command
shell_exec('curl -k "'.$url.'"');
return true;
}
/**
* @remark :更新产品关键词
* @name :updatedProductKeyword
* @author :lyh
* @method :post
* @time :2024/11/27 14:26
*/
public function updatedProductKeyword(){
$productModel = new Product();
$lists = $productModel->list();
foreach ($lists as $k => $v){
}
}
}
... ...
... ... @@ -230,7 +230,7 @@ class AdsController extends BaseController
public function fbInquiryChart(Request $request)
{
$start_date = $request->input('start_date', date('Y-m-d', strtotime('-1 month')));
$end_date = $request->input('end', date('Y-m-d'));
$end_date = $request->input('end_date', date('Y-m-d'));
$result = ReInquiryForm::select(DB::raw('DATE(inquiry_date) as date'), DB::raw('COUNT(*) as count'))
->whereBetween('inquiry_date', [$start_date, date('Y-m-d', strtotime($end_date . ' +1 day'))])
->groupBy(DB::raw('DATE(inquiry_date)'))
... ...
... ... @@ -31,7 +31,7 @@ class KeywordController extends BaseController
public function index(Keyword $keyword)
{
$this->map = $this->searchParam($this->map);
$filed = ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at','route','keyword_title'];
$filed = ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at','route','keyword_title','is_video_keyword'];
$data = $keyword->lists($this->map,$this->page,$this->row,$this->order,$filed);
if(!empty($data)){
foreach ($data['list'] as &$v){
... ...
... ... @@ -391,17 +391,6 @@ class TranslateController extends BaseController
}
/**
* @remark :获取默认数据
* @name :getDefaultData
* @author :lyh
* @method :post
* @time :2024/7/16 15:28
*/
public function getDefaultData(){
}
/**
* @remark :
* @name :pageList
* @author :lyh
... ...
... ... @@ -24,19 +24,20 @@ class KeywordRelated extends Base
* @author zbj
* @date 2023/5/4
*/
public static function saveRelated($product_id, $keyword_ids)
public static function saveRelated($product_id, $keyword_ids,$type = 1)
{
if(!is_array($keyword_ids)){
$keyword_ids = array_filter(Arr::splitFilterToArray($keyword_ids), 'intval');
}
//先删除
self::where('product_id', $product_id)->delete();
self::where('product_id', $product_id)->where('type',$type)->delete();
//批量保存
$data = [];
if(!empty($keyword_ids)){
foreach ($keyword_ids as $keyword_id){
$data[] = [
'type' => $type,
'product_id' => $product_id,
'keyword_id' => $keyword_id,
'created_at'=>date('Y-m-d H:i:s'),
... ...
... ... @@ -196,7 +196,9 @@ class Product extends Base
public function getKeywordIdAttribute($value){
return Arr::setToArr(trim($value,','));
}
public function getKeywordVideoIdAttribute($value){
return Arr::setToArr(trim($value,','));
}
public function getRelatedProductIdAttribute($value){
return Arr::setToArr($value);
}
... ...
... ... @@ -310,13 +310,22 @@ class SyncSubmitTaskService
//过滤内容
if(!empty($data['data']['message'])) {
//过滤内容关键字
if (!empty($config['filter_contents'])){
if (!empty($config['filter_contents'])) {
foreach ($config['filter_contents'] as $filter_content) {
if (Str::contains(strtolower($data['data']['message']), strtolower($filter_content))) {
throw new InquiryFilterException('过滤内容:' . $filter_content);
//中文直接包含
if (preg_match("/^[\x{4e00}-\x{9fa5}]+$/u", $filter_content)) {
if (Str::contains($data['data']['message'], $filter_content)) {
throw new InquiryFilterException('过滤内容:' . $filter_content);
}
} else {
//英文要指定词才过滤
if (preg_match("/\b" . preg_quote($filter_content, "/") . "\b/i", $data['data']['message'])) {
throw new InquiryFilterException('过滤内容:' . $filter_content);
}
}
}
}
//是否允许包含链接
if(isset($config['is_allow_link']) && !$config['is_allow_link']){
if (Str::contains(strtolower($data['data']['message']), ['http://', 'https://', 'www.'])) {
... ...