diff --git a/api/core/types/config.go b/api/core/types/config.go
index a31d8820..77594305 100644
--- a/api/core/types/config.go
+++ b/api/core/types/config.go
@@ -156,10 +156,6 @@ type UserChatConfig struct {
ApiKeys map[Platform]string `json:"api_keys"`
}
-type InviteReward struct {
- Power int `json:"power"`
-}
-
type ModelAPIConfig struct {
Temperature float32 `json:"temperature"`
MaxTokens int `json:"max_tokens"`
diff --git a/api/handler/function_handler.go b/api/handler/function_handler.go
index 061cc7c8..488aa8b3 100644
--- a/api/handler/function_handler.go
+++ b/api/handler/function_handler.go
@@ -192,7 +192,6 @@ func (h *FunctionHandler) Dall3(c *gin.Context) {
}
logger.Debugf("绘画参数:%+v", params)
- // check img calls
var user model.User
tx := h.db.Where("id = ?", params["user_id"]).First(&user)
if tx.Error != nil {
@@ -274,7 +273,7 @@ func (h *FunctionHandler) Dall3(c *gin.Context) {
}
content := fmt.Sprintf("下面是根据您的描述创作的图片,它描绘了 【%s】 的场景。 \n\n\n", prompt, imgURL)
- // update user's img_calls
+ // 更新用户算力
tx = h.db.Model(&model.User{}).Where("id = ?", user.Id).UpdateColumn("power", gorm.Expr("power - ?", h.App.SysConfig.DallPower))
// 记录算力变化日志
if tx.Error == nil && tx.RowsAffected > 0 {
diff --git a/api/handler/payment_handler.go b/api/handler/payment_handler.go
index 1601e687..a33ad0e9 100644
--- a/api/handler/payment_handler.go
+++ b/api/handler/payment_handler.go
@@ -316,7 +316,7 @@ func (h *PaymentHandler) notify(orderNo string, tradeNo string) error {
}
} else { // 非 VIP 用户
- if remark.Days > 0 { // vip 套餐:days > 0, calls == 0
+ if remark.Days > 0 { // vip 套餐:days > 0, power == 0
user.ExpiredTime = time.Now().AddDate(0, 0, remark.Days).Unix()
user.Power += h.App.SysConfig.VipMonthPower
user.Vip = true
diff --git a/api/handler/user_handler.go b/api/handler/user_handler.go
index b9f32d94..92248dee 100644
--- a/api/handler/user_handler.go
+++ b/api/handler/user_handler.go
@@ -126,7 +126,7 @@ func (h *UserHandler) Register(c *gin.Context) {
UserId: user.Id,
Username: user.Username,
InviteCode: inviteCode.Code,
- Reward: utils.JsonEncode(types.InviteReward{Power: h.App.SysConfig.InvitePower}),
+ Remark: fmt.Sprintf("奖励 %d 算力", h.App.SysConfig.InvitePower),
})
}
diff --git a/api/store/model/invite_log.go b/api/store/model/invite_log.go
index 1cfa1dfd..22052b2a 100644
--- a/api/store/model/invite_log.go
+++ b/api/store/model/invite_log.go
@@ -10,6 +10,6 @@ type InviteLog struct {
UserId uint
Username string
InviteCode string
- Reward string `gorm:"column:reward_json"` // 邀请奖励
+ Remark string
CreatedAt time.Time
}
diff --git a/api/store/vo/invite_log.go b/api/store/vo/invite_log.go
index d94219c8..3be80c32 100644
--- a/api/store/vo/invite_log.go
+++ b/api/store/vo/invite_log.go
@@ -1,15 +1,11 @@
package vo
-import (
- "chatplus/core/types"
-)
-
type InviteLog struct {
- Id uint `json:"id"`
- InviterId uint `json:"inviter_id"`
- UserId uint `json:"user_id"`
- Username string `json:"username"`
- InviteCode string `json:"invite_code"`
- Reward types.InviteReward `json:"reward"`
- CreatedAt int64 `json:"created_at"`
+ Id uint `json:"id"`
+ InviterId uint `json:"inviter_id"`
+ UserId uint `json:"user_id"`
+ Username string `json:"username"`
+ InviteCode string `json:"invite_code"`
+ Remark string `json:"remark"`
+ CreatedAt int64 `json:"created_at"`
}
diff --git a/database/update-v4.0.0.sql b/database/update-v4.0.0.sql
index d589a239..d671e047 100644
--- a/database/update-v4.0.0.sql
+++ b/database/update-v4.0.0.sql
@@ -41,4 +41,6 @@ ALTER TABLE `chatgpt_products` DROP `img_calls`;
ALTER TABLE `chatgpt_power_logs` CHANGE `amount` `amount` SMALLINT NOT NULL COMMENT '算力数值';
ALTER TABLE `chatgpt_power_logs` ADD `mark` TINYINT(1) NOT NULL COMMENT '资金类型(0:支出,1:收入)' AFTER `remark`;
ALTER TABLE `chatgpt_mj_jobs` ADD `power` SMALLINT(5) NOT NULL DEFAULT '0' COMMENT '消耗算力' AFTER `err_msg`;
-ALTER TABLE `chatgpt_sd_jobs` ADD `power` SMALLINT(5) NOT NULL DEFAULT '0' COMMENT '消耗算力' AFTER `err_msg`;
\ No newline at end of file
+ALTER TABLE `chatgpt_sd_jobs` ADD `power` SMALLINT(5) NOT NULL DEFAULT '0' COMMENT '消耗算力' AFTER `err_msg`;
+
+ALTER TABLE `chatgpt_invite_logs` CHANGE `reward_json` `remark` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '备注';
\ No newline at end of file
diff --git a/web/src/components/ConfigDialog.vue b/web/src/components/ConfigDialog.vue
index 03a39c0e..c4c8be37 100644
--- a/web/src/components/ConfigDialog.vue
+++ b/web/src/components/ConfigDialog.vue
@@ -12,17 +12,8 @@
{{ user.username }}
-
- {{ user['calls'] }}
-
-
- {{ user['img_calls'] }}
-
-
- {{ user['tokens'] }}
-
-
- {{ user['total_tokens'] }}
+
+ {{ user['power'] }}
{{ dateFormat(user['expired_time']) }}
diff --git a/web/src/components/InviteList.vue b/web/src/components/InviteList.vue
index 501dddde..91567e79 100644
--- a/web/src/components/InviteList.vue
+++ b/web/src/components/InviteList.vue
@@ -9,12 +9,7 @@
--el-table-text-color:#d1d1d1">
-
-
- 对话:{{ scope.row['reward']['chat_calls'] }}次,
- 绘图:{{ scope.row['reward']['img_calls'] }}次
-
-
+
diff --git a/web/src/components/UserOrder.vue b/web/src/components/UserOrder.vue
index 5a195104..005519ce 100644
--- a/web/src/components/UserOrder.vue
+++ b/web/src/components/UserOrder.vue
@@ -17,14 +17,9 @@
-
+
- {{ scope.row.remark?.calls }}
-
-
-
-
- {{ scope.row.remark?.img_calls ?? 0 }}
+ {{ scope.row.remark?.power }}
diff --git a/web/src/components/UserProfile.vue b/web/src/components/UserProfile.vue
index 0d07b7f1..0979466d 100644
--- a/web/src/components/UserProfile.vue
+++ b/web/src/components/UserProfile.vue
@@ -29,17 +29,8 @@
-
- {{ user['calls'] }}
-
-
- {{ user['img_calls'] }}
-
-
- {{ user['tokens'] }}
-
-
- {{ user['total_tokens'] }}
+
+ {{ user['power'] }}
{{ dateFormat(user['expired_time']) }}
@@ -67,8 +58,7 @@ const user = ref({
nickname: '',
avatar: '',
mobile: '',
- calls: 0,
- tokens: 0,
+ power: 0,
})
const vipImg = ref("/images/vip.png")