416 lines
11 KiB
Go
416 lines
11 KiB
Go
package initialize
|
||
|
||
import (
|
||
"context"
|
||
|
||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||
"github.com/flipped-aurora/gin-vue-admin/server/plugin/plugin-tool/utils"
|
||
)
|
||
|
||
// Api 初始化API权限
|
||
func Api(ctx context.Context) {
|
||
// 注册微信集成相关API
|
||
utils.RegisterApis(
|
||
// 小程序用户相关API(公开接口)
|
||
system.SysApi{
|
||
Path: "/wechat/user/mini/login",
|
||
Description: "小程序登录",
|
||
ApiGroup: "微信小程序",
|
||
Method: "POST",
|
||
},
|
||
// 小程序用户相关API(需要认证)
|
||
system.SysApi{
|
||
Path: "/user/wechat/mini/phone-update",
|
||
Description: "更新用户手机号",
|
||
ApiGroup: "微信小程序",
|
||
Method: "POST",
|
||
},
|
||
// 小程序用户相关API(需要认证)
|
||
system.SysApi{
|
||
Path: "/user/wechat/mini/userinfo",
|
||
Description: "获取小程序用户信息",
|
||
ApiGroup: "微信小程序",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/user/wechat/mini/userinfo",
|
||
Description: "更新小程序用户信息",
|
||
ApiGroup: "微信小程序",
|
||
Method: "PUT",
|
||
},
|
||
system.SysApi{
|
||
Path: "/user/wechat/mini/bind-phone",
|
||
Description: "绑定手机号",
|
||
ApiGroup: "微信小程序",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/user/wechat/mini/check-unionid",
|
||
Description: "检查UnionID",
|
||
ApiGroup: "微信小程序",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mini/users",
|
||
Description: "获取小程序用户列表",
|
||
ApiGroup: "微信小程序",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mini/check-unionid",
|
||
Description: "检查UnionID",
|
||
ApiGroup: "微信小程序",
|
||
Method: "GET",
|
||
},
|
||
|
||
// 公众号用户相关API
|
||
system.SysApi{
|
||
Path: "/wechat/mp/users",
|
||
Description: "获取公众号用户列表",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/user",
|
||
Description: "获取公众号用户信息",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/user/sync",
|
||
Description: "同步公众号用户信息",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/user/remark",
|
||
Description: "更新公众号用户备注",
|
||
ApiGroup: "微信公众号",
|
||
Method: "PUT",
|
||
},
|
||
|
||
// 公众号消息相关API
|
||
system.SysApi{
|
||
Path: "/wechat/mp/messages",
|
||
Description: "获取公众号消息列表",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/message/text",
|
||
Description: "发送文本消息",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/message/image",
|
||
Description: "发送图片消息",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/message/:id",
|
||
Description: "获取消息详情",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/message/:id",
|
||
Description: "删除消息",
|
||
ApiGroup: "微信公众号",
|
||
Method: "DELETE",
|
||
},
|
||
|
||
// 微信Webhook(公开接口)
|
||
system.SysApi{
|
||
Path: "/wechat/official/webhook",
|
||
Description: "微信公众号Webhook",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/official/webhook",
|
||
Description: "微信公众号Webhook",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
|
||
// 小程序统计相关API
|
||
system.SysApi{
|
||
Path: "/wechat/mini/statistics",
|
||
Description: "获取小程序基础统计数据",
|
||
ApiGroup: "微信小程序",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mini/statistics/visit-trend",
|
||
Description: "获取小程序访问趋势数据",
|
||
ApiGroup: "微信小程序",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mini/statistics/source",
|
||
Description: "获取小程序用户来源分布数据",
|
||
ApiGroup: "微信小程序",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mini/statistics/page",
|
||
Description: "获取小程序页面访问数据",
|
||
ApiGroup: "微信小程序",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mini/statistics/retention",
|
||
Description: "获取小程序用户留存数据",
|
||
ApiGroup: "微信小程序",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mini/statistics/device",
|
||
Description: "获取小程序设备分布数据",
|
||
ApiGroup: "微信小程序",
|
||
Method: "GET",
|
||
},
|
||
// 公众号标签管理相关API
|
||
system.SysApi{
|
||
Path: "/wechat/mp/tag",
|
||
Description: "获取公众号标签列表",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/tag/:id",
|
||
Description: "获取公众号标签详情",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/tag",
|
||
Description: "创建公众号标签",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/tag",
|
||
Description: "更新公众号标签",
|
||
ApiGroup: "微信公众号",
|
||
Method: "PUT",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/tag/:id",
|
||
Description: "删除公众号标签",
|
||
ApiGroup: "微信公众号",
|
||
Method: "DELETE",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/tag/sync",
|
||
Description: "同步公众号标签",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/tag/list-all-simple",
|
||
Description: "获取公众号标签简单列表",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
|
||
// 公众号统计数据相关API
|
||
system.SysApi{
|
||
Path: "/wechat/mp/statistics",
|
||
Description: "获取公众号基础统计数据",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/statistics/user-growth",
|
||
Description: "获取公众号用户增长数据",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/statistics/message-type",
|
||
Description: "获取公众号消息类型分布数据",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/statistics/message-trend",
|
||
Description: "获取公众号消息趋势数据",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/statistics/region",
|
||
Description: "获取公众号地区分布数据",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
// 公众号图文发表记录相关API
|
||
system.SysApi{
|
||
Path: "/wechat/mp/news",
|
||
Description: "获取公众号图文发表记录列表",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/news/:id",
|
||
Description: "获取公众号图文详情",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/news",
|
||
Description: "创建公众号图文记录",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/news",
|
||
Description: "更新公众号图文记录",
|
||
ApiGroup: "微信公众号",
|
||
Method: "PUT",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/news/:id",
|
||
Description: "删除公众号图文记录",
|
||
ApiGroup: "微信公众号",
|
||
Method: "DELETE",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/news/:id/statistics",
|
||
Description: "获取公众号图文数据统计",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/news/sync",
|
||
Description: "同步公众号图文发表记录",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
|
||
// 微信配置管理相关API
|
||
system.SysApi{
|
||
Path: "/wechat/mp/config",
|
||
Description: "获取微信配置",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/config",
|
||
Description: "保存微信配置",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/config/test",
|
||
Description: "测试微信配置",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/config/validate",
|
||
Description: "验证微信配置",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/qrcode/generate",
|
||
Description: "生成公众号二维码",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/quota/clear",
|
||
Description: "清空API配额",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/config/list",
|
||
Description: "获取微信配置列表",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/config/:id",
|
||
Description: "删除微信配置",
|
||
ApiGroup: "微信公众号",
|
||
Method: "DELETE",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/webhook/logs",
|
||
Description: "获取Webhook日志",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/webhook/logs/:id",
|
||
Description: "获取Webhook日志详情",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/webhook/logs/clear",
|
||
Description: "清空Webhook日志",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
|
||
// 公众号草稿管理相关API
|
||
system.SysApi{
|
||
Path: "/wechat/mp/draft",
|
||
Description: "获取公众号草稿列表",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/draft/:id",
|
||
Description: "获取公众号草稿详情",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/draft",
|
||
Description: "创建公众号草稿",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/draft",
|
||
Description: "更新公众号草稿",
|
||
ApiGroup: "微信公众号",
|
||
Method: "PUT",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/draft/:id",
|
||
Description: "删除公众号草稿",
|
||
ApiGroup: "微信公众号",
|
||
Method: "DELETE",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/draft/:id/publish",
|
||
Description: "发布公众号草稿",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/draft/sync",
|
||
Description: "同步公众号草稿",
|
||
ApiGroup: "微信公众号",
|
||
Method: "POST",
|
||
},
|
||
system.SysApi{
|
||
Path: "/wechat/mp/draft/count",
|
||
Description: "获取公众号草稿数量统计",
|
||
ApiGroup: "微信公众号",
|
||
Method: "GET",
|
||
},
|
||
)
|
||
|
||
global.GVA_LOG.Info("微信集成API权限注册完成")
|
||
}
|