更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -15,14 +15,10 @@ import (
|
||||
"server/pkg/identity"
|
||||
)
|
||||
|
||||
// ============================== 回访 / 跟进记录 ==============================
|
||||
|
||||
// BackendCrmFollowController 回访记录(贯穿线索/商机/项目)
|
||||
type BackendCrmFollowController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// List GET /backend/crm/follow/list
|
||||
func (c *BackendCrmFollowController) List() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -45,7 +41,6 @@ func (c *BackendCrmFollowController) List() {
|
||||
keyword := strings.TrimSpace(c.GetString("keyword"))
|
||||
includeSource := strings.TrimSpace(c.GetString("include_source")) == "1"
|
||||
|
||||
// 详情页链路模式(include_source=1):按 线索→商机→项目 累积返回上游 + 自身的数据
|
||||
if includeSource && relatedType != "" && relatedID != "" && relatedID != "0" {
|
||||
rid, _ := strconv.ParseUint(relatedID, 10, 64)
|
||||
rt, _ := strconv.Atoi(relatedType)
|
||||
@@ -109,14 +104,13 @@ type followPayload struct {
|
||||
RelatedType int8 `json:"related_type"`
|
||||
RelatedID uint64 `json:"related_id"`
|
||||
RelatedName string `json:"related_name"`
|
||||
Stage int8 `json:"stage"` // 创建阶段:不传时默认取 related_type
|
||||
Stage int8 `json:"stage"`
|
||||
FollowType string `json:"follow_type"`
|
||||
FollowTime string `json:"follow_time"`
|
||||
Content string `json:"content"`
|
||||
NextContactTime string `json:"next_contact_time"`
|
||||
}
|
||||
|
||||
// Add POST /backend/crm/follow/add
|
||||
func (c *BackendCrmFollowController) Add() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -145,7 +139,6 @@ func (c *BackendCrmFollowController) Add() {
|
||||
followTime = &t
|
||||
}
|
||||
nextContact := parsePipelineDateTime(p.NextContactTime)
|
||||
// 创建阶段:默认取当前关联类型(线索/商机/项目)
|
||||
stage := p.Stage
|
||||
if stage != 1 && stage != 2 && stage != 3 {
|
||||
stage = p.RelatedType
|
||||
@@ -170,7 +163,6 @@ func (c *BackendCrmFollowController) Add() {
|
||||
pipelineErr(&c.Controller, 500, 500, "新增失败: "+err.Error())
|
||||
return
|
||||
}
|
||||
// 同步更新关联对象的下次联系时间
|
||||
if nextContact != nil {
|
||||
syncNextContact(tenantID, p.RelatedType, p.RelatedID, nextContact)
|
||||
}
|
||||
@@ -178,7 +170,6 @@ func (c *BackendCrmFollowController) Add() {
|
||||
pipelineOk(&c.Controller, map[string]interface{}{"id": id})
|
||||
}
|
||||
|
||||
// Edit POST /backend/crm/follow/edit
|
||||
func (c *BackendCrmFollowController) Edit() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -205,8 +196,6 @@ func (c *BackendCrmFollowController) Edit() {
|
||||
return
|
||||
}
|
||||
row.FollowType = firstNonEmpty(p.FollowType, row.FollowType)
|
||||
// 回访阶段(所属阶段)允许修正:仅在传入合法阶段(1线索/2商机/3项目)时更新,
|
||||
// 保证"记录创建时所在阶段"可被纠正为沟通实际发生的阶段。
|
||||
if p.Stage == 1 || p.Stage == 2 || p.Stage == 3 {
|
||||
row.Stage = p.Stage
|
||||
}
|
||||
@@ -223,7 +212,6 @@ func (c *BackendCrmFollowController) Edit() {
|
||||
pipelineOk(&c.Controller, map[string]interface{}{"id": row.ID})
|
||||
}
|
||||
|
||||
// Delete POST /backend/crm/follow/delete
|
||||
func (c *BackendCrmFollowController) Delete() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -255,7 +243,6 @@ func (c *BackendCrmFollowController) Delete() {
|
||||
pipelineOk(&c.Controller, nil)
|
||||
}
|
||||
|
||||
// syncNextContact 回访后同步更新线索/商机的下次联系时间。
|
||||
func syncNextContact(tenantID string, relatedType int8, relatedID uint64, next *time.Time) {
|
||||
if models.Orm == nil || next == nil {
|
||||
return
|
||||
@@ -273,14 +260,10 @@ func syncNextContact(tenantID string, relatedType int8, relatedID uint64, next *
|
||||
}
|
||||
}
|
||||
|
||||
// ================================= 附件 =================================
|
||||
|
||||
// BackendCrmAttachController 附件(线索/商机/项目)
|
||||
type BackendCrmAttachController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// List GET /backend/crm/attach/list
|
||||
func (c *BackendCrmAttachController) List() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -306,7 +289,6 @@ func (c *BackendCrmAttachController) List() {
|
||||
var list []models.TenantCrmAttach
|
||||
total := 0
|
||||
if includeSource && relatedType != "" && relatedID != "" && relatedID != "0" {
|
||||
// 链路模式:线索 → 商机 → 项目 累积(跨表汇总后内存分页)
|
||||
rid, _ := strconv.ParseUint(relatedID, 10, 64)
|
||||
rt, _ := strconv.Atoi(relatedType)
|
||||
for _, r := range relatedChain(tenantID, int8(rt), rid) {
|
||||
@@ -352,7 +334,6 @@ func (c *BackendCrmAttachController) List() {
|
||||
})
|
||||
}
|
||||
|
||||
// Add POST /backend/crm/attach/add
|
||||
func (c *BackendCrmAttachController) Add() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -405,7 +386,6 @@ func (c *BackendCrmAttachController) Add() {
|
||||
pipelineOk(&c.Controller, map[string]interface{}{"id": id})
|
||||
}
|
||||
|
||||
// Delete POST /backend/crm/attach/delete
|
||||
func (c *BackendCrmAttachController) Delete() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -437,14 +417,10 @@ func (c *BackendCrmAttachController) Delete() {
|
||||
pipelineOk(&c.Controller, nil)
|
||||
}
|
||||
|
||||
// ========================== 联系人(线索/商机/项目) ==========================
|
||||
|
||||
// BackendCrmEntityContactController 实体联系人
|
||||
type BackendCrmEntityContactController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// List GET /backend/crm/entity/contact/list
|
||||
func (c *BackendCrmEntityContactController) List() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -459,7 +435,6 @@ func (c *BackendCrmEntityContactController) List() {
|
||||
|
||||
var list []models.TenantCrmEntityContact
|
||||
if includeSource && relatedType != "" && relatedID != "" && relatedID != "0" {
|
||||
// 链路模式:线索 → 商机 → 项目 累积
|
||||
rid, _ := strconv.ParseUint(relatedID, 10, 64)
|
||||
rt, _ := strconv.Atoi(relatedType)
|
||||
for _, r := range relatedChain(tenantID, int8(rt), rid) {
|
||||
@@ -499,7 +474,6 @@ type entityContactPayload struct {
|
||||
ContactName string `json:"contact_name"`
|
||||
Position string `json:"position"`
|
||||
Mobile string `json:"mobile"`
|
||||
// 手机号可登记多个(有的人有多个号码):优先使用,缺省时回退单个 mobile
|
||||
Mobiles []string `json:"mobiles"`
|
||||
Wechat string `json:"wechat"`
|
||||
QQ string `json:"qq"`
|
||||
@@ -508,7 +482,6 @@ type entityContactPayload struct {
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
// Add POST /backend/crm/entity/contact/add
|
||||
func (c *BackendCrmEntityContactController) Add() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -527,7 +500,6 @@ func (c *BackendCrmEntityContactController) Add() {
|
||||
return
|
||||
}
|
||||
tenantID := pipelineTenantID(claims)
|
||||
// 手机号支持多个:优先取 mobiles 数组,缺省回退单个 mobile;mobile 保留为第一个号码
|
||||
mobilesJSON := normalizeMobiles(p.Mobiles, p.Mobile)
|
||||
row := models.TenantCrmEntityContact{
|
||||
TenantID: tenantID,
|
||||
@@ -556,7 +528,6 @@ func (c *BackendCrmEntityContactController) Add() {
|
||||
pipelineOk(&c.Controller, map[string]interface{}{"id": id})
|
||||
}
|
||||
|
||||
// Edit POST /backend/crm/entity/contact/edit
|
||||
func (c *BackendCrmEntityContactController) Edit() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -602,7 +573,6 @@ func (c *BackendCrmEntityContactController) Edit() {
|
||||
pipelineOk(&c.Controller, map[string]interface{}{"id": row.ID})
|
||||
}
|
||||
|
||||
// Delete POST /backend/crm/entity/contact/delete
|
||||
func (c *BackendCrmEntityContactController) Delete() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -647,14 +617,10 @@ func clearOtherEntityPrimary(tenantID string, relatedType int8, relatedID, exclu
|
||||
Update(map[string]interface{}{"is_primary": 0})
|
||||
}
|
||||
|
||||
// ============================== 操作日志 ==============================
|
||||
|
||||
// BackendCrmOperateLogController 操作日志
|
||||
type BackendCrmOperateLogController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// List GET /backend/crm/oplog/list
|
||||
func (c *BackendCrmOperateLogController) List() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user