2021-09-26 02:35:02 +00:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
2021-09-27 06:17:36 +00:00
|
|
|
loger2 "github.com/IceWhaleTech/CasaOS/pkg/utils/loger"
|
|
|
|
model2 "github.com/IceWhaleTech/CasaOS/service/model"
|
2021-09-26 02:35:02 +00:00
|
|
|
"gorm.io/gorm"
|
|
|
|
)
|
|
|
|
|
|
|
|
type RelyService interface {
|
|
|
|
Create(rely model2.RelyDBModel)
|
|
|
|
Delete(id string)
|
|
|
|
GetInfo(id string) model2.RelyDBModel
|
|
|
|
}
|
|
|
|
|
|
|
|
type relyService struct {
|
|
|
|
db *gorm.DB
|
|
|
|
log loger2.OLog
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *relyService) Create(rely model2.RelyDBModel) {
|
|
|
|
|
|
|
|
r.db.Create(&rely)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取我的应用列表
|
|
|
|
func (r *relyService) GetInfo(id string) model2.RelyDBModel {
|
|
|
|
var m model2.RelyDBModel
|
|
|
|
r.db.Where("custom_id = ?", id).First(&m)
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *relyService) Delete(id string) {
|
|
|
|
var c model2.RelyDBModel
|
|
|
|
r.db.Where("custom_id = ?", id).Delete(&c)
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewRelyService(db *gorm.DB, log loger2.OLog) RelyService {
|
|
|
|
return &relyService{db: db, log: log}
|
|
|
|
}
|