groupMapping.go 661 Bytes
Newer Older
hujiebin's avatar
hujiebin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
package group_m

import (
	"git.hilo.cn/hilo-common/domain"
	"hilo-group/myerr/bizerr"
)

func ToTxGroupId(model *domain.Model, imGroupId string) (string, error) {
	if len(imGroupId) <= 0 {
		return "", nil
	}

	gi, err := GetGroupInfo(model, imGroupId)
	if err != nil {
		return "", err
	}
	if gi == nil {
		return "", bizerr.GroupNotFound
	}
	return gi.TxGroupId, nil
}

func ToImGroupId(model *domain.Model, txGroupId string) (string, error) {
	if len(txGroupId) <= 0 {
		return "", nil
	}

	gi, err := GetInfoByTxGroupId(model, txGroupId)
	if err != nil {
		return "", err
	}
	if gi == nil {
		return "", bizerr.GroupNotFound
	}
	return gi.ImGroupId, nil
}