controller

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Overview

Author: Calcium-Ion GitHub: https://github.com/Calcium-Ion/new-api Path: controller/midjourney.go

Index

Constants

View Source
const API_LIMIT_KEY = "api-limiter:%d"

Variables

This section is empty.

Functions

func ActivateUpdateMidjourneyTaskBulk

func ActivateUpdateMidjourneyTaskBulk()

func AddChannel

func AddChannel(c *gin.Context)

func AddOrUpdateTelegramMenu

func AddOrUpdateTelegramMenu(c *gin.Context)

func AddPayment

func AddPayment(c *gin.Context)

func AddPrice

func AddPrice(c *gin.Context)

func AddRedemption

func AddRedemption(c *gin.Context)

func AddToken

func AddToken(c *gin.Context)

func AddUserGroup

func AddUserGroup(c *gin.Context)

func AdminCreatePrivateGroupInviteCode

func AdminCreatePrivateGroupInviteCode(c *gin.Context)

func AdminDeletePrivateGroup

func AdminDeletePrivateGroup(c *gin.Context)

func AdminGrantPrivateGroup

func AdminGrantPrivateGroup(c *gin.Context)

func AdminListPrivateGroupInviteCodes

func AdminListPrivateGroupInviteCodes(c *gin.Context)

func AdminListPrivateGroupMembers

func AdminListPrivateGroupMembers(c *gin.Context)

func AdminListPrivateGroups

func AdminListPrivateGroups(c *gin.Context)

func AdminListUserPrivateGroups

func AdminListUserPrivateGroups(c *gin.Context)

func AdminRevokePrivateGroup

func AdminRevokePrivateGroup(c *gin.Context)

func AdminUpdatePrivateGroup

func AdminUpdatePrivateGroup(c *gin.Context)

func AdminUpdatePrivateGroupInviteCode

func AdminUpdatePrivateGroupInviteCode(c *gin.Context)

func AutomaticallyTestChannels

func AutomaticallyTestChannels(frequency int)

func BatchDelModelChannels

func BatchDelModelChannels(c *gin.Context)

func BatchDeleteChannel

func BatchDeleteChannel(c *gin.Context)

func BatchDeletePrices

func BatchDeletePrices(c *gin.Context)

func BatchSetPrices

func BatchSetPrices(c *gin.Context)

func BatchUpdateChannelsAzureApi

func BatchUpdateChannelsAzureApi(c *gin.Context)

func ChangeChannelsTagStatus

func ChangeChannelsTagStatus(c *gin.Context)

func ChangeUserGroupEnable

func ChangeUserGroupEnable(c *gin.Context)

func ChangeUserQuota

func ChangeUserQuota(c *gin.Context)

func CheckChannel

func CheckChannel(c *gin.Context)

func CheckImg

func CheckImg(c *gin.Context)

func CheckOrderStatus

func CheckOrderStatus(c *gin.Context)

func CreateModelInfo

func CreateModelInfo(c *gin.Context)

func CreateModelOwnedBy

func CreateModelOwnedBy(c *gin.Context)

func CreateOrder

func CreateOrder(c *gin.Context)

CreateOrder

func CreatePrivateGroup

func CreatePrivateGroup(c *gin.Context)

func CreatePrivateGroupInviteCode

func CreatePrivateGroupInviteCode(c *gin.Context)

func CreateUser

func CreateUser(c *gin.Context)

func DeactivateMidjourneyTaskBulk

func DeactivateMidjourneyTaskBulk()

func DeleteChannel

func DeleteChannel(c *gin.Context)

func DeleteChannelTag

func DeleteChannelTag(c *gin.Context)

func DeleteChannelsTag

func DeleteChannelsTag(c *gin.Context)

func DeleteDisabledChannel

func DeleteDisabledChannel(c *gin.Context)

func DeleteDisabledChannelsTag

func DeleteDisabledChannelsTag(c *gin.Context)

func DeleteHistoryLogs

func DeleteHistoryLogs(c *gin.Context)

func DeleteModelInfo

func DeleteModelInfo(c *gin.Context)

func DeleteModelOwnedBy

func DeleteModelOwnedBy(c *gin.Context)

func DeletePayment

func DeletePayment(c *gin.Context)

func DeletePrice

func DeletePrice(c *gin.Context)

func DeletePrivateGroup

func DeletePrivateGroup(c *gin.Context)

func DeletePrivateGroupMember

func DeletePrivateGroupMember(c *gin.Context)

func DeleteRedemption

func DeleteRedemption(c *gin.Context)

func DeleteTelegramMenu

func DeleteTelegramMenu(c *gin.Context)

func DeleteToken

func DeleteToken(c *gin.Context)

func DeleteUser

func DeleteUser(c *gin.Context)

func DeleteUserGroup

func DeleteUserGroup(c *gin.Context)

func DeleteWebAuthnCredential

func DeleteWebAuthnCredential(c *gin.Context)

删除WebAuthn凭据

func DisableChannel

func DisableChannel(channelId int, channelName string, reason string, sendNotify bool)

disable & notify

func EmailBind

func EmailBind(c *gin.Context)

func EnableChannel

func EnableChannel(channelId int, channelName string, sendNotify bool)

enable & notify

func ExportMultiUserStatisticsCSV

func ExportMultiUserStatisticsCSV(c *gin.Context)

ExportMultiUserStatisticsCSV 导出多个用户的统计数据为CSV

func Favicon

func Favicon(buildFS embed.FS) gin.HandlerFunc

func GenInvoice

func GenInvoice(c *gin.Context)

func GenerateAccessToken

func GenerateAccessToken(c *gin.Context)

func GenerateOAuthCode

func GenerateOAuthCode(c *gin.Context)

func GetAbout

func GetAbout(c *gin.Context)

func GetAffCode

func GetAffCode(c *gin.Context)

func GetAllMidjourney

func GetAllMidjourney(c *gin.Context)

func GetAllModelInfo

func GetAllModelInfo(c *gin.Context)

func GetAllModelList

func GetAllModelList(c *gin.Context)

func GetAllModelOwnedBy

func GetAllModelOwnedBy(c *gin.Context)

func GetAllTask

func GetAllTask(c *gin.Context)

func GetChannel

func GetChannel(c *gin.Context)

func GetChannelsList

func GetChannelsList(c *gin.Context)

func GetChannelsTag

func GetChannelsTag(c *gin.Context)

func GetChannelsTagAllList

func GetChannelsTagAllList(c *gin.Context)

func GetChannelsTagList

func GetChannelsTagList(c *gin.Context)

func GetGroups

func GetGroups(c *gin.Context)

func GetHomePageContent

func GetHomePageContent(c *gin.Context)

func GetLogsList

func GetLogsList(c *gin.Context)

func GetLogsSelfStat

func GetLogsSelfStat(c *gin.Context)

func GetLogsStat

func GetLogsStat(c *gin.Context)

func GetModelInfo

func GetModelInfo(c *gin.Context)

func GetModelList

func GetModelList(c *gin.Context)

func GetModelOwnedBy

func GetModelOwnedBy(c *gin.Context)

func GetMultiUserStatistics

func GetMultiUserStatistics(c *gin.Context)

GetMultiUserStatistics 获取多个用户的统计数据

func GetNotice

func GetNotice(c *gin.Context)

func GetOptions

func GetOptions(c *gin.Context)

func GetOrderList

func GetOrderList(c *gin.Context)

func GetPayment

func GetPayment(c *gin.Context)

func GetPaymentList

func GetPaymentList(c *gin.Context)

func GetPlaygroundToken

func GetPlaygroundToken(c *gin.Context)

func GetPricesList

func GetPricesList(c *gin.Context)

func GetRateRealtime

func GetRateRealtime(c *gin.Context)

func GetRedemption

func GetRedemption(c *gin.Context)

func GetRedemptionsList

func GetRedemptionsList(c *gin.Context)

func GetSafeTools

func GetSafeTools(c *gin.Context)

func GetSelf

func GetSelf(c *gin.Context)

func GetStatisticsByPeriod

func GetStatisticsByPeriod(c *gin.Context)

func GetStatisticsDetail

func GetStatisticsDetail(c *gin.Context)

func GetStatus

func GetStatus(c *gin.Context)

func GetSubscription

func GetSubscription(c *gin.Context)

func GetTelegramBotStatus

func GetTelegramBotStatus(c *gin.Context)

func GetTelegramMenu

func GetTelegramMenu(c *gin.Context)

func GetTelegramMenuList

func GetTelegramMenuList(c *gin.Context)

func GetToken

func GetToken(c *gin.Context)

func GetTokensListByAdmin

func GetTokensListByAdmin(c *gin.Context)

GetTokensListByAdmin 管理员查询令牌列表(可按用户ID或令牌ID查询)

func GetUpdatePriceService

func GetUpdatePriceService(c *gin.Context)

func GetUsage

func GetUsage(c *gin.Context)

func GetUser

func GetUser(c *gin.Context)

func GetUserAllTask

func GetUserAllTask(c *gin.Context)

func GetUserDashboard

func GetUserDashboard(c *gin.Context)

func GetUserGroupById

func GetUserGroupById(c *gin.Context)

func GetUserGroupRatio

func GetUserGroupRatio(c *gin.Context)

func GetUserGroups

func GetUserGroups(c *gin.Context)

func GetUserInvoice

func GetUserInvoice(c *gin.Context)

GetUserInvoice 根据查询参数获取用户的账单统计数据

func GetUserInvoiceDetail

func GetUserInvoiceDetail(c *gin.Context)

GetUserInvoiceDetail 获取用户指定月份的账单详情。

func GetUserLogsList

func GetUserLogsList(c *gin.Context)

func GetUserMidjourney

func GetUserMidjourney(c *gin.Context)

func GetUserPaymentList

func GetUserPaymentList(c *gin.Context)

func GetUserTokensList

func GetUserTokensList(c *gin.Context)

func GetUserWebAuthnCredentials

func GetUserWebAuthnCredentials(c *gin.Context)

获取用户的WebAuthn凭据列表

func GetUsersList

func GetUsersList(c *gin.Context)

func GitHubBind

func GitHubBind(c *gin.Context)

func GitHubOAuth

func GitHubOAuth(c *gin.Context)

func GoogleBind

func GoogleBind(c *gin.Context)

func GoogleEndpoint

func GoogleEndpoint(c *gin.Context)

func GoogleOAuth

func GoogleOAuth(c *gin.Context)

func InitMidjourneyTask

func InitMidjourneyTask()

func LarkBind

func LarkBind(c *gin.Context)

func LarkOAuth

func LarkOAuth(c *gin.Context)

func ListJoinedPrivateGroups

func ListJoinedPrivateGroups(c *gin.Context)

func ListPrivateGroupInviteCodes

func ListPrivateGroupInviteCodes(c *gin.Context)

func ListPrivateGroupMembers

func ListPrivateGroupMembers(c *gin.Context)

func ListPrivateGroups

func ListPrivateGroups(c *gin.Context)

func LockOrder

func LockOrder(tradeNo string)

LockOrder 尝试对给定订单号加锁

func Login

func Login(c *gin.Context)

func Logout

func Logout(c *gin.Context)

func ManageUser

func ManageUser(c *gin.Context)

ManageUser Only admin user can do this

func MjTaskHandler

func MjTaskHandler(midjourneyChannel *model.Channel, taskIds []string, taskM map[string]*model.Midjourney) error

func OIDCAuth

func OIDCAuth(c *gin.Context)

OIDCAuth 通过OIDC登录 首先通过OIDC ID进行登录、如果登录失败尝试使用USERNAME 进行登录(遵循用户禁用条件),如果OIDC ID和USERNAME都不存在则注册新用户(遵循是否开启注册功能条件)

func OIDCEndpoint

func OIDCEndpoint(c *gin.Context)

func PaymentCallback

func PaymentCallback(c *gin.Context)

func RedeemPrivateGroupInviteCode

func RedeemPrivateGroupInviteCode(c *gin.Context)

func Register

func Register(c *gin.Context)

func RelayNotFound

func RelayNotFound(c *gin.Context)

func ReloadTelegramBot

func ReloadTelegramBot(c *gin.Context)

func ResetPassword

func ResetPassword(c *gin.Context)

func SendEmailVerification

func SendEmailVerification(c *gin.Context)

func SendPasswordResetEmail

func SendPasswordResetEmail(c *gin.Context)

func ShouldDisableChannel

func ShouldDisableChannel(channelType int, err *types.OpenAIErrorWithStatusCode) bool

func SyncPricing

func SyncPricing(c *gin.Context)

func SystemLog

func SystemLog(c *gin.Context)

SystemLog handles the request to get the latest system logs from the log file It accepts a POST request with a 'count' parameter specifying the number of logs to return

func TelegramBotWebHook

func TelegramBotWebHook(c *gin.Context)

func TestAllChannels

func TestAllChannels(c *gin.Context)

func TestChannel

func TestChannel(c *gin.Context)

func TokilakeConnect

func TokilakeConnect(c *gin.Context)

func TopUp

func TopUp(c *gin.Context)

func Unbind

func Unbind(c *gin.Context)

func UnlockOrder

func UnlockOrder(tradeNo string)

UnlockOrder 释放给定订单号的锁

func UpdateAllChannelsBalance

func UpdateAllChannelsBalance(c *gin.Context)

func UpdateChannel

func UpdateChannel(c *gin.Context)

func UpdateChannelBalance

func UpdateChannelBalance(c *gin.Context)

func UpdateChannelsTag

func UpdateChannelsTag(c *gin.Context)

func UpdateChannelsTagPriority

func UpdateChannelsTagPriority(c *gin.Context)

func UpdateInvoice

func UpdateInvoice(c *gin.Context)

func UpdateMidjourneyTaskBulk

func UpdateMidjourneyTaskBulk()

func UpdateModelInfo

func UpdateModelInfo(c *gin.Context)

func UpdateModelOwnedBy

func UpdateModelOwnedBy(c *gin.Context)

func UpdateOption

func UpdateOption(c *gin.Context)

func UpdatePayment

func UpdatePayment(c *gin.Context)

func UpdatePrice

func UpdatePrice(c *gin.Context)

func UpdatePrivateGroup

func UpdatePrivateGroup(c *gin.Context)

func UpdatePrivateGroupInviteCode

func UpdatePrivateGroupInviteCode(c *gin.Context)

func UpdateRedemption

func UpdateRedemption(c *gin.Context)

func UpdateSelf

func UpdateSelf(c *gin.Context)

func UpdateToken

func UpdateToken(c *gin.Context)

func UpdateTokenByAdmin

func UpdateTokenByAdmin(c *gin.Context)

UpdateTokenByAdmin 管理员更新任意token(支持转移用户)

func UpdateUser

func UpdateUser(c *gin.Context)

func UpdateUserGroup

func UpdateUserGroup(c *gin.Context)

func UptimeKumaStatusPage

func UptimeKumaStatusPage(c *gin.Context)

func UptimeKumaStatusPageHeartbeat

func UptimeKumaStatusPageHeartbeat(c *gin.Context)

func WeChatAuth

func WeChatAuth(c *gin.Context)

func WeChatBind

func WeChatBind(c *gin.Context)

func WebauthnBeginLogin

func WebauthnBeginLogin(c *gin.Context)

WebAuthn 登录开始

func WebauthnBeginRegistration

func WebauthnBeginRegistration(c *gin.Context)

WebAuthn 注册开始

func WebauthnFinishLogin

func WebauthnFinishLogin(c *gin.Context)

WebAuthn 登录完成

func WebauthnFinishRegistration

func WebauthnFinishRegistration(c *gin.Context)

WebAuthn 注册完成

Types

type ChangeUserQuotaRequest

type ChangeUserQuotaRequest struct {
	Quota  int    `json:"quota" form:"quota"`
	Remark string `json:"remark" form:"remark"`
}

type GitHubOAuthResponse

type GitHubOAuthResponse struct {
	AccessToken string `json:"access_token"`
	Scope       string `json:"scope"`
	TokenType   string `json:"token_type"`
}

type GitHubUser

type GitHubUser struct {
	Id        int    `json:"id"`
	Login     string `json:"login"`
	Name      string `json:"name"`
	Email     string `json:"email"`
	AvatarUrl string `json:"avatar_url"`
}

type GithubEmail

type GithubEmail struct {
	Email    string `json:"email"`
	Primary  bool   `json:"primary"`
	Verified bool   `json:"verified"`
}

type GoogleUser

type GoogleUser struct {
	Sub           string `json:"sub"`
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
	Name          string `json:"name"`
	Picture       string `json:"picture"`
}

type LarkAppAccessTokenResponse

type LarkAppAccessTokenResponse struct {
	Code           int    `json:"code"`
	Msg            string `json:"msg"`
	AppAccessToken string `json:"app_access_token"`
}

type LarkUser

type LarkUser struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		OpenID string `json:"open_id"`
		Name   string `json:"name"`
	} `json:"data"`
}

type LarkUserAccessTokenResponse

type LarkUserAccessTokenResponse struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		AccessToken string `json:"access_token"`
	} `json:"data"`
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type ManageRequest

type ManageRequest struct {
	Username string `json:"username"`
	Action   string `json:"action"`
}

type MultiUserStatsRequest

type MultiUserStatsRequest struct {
	Usernames string `form:"usernames" binding:"required"`
	StartTime string `form:"start_time" binding:"required"`
	EndTime   string `form:"end_time" binding:"required"`
}

type OpenAICreditGrants

type OpenAICreditGrants struct {
	Object         string  `json:"object"`
	TotalGranted   float64 `json:"total_granted"`
	TotalUsed      float64 `json:"total_used"`
	TotalAvailable float64 `json:"total_available"`
}

type OpenAISubscriptionResponse

type OpenAISubscriptionResponse struct {
	Object             string  `json:"object"`
	HasPaymentMethod   bool    `json:"has_payment_method"`
	SoftLimitUSD       float64 `json:"soft_limit_usd"`
	HardLimitUSD       float64 `json:"hard_limit_usd"`
	SystemHardLimitUSD float64 `json:"system_hard_limit_usd"`
	AccessUntil        int64   `json:"access_until"`
}

type OpenAIUsageDailyCost

type OpenAIUsageDailyCost struct {
	Timestamp float64 `json:"timestamp"`
	LineItems []struct {
		Name string  `json:"name"`
		Cost float64 `json:"cost"`
	}
}

type OpenAIUsageResponse

type OpenAIUsageResponse struct {
	Object string `json:"object"`
	//DailyCosts []OpenAIUsageDailyCost `json:"daily_costs"`
	TotalUsage float64 `json:"total_usage"` // unit: 0.01 dollar
}

type OrderRequest

type OrderRequest struct {
	UUID   string `json:"uuid" binding:"required"`
	Amount int    `json:"amount" binding:"required"`
}

type OrderResponse

type OrderResponse struct {
	TradeNo string `json:"trade_no"`
	*types.PayRequest
}

type PasswordResetRequest

type PasswordResetRequest struct {
	Email string `json:"email"`
	Token string `json:"token"`
}

type PriceBatchDeleteRequest

type PriceBatchDeleteRequest struct {
	Models []string `json:"models" binding:"required"`
}

type PriceBatchRequest

type PriceBatchRequest struct {
	OriginalModels []string `json:"original_models"`
	model.BatchPrices
}

type StatisticsByPeriod

type StatisticsByPeriod struct {
	UserStatistics       []*model.UserStatisticsByPeriod    `json:"user_statistics"`
	ChannelStatistics    []*model.LogStatisticGroupChannel  `json:"channel_statistics"`
	RedemptionStatistics []*model.RedemptionStatisticsGroup `json:"redemption_statistics"`
	OrderStatistics      []*model.OrderStatisticsGroup      `json:"order_statistics"`
}

type StatisticsDetail

type StatisticsDetail struct {
	UserStatistics      *model.StatisticsUser         `json:"user_statistics"`
	ChannelStatistics   []*model.ChannelStatistics    `json:"channel_statistics"`
	RedemptionStatistic []*model.RedemptionStatistics `json:"redemption_statistic"`
	OrderStatistics     []*model.OrderStatistics      `json:"order_statistics"`
}

type UnbindRequest

type UnbindRequest struct {
	Type string `json:"type"`
}

type UpdateChannelsTagParams

type UpdateChannelsTagParams struct {
	Type  string `json:"type"`
	Value int    `json:"value"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL