整合小程序、管理端与后端的最新本地改动,补齐用户管理与首页入口相关能力;提交前已完成敏感信息扫描,并移除本地 gitea 远程 URL 中的明文凭证,避免隐私信息进入远程仓库。 Made-with: Cursor
40 lines
1011 B
Go
40 lines
1011 B
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
|
|
"soul-api/internal/database"
|
|
"soul-api/internal/model"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// MiniprogramMySuperStats GET /api/miniprogram/my/super-stats?userId=
|
|
// 返回当前 VIP 用户的超级个体获客数和头像点击数(小程序「我的」页展示用)。
|
|
func MiniprogramMySuperStats(c *gin.Context) {
|
|
userID := strings.TrimSpace(c.Query("userId"))
|
|
if userID == "" {
|
|
c.JSON(http.StatusOK, gin.H{"success": true, "data": nil})
|
|
return
|
|
}
|
|
db := database.DB()
|
|
|
|
clicks := batchSuperIndividualClicks(db, []string{userID})
|
|
leads := batchSuperIndividualLeads(db, []string{userID})
|
|
|
|
var person model.Person
|
|
hasPerson := db.Where("user_id = ?", userID).First(&person).Error == nil
|
|
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"success": true,
|
|
"data": gin.H{
|
|
"clickCount": clicks[userID],
|
|
"leadCount": leads[userID],
|
|
"hasPerson": hasPerson,
|
|
"isPinned": hasPerson && person.IsPinned,
|
|
"personName": person.Name,
|
|
},
|
|
})
|
|
}
|