test
This commit is contained in:
@@ -205,6 +205,7 @@ type GetMessageGroupsResult struct {
|
||||
LastContent string `json:"lastContent"`
|
||||
LastTime time.Time `json:"lastTime"`
|
||||
LastUserName string `json:"lastUserName"`
|
||||
UserName string `json:"userName"`
|
||||
MessageGroupMembers []*GetMessageGroupsMemberResult `json:"messageGroupMembers"`
|
||||
}
|
||||
|
||||
@@ -215,21 +216,22 @@ type GetMessageGroupsMemberResult struct {
|
||||
|
||||
func GetMessageGroups(db *DaoDB, userID string, groupID, groupType int, isMember bool, userID2 string) (messageGroupsResult []*GetMessageGroupsResult, err error) {
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM message_group
|
||||
WHERE deleted_at = ?
|
||||
SELECT a.*, b.name user_name, b.avatar
|
||||
FROM message_group a
|
||||
JOIN user b ON b.user_id = a.user_id
|
||||
WHERE a.deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{utils.DefaultTimeValue}
|
||||
if userID != "" {
|
||||
sql += " AND user_id = ?"
|
||||
sql += " AND a.user_id = ?"
|
||||
sqlParams = append(sqlParams, userID)
|
||||
}
|
||||
if groupType != 0 {
|
||||
sql += " AND type = ?"
|
||||
sql += " AND a.type = ?"
|
||||
sqlParams = append(sqlParams, groupType)
|
||||
}
|
||||
if groupID != 0 {
|
||||
sql += " AND group_id LIKE ?"
|
||||
sql += " AND a.group_id LIKE ?"
|
||||
sqlParams = append(sqlParams, utils.Int2Str(groupID)+"%")
|
||||
}
|
||||
if err = GetRows(db, &messageGroupsResult, sql, sqlParams); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user