|
@@ -6,6 +6,7 @@ use App\Helper\Translate; |
|
@@ -6,6 +6,7 @@ use App\Helper\Translate; |
|
6
|
use App\Http\Logic\Bside\BaseLogic;
|
6
|
use App\Http\Logic\Bside\BaseLogic;
|
|
7
|
use App\Models\Ai\AiBlog;
|
7
|
use App\Models\Ai\AiBlog;
|
|
8
|
use App\Models\Ai\AiBlogAuthor;
|
8
|
use App\Models\Ai\AiBlogAuthor;
|
|
|
|
9
|
+use App\Models\Ai\AiBlogList;
|
|
9
|
use App\Models\Project\AiBlogTask;
|
10
|
use App\Models\Project\AiBlogTask;
|
|
10
|
use App\Models\Project\Project;
|
11
|
use App\Models\Project\Project;
|
|
11
|
use App\Models\Project\ProjectAiSetting;
|
12
|
use App\Models\Project\ProjectAiSetting;
|
|
@@ -130,6 +131,7 @@ class AiBlogLogic extends BaseLogic |
|
@@ -130,6 +131,7 @@ class AiBlogLogic extends BaseLogic |
|
130
|
//删除路由映射
|
131
|
//删除路由映射
|
|
131
|
RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']);
|
132
|
RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']);
|
|
132
|
$this->model->del(['id'=>$id]);
|
133
|
$this->model->del(['id'=>$id]);
|
|
|
|
134
|
+ $this->updateBlogList($aiSettingInfo);
|
|
133
|
}
|
135
|
}
|
|
134
|
}catch (\Exception $e){
|
136
|
}catch (\Exception $e){
|
|
135
|
$this->fail('删除失败');
|
137
|
$this->fail('删除失败');
|
|
@@ -137,4 +139,46 @@ class AiBlogLogic extends BaseLogic |
|
@@ -137,4 +139,46 @@ class AiBlogLogic extends BaseLogic |
|
137
|
return $this->success();
|
139
|
return $this->success();
|
|
138
|
}
|
140
|
}
|
|
139
|
|
141
|
|
|
|
|
142
|
+
|
|
|
|
143
|
+ /**
|
|
|
|
144
|
+ * @remark :更新列表页数据
|
|
|
|
145
|
+ * @name :updateBlogList
|
|
|
|
146
|
+ * @author :lyh
|
|
|
|
147
|
+ * @method :post
|
|
|
|
148
|
+ * @time :2025/3/5 11:07
|
|
|
|
149
|
+ */
|
|
|
|
150
|
+ public function updateBlogList($aiSettingInfo){
|
|
|
|
151
|
+ $aiBlogService = new AiBlogService();
|
|
|
|
152
|
+ $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
|
|
|
|
153
|
+ $aiBlogService->key = $aiSettingInfo['key'];
|
|
|
|
154
|
+ $page = 1;
|
|
|
|
155
|
+ $saveData = [];
|
|
|
|
156
|
+ $result = $aiBlogService->getAiBlogList($page,15);
|
|
|
|
157
|
+ if(!isset($result['status']) && $result['status'] != 200){
|
|
|
|
158
|
+ return true;
|
|
|
|
159
|
+ }
|
|
|
|
160
|
+ $total_page = $result['data']['total_page'];
|
|
|
|
161
|
+ //组装数据保存
|
|
|
|
162
|
+ $saveData[] = [
|
|
|
|
163
|
+ 'route'=>$page,
|
|
|
|
164
|
+ 'text'=>$result['data']['section'],
|
|
|
|
165
|
+ ];
|
|
|
|
166
|
+ while ($total_page > $page){
|
|
|
|
167
|
+ $page++;
|
|
|
|
168
|
+ $result = $aiBlogService->getAiBlogList($page,15);
|
|
|
|
169
|
+ if(isset($result['status']) && $result['status'] == 200){
|
|
|
|
170
|
+ $saveData[] = [
|
|
|
|
171
|
+ 'route'=>$page,
|
|
|
|
172
|
+ 'text'=>$result['data']['section'],
|
|
|
|
173
|
+ ];
|
|
|
|
174
|
+ }
|
|
|
|
175
|
+ }
|
|
|
|
176
|
+ $aiBlogListModel = new AiBlogList();
|
|
|
|
177
|
+ if(!empty($saveData)){
|
|
|
|
178
|
+ //写一条路由信息
|
|
|
|
179
|
+ $aiBlogListModel->truncate();
|
|
|
|
180
|
+ $aiBlogListModel->insertAll($saveData);
|
|
|
|
181
|
+ }
|
|
|
|
182
|
+ return true;
|
|
|
|
183
|
+ }
|
|
140
|
} |
184
|
} |