更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -10,40 +10,22 @@ import (
|
||||
"server/pkg/identity"
|
||||
)
|
||||
|
||||
// =============================================================
|
||||
// CRM 招投标管理 - 到期提醒(开发计划 4.1)
|
||||
// =============================================================
|
||||
//
|
||||
// 不新增表、不引入定时任务:所有提醒都是「按当前时间实时计算」的,
|
||||
// 避免定时任务没跑导致状态陈旧。前端在招投标首页拉取近 N 天的待办。
|
||||
//
|
||||
// 覆盖四类到期:
|
||||
// 1. 投标:报名截止 / 投标截止 / 开标时间
|
||||
// 2. 招标:报名截止 / 投标截止 / 开标时间
|
||||
// 3. 资质:证书到期
|
||||
//
|
||||
// GET /backend/crm/bidding/reminders?days=7
|
||||
// =============================================================
|
||||
|
||||
// BackendCrmBiddingReminderController 招投标到期提醒
|
||||
type BackendCrmBiddingReminderController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// biddingReminderItem 一条到期提醒
|
||||
type biddingReminderItem struct {
|
||||
BizType string `json:"biz_type"` // bid | tender | qualification
|
||||
BizID uint64 `json:"biz_id"` // 业务记录ID
|
||||
Kind string `json:"kind"` // register_end | bid_end | open_bid | expire
|
||||
KindName string `json:"kind_name"` // 提醒类型名称
|
||||
Title string `json:"title"` // 记录标题
|
||||
DueDate string `json:"due_date"` // 到期时间 yyyy-MM-dd HH:mm:ss
|
||||
RemainDays int `json:"remain_days"` // 剩余天数,负值表示已逾期
|
||||
Level string `json:"level"` // danger(<=1天/已逾期) | warning(<=3天) | info
|
||||
BizType string `json:"biz_type"`
|
||||
BizID uint64 `json:"biz_id"`
|
||||
Kind string `json:"kind"`
|
||||
KindName string `json:"kind_name"`
|
||||
Title string `json:"title"`
|
||||
DueDate string `json:"due_date"`
|
||||
RemainDays int `json:"remain_days"`
|
||||
Level string `json:"level"`
|
||||
OwnerName string `json:"owner_user_name"`
|
||||
}
|
||||
|
||||
// List GET /backend/crm/bidding/reminders?days=7
|
||||
func (c *BackendCrmBiddingReminderController) List() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -62,7 +44,6 @@ func (c *BackendCrmBiddingReminderController) List() {
|
||||
|
||||
items := make([]biddingReminderItem, 0, 32)
|
||||
|
||||
// ---------- 投标侧 ----------
|
||||
var bids []models.TenantCrmBiddingBid
|
||||
_, _ = models.Orm.QueryTable(new(models.TenantCrmBiddingBid)).
|
||||
Filter("tenant_id", tid).
|
||||
@@ -76,7 +57,6 @@ func (c *BackendCrmBiddingReminderController) List() {
|
||||
items = append(items, pickBidReminders(b, now, deadline)...)
|
||||
}
|
||||
|
||||
// ---------- 招标侧 ----------
|
||||
var tenders []models.TenantCrmBiddingTender
|
||||
_, _ = models.Orm.QueryTable(new(models.TenantCrmBiddingTender)).
|
||||
Filter("tenant_id", tid).
|
||||
@@ -90,7 +70,6 @@ func (c *BackendCrmBiddingReminderController) List() {
|
||||
items = append(items, pickTenderReminders(t, now, deadline)...)
|
||||
}
|
||||
|
||||
// ---------- 资质到期 ----------
|
||||
var quals []models.TenantCrmBiddingBidQualification
|
||||
_, _ = models.Orm.QueryTable(new(models.TenantCrmBiddingBidQualification)).
|
||||
Filter("tenant_id", tid).
|
||||
@@ -101,7 +80,6 @@ func (c *BackendCrmBiddingReminderController) List() {
|
||||
continue
|
||||
}
|
||||
due := *q.ExpireDate
|
||||
// 资质到期包含「已过期」,便于用户发现失效证书
|
||||
if due.After(deadline) {
|
||||
continue
|
||||
}
|
||||
@@ -118,7 +96,6 @@ func (c *BackendCrmBiddingReminderController) List() {
|
||||
})
|
||||
}
|
||||
|
||||
// 按到期时间升序:最紧急的排在最前
|
||||
sort.SliceStable(items, func(i, j int) bool {
|
||||
if items[i].RemainDays != items[j].RemainDays {
|
||||
return items[i].RemainDays < items[j].RemainDays
|
||||
@@ -133,7 +110,6 @@ func (c *BackendCrmBiddingReminderController) List() {
|
||||
})
|
||||
}
|
||||
|
||||
// pickBidReminders 从一条投标记录中挑出落在窗口内的到期项
|
||||
func pickBidReminders(b models.TenantCrmBiddingBid, now, deadline time.Time) []biddingReminderItem {
|
||||
out := make([]biddingReminderItem, 0, 3)
|
||||
add := func(kind, kindName string, due *time.Time) {
|
||||
@@ -162,7 +138,6 @@ func pickBidReminders(b models.TenantCrmBiddingBid, now, deadline time.Time) []b
|
||||
return out
|
||||
}
|
||||
|
||||
// pickTenderReminders 从一条招标记录中挑出落在窗口内的到期项
|
||||
func pickTenderReminders(t models.TenantCrmBiddingTender, now, deadline time.Time) []biddingReminderItem {
|
||||
out := make([]biddingReminderItem, 0, 3)
|
||||
add := func(kind, kindName string, due *time.Time) {
|
||||
@@ -191,14 +166,12 @@ func pickTenderReminders(t models.TenantCrmBiddingTender, now, deadline time.Tim
|
||||
return out
|
||||
}
|
||||
|
||||
// daysBetween 计算今天(0点)到目标时间的剩余天数
|
||||
func daysBetween(now, target time.Time) int {
|
||||
n := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
|
||||
t := time.Date(target.Year(), target.Month(), target.Day(), 0, 0, 0, 0, target.Location())
|
||||
return int(t.Sub(n).Hours() / 24)
|
||||
}
|
||||
|
||||
// levelOf 剩余天数 -> 提醒等级
|
||||
func levelOf(days int) string {
|
||||
if days <= 1 {
|
||||
return "danger"
|
||||
|
||||
Reference in new issue
Block a user