作者 李宇航

合并分支 'master-server' 到 'master'

Master server



查看合并请求 !1118
@@ -40,7 +40,7 @@ class AiBlogTask extends Command @@ -40,7 +40,7 @@ class AiBlogTask extends Command
40 while (true){ 40 while (true){
41 $info = $aiBlogTaskModel->where('status',1)->orderBy('id','asc')->first(); 41 $info = $aiBlogTaskModel->where('status',1)->orderBy('id','asc')->first();
42 if($info === false){ 42 if($info === false){
43 - sleep(20); 43 + sleep(30);
44 continue; 44 continue;
45 } 45 }
46 $info = $info->toArray(); 46 $info = $info->toArray();
@@ -35,6 +35,12 @@ class AiBlogController extends BaseController @@ -35,6 +35,12 @@ class AiBlogController extends BaseController
35 */ 35 */
36 public function getAiBlog(AiBlog $aiBlog){ 36 public function getAiBlog(AiBlog $aiBlog){
37 $lists = $aiBlog->lists($this->map,$this->page,$this->row,'id',['id','new_title','task_id','status','created_at','updated_at']); 37 $lists = $aiBlog->lists($this->map,$this->page,$this->row,'id',['id','new_title','task_id','status','created_at','updated_at']);
  38 + if(!empty($lists) && !empty($lists['list'])){
  39 + foreach ($lists['list'] as $k => $v){
  40 + $v['image'] = getImageUrl($v['url'],$this->user['storage_type'],$this->user['project_location']);
  41 + $lists['list'][$k] = $v;
  42 + }
  43 + }
38 $this->response('success',Code::SUCCESS,$lists); 44 $this->response('success',Code::SUCCESS,$lists);
39 } 45 }
40 46
@@ -34,10 +34,11 @@ class KeywordPrefixLogic extends BaseLogic @@ -34,10 +34,11 @@ class KeywordPrefixLogic extends BaseLogic
34 $data = [ 34 $data = [
35 'project_id'=>$this->param['project_id'] ?? 0, 35 'project_id'=>$this->param['project_id'] ?? 0,
36 'keyword'=>$v, 36 'keyword'=>$v,
37 - 'type'=>$this->param['type'] 37 + 'type'=>$this->param['type'],
38 ]; 38 ];
39 $prefixInfo = $this->model->read($data); 39 $prefixInfo = $this->model->read($data);
40 if($prefixInfo == false){ 40 if($prefixInfo == false){
  41 + $data['remark'] = $this->param['remark'] ?? '';
41 $this->model->add($data); 42 $this->model->add($data);
42 } 43 }
43 } 44 }
@@ -99,6 +99,9 @@ class ProjectLogic extends BaseLogic @@ -99,6 +99,9 @@ class ProjectLogic extends BaseLogic
99 if(isset($info['deploy_build']['other_project']) && !empty($info['deploy_build']['other_project'])){ 99 if(isset($info['deploy_build']['other_project']) && !empty($info['deploy_build']['other_project'])){
100 $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']); 100 $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']);
101 } 101 }
  102 + if(isset($info['project_keyword']['operator_log']) && !empty($info['project_keyword']['operator_log'])){
  103 + $info['project_keyword']['operator_log'] = json_decode($info['project_keyword']['operator_log']);
  104 + }
102 //is_product:"0",is_news:"0",is_blogs:"0",is_module:"0" 105 //is_product:"0",is_news:"0",is_blogs:"0",is_module:"0"
103 //获取小语种 106 //获取小语种
104 $info['minor_languages'] = $this->getProjectMinorLanguages($id); 107 $info['minor_languages'] = $this->getProjectMinorLanguages($id);
@@ -439,6 +442,9 @@ class ProjectLogic extends BaseLogic @@ -439,6 +442,9 @@ class ProjectLogic extends BaseLogic
439 'customer_keywords'=>$project_keyword['customer_keywords'] ?? '', 442 'customer_keywords'=>$project_keyword['customer_keywords'] ?? '',
440 'search_keywords'=>$project_keyword['search_keywords'] ?? '', 443 'search_keywords'=>$project_keyword['search_keywords'] ?? '',
441 ]; 444 ];
  445 + if(isset($project_keyword['operator_log']) && !empty($project_keyword['operator_log'])){
  446 + $data['operator_log'] = json_encode($project_keyword['operator_log'] ?? []);
  447 + }
442 if($info === false){ 448 if($info === false){
443 $data['project_id'] = $project_id; 449 $data['project_id'] = $project_id;
444 $projectKeywordModel->addReturnId($data); 450 $projectKeywordModel->addReturnId($data);
@@ -28,8 +28,11 @@ class AiBlogLogic extends BaseLogic @@ -28,8 +28,11 @@ class AiBlogLogic extends BaseLogic
28 * @time :2023/7/5 14:46 28 * @time :2023/7/5 14:46
29 */ 29 */
30 public function blogSave(){ 30 public function blogSave(){
31 - $this->param['project_id'] = $this->user['project_id'];  
32 - $rs = $this->model->add($this->param); 31 + if(!empty($this->param['image'])){
  32 + $this->param['image'] = str_replace_url($this->param['image']);
  33 + }
  34 + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
  35 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
33 if($rs === false){ 36 if($rs === false){
34 $this->fail('error'); 37 $this->fail('error');
35 } 38 }
@@ -57,15 +60,13 @@ class AiBlogLogic extends BaseLogic @@ -57,15 +60,13 @@ class AiBlogLogic extends BaseLogic
57 } 60 }
58 $result = $aiBlogService->createTask($this->param['keyword'],$this->param['type']); 61 $result = $aiBlogService->createTask($this->param['keyword'],$this->param['type']);
59 if($result['status'] == 200){ 62 if($result['status'] == 200){
60 - try {  
61 $aiBlogTaskModel = new AiBlogTask(); 63 $aiBlogTaskModel = new AiBlogTask();
62 $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'task_id'=>$result['data']['task_id'],'status'=>$result['data']['status']]); 64 $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'task_id'=>$result['data']['task_id'],'status'=>$result['data']['status']]);
63 $aiBlogModel = new AiBlog(); 65 $aiBlogModel = new AiBlog();
64 - $aiBlogModel->addReturnId(['keyword'=>$this->param['keyword'], 'status'=>$result['data']['status'], 'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'], 66 + $aiBlogId = $aiBlogModel->addReturnId(['keyword'=>$this->param['keyword'], 'status'=>$result['data']['status'], 'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],
65 ]); 67 ]);
66 - }catch (\Exception $e){  
67 - $this->fail('请求ai_blog失败,请联系管理员');  
68 - } 68 + $route = RouteMap::setRoute($aiBlogService->route, RouteMap::SOURCE_AI_BLOG, $aiBlogId, $this->user['project_id']);
  69 + $aiBlogModel->edit(['route'=>$route],['id'=>$aiBlogId]);
69 } 70 }
70 return $this->success(); 71 return $this->success();
71 } 72 }
@@ -33,6 +33,8 @@ class RouteMap extends Base @@ -33,6 +33,8 @@ class RouteMap extends Base
33 const SOURCE_NEWS_CATE = 'news_category'; 33 const SOURCE_NEWS_CATE = 'news_category';
34 //自定义模块 34 //自定义模块
35 const SOURCE_MODULE = 'module'; 35 const SOURCE_MODULE = 'module';
  36 +
  37 + const SOURCE_AI_BLOG = 'ai_blog';
36 //自定义模块分类 38 //自定义模块分类
37 const SOURCE_MODULE_CATE = 'module_category'; 39 const SOURCE_MODULE_CATE = 'module_category';
38 40