service.go 1.9 KB
package service

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/systemsetting/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/systemsetting/query"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
)

// 用户信息
type SystemSettingService struct {
}

func NewSystemSettingService(options map[string]interface{}) *SystemSettingService {
	newUsersService := &SystemSettingService{}
	return newUsersService
}

func (srv SystemSettingService) GetSystemSettingList(systemSettingListQuery *query.SettingListQuery) (interface{}, error) {
	creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
		systemSettingListQuery.Operator,
	)
	result, err := creationBasicGateway.SystemSettingSearch(allied_creation_basic.ReqSystemSettingSearch{
		SettingName: systemSettingListQuery.Key,
	})
	return result, err
}

func (srv SystemSettingService) GetSystemSetting(systemSettingGetQuery *query.SettingGetQuery) (interface{}, error) {
	creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
		systemSettingGetQuery.Operator,
	)
	result, err := creationBasicGateway.SystemSettingGet(allied_creation_basic.ReqSystemSettingGet{
		SettingCode: systemSettingGetQuery.SettingCode,
	})
	return result, err
}

func (srv SystemSettingService) SystemSettingUpdate(systemSettingUpdate *command.SettingUpdateCommand) (interface{}, error) {
	creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
		systemSettingUpdate.Operator,
	)
	result, err := creationBasicGateway.SystemSettingUpdate(allied_creation_basic.ReqSystemSettingUpdate{
		SettingCode: systemSettingUpdate.SettingCode,
		Value:       systemSettingUpdate.Value,
		CompanyId:   systemSettingUpdate.Operator.CompanyId,
	})
	return result, err
}