Skip to content

Let's use AI to Earn!

feat: 视频号活动添加完成

gaoSir4ee733547710
diff --git a/electron/plat/shipinhao/index.ts b/electron/plat/shipinhao/index.ts
index f12edbd2..daf4a3e3 100644
--- a/electron/plat/shipinhao/index.ts
+++ b/electron/plat/shipinhao/index.ts
@@ -4,7 +4,7 @@ import path from 'path';
import { FileUtils } from '../../util/file';
import { CookieToString, getFileContent } from '../utils';
import requestNet from '../requestNet';
-import { WeChatLocationData } from './wxShp.type';
+import { WeChatLocationData, WeChatVideoApiResponse } from "./wxShp.type";
interface UserInfo {
authorId: string;
@@ -1325,7 +1325,7 @@ export class ShipinhaoService {
// 获取视频号的活动
async getActivityList(params: { cookie: Electron.Cookie[]; query: string }) {
- return await requestNet<WeChatLocationData>({
+ return await requestNet<WeChatVideoApiResponse>({
url: `https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/post/post_search_event`,
method: 'POST',
body: params,
diff --git a/electron/plat/shipinhao/wxShp.type.ts b/electron/plat/shipinhao/wxShp.type.ts
index 9f6346b8..8242ef8c 100644
--- a/electron/plat/shipinhao/wxShp.type.ts
+++ b/electron/plat/shipinhao/wxShp.type.ts
@@ -23,6 +23,24 @@ interface POI {
poiCheckSum: string;
}
+interface Data {
+ eventList: WxSphEventList[];
+ lastBuff: string;
+ continueFlag: boolean;
+}
+
+export interface WxSphEventList {
+ eventTopicId: string;
+ eventName: string;
+ eventCreatorNickname: string;
+}
+
+export interface WeChatVideoApiResponse {
+ errCode: number;
+ errMsg: string;
+ data: Data;
+}
+
export interface WeChatLocationData {
errCode: number;
errMsg: string;
diff --git a/src/icp/publish.ts b/src/icp/publish.ts
index 826cb5a3..375d71b0 100644
--- a/src/icp/publish.ts
+++ b/src/icp/publish.ts
@@ -25,7 +25,7 @@ import {
DouyinHotDataResponse,
} from '../../electron/plat/douyin/douyin.type';
import { IRequestNetResult } from '../../electron/plat/requestNet';
-import { WeChatLocationData } from '../../electron/plat/shipinhao/wxShp.type';
+import { WeChatLocationData, WeChatVideoApiResponse } from "../../electron/plat/shipinhao/wxShp.type";
// 创建发布记录
export async function icpCreatePubRecord(pubRecord: Partial<PubRecordModel>) {
@@ -228,9 +228,9 @@ export async function getDouyinActivityDetails(
return res;
}
-// 获取微信视频号的活动详情
+// 获取微信视频号的活动列表
export async function getSphActivity(account: AccountModel, query: string) {
- const res: IRequestNetResult<WeChatLocationData> =
+ const res: IRequestNetResult<WeChatVideoApiResponse> =
await window.ipcRenderer.invoke(
'ICP_PUBLISH_GET_WXSPH_ACTIVITY',
account,
diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_WxSph.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_WxSph.tsx
index 9b563215..7f1e1d7b 100644
--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_WxSph.tsx
+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_WxSph.tsx
@@ -8,45 +8,64 @@ import { useVideoPageStore } from '@/views/publish/children/videoPage/useVideoPa
import { useShallow } from 'zustand/react/shallow';
import { VisibleTypeEnum } from '@@/publish/PublishEnum';
import LocationSelect from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/LocationSelect';
-import { AccountType } from '@@/AccountEnum';
+import { AccountStatus, AccountType } from '@@/AccountEnum';
import { QuestionCircleOutlined } from '@ant-design/icons';
-import { DouyinHotSentence } from '../../../../../../../../electron/plat/douyin/douyin.type';
import useDebounceFetcher from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/useDebounceFetcher';
import { VideoPubRestartLogin } from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon';
+import { getSphActivity } from '@/icp/publish';
+import { ipcUpdateAccountStatus } from '@/icp/account';
+import { WxSphEventList } from '../../../../../../../../electron/plat/shipinhao/wxShp.type';
const { TextArea } = Input;
const WXSphActivity = ({ currChooseAccount }: IVideoPubSetModalChildProps) => {
- const { setOnePubParams } = useVideoPageStore(
+ const { setOnePubParams, updateAccounts } = useVideoPageStore(
useShallow((state) => ({
setOnePubParams: state.setOnePubParams,
+ updateAccounts: state.updateAccounts,
})),
);
const { fetching, options, debounceFetcher } =
- useDebounceFetcher<DouyinHotSentence>(async (keywords) => {
- console.log(keywords);
+ useDebounceFetcher<WxSphEventList>(async (keywords) => {
+ const res = await getSphActivity(currChooseAccount.account!, keywords);
+ if (res.data.errCode === 300334) {
+ currChooseAccount.account!.status = AccountStatus.DISABLE;
+ updateAccounts({ accounts: [currChooseAccount.account!] });
+ await ipcUpdateAccountStatus(
+ currChooseAccount.account!.id,
+ AccountStatus.DISABLE,
+ );
+ return [];
+ }
+ console.log(res);
+ return res.data.data.eventList;
});
return (
<>
- <h1>申请关联热点</h1>
+ <h1>参与活动</h1>
<Select
showSearch
allowClear
style={{ width: '100%' }}
- placeholder="输入热点词搜索"
+ placeholder="输入关键词搜索活动"
labelInValue
filterOption={false}
onSearch={debounceFetcher}
notFoundContent={fetching ? <Spin size="small" /> : null}
- options={[]}
+ options={options.map((v) => {
+ return {
+ label: v.eventName,
+ value: v.eventTopicId,
+ };
+ })}
value={
- currChooseAccount.pubParams!.diffParams![AccountType.Douyin]!.hotPoint
+ currChooseAccount.pubParams!.diffParams![AccountType.WxSph]!.activity
}
onChange={(newValue) => {
const newDiffParams = currChooseAccount.pubParams.diffParams!;
- newDiffParams[AccountType.Douyin]!.hotPoint = newValue;
+ newDiffParams[AccountType.WxSph]!.activity = newValue;
setOnePubParams(
{
diffParams: newDiffParams,