feat platform dashboard and organization management
This commit is contained in:
@@ -2,32 +2,6 @@ package models
|
||||
|
||||
import "git.apinb.com/heqiapp/platforms/backend/api/internal/impl"
|
||||
|
||||
// DashboardOverview 是平台总后台的跨组织运营概览指标。
|
||||
type DashboardOverview struct {
|
||||
GasBasicCount int64 `json:"gas_basic_count"` // 启用可燃气体站数量
|
||||
DeliveryBasicCount int64 `json:"delivery_basic_count"` // 启用配送点数量
|
||||
StaffCount int64 `json:"staff_count"` // 在岗服务人员数量
|
||||
UserCount int64 `json:"user_count"` // 启用业主客户数量
|
||||
}
|
||||
|
||||
// GetDashboardOverview 通过独立查询返回首页概览指标。
|
||||
func GetDashboardOverview() (DashboardOverview, error) {
|
||||
var overview DashboardOverview
|
||||
if err := impl.DBService.Model(&GasBasic{}).Where("status = ?", 1).Count(&overview.GasBasicCount).Error; err != nil {
|
||||
return DashboardOverview{}, err
|
||||
}
|
||||
if err := impl.DBService.Model(&DeliveryBasic{}).Where("status = ?", 1).Count(&overview.DeliveryBasicCount).Error; err != nil {
|
||||
return DashboardOverview{}, err
|
||||
}
|
||||
if err := impl.DBService.Model(&StaffAccount{}).Where("work_status = ?", "on_duty").Count(&overview.StaffCount).Error; err != nil {
|
||||
return DashboardOverview{}, err
|
||||
}
|
||||
if err := impl.DBService.Model(&UserAccount{}).Where("status = ?", 1).Count(&overview.UserCount).Error; err != nil {
|
||||
return DashboardOverview{}, err
|
||||
}
|
||||
return overview, nil
|
||||
}
|
||||
|
||||
// ListPlatformAccount 返回平台账号分页列表,敏感字段由接口展示层脱敏。
|
||||
func ListPlatformAccount(page, size int) ([]PlatformAccount, int64, error) {
|
||||
var list []PlatformAccount
|
||||
|
||||
Reference in New Issue
Block a user