作者 lyh

gx

@@ -9,7 +9,10 @@ @@ -9,7 +9,10 @@
9 9
10 namespace App\Http\Controllers\Bside\BCom; 10 namespace App\Http\Controllers\Bside\BCom;
11 11
  12 +use App\Helper\Common;
12 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
  14 +use App\Models\Blog\Blog;
  15 +use App\Models\News\News;
13 use App\Models\Product\Product; 16 use App\Models\Product\Product;
14 17
15 /** 18 /**
@@ -42,23 +45,76 @@ class UpdateController extends BaseController @@ -42,23 +45,76 @@ class UpdateController extends BaseController
42 public function updateProduct(){ 45 public function updateProduct(){
43 $productModel = new Product(); 46 $productModel = new Product();
44 $list = $productModel->list(['status'=>Product::STATUS_ON,'project_id'=>$this->user['project_id'],'deleted_at'=>null]); 47 $list = $productModel->list(['status'=>Product::STATUS_ON,'project_id'=>$this->user['project_id'],'deleted_at'=>null]);
45 - foreach ($list as $k => $v){  
46 - if(!empty($v['seo_mate'])){  
47 - $seo_arr = json_decode($v['seo_mate']);  
48 - //更新seo_title  
49 - if(!isset($seo_arr['title']) || empty($seo_arr['title'])){  
50 - 48 + if(!empty($list)){
  49 + foreach ($list as $k => $v){
  50 + if(!empty($v['seo_mate'])){
  51 + $seo_arr = json_decode($v['seo_mate']);
  52 + //更新seo_title
  53 + if(!isset($seo_arr['title'])){
  54 + //生成seo_title
  55 + $seo_arr['title'] = Com;
  56 + }
  57 + //更新seo_keyword
  58 + if(!isset($seo_arr['keyword'])){
  59 + $seo_arr['keyword'] = 1;
  60 + }
  61 + //更新seo_keyword
  62 + if(!isset($seo_arr['description'])){
  63 + $seo_arr['description'] = 1;
  64 + }
51 } 65 }
52 - //更新seo_keyword  
53 - if(!isset($seo_arr['keyword']) || empty($seo_arr['keyword'])){ 66 + }
  67 + }
  68 + }
54 69
55 - } 70 + /**
  71 + * @remark :更新新闻Tdk
  72 + * @name :updateNews
  73 + * @author :lyh
  74 + * @method :post
  75 + * @time :2023/8/19 10:06
  76 + */
  77 + public function updateNews(){
  78 + $newsModel = new News();
  79 + $list = $newsModel->list(['status'=>$newsModel::STATUS_ONE]);
  80 + if(!empty($list)){
  81 + foreach ($list as $k => $v){
56 82
57 - //更新seo_keyword  
58 - if(!isset($seo_arr['keyword']) || empty($seo_arr['keyword'])){ 83 + }
  84 + }
  85 + }
  86 +
  87 + /**
  88 + * @remark :更新blogTdk
  89 + * @name :updateBlogs
  90 + * @author :lyh
  91 + * @method :post
  92 + * @time :2023/8/19 10:07
  93 + */
  94 + public function updateBlogs(){
  95 + $blogModel = new Blog();
  96 + $list = $blogModel->list(['status'=>$blogModel::STATUS_ONE]);
  97 + if(!empty($list)){
  98 + foreach ($list as $k => $v){
59 99
60 - }  
61 } 100 }
62 } 101 }
63 } 102 }
  103 +
  104 + /**
  105 + * @remark :AI发送
  106 + * @name :ai_send
  107 + * @author :lyh
  108 + * @method :post
  109 + * @time :2023/8/19 10:40
  110 + */
  111 + public function ai_send($key,$keywords){
  112 + $chat_url = 'v2/openai_chat';
  113 + $param = [
  114 + 'key'=>$key,
  115 + 'keywords'=>$keywords,
  116 + ];
  117 + $data = Common::send_openai_msg($chat_url,$param);
  118 +
  119 + }
64 } 120 }
@@ -26,7 +26,6 @@ class NavController extends BaseController @@ -26,7 +26,6 @@ class NavController extends BaseController
26 * @time 2023/5/8 16:37 26 * @time 2023/5/8 16:37
27 */ 27 */
28 public function index(){ 28 public function index(){
29 -  
30 return $this->success(NavLogic::instance()->list()); 29 return $this->success(NavLogic::instance()->list());
31 } 30 }
32 31
@@ -24,6 +24,12 @@ class CustomTemplateController extends BaseController @@ -24,6 +24,12 @@ class CustomTemplateController extends BaseController
24 */ 24 */
25 public function lists(CustomTemplateLogic $customTemplateLogic){ 25 public function lists(CustomTemplateLogic $customTemplateLogic){
26 $lists = $customTemplateLogic->customTemplateLists($this->map,$this->page,$this->row,$this->order); 26 $lists = $customTemplateLogic->customTemplateLists($this->map,$this->page,$this->row,$this->order);
  27 + if (!empty($lists)){
  28 + foreach ($lists['list'] as $k => $v){
  29 + $v['url'] = $this->user['domain'].$v['url'];
  30 + $lists['list'][$k] = $v;
  31 + }
  32 + }
27 $this->response('success',Code::SUCCESS,$lists); 33 $this->response('success',Code::SUCCESS,$lists);
28 } 34 }
29 35
@@ -7,6 +7,7 @@ use App\Models\User\User; @@ -7,6 +7,7 @@ use App\Models\User\User;
7 7
8 class Blog extends Base 8 class Blog extends Base
9 { 9 {
  10 + const STATUS_ONE = 1;
10 protected $table = 'gl_blog'; 11 protected $table = 'gl_blog';
11 //连接数据库 12 //连接数据库
12 protected $connection = 'custom_mysql'; 13 protected $connection = 'custom_mysql';
@@ -6,6 +6,8 @@ use App\Models\Base; @@ -6,6 +6,8 @@ use App\Models\Base;
6 6
7 class News extends Base 7 class News extends Base
8 { 8 {
  9 + const STATUS_ONE = 1;
  10 +
9 protected $table = 'gl_news'; 11 protected $table = 'gl_news';
10 //连接数据库 12 //连接数据库
11 protected $connection = 'custom_mysql'; 13 protected $connection = 'custom_mysql';