From 250cbfa1ddcb3cf38e0d0505c1c7e282b940d25b Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 13 十月 2023 10:30:05 +0800
Subject: [PATCH] admin user id 转crm user id

---
 model/followRecord.go |   44 ++++++++++++++++++++++++--------------------
 1 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/model/followRecord.go b/model/followRecord.go
index b12a6da..67352b6 100644
--- a/model/followRecord.go
+++ b/model/followRecord.go
@@ -7,24 +7,28 @@
 
 type (
 	FollowRecord struct {
-		Id                   int         `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
-		ClientId             int         `json:"client_id" gorm:"column:client_id;type:int(11);comment:瀹㈡埛id"`
-		ClientStatusId       int         `json:"client_status_id" gorm:"column:client_status_id;type:int(11);comment:瀹㈡埛鐘舵�乮d"`
-		MemberId             int         `json:"member_id" gorm:"column:member_id;type:int(11);comment:璺熻繘浜篿d"`
-		Member               User        `json:"member" gorm:"foreignKey:MemberId"`
-		Number               string      `json:"number" gorm:"column:number;type:varchar(255);comment:璺熻繘缂栧彿"`
-		ContactId            int         `json:"contact_id" gorm:"column:contact_id;type:int(11);comment:鑱旂郴浜篿d"`
-		Topic                string      `json:"topic" gorm:"column:topic;type:varchar(255);comment:璺熻繘涓婚"`
-		Record               string      `json:"record" gorm:"column:record;type:MEDIUMTEXT;comment:璺熻繘璁板綍"`
-		SaleChanceId         int         `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int(11);comment:閿�鍞満浼歩d"`
-		SalesLeadsId         int         `json:"sales_leads_id" gorm:"column:sales_leads_id;type:int(11);comment:閿�鍞嚎绱d"`
-		ContactInformationId int         `json:"contact_information_id" gorm:"column:contact_information_id;type:int(11);comment:鑱旂郴鏂瑰紡id"`
-		FollowTime           *CustomTime `json:"follow_time" gorm:"column:follow_time;type:datetime;comment:璺熻繘鏃堕棿"`
-		NextFollowTime       *CustomTime `json:"next_follow_time" gorm:"column:next_follow_time;type:datetime;comment:涓嬫璺熻繘鏃堕棿"`
-		Purpose              string      `json:"purpose" gorm:"column:purpose;type:varchar(255);comment:璺熻繘鐩殑"`
-		Content              string      `json:"content" gorm:"column:content;type:MEDIUMTEXT;comment:璺熻繘鍐呭"`
-		Client               Client      `json:"client" gorm:"foreignKey:ClientId"`
-		Contact              Contact     `json:"contact" gorm:"foreignKey:ContactId"`
+		Id                   int                `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
+		ClientId             int                `json:"client_id" gorm:"column:client_id;type:int(11);comment:瀹㈡埛id"`
+		ClientStatusId       int                `json:"client_status_id" gorm:"column:client_status_id;type:int(11);comment:瀹㈡埛鐘舵�乮d"`
+		ClientStatus         ClientStatus       `json:"client_status" gorm:"foreignKey:ClientStatusId"`
+		MemberId             int                `json:"member_id" gorm:"column:member_id;type:int(11);comment:璺熻繘浜篿d"`
+		Member               User               `json:"member" gorm:"foreignKey:MemberId"`
+		Number               string             `json:"number" gorm:"column:number;type:varchar(255);comment:璺熻繘缂栧彿"`
+		ContactId            int                `json:"contact_id" gorm:"column:contact_id;type:int(11);comment:鑱旂郴浜篿d"`
+		Topic                string             `json:"topic" gorm:"column:topic;type:varchar(255);comment:璺熻繘涓婚"`
+		Record               string             `json:"record" gorm:"column:record;type:MEDIUMTEXT;comment:璺熻繘璁板綍"`
+		SaleChanceId         int                `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int(11);comment:閿�鍞満浼歩d"`
+		SaleChance           SaleChance         `json:"sale_chance" gorm:"foreignKey:SaleChanceId"`
+		SalesLeadsId         int                `json:"sales_leads_id" gorm:"column:sales_leads_id;type:int(11);comment:閿�鍞嚎绱d"`
+		SalesLeads           SalesLeads         `json:"sales_leads" gorm:"foreignKey:SalesLeadsId"`
+		ContactInformationId int                `json:"contact_information_id" gorm:"column:contact_information_id;type:int(11);comment:鑱旂郴鏂瑰紡id"`
+		FollowTime           *CustomTime        `json:"follow_time" gorm:"column:follow_time;type:datetime;comment:璺熻繘鏃堕棿"`
+		NextFollowTime       *CustomTime        `json:"next_follow_time" gorm:"column:next_follow_time;type:datetime;comment:涓嬫璺熻繘鏃堕棿"`
+		Purpose              string             `json:"purpose" gorm:"column:purpose;type:varchar(255);comment:璺熻繘鐩殑"`
+		Content              string             `json:"content" gorm:"column:content;type:MEDIUMTEXT;comment:璺熻繘鍐呭"`
+		Client               Client             `json:"client" gorm:"foreignKey:ClientId"`
+		Contact              Contact            `json:"contact" gorm:"foreignKey:ContactId"`
+		ContactInformation   ContactInformation `json:"contact_information" gorm:"foreignKey:ContactInformationId"`
 		gorm.Model           `json:"-"`
 	}
 
@@ -123,7 +127,7 @@
 		db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize)
 	}
 
-	err := db.Preload("Client").Preload("Contact").Find(&records).Error
+	err := db.Preload("SalesLeads").Preload("SaleChance").Preload("ClientStatus").Preload("Member").Preload("Client").Preload("Contact").Preload("ContactInformation").Order("id desc").Find(&records).Error
 	return records, total, err
 }
 
@@ -140,7 +144,7 @@
 	if err != nil {
 		return records, count, err
 	}
-	err = slf.build().Offset((page - 1) * pageSize).Limit(pageSize).Find(&records).Error
+	err = slf.build().Offset((page - 1) * pageSize).Limit(pageSize).Order("id desc").Find(&records).Error
 	return records, count, err
 }
 

--
Gitblit v1.8.0