+ user2/GetUsers
This commit is contained in:
@@ -22,3 +22,28 @@ func GetUserByID(db *DaoDB, fieldName, fieldValue string) (user *model.User, err
|
||||
err = GetRow(db, &user, sql, sqlParams...)
|
||||
return user, err
|
||||
}
|
||||
|
||||
func GetUsers(db *DaoDB, userType int, userID2, mobile, userName string) (userList []*model.User, err error) {
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM user t1
|
||||
WHERE t1.deleted_at = ? AND t1.type & ? <> 0`
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
userType,
|
||||
}
|
||||
if userID2 != "" {
|
||||
sql += " AND t1.user_id2 = ?"
|
||||
sqlParams = append(sqlParams, userID2)
|
||||
}
|
||||
if mobile != "" {
|
||||
sql += " AND t1.mobile = ?"
|
||||
sqlParams = append(sqlParams, mobile)
|
||||
}
|
||||
if userName != "" {
|
||||
sql += " AND t1.name LIKE ?"
|
||||
sqlParams = append(sqlParams, "%"+userName+"%")
|
||||
}
|
||||
err = GetRows(db, &userList, sql, sqlParams...)
|
||||
return userList, err
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
ConfigTypeList = []string{
|
||||
ConfigTypeSys,
|
||||
ConfigTypePricePack,
|
||||
ConfigTypeBank,
|
||||
ConfigTypeName = map[string]string{
|
||||
ConfigTypeSys: "系统",
|
||||
ConfigTypePricePack: "价格包",
|
||||
ConfigTypeBank: "银行",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -12,6 +12,15 @@ const (
|
||||
UserTypeBoss = 8
|
||||
)
|
||||
|
||||
var (
|
||||
UserTypeName = map[int]string{
|
||||
UserTypeConsumer: "消费者",
|
||||
UserTypeStoreBoss: "门店老板",
|
||||
UserTypeOperator: "运营",
|
||||
UserTypeBoss: "老板",
|
||||
}
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ModelIDCULD
|
||||
UserID string `orm:"size(48);column(user_id)" json:"userID"` // 内部唯一标识
|
||||
@@ -20,7 +29,7 @@ type User struct {
|
||||
Mobile string `orm:"size(32)" json:"mobile"`
|
||||
Email string `orm:"size(32);index" json:"email"`
|
||||
Status int8 `json:"status"`
|
||||
Type int8 // 用户类型
|
||||
Type int8 `json:"type"` // 用户类型
|
||||
IDCardNo string `orm:"size(18);column(id_card_no)" json:"idCardNo"` // 身份证号
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user