From db63bbb15a5bbb241676e1d528ead238b73506f1 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期五, 25 八月 2023 10:40:27 +0800
Subject: [PATCH] fix

---
 constvar/const.go           |    7 +++++++
 model/request/salesLeads.go |    1 +
 api/v1/salesLeads.go        |    1 +
 model/salesLeads.go         |    1 +
 model/client.go             |   11 +++++++++++
 model/request/client.go     |    2 +-
 docs/swagger.yaml           |   10 +++++++++-
 docs/docs.go                |   13 ++++++++++++-
 docs/swagger.json           |   13 ++++++++++++-
 9 files changed, 55 insertions(+), 4 deletions(-)

diff --git a/api/v1/salesLeads.go b/api/v1/salesLeads.go
index bd501e9..1e751b5 100644
--- a/api/v1/salesLeads.go
+++ b/api/v1/salesLeads.go
@@ -131,6 +131,7 @@
 			RegionId:   params.RegionId,
 			CountryId:  params.CountryId,
 		},
+		DetailAddress: params.DetailAddress,
 	}
 
 	return ecode.OK, salesLeads
diff --git a/constvar/const.go b/constvar/const.go
index 878c215..b70189e 100644
--- a/constvar/const.go
+++ b/constvar/const.go
@@ -32,6 +32,13 @@
 	UserTypeSub                         // 瀛愯处鎴�
 )
 
+type NotAdmin int
+
+const (
+	NotAdminAll NotAdmin = iota // 鍏捣
+	NotAdminYes                 // 鎴戠殑瀹㈡埛
+)
+
 type SalesStatus int
 
 const (
diff --git a/docs/docs.go b/docs/docs.go
index 1d57580..8d2e5b7 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -12291,6 +12291,9 @@
                 "desc": {
                     "type": "string"
                 },
+                "detail_address": {
+                    "type": "string"
+                },
                 "followRecord": {
                     "type": "array",
                     "items": {
@@ -14271,6 +14274,10 @@
                     "description": "澶囨敞",
                     "type": "string"
                 },
+                "detail_address": {
+                    "description": "璇︾粏鍦板潃",
+                    "type": "string"
+                },
                 "member_id": {
                     "description": "閿�鍞礋璐d汉ID",
                     "type": "integer"
@@ -15247,7 +15254,7 @@
                     "type": "integer"
                 },
                 "search_map": {
-                    "description": "鎼滅储鏉′欢: map[string]interface{}{\"name\": \"xxx\"}; {\"name\": \"瀹㈡埛鍚嶇О\", \"phone\": \"鎵嬫満鍙风爜\", \"detail_address\":\"璇︾粏鍦板潃\", \"next_visit_time\":\"涓嬪洖鍥炶鏃ユ湡\", \"member_name\": \"閿�鍞礋璐d汉\", \"client_status\": \"瀹㈡埛鐘舵�乗", \"client_level\": \"閲嶈绾у埆\",\"representative\": \"娉曞畾浠h〃浜篭", \"registration_time\": \"娉ㄥ唽鏃堕棿\", \"business_scope\": \"缁忚惀鑼冨洿\", \"remark\": \"澶囨敞\"}",
+                    "description": "鎼滅储鏉′欢: map[string]interface{}{\"name\": \"xxx\"}; {\"name\": \"瀹㈡埛鍚嶇О\", \"phone\": \"鎵嬫満鍙风爜\", \"detail_address\":\"璇︾粏鍦板潃\", \"next_visit_time\":\"涓嬪洖鍥炶鏃ユ湡\", \"member_name\": \"閿�鍞礋璐d汉\", \"client_status\": \"瀹㈡埛鐘舵�乗", \"client_level\": \"閲嶈绾у埆\",\"representative\": \"娉曞畾浠h〃浜篭", \"registration_time\": \"娉ㄥ唽鏃堕棿\", \"business_scope\": \"缁忚惀鑼冨洿\", \"remark\": \"澶囨敞\", \"not_admin\":\"1:鎴戠殑瀹㈡埛; 2:admin瀹㈡埛\"}",
                     "type": "object",
                     "additionalProperties": true
                 }
@@ -17435,6 +17442,10 @@
                     "description": "澶囨敞",
                     "type": "string"
                 },
+                "detail_address": {
+                    "description": "璇︾粏鍦板潃",
+                    "type": "string"
+                },
                 "id": {
                     "type": "integer"
                 },
diff --git a/docs/swagger.json b/docs/swagger.json
index 8352956..f8501aa 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -12279,6 +12279,9 @@
                 "desc": {
                     "type": "string"
                 },
+                "detail_address": {
+                    "type": "string"
+                },
                 "followRecord": {
                     "type": "array",
                     "items": {
@@ -14259,6 +14262,10 @@
                     "description": "澶囨敞",
                     "type": "string"
                 },
+                "detail_address": {
+                    "description": "璇︾粏鍦板潃",
+                    "type": "string"
+                },
                 "member_id": {
                     "description": "閿�鍞礋璐d汉ID",
                     "type": "integer"
@@ -15235,7 +15242,7 @@
                     "type": "integer"
                 },
                 "search_map": {
-                    "description": "鎼滅储鏉′欢: map[string]interface{}{\"name\": \"xxx\"}; {\"name\": \"瀹㈡埛鍚嶇О\", \"phone\": \"鎵嬫満鍙风爜\", \"detail_address\":\"璇︾粏鍦板潃\", \"next_visit_time\":\"涓嬪洖鍥炶鏃ユ湡\", \"member_name\": \"閿�鍞礋璐d汉\", \"client_status\": \"瀹㈡埛鐘舵�乗", \"client_level\": \"閲嶈绾у埆\",\"representative\": \"娉曞畾浠h〃浜篭", \"registration_time\": \"娉ㄥ唽鏃堕棿\", \"business_scope\": \"缁忚惀鑼冨洿\", \"remark\": \"澶囨敞\"}",
+                    "description": "鎼滅储鏉′欢: map[string]interface{}{\"name\": \"xxx\"}; {\"name\": \"瀹㈡埛鍚嶇О\", \"phone\": \"鎵嬫満鍙风爜\", \"detail_address\":\"璇︾粏鍦板潃\", \"next_visit_time\":\"涓嬪洖鍥炶鏃ユ湡\", \"member_name\": \"閿�鍞礋璐d汉\", \"client_status\": \"瀹㈡埛鐘舵�乗", \"client_level\": \"閲嶈绾у埆\",\"representative\": \"娉曞畾浠h〃浜篭", \"registration_time\": \"娉ㄥ唽鏃堕棿\", \"business_scope\": \"缁忚惀鑼冨洿\", \"remark\": \"澶囨敞\", \"not_admin\":\"1:鎴戠殑瀹㈡埛; 2:admin瀹㈡埛\"}",
                     "type": "object",
                     "additionalProperties": true
                 }
@@ -17423,6 +17430,10 @@
                     "description": "澶囨敞",
                     "type": "string"
                 },
+                "detail_address": {
+                    "description": "璇︾粏鍦板潃",
+                    "type": "string"
+                },
                 "id": {
                     "type": "integer"
                 },
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index a815bad..ac2abf1 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -1444,6 +1444,8 @@
         type: integer
       desc:
         type: string
+      detail_address:
+        type: string
       followRecord:
         items:
           $ref: '#/definitions/model.FollowRecord'
@@ -2773,6 +2775,9 @@
       desc:
         description: 澶囨敞
         type: string
+      detail_address:
+        description: 璇︾粏鍦板潃
+        type: string
       member_id:
         description: 閿�鍞礋璐d汉ID
         type: integer
@@ -3446,7 +3451,7 @@
           "phone": "鎵嬫満鍙风爜", "detail_address":"璇︾粏鍦板潃", "next_visit_time":"涓嬪洖鍥炶鏃ユ湡", "member_name":
           "閿�鍞礋璐d汉", "client_status": "瀹㈡埛鐘舵��", "client_level": "閲嶈绾у埆","representative":
           "娉曞畾浠h〃浜�", "registration_time": "娉ㄥ唽鏃堕棿", "business_scope": "缁忚惀鑼冨洿", "remark":
-          "澶囨敞"}'
+          "澶囨敞", "not_admin":"1:鎴戠殑瀹㈡埛; 2:admin瀹㈡埛"}'
         type: object
     type: object
   request.GetContactList:
@@ -4938,6 +4943,9 @@
       desc:
         description: 澶囨敞
         type: string
+      detail_address:
+        description: 璇︾粏鍦板潃
+        type: string
       id:
         type: integer
       member_id:
diff --git a/model/client.go b/model/client.go
index 639b0aa..6ead265 100644
--- a/model/client.go
+++ b/model/client.go
@@ -113,9 +113,20 @@
 				}
 
 			case int:
+			case int64:
+			case float64:
 				if key == "id" || key == "client_type_id" || key == "client_status_id" || key == "member_id" {
 					db = db.Where(key+" = ?", v)
 				}
+
+				if key == "not_admin" {
+					if v == float64(constvar.NotAdminYes) {
+						db = db.Where("member_id != ?", constvar.UserTypeSuper)
+					} else {
+						db = db.Where("member_id = ?", constvar.UserTypeSuper)
+					}
+				}
+
 			}
 		}
 	}
diff --git a/model/request/client.go b/model/request/client.go
index 615df7b..48caa0c 100644
--- a/model/request/client.go
+++ b/model/request/client.go
@@ -31,7 +31,7 @@
 
 type GetClientList struct {
 	PageInfo
-	SearchMap map[string]interface{} `json:"search_map"` // 鎼滅储鏉′欢: map[string]interface{}{"name": "xxx"}; {"name": "瀹㈡埛鍚嶇О", "phone": "鎵嬫満鍙风爜", "detail_address":"璇︾粏鍦板潃", "next_visit_time":"涓嬪洖鍥炶鏃ユ湡", "member_name": "閿�鍞礋璐d汉", "client_status": "瀹㈡埛鐘舵��", "client_level": "閲嶈绾у埆","representative": "娉曞畾浠h〃浜�", "registration_time": "娉ㄥ唽鏃堕棿", "business_scope": "缁忚惀鑼冨洿", "remark": "澶囨敞"}
+	SearchMap map[string]interface{} `json:"search_map"` // 鎼滅储鏉′欢: map[string]interface{}{"name": "xxx"}; {"name": "瀹㈡埛鍚嶇О", "phone": "鎵嬫満鍙风爜", "detail_address":"璇︾粏鍦板潃", "next_visit_time":"涓嬪洖鍥炶鏃ユ湡", "member_name": "閿�鍞礋璐d汉", "client_status": "瀹㈡埛鐘舵��", "client_level": "閲嶈绾у埆","representative": "娉曞畾浠h〃浜�", "registration_time": "娉ㄥ唽鏃堕棿", "business_scope": "缁忚惀鑼冨洿", "remark": "澶囨敞", "not_admin":"1:鎴戠殑瀹㈡埛; 2:admin瀹㈡埛"}
 }
 
 type DeleteClient struct {
diff --git a/model/request/salesLeads.go b/model/request/salesLeads.go
index d4684b2..b29c4fb 100644
--- a/model/request/salesLeads.go
+++ b/model/request/salesLeads.go
@@ -15,6 +15,7 @@
 	SalesSourcesId  int    `json:"sales_sources_id"` // 鍟嗘満鏉ユ簮ID
 	MemberId        int    `json:"member_id"`        // 閿�鍞礋璐d汉ID
 	Desc            string `json:"desc"`             // 澶囨敞
+	DetailAddress   string `json:"detail_address"`   // 璇︾粏鍦板潃
 	Address
 }
 
diff --git a/model/salesLeads.go b/model/salesLeads.go
index a2cc2aa..d9c52c6 100644
--- a/model/salesLeads.go
+++ b/model/salesLeads.go
@@ -22,6 +22,7 @@
 		Desc            string               `json:"desc" gorm:"column:desc;type:varchar(255);comment:澶囨敞"`
 		Reason          string               `json:"reason" gorm:"column:reason;type:text;comment:澶辫触鍘熷洜"`
 		FollowRecord    []FollowRecord       `gorm:"foreignKey:SalesLeadsId"`
+		DetailAddress   string               `json:"detail_address" gorm:"column:detail_address;type:varchar(255);comment:璇︾粏鍦板潃"`
 		Address
 		gorm.Model `json:"-"`
 	}

--
Gitblit v1.8.0