diff --git a/Cunkebao/src/pages/mobile/mine/content/form/index.tsx b/Cunkebao/src/pages/mobile/mine/content/form/index.tsx index 98527516..f758cee4 100644 --- a/Cunkebao/src/pages/mobile/mine/content/form/index.tsx +++ b/Cunkebao/src/pages/mobile/mine/content/form/index.tsx @@ -9,8 +9,7 @@ import GroupSelection from "@/components/GroupSelection"; import DeviceSelection from "@/components/DeviceSelection"; import Layout from "@/components/Layout/Layout"; import style from "./index.module.scss"; -import request from "@/api/request"; -import { getContentLibraryDetail, updateContentLibrary } from "./api"; +import { getContentLibraryDetail, updateContentLibrary, createContentLibrary } from "./api"; import { GroupSelectionItem } from "@/components/GroupSelection/data"; import { FriendSelectionItem } from "@/components/FriendSelection/data"; import { DeviceSelectionItem } from "@/components/DeviceSelection/data"; @@ -162,7 +161,7 @@ export default function ContentForm() { await updateContentLibrary({ id, ...payload }); Toast.show({ content: "保存成功", position: "top" }); } else { - await request("/v1/content/library/create", { ...payload, formType: 0 }, "POST"); + await createContentLibrary(payload); Toast.show({ content: "创建成功", position: "top" }); } navigate("/mine/content"); diff --git a/Server/application/cunkebao/controller/ContentLibraryController.php b/Server/application/cunkebao/controller/ContentLibraryController.php index 1151a876..690d8a64 100644 --- a/Server/application/cunkebao/controller/ContentLibraryController.php +++ b/Server/application/cunkebao/controller/ContentLibraryController.php @@ -95,7 +95,7 @@ class ContentLibraryController extends Controller // 来源类型 'sourceType' => $sourceType, // 1=好友,2=群,3=好友和群 // 表单类型 - 'formType' => isset($param['formType']) ? intval($param['formType']) : 0, // 表单类型,默认为0 + 'formType' => isset($param['formType']) ? intval($param['formType']) : 1, // 表单类型,默认为0 // 基础信息 'status' => isset($param['status']) ? $param['status'] : 0, // 状态:0=禁用,1=启用 'userId' => $this->request->userInfo['id'], @@ -131,7 +131,7 @@ class ContentLibraryController extends Controller $limit = $this->request->param('limit', 10); $keyword = $this->request->param('keyword', ''); $sourceType = $this->request->param('sourceType', ''); // 来源类型,1=好友,2=群 - $formType = $this->request->param('formType', ''); // 表单类型筛选 + $formType = $this->request->param('formType', 0); // 表单类型筛选 $companyId = $this->request->userInfo['companyId']; $userId = $this->request->userInfo['id']; $isAdmin = !empty($this->request->userInfo['isAdmin']); diff --git a/Server/application/job/SyncContentJob.php b/Server/application/job/SyncContentJob.php index 8f2b9b4f..e5e95bc5 100644 --- a/Server/application/job/SyncContentJob.php +++ b/Server/application/job/SyncContentJob.php @@ -1,34 +1,54 @@ delete(); - - // 记录日志 - \think\Log::info('内容库同步成功:' . json_encode($data)); - - } catch (\Exception $e) { - // 如果任务执行失败,记录日志 - \think\Log::error('内容库同步失败:' . $e->getMessage()); - - // 如果任务失败次数小于3次,重新放入队列 - if ($job->attempts() < 3) { - $job->release(60); // 延迟60秒后重试 - } else { - $job->delete(); + return true; + /*$ddd= '[{"id":21909,"groupName":"私域运营招聘","sortIndex":240426546,"parentId":0,"replyType":1,"children":[],"replys":null},{"id":8074,"groupName":"存客宝新客户介绍","sortIndex":230,"parentId":0,"replyType":1,"children":[{"id":8081,"groupName":"客户系统上线准备","sortIndex":1,"parentId":8074,"replyType":1,"children":[],"replys":null}],"replys":null},{"id":10441,"groupName":"BOSS直聘","sortIndex":229,"parentId":0,"replyType":1,"children":[],"replys":null},{"id":15111,"groupName":"点了码新客户了解","sortIndex":228,"parentId":0,"replyType":1,"children":[],"replys":null},{"id":12732,"groupName":"测试","sortIndex":219,"parentId":0,"replyType":1,"children":[],"replys":null},{"id":8814,"groupName":"封单话术","sortIndex":176,"parentId":0,"replyType":1,"children":[],"replys":null},{"id":8216,"groupName":"私域合伙人","sortIndex":172,"parentId":0,"replyType":1,"children":[],"replys":null},{"id":6476,"groupName":"新客户了解","sortIndex":119,"parentId":0,"replyType":1,"children":[],"replys":null}]'; + $ddd=json_decode($ddd,1);*/ + + $ddd = ReplyGroup::where('companyId',2778)->where('companyId','<>',21898)->where('isDel',0)->select()->toArray(); + + + $authorization = 'OE7kh6Dsw_0SqqH1FTAPCB2ewCQDhx7VvPw6PrsE_p9tcRKbtlFsZau8kjk2NQ829Yah90KhTh0C_35ek569uRQgM_gC0NtKzfRPDDoqMIUE5mI6AO_hm0dm-xDJqhAFYkXHCdXnJYzQZxWS5dleJCIwtQxgRuIzIbr-_G_5C-7DeLEOSt2vi1oGPleLt00QGQ1WYVYqoHYrbPGMghMQpWIbgk5qNcUCeANlLJ_s7QFC3QzArU95_YiK0HlhU81hZqr8kI_5lmdrRBoR-yNIlyhySLRCmEZYGzOxCiUHL3uFHYZA1VnLBAVbryNj5DElZjMgwA'; + // 设置请求头 + $headerData = ['client:system']; + $header = setHeader($headerData, $authorization, 'json'); + + + + foreach ($ddd as $key => $value) { + $data = []; + // 发送请求获取公司账号列表 + $result = requestCurl('https://s2.siyuguanli.com:9991/api/Reply/listReply?groupId='.$value['id'], '', 'GET', $header,'json'); + $response = handleApiResponse($result); + foreach ($response as $k => $v) { + $data[] = [ + 'groupId' => $v['groupId'], + 'userId' => $value['userId'], + 'title' => $v['title'], + 'msgType' => $v['msgType'], + 'content' => $v['content'], + 'createTime' => strtotime($v['createTime']), + 'lastUpdateTime' => strtotime($v['lastUpdateTime']), + 'sortIndex' => 50 + ]; } + $Reply = new Reply(); + $Reply->insertAll($data); } + + + exit_data(11111); + + + + } } \ No newline at end of file