更新密码找回uniapp

This commit is contained in:
hero920103 committed 2026-11-16 17:22:50 +08:00
1 parent 7f9a66da0f
commit 3fdda89833
1304 files changed
+3503 -26132

No files matched your search

-19
View File
@@ -13,14 +13,6 @@ import (
beego "github.com/beego/beego/v2/server/web"
)
// AppErpBaseController 移动端进销存接口公共底座。
//
// 与 /backend/erp/** 的关系(接口隔离规范):两端各有独立 handler 与路由,
// 但单据校验、明细装配、库存/往来账联动与报表统计的口径只能有一份实现,
// 全部在 erp_*_core.go 里;这里只负责「解移动端令牌 → 组装 erpActor → 调核心 → 输出响应」。
//
// 鉴权:/api/** 只被 uniapp 调用,放行 app 与 backend 两类令牌,平台令牌不允许打移动端接口。
// 数据隔离:tenant_id 一律取自 JWT,前端无法指定租户。
type AppErpBaseController struct {
beego.Controller
}
@@ -29,7 +21,6 @@ func (c *AppErpBaseController) erpClaims() (*jwtutil.Claims, error) {
return identity.Claims(c.Ctx.Request.Header.Get("Authorization"), identity.EndApp, identity.EndBackend)
}
// actor 组装核心逻辑需要的调用者身份
func (c *AppErpBaseController) actor(cl *jwtutil.Claims) erpActor {
return erpNewActor(cl)
}
@@ -39,7 +30,6 @@ func (c *AppErpBaseController) erpOk(data interface{}) {
_ = c.ServeJSON()
}
// erpListOK 分页出参形状与 Web 端保持一致:{list,total,page,pageSize,...extra}
func (c *AppErpBaseController) erpListOK(list interface{}, total int64, page, pageSize int, extra map[string]interface{}) {
data := map[string]interface{}{"list": list, "total": total, "page": page, "pageSize": pageSize}
for k, v := range extra {
@@ -54,7 +44,6 @@ func (c *AppErpBaseController) erpFail(httpStatus, bizCode int, msg string) {
_ = c.ServeJSON()
}
// erpDenied 鉴权失败统一出口(返回 true 表示已响应,调用方应 return)
func (c *AppErpBaseController) erpDenied(err error) bool {
if err != nil {
code := identity.Status(err)
@@ -69,7 +58,6 @@ func (c *AppErpBaseController) erpPathID() uint64 {
return id
}
// erpPage 分页参数:默认 20,上限 100(与 Web 端口径一致)
func (c *AppErpBaseController) erpPage() (int, int) {
page, _ := c.GetInt("page", 1)
pageSize, _ := c.GetInt("pageSize", 20)
@@ -82,7 +70,6 @@ func (c *AppErpBaseController) erpPage() (int, int) {
return page, pageSize
}
// erpBody 解析 JSON 请求体;allowEmpty 为 true 时允许空 body(自动核销等场景)
func (c *AppErpBaseController) erpBody(v interface{}, allowEmpty bool) bool {
raw, err := io.ReadAll(c.Ctx.Request.Body)
if err != nil {
@@ -115,7 +102,6 @@ func (c *AppErpBaseController) erpFlag(name string) bool {
return c.erpQuery(name) == "1"
}
// erpDateRange 报表/流水的日期区间:默认当月,date_to 含当天
func (c *AppErpBaseController) erpDateRange(defMonths int) (time.Time, time.Time) {
from, to := erpMonthRange(defMonths)
if d := c.erpQuery("date_from"); d != "" {
@@ -131,14 +117,10 @@ func (c *AppErpBaseController) erpDateRange(defMonths int) (time.Time, time.Time
return from, to
}
// ---- 经营看板 / 字典 ----
// AppErpController 移动端进销存首页聚合与全局字典。
type AppErpController struct {
AppErpBaseController
}
// Dashboard GET /api/erp/dashboard 经营看板(与 Web 端同一份统计口径)
func (c *AppErpController) Dashboard() {
cl, err := c.erpClaims()
if c.erpDenied(err) {
@@ -147,7 +129,6 @@ func (c *AppErpController) Dashboard() {
c.erpOk(erpDashboardCore(c.actor(cl), c.erpQuery("period")))
}
// Meta GET /api/erp/meta 单据类型、状态、收付款方式等下拉字典
func (c *AppErpController) Meta() {
cl, err := c.erpClaims()
if c.erpDenied(err) {