Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
style: 1
牛文政1c671ebf0886
diff --git a/electron/global/notice.ts b/electron/global/notice.tsindex 8c67e74f..ab9de561 100644--- a/electron/global/notice.ts+++ b/electron/global/notice.ts@@ -8,9 +8,8 @@import { Notification } from 'electron';export const sysNotice = (title: string, body: string) =>new Promise((resolve, reject) => {- if (!Notification.isSupported()) {- reject('当前系统不支持通知');- }+ if (!Notification.isSupported()) reject('当前系统不支持通知');+const options = typeof title === 'object' ? title : { title, body };const notification = new Notification(options);notification.on('click', resolve);diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.tsindex 2b995b02..233d436b 100644--- a/electron/main/reply/controller.ts+++ b/electron/main/reply/controller.ts@@ -26,33 +26,29 @@ export class ReplyController {@Inject(AutoRunService)private readonly autoRunService!: AutoRunService;---- /**+ /*** 作品点赞*/- @Icp('ICP_DIANZAN_DY_OTHER')- async dianzanDyOther(- event: Electron.IpcMainInvokeEvent,- accountId: number,- pcursor?: string,- ) {- const account = await this.accountService.getAccountById(accountId);-- if (!account)- return {- list: [],- count: 0,- };-- const res = await platController.dianzanDyOther(account, pcursor);-- return res;- }--- /**+ @Icp('ICP_DIANZAN_DY_OTHER')+ async dianzanDyOther(+ event: Electron.IpcMainInvokeEvent,+ accountId: number,+ pcursor?: string,+ ) {+ const account = await this.accountService.getAccountById(accountId);++ if (!account)+ return {+ list: [],+ count: 0,+ };++ const res = await platController.dianzanDyOther(account, pcursor);++ return res;+ }++ /*** 作品收藏*/@Icp('ICP_SHOUCANG_DY_OTHER')diff --git a/electron/main/reply/service.ts b/electron/main/reply/service.tsindex fd4a6549..0f9d8d89 100644--- a/electron/main/reply/service.ts+++ b/electron/main/reply/service.ts@@ -12,6 +12,7 @@ import { toolsApi } from '../api/tools';import { AutorReplyCommentScheduleEvent } from './comment';import { AutoRunService } from '../autoRun/service';import { AutoRunModel } from '../../db/models/autoRun';+import { sysNotice } from '../../global/notice';@Injectable()export class ReplyService {@@ -144,6 +145,11 @@ export class ReplyService {e.status,e.error,);++ sysNotice(+ '评论回复任务执行',+ `评论回复任务执行--${e.tag}--${e.status}`,+ );},);});diff --git a/src/views/reply/components/replyComment.tsx b/src/views/reply/components/replyComment.tsxindex 94d4c366..b10fadc9 100644--- a/src/views/reply/components/replyComment.tsx+++ b/src/views/reply/components/replyComment.tsx@@ -1,7 +1,9 @@import { toolsApi } from '@/api/tools';import { CommentData, icpReplyComment } from '@/icp/reply';-import { Button, Form, Input, Modal } from 'antd';+import { SendOutlined } from '@ant-design/icons';+import { Button, Form, Input, Modal, Tooltip } from 'antd';import { forwardRef, useImperativeHandle, useState } from 'react';+import logoAi from '@/assets/logoAi.png';export interface ReplyCommentRef {init: (accountId: number, inInfo: CommentData) => Promise<void>;@@ -73,35 +75,47 @@ const Com = forwardRef<ReplyCommentRef>((props: any, ref) => {open={isModalOpen}onCancel={handleCancel}footer={null}- width={800}+ width={400}>- <Form- form={form}- name="basic"- labelCol={{ span: 8 }}- wrapperCol={{ span: 16 }}- initialValues={{ remember: true }}- onFinish={onFinish}- onFinishFailed={onFinishFailed}- autoComplete="off"- >- <Form.Item- label="content"- name="content"- rules={[{ required: true, message: '请输入评论!' }]}+ <div className="p-5">+ <Form+ form={form}+ name="basic"+ labelCol={{ span: 8 }}+ wrapperCol={{ span: 16 }}+ initialValues={{ remember: true }}+ onFinish={onFinish}+ onFinishFailed={onFinishFailed}+ autoComplete="off">- <Input />- </Form.Item>+ <Form.Item+ label="内容"+ name="content"+ rules={[{ required: true, message: '请输入评论!' }]}+ >+ <Input />+ </Form.Item>- <Form.Item wrapperCol={{ offset: 8, span: 16 }}>- <Button type="primary" onClick={getAiContent}>- AI建议- </Button>- <Button type="primary" htmlType="submit">- 提交- </Button>- </Form.Item>- </Form>+ <p className="text-right">+ <Tooltip title="获取AI建议">+ <img+ src={logoAi}+ alt="logo"+ width={40}+ onClick={getAiContent}+ />+ </Tooltip>++ <Tooltip title="发送">+ <Button+ shape="circle"+ htmlType="submit"+ icon={<SendOutlined />}+ />+ </Tooltip>+ </p>+ </Form>+ </div></Modal></>);