小程序一些功能更新

This commit is contained in:
李琦
2026-09-30 17:01:18 +08:00
parent 75499ba85c
commit 6f51d99a78
46 changed files with 5280 additions and 37 deletions

View File

@@ -27,6 +27,7 @@ const (
cronPatternReleaseCoupons = "0 */5 * * * *" // 免单券超时占用释放:每 5 分钟
cronPatternCloseOrders = "0 */5 * * * *" // 订单超时关闭:每 5 分钟
cronPatternRefundPoll = "0 */2 * * * *" // 退款结果轮询:每 2 分钟(logic/order_refund.go)
cronPatternMaintainRemind = "0 40 9 * * *" // 维护费到期提醒:每天 09:40(logic/project_flow.go)
)
var (
@@ -87,6 +88,15 @@ var (
g.Log().Infof(ctx, "[cron] 已注册任务 %s pattern=%q", "refund-status-poll", cronPatternRefundPoll)
}
// 维护费到期提醒:已验收项目的年度维护费,到期前 N 天开始提醒(隔 3 天一发、最后 3 天天天发)
if _, err = gcron.AddSingleton(ctx, cronPatternMaintainRemind, func(c context.Context) {
logic.ScanMaintainReminders(c)
}, "maintain-remind-scan"); err != nil {
g.Log().Warningf(ctx, "[cron] 维护费提醒任务注册失败: %v", err)
} else {
g.Log().Infof(ctx, "[cron] 已注册任务 %s pattern=%q", "maintain-remind-scan", cronPatternMaintainRemind)
}
s := g.Server()
// 公开接口:小程序登录、开发登录、管理端登录、虚拟支付发货推送回调
s.Group("/", func(group *ghttp.RouterGroup) {
@@ -99,12 +109,15 @@ var (
s.Group("/", func(group *ghttp.RouterGroup) {
group.Middleware(logic.CORS, logic.Response, logic.UserAuth)
group.Bind(controller.UserAuth, controller.Member, controller.Quota, controller.Note,
controller.Promo, controller.Coupon)
controller.Promo, controller.Coupon, controller.Goods, controller.AppConfig,
controller.Service, controller.ServiceProject)
})
// 管理端接口:鉴权(AdminAuth)+ 权限分级(AdminPerm,按角色权限点放行)
s.Group("/", func(group *ghttp.RouterGroup) {
group.Middleware(logic.CORS, logic.Response, logic.AdminAuth, logic.AdminPerm)
group.Bind(controller.AdminAuth, controller.Event, controller.AdminPromo, controller.AdminCoupon, controller.AdminOrder)
group.Bind(controller.AdminAuth, controller.Event, controller.AdminPromo, controller.AdminCoupon, controller.AdminOrder,
controller.AdminGoods, controller.AdminAttachment, controller.AdminSetting, controller.AdminService,
controller.AdminServiceProject)
})
// 活动小程序码静态资源(生成时落在 manifest/qrcode,供管理端/前端访问)
// ⚠️ AddStaticPath 在目录不存在时**直接 FATAL 退出、不降级**,而该目录原先只在