AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
通过 ``config/redis.js`` 文件来配置连接Redis <br> ``` // redis配置 module.exports = { db: { host: '127.0.0.1', prot: 6379, db: 0 } // 多个db可以指定多数据源,如:db2: {...} } ``` 在控制器中可以通过 ``this.RDb()`` 来调用redis方法,可以通过传入数据源的名称来选用数据源,默认不传是db ``` const Controller = require('think-js-lib').Controller class HelloController extends Controller { // 用于演示 restful api 接口功能 async sayHello(ctx) { let result = await this.RDb().get('token') return this.showSuccess(result) } } module.exports = HelloController ```