74 lines
4.5 KiB
Go
74 lines
4.5 KiB
Go
|
package repository
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"errors"
|
||
|
"finclip-app-manager/domain/entity"
|
||
|
"finclip-app-manager/domain/entity/proto/apiproto"
|
||
|
mgo "gitlab.finogeeks.club/finclip-backend-v2/finclip-mgo"
|
||
|
"gorm.io/gorm"
|
||
|
)
|
||
|
|
||
|
type AppRepository interface {
|
||
|
AppCount(ctx context.Context, organId string) (int, error)
|
||
|
InsertApp(ctx context.Context, info entity.App) error
|
||
|
GetAppInfo(ctx context.Context, appId string) (entity.App, error)
|
||
|
UpdateApp(ctx context.Context, info entity.App) error
|
||
|
|
||
|
GetAppVerInfo(ctx context.Context, appId string, seq int) (entity.AppVersion, error)
|
||
|
GetOnlineAppVer(ctx context.Context, appId string) (entity.AppVersion, error)
|
||
|
GetLatestPubAppVer(ctx context.Context, appId string) (entity.AppVersion, error)
|
||
|
GetLatestReviewAppVer(ctx context.Context, appId string) (entity.AppVersion, error)
|
||
|
GetAllPermitGrayPubVers(ctx context.Context, appId string, nowPubSeq int) ([]entity.AppVersion, error)
|
||
|
GetMaxSeqAppVer(ctx context.Context, appId string) (entity.AppVersion, error)
|
||
|
UpdateAppVerAppName(ctx context.Context, appId, appName string) error
|
||
|
|
||
|
SubmitApp(ctx context.Context, req entity.SubmitAppReq, expire int64, userId string) error
|
||
|
WithdrawPubApp(ctx context.Context, appId string, seq int, account string) error
|
||
|
PubApp(ctx context.Context, appId string, seq int, account string, isDev, isRollback bool) error
|
||
|
UnpubApp(ctx context.Context, appId string, seq int, account, reason string, isDev bool) error
|
||
|
ListApps(ctx context.Context, groupId string, pageNo, pageSize int, searchText string, sortType, pullType string) (int, []entity.App, error)
|
||
|
ListAppVers(ctx context.Context, pageNo, pageSize int, searchText string, t string, groupId string) (int, []entity.AppVersion, error)
|
||
|
ListAppVersByAppId(ctx context.Context, appId string, pageNo, pageSize int) (int, []entity.AppVersion, error)
|
||
|
GetAppReviews(ctx context.Context, req apiproto.AdminGetAppReviewsReq) (int, []entity.AppVersion, error)
|
||
|
GetAllPublishedVerList(ctx context.Context, appId string) ([]entity.AppVersion, int, error)
|
||
|
GetPublishedAppList(ctx context.Context, pageNo, pageSize int, searchText string) ([]entity.AppVersion, int, error)
|
||
|
GetAllVers(ctx context.Context, appId string) ([]entity.AppVersion, int, error)
|
||
|
GetAppsByAppIds(ctx context.Context, appIds []string) ([]entity.App, error)
|
||
|
GetAppsByGroupIds(ctx context.Context, groupIds []string) (int, []entity.App, error)
|
||
|
GetAppsToBinding(ctx context.Context, bindingId string, pageNo, pageSize int, searchText string) (int, []entity.App, error)
|
||
|
GetLinkAppsByBindingId(ctx context.Context, bindingId string, pageNo, pageSize int, searchText string) (int, []entity.App, error)
|
||
|
GetLinkAppsBySDKKey(ctx context.Context, sdkKey string, pageNo, pageSize int) (int, []entity.App, error)
|
||
|
AdminGetLinkApps(ctx context.Context, pageNo, pageSize int, searchText string) (int, []entity.AdminGetLinkAppsRspItem, error)
|
||
|
|
||
|
ApproveApp(ctx context.Context, appId string, seq int, account, reason string, isPass bool) error
|
||
|
GetRollbackAbleList(ctx context.Context, groupId, appId string, latestPubSeq int) ([]entity.AppVersion, error)
|
||
|
UpdateGrayStatus(ctx context.Context, appId string, seq int, status bool) error
|
||
|
|
||
|
UpdateExpire(ctx context.Context, appId string, expire int64) error
|
||
|
UpdateExpireAppVersion(ctx context.Context, appId string, seq int, expire int64) error
|
||
|
//statistics
|
||
|
GetCreatedStatistics(ctx context.Context, startTime, endTime int64, groupId string, isForbidden int) (int, error)
|
||
|
GetPublishedStatistics(ctx context.Context, startTime, endTime int64, groupId string) (int, error)
|
||
|
GetSubmittedStatistics(ctx context.Context, startTime, endTime int64, groupId string, distinct bool) (int, error)
|
||
|
GetApprovedStatistics(ctx context.Context, startTime, endTime int64, groupId string, distinct bool) (int, error)
|
||
|
GetAppClassPer(ctx context.Context, status string) ([]entity.AppClassPerRsp, error)
|
||
|
|
||
|
GetGrayStatisticsVerList(ctx context.Context, appId string, seq int, begin, end int64) (int, []entity.AppVersion, error)
|
||
|
|
||
|
//对接wx
|
||
|
GetAppVerLimitByIdentity(ctx context.Context, t, appId, identity string, limit int) ([]entity.AppVersion, error)
|
||
|
GetAppClassList(ctx context.Context) ([]entity.CItem, error)
|
||
|
GetAppTagList(ctx context.Context) ([]entity.TagItem, error)
|
||
|
GetAppsBySearchText(ctx context.Context, searchText string) ([]entity.App, error)
|
||
|
GetAppByCreator(ctx context.Context, phone string) ([]entity.App, error)
|
||
|
}
|
||
|
|
||
|
func NotFound(err error) bool {
|
||
|
return err == gorm.ErrRecordNotFound ||
|
||
|
err == mgo.ErrNotFound ||
|
||
|
err == entity.NotFoundErr ||
|
||
|
err == entity.ErrNotFound ||
|
||
|
errors.Is(err, gorm.ErrRecordNotFound)
|
||
|
}
|