@@ -37,7 +37,7 @@ type AppService struct {
3737}
3838
3939type IAppService interface {
40- PageApp (ctx * gin.Context , req request.AppSearch ) (interface {} , error )
40+ PageApp (ctx * gin.Context , req request.AppSearch ) (* response. AppRes , error )
4141 GetAppTags (ctx * gin.Context ) ([]response.TagDTO , error )
4242 GetApp (ctx * gin.Context , key string ) (* response.AppDTO , error )
4343 GetAppDetail (appId uint , version , appType string ) (response.AppDetailDTO , error )
@@ -46,13 +46,14 @@ type IAppService interface {
4646 GetAppUpdate () (* response.AppUpdateRes , error )
4747 GetAppDetailByID (id uint ) (* response.AppDetailDTO , error )
4848 SyncAppListFromLocal (taskID string )
49+ GetAppIcon (appID uint ) ([]byte , error )
4950}
5051
5152func NewIAppService () IAppService {
5253 return & AppService {}
5354}
5455
55- func (a AppService ) PageApp (ctx * gin.Context , req request.AppSearch ) (interface {} , error ) {
56+ func (a AppService ) PageApp (ctx * gin.Context , req request.AppSearch ) (* response. AppRes , error ) {
5657 var opts []repo.DBOption
5758 opts = append (opts , appRepo .OrderByRecommend ())
5859 if req .Name != "" {
@@ -98,7 +99,7 @@ func (a AppService) PageApp(ctx *gin.Context, req request.AppSearch) (interface{
9899 }
99100 opts = append (opts , repo .WithByIDs (appIds ))
100101 }
101- var res response.AppRes
102+ res := & response.AppRes {}
102103
103104 total , apps , err := appRepo .Page (req .Page , req .PageSize , opts ... )
104105 if err != nil {
@@ -120,12 +121,7 @@ func (a AppService) PageApp(ctx *gin.Context, req request.AppSearch) (interface{
120121 ID : ap .ID ,
121122 Name : ap .Name ,
122123 Key : ap .Key ,
123- Type : ap .Type ,
124- Icon : ap .Icon ,
125- Resource : ap .Resource ,
126124 Limit : ap .Limit ,
127- Website : ap .Website ,
128- Github : ap .Github ,
129125 GpuSupport : ap .GpuSupport ,
130126 Recommend : ap .Recommend ,
131127 Description : ap .GetDescription (ctx ),
@@ -135,7 +131,9 @@ func (a AppService) PageApp(ctx *gin.Context, req request.AppSearch) (interface{
135131 if err != nil {
136132 continue
137133 }
138- appDTO .Tags = tags
134+ for _ , tag := range tags {
135+ appDTO .Tags = append (appDTO .Tags , tag .Name )
136+ }
139137 if ap .Type == constant .RuntimePHP || ap .Type == constant .RuntimeGo || ap .Type == constant .RuntimeNode || ap .Type == constant .RuntimePython || ap .Type == constant .RuntimeJava || ap .Type == constant .RuntimeDotNet {
140138 details , _ := appDetailRepo .GetBy (appDetailRepo .WithAppId (ap .ID ))
141139 var ids []uint
@@ -1161,3 +1159,15 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) {
11611159
11621160 return nil
11631161}
1162+
1163+ func (a AppService ) GetAppIcon (appID uint ) ([]byte , error ) {
1164+ app , err := appRepo .GetFirst (repo .WithByID (appID ))
1165+ if err != nil {
1166+ return nil , err
1167+ }
1168+ iconBytes , err := base64 .StdEncoding .DecodeString (app .Icon )
1169+ if err != nil {
1170+ return nil , err
1171+ }
1172+ return iconBytes , nil
1173+ }
0 commit comments