Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
11 个修改的文件
包含
75 行增加
和
42 行删除
| @@ -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) { |
| 302 | + if(strpos(','.$keyword_video_ids.',', ','.$keyword_id.',') === false){ | ||
| 301 | //不包含 | 303 | //不包含 |
| 302 | $productModel = new Product(); | 304 | $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]); | 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,31 +62,51 @@ class Demo extends Command | @@ -61,31 +62,51 @@ 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']); | 65 | + $projectModel = new Project(); |
| 66 | + $list = $projectModel->list(['is_upgrade'=>0,'delete_status'=>0]); | ||
| 67 | + foreach ($list as $v){ | ||
| 68 | + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | ||
| 69 | + ProjectServer::useProject($v['id']); | ||
| 69 | // $this->getProduct(); | 70 | // $this->getProduct(); |
| 70 | -// DB::disconnect('custom_mysql'); | ||
| 71 | -// } | ||
| 72 | - return $this->savePurchaserInfo(); | 71 | + $this->copyProduct(); |
| 72 | + DB::disconnect('custom_mysql'); | ||
| 73 | + } | ||
| 73 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 74 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 74 | } | 75 | } |
| 75 | 76 | ||
| 76 | public function getProduct(){ | 77 | public function getProduct(){ |
| 77 | $productModel = new Product(); | 78 | $productModel = new Product(); |
| 78 | - $lists = $productModel->list(['status'=>['!=',2]]); | 79 | + $lists = $productModel->list(['status'=>['!=',3]]); |
| 79 | if(!empty($lists)){ | 80 | if(!empty($lists)){ |
| 80 | foreach ($lists as $v){ | 81 | foreach ($lists as $v){ |
| 81 | - if(!empty($v['route'])){ | 82 | + if(!empty($v['keyword_id'])){ |
| 82 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | 83 | 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']]); | 84 | + $keyword_arr = []; |
| 85 | + $count = count($v['keyword_id']); | ||
| 86 | + if($count > 7){ | ||
| 87 | + foreach ($v['keyword_id'] as $key => $val){ | ||
| 88 | + if($key > 6){ | ||
| 89 | + break; | ||
| 90 | + } | ||
| 91 | + $keyword_arr[] = $val; | ||
| 92 | + } | ||
| 93 | + $keyword_str = explode(',',$keyword_arr); | ||
| 94 | + $productModel->edit(['keyword_id'=>$keyword_str],['id'=>$v['id']]); | ||
| 95 | + $keywordRelatedModel = new KeywordRelated(); | ||
| 96 | + $keywordRelatedModel->edit(['type'=>2],['keyword_id'=>$val,'product_id'=>$v['id']]); | ||
| 85 | } | 97 | } |
| 86 | } | 98 | } |
| 87 | } | 99 | } |
| 88 | } | 100 | } |
| 101 | + } | ||
| 102 | + | ||
| 103 | + public function copyProduct(){ | ||
| 104 | + $tableName = 'gl_product'; | ||
| 105 | + $copyTableName = $tableName . '_c'; | ||
| 106 | + // 创建新表并复制数据 | ||
| 107 | + DB::connection('custom_mysql')->statement("CREATE TABLE {$copyTableName} LIKE {$tableName}"); | ||
| 108 | + DB::connection('custom_mysql')->statement("INSERT INTO {$copyTableName} SELECT * FROM {$tableName}"); | ||
| 109 | + } | ||
| 89 | 110 | ||
| 90 | /** | 111 | /** |
| 91 | * @remark :保存供应商详情 | 112 | * @remark :保存供应商详情 |
| @@ -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 | } |
| @@ -110,7 +110,7 @@ class DetailController extends BaseController | @@ -110,7 +110,7 @@ class DetailController extends BaseController | ||
| 110 | 'product_id.required' => '产品id不能为空', | 110 | 'product_id.required' => '产品id不能为空', |
| 111 | 'data.required' => 'data不能为空', | 111 | 'data.required' => 'data不能为空', |
| 112 | ]); | 112 | ]); |
| 113 | - $data = $logic->saveDetail(); | 113 | + $data = $logic->saveDetail($this->param['product_id'],$this->param['data']); |
| 114 | $this->response('success',Code::SUCCESS,$data); | 114 | $this->response('success',Code::SUCCESS,$data); |
| 115 | } | 115 | } |
| 116 | 116 |
| @@ -94,7 +94,7 @@ class TranslateController extends BaseController | @@ -94,7 +94,7 @@ class TranslateController extends BaseController | ||
| 94 | $resData['route'] = $values['url']; | 94 | $resData['route'] = $values['url']; |
| 95 | $resData['page'] = $values['page']; | 95 | $resData['page'] = $values['page']; |
| 96 | $resData['data'] = []; | 96 | $resData['data'] = []; |
| 97 | - $keyInfo = $keyModel->read(['route'=>$values['route'],'page'=>$values['page']],['id','proof_key']); | 97 | + $keyInfo = $keyModel->read(['url'=>$values['url'],'page'=>$values['page']],['id','proof_key']); |
| 98 | if($keyInfo !== false){ | 98 | if($keyInfo !== false){ |
| 99 | $result_id_data[] = $keyInfo['id']; | 99 | $result_id_data[] = $keyInfo['id']; |
| 100 | $translate_data = json_decode($values['translate_data']['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); | 100 | $translate_data = json_decode($values['translate_data']['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); |
| @@ -106,7 +106,7 @@ class TranslateController extends BaseController | @@ -106,7 +106,7 @@ class TranslateController extends BaseController | ||
| 106 | } | 106 | } |
| 107 | } | 107 | } |
| 108 | } | 108 | } |
| 109 | - $resData['data'] = $translate_data; | 109 | + $resData['data'] = $translate_data ?? []; |
| 110 | $res_data[] = $resData; | 110 | $res_data[] = $resData; |
| 111 | } | 111 | } |
| 112 | $keyList = $keyModel->list(['id'=>['not in',$result_id_data]],'id',['id','proof_key','url','page']); | 112 | $keyList = $keyModel->list(['id'=>['not in',$result_id_data]],'id',['id','proof_key','url','page']); |
| @@ -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 |
| @@ -29,7 +29,7 @@ class ImportLogic extends BaseLogic | @@ -29,7 +29,7 @@ class ImportLogic extends BaseLogic | ||
| 29 | $this->fail('导入文件格式必须为csv'); | 29 | $this->fail('导入文件格式必须为csv'); |
| 30 | } | 30 | } |
| 31 | $domain = $this->param['domain']; | 31 | $domain = $this->param['domain']; |
| 32 | - if (strpos($domain, 'https') === false && strpos($domain, 'http') == false) { | 32 | + if (strpos($domain, 'https') === false && strpos($domain, 'http') === false) { |
| 33 | $this->fail('请输入完整的采集页面地址'); | 33 | $this->fail('请输入完整的采集页面地址'); |
| 34 | } | 34 | } |
| 35 | $domain_arr = parse_url($domain); | 35 | $domain_arr = parse_url($domain); |
| @@ -50,15 +50,15 @@ class DetailLogic extends BaseLogic | @@ -50,15 +50,15 @@ class DetailLogic extends BaseLogic | ||
| 50 | * @method :post | 50 | * @method :post |
| 51 | * @time :2024/11/13 9:30 | 51 | * @time :2024/11/13 9:30 |
| 52 | */ | 52 | */ |
| 53 | - public function saveDetail(){ | ||
| 54 | - if(!empty($this->param['data'])){ | 53 | + public function saveDetail($product_id,$data){ |
| 54 | + if(!empty($data)){ | ||
| 55 | try { | 55 | try { |
| 56 | - foreach ($this->param['data'] as $data){ | ||
| 57 | - foreach ($data as $v){ | 56 | + foreach ($data as $val){ |
| 57 | + foreach ($val as $v){ | ||
| 58 | $save_data = [ | 58 | $save_data = [ |
| 59 | 'sort'=>$v['sort'], | 59 | 'sort'=>$v['sort'], |
| 60 | 'column_id'=>$v['column_id'], | 60 | 'column_id'=>$v['column_id'], |
| 61 | - 'product_id'=>$this->param['product_id'], | 61 | + 'product_id'=>$product_id, |
| 62 | 'text_type'=>$v['text_type'], | 62 | 'text_type'=>$v['text_type'], |
| 63 | 'title'=>$v['title'] ?? '', | 63 | 'title'=>$v['title'] ?? '', |
| 64 | 'content'=>json_encode($v['content'] ?? [],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), | 64 | 'content'=>json_encode($v['content'] ?? [],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), |
| @@ -75,6 +75,6 @@ class DetailLogic extends BaseLogic | @@ -75,6 +75,6 @@ class DetailLogic extends BaseLogic | ||
| 75 | $this->fail('保存失败,请联系管理员.错误:'.$e->getMessage()); | 75 | $this->fail('保存失败,请联系管理员.错误:'.$e->getMessage()); |
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | - return $this->success(['product_id'=>$this->param['product_id']]); | 78 | + return $this->success(['product_id'=>$product_id]); |
| 79 | } | 79 | } |
| 80 | } | 80 | } |
| @@ -67,6 +67,9 @@ class ProductLogic extends BaseLogic | @@ -67,6 +67,9 @@ class ProductLogic extends BaseLogic | ||
| 67 | //产品分类关联 | 67 | //产品分类关联 |
| 68 | CategoryRelated::saveRelated($id, $category_ids); | 68 | CategoryRelated::saveRelated($id, $category_ids); |
| 69 | KeywordRelated::saveRelated($id,$category_ids); | 69 | KeywordRelated::saveRelated($id,$category_ids); |
| 70 | + //更新产品新描述 | ||
| 71 | + $detailLogic = new DetailLogic(); | ||
| 72 | + $detailLogic->saveDetail($id,$this->param['data'] ?? []); | ||
| 70 | //保存扩展字段 | 73 | //保存扩展字段 |
| 71 | $this->saveExtendInfo($id,$extend); | 74 | $this->saveExtendInfo($id,$extend); |
| 72 | }catch (\Exception $e){ | 75 | }catch (\Exception $e){ |
| @@ -294,10 +294,8 @@ class TranslateLogic extends BaseLogic | @@ -294,10 +294,8 @@ class TranslateLogic extends BaseLogic | ||
| 294 | $id = $this->model->addReturnId($param); | 294 | $id = $this->model->addReturnId($param); |
| 295 | TranslateData::insert(['trans_id'=>$id,'data'=>json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]); | 295 | TranslateData::insert(['trans_id'=>$id,'data'=>json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]); |
| 296 | }else{ | 296 | }else{ |
| 297 | - if(!empty($data)){ | ||
| 298 | TranslateData::where(['trans_id'=>$info['id']])->update(['data'=>json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]); | 297 | TranslateData::where(['trans_id'=>$info['id']])->update(['data'=>json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]); |
| 299 | } | 298 | } |
| 300 | - } | ||
| 301 | //写日志 | 299 | //写日志 |
| 302 | $userLogModel = new UserLog(); | 300 | $userLogModel = new UserLog(); |
| 303 | $userLogModel->add(['model'=>'translate/save','remark'=>json_encode($this->param,true),'type'=>0,'operator_id'=>$this->user['id'],'project_id'=>$this->user['project_id']]); | 301 | $userLogModel->add(['model'=>'translate/save','remark'=>json_encode($this->param,true),'type'=>0,'operator_id'=>$this->user['id'],'project_id'=>$this->user['project_id']]); |
| @@ -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 | } |
-
请 注册 或 登录 后发表评论