chore: 补全工程配置,部署云函数,建立数据库索引

- 新增 .gitignore(排除 node_modules、私有配置、编译产物)
- 新增 cloudbaserc.json,绑定云环境 cloud1-d4g697lte499543d8
- project.config.json:补 miniprogramRoot、开启 useCompilerPlugins typescript,修复预览报 app.json 找不到的问题
- tsconfig.json:移除无效 typeRoots,解除 TypeScript 编译阻断
- miniprogram/app.json:移除 glass-easel(需基础库 3.x,兼容性差)
- miniprogram/utils/constants.ts:填入真实云环境 ID
- cloudfunctions/updateLocation:位置字段改用 GeoPoint 以支持地理索引
- cloudfunctions/getNearbyPets:改用 geoNear 聚合管道,支持真实距离排序

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-06-06 00:37:33 +08:00
parent c04c890186
commit 24891d9004
8 changed files with 161 additions and 74 deletions

63
cloudbaserc.json Normal file
View File

@@ -0,0 +1,63 @@
{
"$schema": "https://static.cloudbase.net/cli/cloudbaserc.schema.json",
"envId": "cloud1-d4g697lte499543d8",
"functionRoot": "cloudfunctions",
"functions": [
{
"name": "login",
"timeout": 10,
"runtime": "Nodejs20.19",
"handler": "index.main",
"description": "微信登录 & 用户注册"
},
{
"name": "createPost",
"timeout": 15,
"runtime": "Nodejs20.19",
"handler": "index.main",
"description": "发布帖子"
},
{
"name": "getPosts",
"timeout": 10,
"runtime": "Nodejs20.19",
"handler": "index.main",
"description": "获取信息流帖子列表"
},
{
"name": "getPost",
"timeout": 10,
"runtime": "Nodejs20.19",
"handler": "index.main",
"description": "获取单条帖子详情"
},
{
"name": "likePost",
"timeout": 10,
"runtime": "Nodejs20.19",
"handler": "index.main",
"description": "点赞 / 取消点赞"
},
{
"name": "getNearbyPets",
"timeout": 15,
"runtime": "Nodejs20.19",
"handler": "index.main",
"description": "附近宠物地理位置查询"
},
{
"name": "updateLocation",
"timeout": 10,
"runtime": "Nodejs20.19",
"handler": "index.main",
"description": "更新用户地理位置GeoPoint"
},
{
"name": "sendGreeting",
"timeout": 10,
"runtime": "Nodejs20.19",
"handler": "index.main",
"description": "打招呼 / 发起私信"
}
]
}