# robotServer **Repository Path**: Night.Ming/robot-server ## Basic Information - **Project Name**: robotServer - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-12-09 - **Last Updated**: 2025-01-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # robotServer ## QuickStart see [egg docs][egg] for more detail. ### Development ```bash npm i npm run dev open http://localhost:7001/ ``` ### Deploy ```bash npm start npm stop ``` ### npm scripts - Use `npm run lint` to check code style. - Use `npm test` to run unit test. [egg]: https://eggjs.org ### 说明 - event里面写功能 service里面写业务逻辑(比如sql操作) - 配置文件在config/config.default.js 写在userConfig里面,通过app.config获取 - 通过app.dayjs获取dayjs实例 ```js // 获取当前时间 const now = app.dayjs(); // 获取当前时间的时间戳 const now = app.dayjs().valueOf(); // 获取当前时间的格式化字符串 const now = app.dayjs().format('YYYY-MM-DD HH:mm:ss'); ``` - 通过app.redis获取redis实例 ```js // set await app.redis.set('foo', '测试存储'); // get const value = await app.redis.get('foo'); ``` - 通过app.sqlite获取sqlite实例 ```js // 查询单个数据 const result = await app.sqlite.get('select * from user where id= 3309'); // 查询多个数据 const result = await app.sqlite.all('select * from user'); // 执行语句 const result = await app.sqlite.run('update user set name = "test" where id = 3309'); ``` - 发送消息 ```js // 发送文本消息 const result = await app.sendText('测试文本消息', data.fromId); // 发送图片消息 const result = await app.sendImage('图片地址', data.fromId); // 发送文件消息 const result = await app.sendFile('文件地址', data.fromId); ```