feat(小程序): 添加小程序密钥字段到模型和API

在创建小程序和列表展示时新增app_secret字段,用于存储小程序密钥
This commit is contained in:
邹方成 2025-10-18 11:05:55 +08:00
parent cd2093f594
commit 23e7d42531
3 changed files with 8 additions and 4 deletions

View File

@ -14,10 +14,11 @@ import (
) )
type createAppRequest struct { type createAppRequest struct {
AppID string `json:"app_id" binding:"required"` // 小程序ID AppID string `json:"app_id" binding:"required"` // 小程序ID
Name string `json:"name" binding:"required"` // 名称 AppSecret string `json:"app_secret" binding:"required"` // 小程序密钥
Description string `json:"description"` // 描述 Name string `json:"name" binding:"required"` // 名称
Avatar string `json:"avatar"` // 头像 Description string `json:"description"` // 描述
Avatar string `json:"avatar"` // 头像
} }
type createAppResponse struct { type createAppResponse struct {
@ -80,6 +81,7 @@ func (h *handler) CreateApp() core.HandlerFunc {
App := new(model.MiniProgram) App := new(model.MiniProgram)
App.AppID = req.AppID App.AppID = req.AppID
App.AppSecret = req.AppSecret
App.Name = req.Name App.Name = req.Name
App.Description = req.Description App.Description = req.Description
App.Avatar = req.Avatar App.Avatar = req.Avatar

View File

@ -23,6 +23,7 @@ type listRequest struct {
type listData struct { type listData struct {
ID int32 `json:"id"` // 小程序编号 ID int32 `json:"id"` // 小程序编号
AppID string `json:"app_id"` // 小程序ID AppID string `json:"app_id"` // 小程序ID
AppSecret string `json:"app_secret"` // 小程序密钥
Name string `json:"name"` // 小程序名称 Name string `json:"name"` // 小程序名称
Description string `json:"description"` // 小程序描述 Description string `json:"description"` // 小程序描述
Avatar string `json:"avatar"` // 小程序头像 Avatar string `json:"avatar"` // 小程序头像

View File

@ -14,6 +14,7 @@ const TableNameMiniProgram = "mini_program"
type MiniProgram struct { type MiniProgram struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:主键ID" json:"id"` // 主键ID ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:主键ID" json:"id"` // 主键ID
AppID string `gorm:"column:app_id;not null;comment:小程序ID" json:"app_id"` // 小程序ID AppID string `gorm:"column:app_id;not null;comment:小程序ID" json:"app_id"` // 小程序ID
AppSecret string `gorm:"column:app_secret;not null;comment:小程序密钥" json:"app_secret"` // 小程序密钥
AdminID int32 `gorm:"column:admin_id;not null;comment:管理员ID" json:"admin_id"` // 管理员ID AdminID int32 `gorm:"column:admin_id;not null;comment:管理员ID" json:"admin_id"` // 管理员ID
Name string `gorm:"column:name;not null;comment:名称" json:"name"` // 名称 Name string `gorm:"column:name;not null;comment:名称" json:"name"` // 名称
Description string `gorm:"column:description;not null;comment:描述" json:"description"` // 描述 Description string `gorm:"column:description;not null;comment:描述" json:"description"` // 描述