eggjs / eggjs/tegg

Service 里面怎么拿到context

Open
#258 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
264
Forks
46
Avg merge
2d 22h
Merged PRs (30d)
1

Description

### 在此输入你需要反馈的 Bug 具体信息(Bug in Detail):
Service 里面怎么拿到context

@SingletonProto({
// 如果需要在上层使用,需要把 accessLevel 显示声明为 public
accessLevel: AccessLevel.PUBLIC,
})
export class DemoService {
constructor(){
setInterval(() => {
//执行定时任务
// 调用egg-sequelize model更新数据库
ctx.model.Demo.findAll();
}, 100000);
}
}

### 可复现问题的仓库地址(Reproduction Repo)

https://github.com/ssss

### Node 版本号:

v20.14.0

### TEgg 版本号:

3.5.2

### 相关插件名称与版本号:

"egg-sequelize": "^6.0.0",

### 操作平台与版本号:

macos 15.1

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.