新增技术文档,详细描述了项目的技术栈、配置、鉴权与安全、数据层等内容。同时,更新小程序页面以支持收益数据的加载与刷新功能,优化用户体验。新增收益接口以返回用户的累计收益和可提现金额,并调整相关逻辑以确保数据准确性。
This commit is contained in:
@@ -326,7 +326,7 @@ func WithdrawPendingConfirm(c *gin.Context) {
|
||||
}
|
||||
|
||||
// WithdrawConfirmReceived POST /api/miniprogram/withdraw/confirm-received 用户确认收款(记录已点击确认)
|
||||
// body: { "withdrawalId": "xxx", "userId": "xxx" },仅本人可操作,更新 user_confirmed_at
|
||||
// body: { "withdrawalId": "xxx", "userId": "xxx" },仅本人可操作;更新 user_confirmed_at 并将状态置为 success,该条不再出现在待确认收款列表
|
||||
func WithdrawConfirmReceived(c *gin.Context) {
|
||||
var req struct {
|
||||
WithdrawalID string `json:"withdrawalId" binding:"required"`
|
||||
@@ -346,7 +346,7 @@ func WithdrawConfirmReceived(c *gin.Context) {
|
||||
if w.Status != nil {
|
||||
st = *w.Status
|
||||
}
|
||||
// 仅处理中或已成功的可标记「用户已确认收款」
|
||||
// 仅处理中或待确认的可标记「用户已确认收款」
|
||||
if st != "processing" && st != "pending_confirm" && st != "success" {
|
||||
c.JSON(http.StatusOK, gin.H{"success": false, "message": "当前状态不可确认收款"})
|
||||
return
|
||||
@@ -356,7 +356,9 @@ func WithdrawConfirmReceived(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
now := time.Now()
|
||||
if err := db.Model(&w).Update("user_confirmed_at", now).Error; err != nil {
|
||||
// 更新为已确认收款,并将状态置为 success,待确认列表只含 processing/pending_confirm,故该条会从列表中移除
|
||||
up := map[string]interface{}{"user_confirmed_at": now, "status": "success"}
|
||||
if err := db.Model(&w).Updates(up).Error; err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{"success": false, "message": "更新失败"})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user