From 530fed8ec225453572d57b15c200ab062c335457 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 01 十一月 2023 19:20:21 +0800
Subject: [PATCH] 公海member_id使用0

---
 model/client.go |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/model/client.go b/model/client.go
index a9a5e1c..dea1044 100644
--- a/model/client.go
+++ b/model/client.go
@@ -71,6 +71,9 @@
 	if slf.Name != "" {
 		db.Where("name = ?", slf.Name)
 	}
+	if slf.Number != "" {
+		db.Where("number = ?", slf.Number)
+	}
 
 	if len(slf.SearchMap) > 0 {
 		for key, value := range slf.SearchMap {
@@ -114,18 +117,22 @@
 					db = db.Joins("Member").Where("Member.username LIKE ?", "%"+v+"%")
 				}
 
-			case int, uint, int64, float64:
+			case int, uint, int64, float64, bool:
 				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("clients.member_id != ?", constvar.UserTypeSuper)
-					} else {
-						db = db.Where("clients.member_id = ?", constvar.UserTypeSuper)
+				if key == "is_public" {
+					if val, ok := v.(bool); ok {
+						if val {
+							db = db.Where("clients.member_id = ?", 0)
+						}
 					}
 				}
+			case []int:
+				if key == "member_ids" {
+					db = db.Where("clients.member_id in ?", v)
+				}
 
 			}
 		}

--
Gitblit v1.8.0