diff --git a/api/handler/chat_handler.go b/api/handler/chat_handler.go
index 3e683a9a..7ff98bec 100644
--- a/api/handler/chat_handler.go
+++ b/api/handler/chat_handler.go
@@ -152,7 +152,7 @@ func (h *ChatHandler) sendMessage(ctx context.Context, session types.ChatSession
}
if userVo.Calls <= 0 && userVo.ChatConfig.ApiKey == "" {
- replyMessage(ws, "您的对话次数已经用尽,请联系管理员充值!")
+ replyMessage(ws, "您的对话次数已经用尽,请联系管理员或者点击左下角菜单加入众筹获得100次对话!")
replyMessage(ws, "")
return nil
}
diff --git a/api/handler/reward_handler.go b/api/handler/reward_handler.go
index 79f6ca82..dc03d13f 100644
--- a/api/handler/reward_handler.go
+++ b/api/handler/reward_handler.go
@@ -24,7 +24,7 @@ func NewRewardHandler(server *core.AppServer, db *gorm.DB) *RewardHandler {
// Verify 打赏码核销
func (h *RewardHandler) Verify(c *gin.Context) {
var data struct {
- TxId string
+ TxId string `json:"tx_id"`
}
if err := c.ShouldBindJSON(&data); err != nil {
resp.ERROR(c, types.InvalidArgs)
@@ -34,12 +34,12 @@ func (h *RewardHandler) Verify(c *gin.Context) {
var item model.Reward
res := h.db.Where("tx_id = ?", data.TxId).First(&item)
if res.Error != nil {
- resp.ERROR(c, "无效的打赏交易流水号!")
+ resp.ERROR(c, "无效的众筹交易流水号!")
return
}
if item.Status {
- resp.ERROR(c, "当前打赏交易流水号已经被核销,请不要重复核销!")
+ resp.ERROR(c, "当前众筹交易流水号已经被核销,请不要重复核销!")
return
}
@@ -50,7 +50,7 @@ func (h *RewardHandler) Verify(c *gin.Context) {
}
tx := h.db.Begin()
- calls := (item.Amount + 0.01) * 10
+ calls := (item.Amount + 0.1) * 10
res = h.db.Model(&user).UpdateColumn("calls", gorm.Expr("calls + ?", calls))
if res.Error != nil {
resp.ERROR(c, "更新数据库失败!")
diff --git a/api/main.go b/api/main.go
index 4e6d7b10..01d2062e 100644
--- a/api/main.go
+++ b/api/main.go
@@ -107,7 +107,9 @@ func main() {
fx.Invoke(func(bot *wexin.WeChatBot) {
go func() {
err := bot.Login()
- log.Fatal(err)
+ if err != nil {
+ log.Fatal(err)
+ }
}()
}),
@@ -188,7 +190,7 @@ func main() {
}),
fx.Invoke(func(s *core.AppServer, h *handler.RewardHandler) {
group := s.Engine.Group("/api/reward/")
- group.GET("verify", h.Verify)
+ group.POST("verify", h.Verify)
}),
// 管理后台控制器
diff --git a/database/reward.sql b/database/reward.sql
index 054b6685..74011eb2 100644
--- a/database/reward.sql
+++ b/database/reward.sql
@@ -15,4 +15,5 @@ ALTER TABLE `chatgpt_rewards`
ALTER TABLE `chatgpt_rewards`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
-COMMIT;
\ No newline at end of file
+
+update chatgpt_users set calls=0
\ No newline at end of file
diff --git a/web/public/images/reward.png b/web/public/images/reward.png
index d7f65b74..88f4234f 100644
Binary files a/web/public/images/reward.png and b/web/public/images/reward.png differ
diff --git a/web/src/components/RewardVerify.vue b/web/src/components/RewardVerify.vue
new file mode 100644
index 00000000..cfffaafd
--- /dev/null
+++ b/web/src/components/RewardVerify.vue
@@ -0,0 +1,75 @@
+
+ 请输入您参与众筹的微信支付转账单号兑换相应的对话次数。
-