yl 59d31d4b47 feat: 添加我的课程模块功能
- 新增我的课程列表API接口
- 支持按学习状态筛选(全部/学习中/已完结)
- 支持分页查询
- 包含课程基本信息、学习进度等数据
- 添加Apifox接口文档配置指南

文件变更:
- server/api/admin/mycourse/mycourse.go - API接口定义
- server/internal/controller/admin/mycourse/mycourse.go - 控制器层
- server/internal/service/mycourse.go - 服务层(模拟数据)
- server/internal/router/admin.go - 路由配置
- docs/apifox_config.md - 接口文档
2025-07-28 15:30:04 +08:00

118 lines
3.5 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Package consts
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package consts
import (
"github.com/gogf/gf/v2/util/gconv"
)
// RequestEncryptKey
// 请求加密密钥用于敏感数据加密16位字符前后端需保持一致
// 安全起见,生产环境运行时请注意修改
var RequestEncryptKey = []byte("f080a463654b2279")
// 配置数据类型
const (
ConfigTypeString = "string"
ConfigTypeInt = "int"
ConfigTypeInt8 = "int8"
ConfigTypeInt16 = "int16"
ConfigTypeInt32 = "int32"
ConfigTypeInt64 = "int64"
ConfigTypeUint = "uint"
ConfigTypeUint8 = "uint8"
ConfigTypeUint16 = "uint16"
ConfigTypeUint32 = "uint32"
ConfigTypeUint64 = "uint64"
ConfigTypeFloat32 = "float32"
ConfigTypeFloat64 = "float64"
ConfigTypeBool = "bool"
ConfigTypeDate = "date"
ConfigTypeDateTime = "datetime"
ConfigTypeSliceString = "[]string"
ConfigTypeSliceInt = "[]int"
ConfigTypeSliceInt64 = "[]int64"
)
var ConfigTypes = []string{ConfigTypeString,
ConfigTypeInt, ConfigTypeInt8, ConfigTypeInt16, ConfigTypeInt32, ConfigTypeInt64,
ConfigTypeUint, ConfigTypeUint8, ConfigTypeUint16, ConfigTypeUint32, ConfigTypeUint64,
ConfigTypeFloat32, ConfigTypeFloat64,
ConfigTypeBool,
ConfigTypeDate, ConfigTypeDateTime,
ConfigTypeSliceString, ConfigTypeSliceInt, ConfigTypeSliceInt64,
}
// ConfigMaskDemoField 演示环境下需要隐藏的配置
var ConfigMaskDemoField = map[string]struct{}{
// 邮箱
"smtpUser": {}, "smtpPass": {},
// 云存储
"uploadUCloudPublicKey": {}, "uploadUCloudPrivateKey": {}, "uploadCosSecretId": {}, "uploadCosSecretKey": {},
"uploadOssSecretId": {}, "uploadOssSecretKey": {}, "uploadQiNiuAccessKey": {}, "uploadQiNiuSecretKey": {},
// 地图
"geoAmapWebKey": {},
// 短信
"smsAliYunAccessKeyID": {}, "smsAliYunAccessKeySecret": {}, "smsTencentSecretId": {}, "smsTencentSecretKey": {},
// 支付
"payWxPayMchId": {}, "payWxPaySerialNo": {}, "payWxPayAPIv3Key": {}, "payWxPayPrivateKey": {}, "payQQPayMchId": {}, "payQQPayApiKey": {},
// 微信
"officialAccountAppSecret": {}, "officialAccountToken": {}, "officialAccountEncodingAESKey": {}, "openPlatformAppSecret": {},
"openPlatformToken": {}, "openPlatformEncodingAESKey": {},
}
// ConvType 类型转换
func ConvType(val interface{}, t string) interface{} {
switch t {
case ConfigTypeString:
val = gconv.String(val)
case ConfigTypeInt:
val = gconv.Int(val)
case ConfigTypeInt8:
val = gconv.Int8(val)
case ConfigTypeInt16:
val = gconv.Int16(val)
case ConfigTypeInt32:
val = gconv.Int32(val)
case ConfigTypeInt64:
val = gconv.Int64(val)
case ConfigTypeUint:
val = gconv.Uint(val)
case ConfigTypeUint8:
val = gconv.Uint8(val)
case ConfigTypeUint16:
val = gconv.Uint16(val)
case ConfigTypeUint32:
val = gconv.Uint32(val)
case ConfigTypeUint64:
val = gconv.Uint64(val)
case ConfigTypeFloat32:
val = gconv.Float32(val)
case ConfigTypeFloat64:
val = gconv.Float64(val)
case ConfigTypeBool:
val = gconv.Bool(val)
case ConfigTypeDate:
val = gconv.Time(val, "Y-m-d")
case ConfigTypeDateTime:
val = gconv.Time(val, "Y-m-d H:i:s")
case ConfigTypeSliceInt:
val = gconv.SliceInt(val)
case ConfigTypeSliceInt64:
val = gconv.SliceInt64(val)
case ConfigTypeSliceString:
val = gconv.SliceStr(val)
default:
val = gconv.String(val)
}
return val
}