Commit Graph
64 Commits
Author SHA1 Message Date
Jiahuiandwj d5cfcd2c19 Corporate (#5726)
* support_pay_refund

* corporate

---------

Co-authored-by: wj <3638877@qq.com>
2025-07-31 17:17:44 +08:00
Jiahui 8e3d1d1b2e update activity rules (#5708)
* pay active

* frontend

* add time filtering active users
2025-07-18 17:58:11 +08:00
Jiahui 6eb28db0ee support the suspension and resumption of export network services (#5629)
* support the suspension and resumption of export network services

* support recording user traffic to the database: `UserTimeRangeTraffic` Table.

* network suspend/resume annotation value to upper

* add suspend/resume user traffic api

* optimize monitor user traffic process

* realize the automatic refresh of traffic usage

* add test
2025-06-06 11:07:03 +08:00
Jiahui 72f03970a4 fix get user id without cache (#5635) 2025-06-04 17:34:24 +08:00
Jiahui 4e70494a70 optimize sendFlushQuotaRequest log & fix create or update quota (#5609)
* optimize sendFlushQuotaRequest log & fix create or update quota

* optimize: user remove the watching AnnotationChangedPredicate

* optimize initialize the account data
2025-05-27 17:04:30 +08:00
Jiahui 563ce808ad fix assignment user uid to UserQueryOpts (#5606) 2025-05-26 18:26:40 +08:00
Jiahui cb45b20a1c Fix/debt process time range (#5602)
* fix debt time range process: if error occurs, the start time of the next execution is the start time of the last one

* optimize

* suspend create transaction

* add github detection initialization account

* fix ci
2025-05-16 16:07:26 +08:00
Jiahui 30ec4f9b17 Compatible with pgsql syntax: current_timestamp() => current_timestamp (#5586)
* delete repeated update time

* add namespace reconcile status & add final delete job & app resource

* remove the useless lock & optimize GetCreditsInfo api speed

* add KYC process enabled env
2025-05-13 16:20:45 +08:00
Jiahui 8c2db08fd4 Support subscriptions, atom payments, credits, and optimize debt systems (#5545)
* add credits

* create table

* change name & add table name

* optimize interface

* print result err log

* fix

* add credits for debt

* creditsTransaction add region

* refactor debt status:
Normal\LowBalance\CriticalBalance\Debt\DebtDeletion\Final Period.

* refactor debt status:
Normal\LowBalance\CriticalBalance\Debt\DebtDeletion\Final Period.

* add retry transaction

* optimize determine status

* support card pay & subscription plan & operator service

* add pay notify & redirect url

* fix

* optimize

* add error test log

* fix req time

* fix

* fix

* add subscription payment api

* only processes the `CAPTURE_RESULT` notify type

* fix

* fix

* fixed notify structure parsing

* fix

* fix

* init a Free initial subscription plan √/ Initialize credits Create √

* init resourcequota wiht subscription

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix card type

* fix

* Subscribe controller: real-time monitoring subscriptionTransaction processing created/upgrade/downgrade

* fix

* fix

* fix

* determine current debt status with subscription

* optimize pay api resp

* process subscription auto renewal

* optimize log

* fix

* fix

* add GetAppResourceCosts api

* fix

* add GetLastSubscriptionTransaction api

* add GetSubscriptionUpgradeAmount api

* add /subscription/flush-quota api

* fix

* add remote flush subscription quota

* go mod tidy

* fix

* add retry flush subscription quota

* add custom debt status send email body

* fix

* fix

* fix

* fix

* fix

* add free process subscription

* fix

* add default pay expire time

* optimize

* support kyc & optimize

* optimiz

* add descributed lock with gorm db

* optimize debt reconcile

* optimize send email

* optimize split sms vms code map; handler failure reflush debt status.

* optimize

* add email username

* optimize

* skip zero user

* optimize flush svc

* add convert test func

* fix

* optimize log

* use the k8s client with cache

* fix golang ci lint
2025-05-06 16:56:25 +08:00
Jiahui c672e3750c optimize recharge discount step (#5552) 2025-04-23 10:52:48 +08:00
limbo bf52ed5616 chore(account-service): Add aiproxy backend real name lookup interface (#5394)
* chore(add amdin real name info query)

* chore
2025-02-21 16:14:41 +08:00
Jiahui 6a332d3702 fix skip llm token (#5369) 2025-02-12 14:16:49 +08:00
Jiahui 5cfeb599ca Optimize billing efficiency (#5362)
* billing reconciler changed from controller trigger to scheduled task execution.

* with manager runner

* with manager runner

* change cmv billing with manager runner

* optimize log

* fix reconcile

* add billing with wait group goroutine

* add logger

* get the user cr using the cacheless client

* optimize

* Removes mongo Aggregate processing data that is too slow and uses in-memory batch user metering data.

* fix

* remove the owner that does not need to be updated

* optimize log && fix the genGroupKey GenerateBillingDataFromRecords rules

* make format
2025-02-10 16:33:16 +08:00
limbo 232bc84584 chore(account-service): add enterprise real name info inquiry (#5363) 2025-02-10 16:31:59 +08:00
Jiahui 3cd3d6dddd Feat: llm token account service (#5202)
* add get account with workspace id

* add charge billing

* add ReconcileUnsettledLLMBilling auto reconcile

* add HourlyLLMBillingArchive

* custom startReconcileLLMBilling ticker time

* Process timer tasks through queue tasks to prevent task accumulation from causing the timer to miss execution opportunities.

* Create a buffered channel interrupt and use the signal.

* reconcile user active task reward with clause Locking.

* change signal notify to SIGTERM

* add account service metrics
2024-11-20 17:48:48 +08:00
Jiahui 98395f7dc1 remove unused code (#5134) 2024-10-12 15:40:07 +08:00
Jiahui 351e761613 Feat/active task (#5121)
* feat active task & first recharge discount
* sort discount step & add lock for payment
2024-10-08 15:02:23 +08:00
limboandjiahui 3081c5dc1a fix(account-service): fix concurrency issue and add real name info api (#5103)
---------

Co-authored-by: jiahui <bxy4543@gmail.com>
2024-09-25 11:39:27 +08:00
Jiahui c23bad8227 Fix/get invoice payment (#5088)
* fix get payment with invoice arg

* remove old version verification process

* fix get transfer

* fix deploy account service in cloud scripts

* swag
2024-09-19 16:18:23 +08:00
Jiahui 7e6cb8bccb Monitor api adapt token (#5049)
* add get monitor api

* add account api token

* adapt token

* adapt token

* get payment with invoiced arg.
2024-09-06 14:03:56 +08:00
limbo 8a6844f602 feat(account-service): add use giftcode (#5013)
* feat(account-service): add use giftcode

* update swagger doc and complete test
2024-08-30 17:20:37 +08:00
Jiahui e91f227c17 Optimize/payment (#5000)
* optimize payment controller

* add backward compatible code

* fix ci
2024-08-28 10:58:04 +08:00
Jiahui 2882addbbc Feat/invoice (#4988)
* add invoice service
2024-08-23 17:56:41 +08:00
xuziyiandjiahui cca4da935f feat: get os traffic from minio (#4968)
* get os traffic from minio

* optimize get obj traffic within the last hour

---------

Co-authored-by: jiahui <bxy4543@gmail.com>
2024-08-20 18:04:22 +08:00
Jiahui 594f3af2ac CostCenter api update (#4932)
* optimize monitoring app store

* add get app instance role

* add app instance billing

* add test

* fix

* add CheckPermission with kc

* add get-regions api

* change regions to slice

* add GetCostAppList GetCostOverview api

* fix check-auth user

* fix divisor to zero

* fix get cost overview

* add app type list api

* add init region info

* fix docs get cost app type list

* add service account ingress

* add check region auth

* fix region auth

* add skip tls client get api

* add debug mod

* add basic cost distribution api

* remove deprecated encrypt account field

* set default time range

* add GetAppCostTimeRange api

* add dao test

* make format && fix semgrep ci

* make format && fix semgrep ci

* fix GetCostAppList

* optimize account reconcile

* ignore user not found

* add used_amount result for get app cost

* Ignore that a user is not created for a long time, cause a lot of errors

* add app cost sort with time

* optimize cost app api

* optimize cost app api

* optimize cost app api

* optimize cost app api

* get namespace id and name

* remove debug print

* remove debug print

* terminal named by `app.kubernetes.io/part-of` label
2024-08-06 15:45:56 +08:00
Jiahui 708e977d11 feat: app cost svc (#4843)
* account service add app cost api

* add transfer all service

* optimize

* fix get user with id

* add white list k8s host for service auth

* add transfer from user id

* swag init

* rename transfer table to UserTransfer

* add transfer id

* swag init

* fix get transfer

* optimize log

* fix

* fix get user

* fix get transfer limit range

* add limitrange log

* fix time range

* fix limit req name
2024-07-04 17:28:45 +08:00
Jiahui 0992fc04df update cvm interface (#4798) 2024-06-25 11:14:54 +08:00
Jiahui 1ad3c7185c Feat/ add vms/email debt notification (#4763)
* optimize debt log & fix named kb cluster backup pvc named.
* add vms notification for debt
* add email notification for debt
2024-05-29 16:31:41 +08:00
Jiahui 26739d9a6c fix set account create region id (#4739)
* fix set account create region id

* fix null metrics client cause monitor error
2024-05-16 11:26:28 +08:00
Jiahui c56ce7aebd fix billing record query with app type (#4731) 2024-05-13 17:21:50 +08:00
Jiahui 8cb7b73400 Feat: Cloud Virtual Machine Billing (#4699)
* init vm billing
2024-04-24 15:22:41 +08:00
Jiahui af438cf524 Fix waiting for table creation (#4638)
* fix wait table exist

* fix wait table exist
2024-03-28 15:36:37 +08:00
Jiahui c3d58c03b2 fix create region (#4632) 2024-03-27 16:34:10 +08:00
Jiahui 8d6e23fd7c add init job (#4629)
* fix init job

* fix init job

* fix init job

* fix init job

* fix
2024-03-27 14:24:09 +08:00
Jiahui 0d9d19d4c6 The init job waits for the user table to be created before execution. (#4619)
* retry table create

* create region
2024-03-22 17:32:22 +08:00
Jiahui 0755c905e0 License with accountv2 (#4600)
* adapt cockroachdb for license & init job
2024-03-19 15:03:11 +08:00
Jiahui 5e0ea541ca Transfer service (#4594)
* add transfer/invoice service
2024-03-15 14:34:29 +08:00
Jiahui 0350700b55 Unified account (#4576)
* accountv2 interface implementation:
use the cockroach distributed database as a multi-region unified account data storage source to replace the old CRD interaction format;
temporarily turn off account functions such as transfers and activities.

* create account v2 with cockroachdb

* add get account api service;
2024-03-11 15:13:50 +08:00
Jiahui 14e397c38d Fix/traffic db name (#4548)
* fix custom traffic db name

* optimize traffic speed
2024-03-04 15:47:31 +08:00
Jiahui e819739117 Optimize/monitor (#4481)
* add Traffic interface

* add sum traffic used

* remove useless code
2024-01-12 11:42:56 +08:00
Jiahui 4bea4eaf36 Feat/cost service (#4391)
* init account service

* rebase

* add properties query

# Conflicts:
#	service/go.work.sum

* add GetCostAmount query api

* format && add account service workflow

* add swagger api docment for account service

* rebase upstream
2023-12-13 10:53:49 +08:00
Jiahui 3eb6823238 feat: message notification (#4350)
* add ali sms service for debt message notification

* add notification crd && fix debt update notification
2023-11-29 15:27:34 +08:00
Jiahui 4efa9d802e Delete useless code (#4340)
* delete monitor-metering useless code

* delete monitor-metering ci workflow
2023-11-23 16:21:39 +08:00
zzjin bd68a735b4 Depre Bytebase and imagehub. (#4273)
* Depre Bytebase.

Signed-off-by: zzjin <tczzjin@gmail.com>

* Fix format.

Signed-off-by: zzjin <tczzjin@gmail.com>

* Add code license header.

Signed-off-by: zzjin <tczzjin@gmail.com>

* Move imagehub && hub into staging.

Signed-off-by: zzjin <tczzjin@gmail.com>

* Update ci fix.

Signed-off-by: zzjin <tczzjin@gmail.com>

* Fix goimports format.

Signed-off-by: zzjin <tczzjin@gmail.com>

---------

Signed-off-by: zzjin <tczzjin@gmail.com>
2023-11-08 23:39:01 +08:00
Jiahui acd4ae3968 fix result (#4238) 2023-11-03 11:05:46 +08:00
Jiahui b868c75d7d Update/pricing (#4182)
* price to float64

* change pricing

* change pricing string

* fix query payment
2023-10-30 10:02:53 +08:00
Jiahui bb5abee999 Optimize BillingRecordQuery to query separate recharge and arrival (recharge + gift) amounts (#4167)
* Optimize BillingRecordQuery to query separate recharge and arrival (recharge + gift) amounts

* add custom cancel & success stripe return url
2023-10-26 10:20:08 +08:00
Jiahui a3728eccf1 Feat/traffic proto (#4095)
* init traffic mod

* add DIF properties;
add kb backup pvc monitoring name;
optimize traffic monitor;

* go mod tidy

* add TRAFFICS_SERVICE_CONNECT_ADDRESS env

* ignore return getPodTrafficUsed error

* change to english annotation

* old data content of the monitor collection is automatically deleted

* add Property omitempty

* fix conflict

* change traffics stat request identity to {2,8}
2023-10-16 15:47:28 +08:00
Jiahui 07abd93e74 feat billing with app/type/ns (#3963)
* feat billing with app/type/ns

* optimize transfer saver && delete accountbalance cr

* init billingInfoquery crd to replace namespaceshistory, costcenter query

* add deploy.yaml.tmpl query crd

* query with order_id

* set resources.DefaultPropertyTypeLS
2023-09-22 11:50:45 +08:00
yy df817021de delete and mv pkg for controllers. (#3938)
* delete and mv pkg for controllers.

* fix ci

* go import
2023-09-15 19:07:42 +08:00