| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package service
- import (
- "context"
- "lims_zju/common"
- "lims_zju/model"
- )
- type Platform struct{}
- func (p *Platform) GetScaleTotal(ctx context.Context) (*model.ScaleTotal, error) {
- entity := new(model.ScaleTotal)
- err := common.ReadJson(entity, "scale", "common/data2.json")
- if err != nil {
- return nil, err
- }
- return entity, nil
- }
- func (p *Platform) GetSubjectTotal(ctx context.Context) ([]model.SubjectTotal, error) {
- entity := make([]model.SubjectTotal, 0)
- err := common.ReadJson(&entity, "subject", "common/data2.json")
- if err != nil {
- return nil, err
- }
- return entity, nil
- }
- func (p *Platform) GetResultStatistics(ctx context.Context) ([]model.ResultStatistics, error) {
- entity := make([]model.ResultStatistics, 0)
- err := common.ReadJson(&entity, "result_statistics", "common/data2.json")
- if err != nil {
- return nil, err
- }
- return entity, nil
- }
- func (p *Platform) GetResult(ctx context.Context) ([]model.Result, error) {
- entity := make([]model.Result, 0)
- err := common.ReadJson(&entity, "result", "common/data2.json")
- if err != nil {
- return nil, err
- }
- return entity, nil
- }
- func (p *Platform) GetMessage(ctx context.Context) ([]model.Message, error) {
- entity := make([]model.Message, 0)
- err := common.ReadJson(&entity, "message", "common/data2.json")
- if err != nil {
- return nil, err
- }
- return entity, nil
- }
|