|
|
@@ -4573,12 +4573,37 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
*/
|
|
|
public function addTemplateCates(array $data): array
|
|
|
{
|
|
|
- $session_id = $data['session_id'];
|
|
|
- $user_id = $data['user_id'];
|
|
|
- $chat = AiChat::where('session_id',$session_id)->where('user_id',$user_id)->orderBy('send_time','asc')->get()->all();
|
|
|
- if(empty($chat)){
|
|
|
- return Result::error('此用户的聊天记录不存在!');
|
|
|
+ $website_template = TemplateDraftbox::where('id',$data['template_id'])->first();
|
|
|
+ if(empty($website_template)){
|
|
|
+ return Result::error('此网站模板不存在!');
|
|
|
+ }
|
|
|
+ // return Result::success($website_template);
|
|
|
+ $template_data = json_decode($website_template['template_data'],true);
|
|
|
+ $template_index = $template_data['template']['index'];
|
|
|
+ if(empty($template_index)){
|
|
|
+ return Result::error('模板数据不能为空!');
|
|
|
+ }
|
|
|
+ $canvas_data = json_decode($website_template['canvas_data'],true);
|
|
|
+ $canvas_index = $canvas_data['template']['index'];
|
|
|
+ if(empty($canvas_index)){
|
|
|
+ return Result::error('画布数据不能为空!');
|
|
|
+ }
|
|
|
+ $cate_column = [
|
|
|
+ 'placeid' => 1,
|
|
|
+ 'pid' => 0,
|
|
|
+ 'num' => 23,
|
|
|
+ 'website_id' => $website_template['website_id'],
|
|
|
+ 'is_show' => 1,
|
|
|
+ ];
|
|
|
+ $websiteServer = new \App\JsonRpc\WebsiteService();
|
|
|
+ $all_cate_data = $websiteServer->getWebsiteModelCategory($cate_column);
|
|
|
+ $all_cate = $all_cate_data['data'] ?? [];
|
|
|
+ if(count($all_cate) == 0){
|
|
|
+ return Result::error('栏目不存在!');
|
|
|
+ }
|
|
|
+ foreach ($all_cate as $key => $item) {
|
|
|
+
|
|
|
}
|
|
|
- return Result::success($chat);
|
|
|
+ return Result::success($all_cate);
|
|
|
}
|
|
|
}
|