Merge branch 'main' of https://github.com/JACKYMYPERSON/toutoukan
This commit is contained in:
43
controllers/feedback/upfeedback.go
Normal file
43
controllers/feedback/upfeedback.go
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package feedback
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"time"
|
||||||
|
"toutoukan/init/databaseInit"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Feedback struct {
|
||||||
|
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
|
||||||
|
UserID string `json:"user_id"`
|
||||||
|
FeedBackType int8 `json:"feed_back_type"`
|
||||||
|
FeedbackContent string `json:"feedback_content"`
|
||||||
|
FeedbackStatus int8 `gorm:"default:0" json:"feedback_status,omitempty"` // 默认为 0(待处理),前端无需传入
|
||||||
|
HandlerID string `gorm:"default:''" json:"handler_id,omitempty"` // 默认为空,前端无需传入
|
||||||
|
CreateTime time.Time `gorm:"autoCreateTime" json:"create_time,omitempty"` // 自动生成创建时间,前端无需传入
|
||||||
|
HandleTime time.Time `gorm:"default:null" json:"handle_time,omitempty"` // 默认为空,处理时赋值,前端无需传入
|
||||||
|
HandleRemark string `gorm:"default:''" json:"handle_remark,omitempty"` // 默认为空,处理时赋值,前端无需传入
|
||||||
|
IsDelete int8 `gorm:"default:0" json:"is_delete,omitempty"` // 默认为 0(未删除),前端无需传入
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpFeedback 新增用户反馈
|
||||||
|
func UpFeedback(c *gin.Context) {
|
||||||
|
var feedback Feedback
|
||||||
|
// 绑定请求体中的 JSON 数据到 feedback 结构体
|
||||||
|
if err := c.ShouldBindJSON(&feedback); err != nil {
|
||||||
|
c.JSON(400, gin.H{"error": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用 GORM 连接池进行数据库操作
|
||||||
|
result := databaseInit.UserDB.Create(&feedback)
|
||||||
|
if result.Error != nil {
|
||||||
|
c.JSON(500, gin.H{"error": result.Error.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回成功响应,包含新增反馈的 ID
|
||||||
|
c.JSON(200, gin.H{
|
||||||
|
"message": "反馈提交成功",
|
||||||
|
"data": feedback,
|
||||||
|
})
|
||||||
|
}
|
||||||
390
database.sql
390
database.sql
@@ -1,9 +1,27 @@
|
|||||||
|
create table check_in_records
|
||||||
|
(
|
||||||
|
id bigint unsigned auto_increment comment '自增主键ID'
|
||||||
|
primary key,
|
||||||
|
user_id bigint unsigned not null comment '用户ID',
|
||||||
|
check_in_date date not null comment '签到日期',
|
||||||
|
created_at timestamp default CURRENT_TIMESTAMP not null comment '记录创建时间',
|
||||||
|
constraint uk_user_date
|
||||||
|
unique (user_id, check_in_date) comment '用户和日期的唯一索引,防止重复签到'
|
||||||
|
)
|
||||||
|
comment '用户签到记录表' collate = utf8mb4_unicode_ci;
|
||||||
|
|
||||||
create table goods_list
|
create table goods_list
|
||||||
(
|
(
|
||||||
gid varchar(20) not null,
|
id int auto_increment comment '商品ID'
|
||||||
stock int not null,
|
primary key,
|
||||||
start_time datetime not null,
|
name varchar(100) not null comment '商品名称',
|
||||||
end_time datetime not null
|
description text null comment '商品描述',
|
||||||
|
points int not null comment '所需积分',
|
||||||
|
stock int default 0 not null comment '库存数量',
|
||||||
|
image_url varchar(255) null comment '商品图片URL',
|
||||||
|
status tinyint default 1 not null comment '状态:1-上架,0-下架',
|
||||||
|
created_at datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||||
|
updated_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间'
|
||||||
);
|
);
|
||||||
|
|
||||||
create table host
|
create table host
|
||||||
@@ -27,12 +45,6 @@ create table login_log
|
|||||||
)
|
)
|
||||||
charset = utf8mb3;
|
charset = utf8mb3;
|
||||||
|
|
||||||
create table oders_list
|
|
||||||
(
|
|
||||||
order_id varchar(30) not null,
|
|
||||||
trade_time datetime not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table setting
|
create table setting
|
||||||
(
|
(
|
||||||
id int auto_increment
|
id int auto_increment
|
||||||
@@ -43,105 +55,6 @@ create table setting
|
|||||||
)
|
)
|
||||||
charset = utf8mb3;
|
charset = utf8mb3;
|
||||||
|
|
||||||
create table task
|
|
||||||
(
|
|
||||||
id int auto_increment
|
|
||||||
primary key,
|
|
||||||
name varchar(32) not null,
|
|
||||||
level tinyint default 1 not null,
|
|
||||||
dependency_task_id varchar(64) default '' not null,
|
|
||||||
dependency_status tinyint default 1 not null,
|
|
||||||
spec varchar(64) not null,
|
|
||||||
protocol tinyint not null,
|
|
||||||
command varchar(256) not null,
|
|
||||||
http_method tinyint default 1 not null,
|
|
||||||
timeout mediumint default 0 not null,
|
|
||||||
multi tinyint default 1 not null,
|
|
||||||
retry_times tinyint default 0 not null,
|
|
||||||
retry_interval smallint default 0 not null,
|
|
||||||
notify_status tinyint default 1 not null,
|
|
||||||
notify_type tinyint default 0 not null,
|
|
||||||
notify_receiver_id varchar(256) default '' not null,
|
|
||||||
notify_keyword varchar(128) default '' not null,
|
|
||||||
tag varchar(32) default '' not null,
|
|
||||||
remark varchar(100) default '' not null,
|
|
||||||
status tinyint default 0 not null,
|
|
||||||
created datetime not null,
|
|
||||||
deleted datetime null
|
|
||||||
)
|
|
||||||
charset = utf8mb3;
|
|
||||||
|
|
||||||
create index IDX_task_level
|
|
||||||
on task (level);
|
|
||||||
|
|
||||||
create index IDX_task_protocol
|
|
||||||
on task (protocol);
|
|
||||||
|
|
||||||
create index IDX_task_status
|
|
||||||
on task (status);
|
|
||||||
|
|
||||||
create table task_host
|
|
||||||
(
|
|
||||||
id int auto_increment
|
|
||||||
primary key,
|
|
||||||
task_id int not null,
|
|
||||||
host_id smallint not null
|
|
||||||
)
|
|
||||||
charset = utf8mb3;
|
|
||||||
|
|
||||||
create index IDX_task_host_host_id
|
|
||||||
on task_host (host_id);
|
|
||||||
|
|
||||||
create index IDX_task_host_task_id
|
|
||||||
on task_host (task_id);
|
|
||||||
|
|
||||||
create table task_log
|
|
||||||
(
|
|
||||||
id bigint auto_increment
|
|
||||||
primary key,
|
|
||||||
task_id int default 0 not null,
|
|
||||||
name varchar(32) not null,
|
|
||||||
spec varchar(64) not null,
|
|
||||||
protocol tinyint not null,
|
|
||||||
command varchar(256) not null,
|
|
||||||
timeout mediumint default 0 not null,
|
|
||||||
retry_times tinyint default 0 not null,
|
|
||||||
hostname varchar(128) default '' not null,
|
|
||||||
start_time datetime null,
|
|
||||||
end_time datetime null,
|
|
||||||
status tinyint default 1 not null,
|
|
||||||
result mediumtext not null
|
|
||||||
)
|
|
||||||
charset = utf8mb3;
|
|
||||||
|
|
||||||
create index IDX_task_log_protocol
|
|
||||||
on task_log (protocol);
|
|
||||||
|
|
||||||
create index IDX_task_log_status
|
|
||||||
on task_log (status);
|
|
||||||
|
|
||||||
create index IDX_task_log_task_id
|
|
||||||
on task_log (task_id);
|
|
||||||
|
|
||||||
create table user
|
|
||||||
(
|
|
||||||
id int auto_increment
|
|
||||||
primary key,
|
|
||||||
name varchar(32) not null,
|
|
||||||
password char(32) not null,
|
|
||||||
salt char(6) not null,
|
|
||||||
email varchar(50) default '' not null,
|
|
||||||
created datetime not null,
|
|
||||||
updated datetime null,
|
|
||||||
is_admin tinyint default 0 not null,
|
|
||||||
status tinyint default 1 not null,
|
|
||||||
constraint UQE_user_email
|
|
||||||
unique (email),
|
|
||||||
constraint UQE_user_name
|
|
||||||
unique (name)
|
|
||||||
)
|
|
||||||
charset = utf8mb3;
|
|
||||||
|
|
||||||
create table user_info
|
create table user_info
|
||||||
(
|
(
|
||||||
uid varchar(40) not null
|
uid varchar(40) not null
|
||||||
@@ -171,6 +84,29 @@ create table article_list
|
|||||||
create_time datetime not null comment '投票创建时间',
|
create_time datetime not null comment '投票创建时间',
|
||||||
constraint article_list_user_info_uid_fk
|
constraint article_list_user_info_uid_fk
|
||||||
foreign key (publish_user_id) references user_info (uid)
|
foreign key (publish_user_id) references user_info (uid)
|
||||||
|
on delete cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table article_comments
|
||||||
|
(
|
||||||
|
id int auto_increment comment '评论唯一ID'
|
||||||
|
primary key,
|
||||||
|
articleId bigint not null comment '对应的文评ID',
|
||||||
|
user_id varchar(40) not null comment '对应的用户ID',
|
||||||
|
parent_id int null comment '关联本表的 id,用于回复功能。 如果为 0 或 NULL,则为顶级评论。',
|
||||||
|
content text not null comment '具体评论',
|
||||||
|
created_time datetime not null comment '评论创建时间',
|
||||||
|
update_time datetime not null comment '更新时间',
|
||||||
|
likes_count int default 0 not null comment '点赞数量',
|
||||||
|
status tinyint default 1 not null comment '1:正常,2:已删除',
|
||||||
|
constraint article_comments_article_comments_id_fk
|
||||||
|
foreign key (parent_id) references article_comments (id),
|
||||||
|
constraint article_comments_article_list_articleId_fk
|
||||||
|
foreign key (articleId) references article_list (articleId)
|
||||||
|
on delete cascade,
|
||||||
|
constraint article_comments_user_info_uid_fk
|
||||||
|
foreign key (user_id) references user_info (uid)
|
||||||
|
on delete cascade
|
||||||
);
|
);
|
||||||
|
|
||||||
create table article_options
|
create table article_options
|
||||||
@@ -183,18 +119,201 @@ create table article_options
|
|||||||
sort_order int null comment '选项的排序',
|
sort_order int null comment '选项的排序',
|
||||||
constraint article_options_article_list_articleId_fk
|
constraint article_options_article_list_articleId_fk
|
||||||
foreign key (vote_article_id) references article_list (articleId)
|
foreign key (vote_article_id) references article_list (articleId)
|
||||||
|
on delete cascade
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create index idx_article_options_vote_article_id_sort_order
|
||||||
|
on article_options (vote_article_id, sort_order);
|
||||||
|
|
||||||
|
create table feed_back
|
||||||
|
(
|
||||||
|
id bigint auto_increment comment '反馈消息ID'
|
||||||
|
primary key,
|
||||||
|
user_id varchar(40) not null comment '反馈的用户ID',
|
||||||
|
feed_back_type tinyint not null comment '反馈类型;1:功能建议,2:问题反馈,3:投诉举报,4.其他',
|
||||||
|
feedback_content text not null comment '反馈内容',
|
||||||
|
feedback_status tinyint null comment '反馈进度;0:待处理,1:正在处理,2:处理完成',
|
||||||
|
handler_id varchar(40) not null comment '处理员ID',
|
||||||
|
create_time datetime not null comment '反馈时间',
|
||||||
|
handle_time datetime not null comment '处理完成时间',
|
||||||
|
handle_remark text null comment '处理备注',
|
||||||
|
is_delete tinyint default 0 not null comment '软删除',
|
||||||
|
constraint feed_back_user_info_uid_fk
|
||||||
|
foreign key (user_id) references user_info (uid)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table orders_list
|
||||||
|
(
|
||||||
|
id int auto_increment comment '订单ID'
|
||||||
|
primary key,
|
||||||
|
user_id varchar(40) not null comment '用户ID,关联用户表',
|
||||||
|
total_points int not null comment '订单总消耗积分',
|
||||||
|
status tinyint default 0 not null comment '订单状态:0-待处理,1-已完成,2-已取消,3-已发货',
|
||||||
|
created_at datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||||
|
updated_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||||
|
constraint orders_list_user_info_uid_fk
|
||||||
|
foreign key (user_id) references user_info (uid)
|
||||||
|
on delete cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table order_consumption
|
||||||
|
(
|
||||||
|
id int auto_increment comment '记录ID'
|
||||||
|
primary key,
|
||||||
|
user_id varchar(40) not null comment '用户ID',
|
||||||
|
order_id int not null comment '关联的订单ID',
|
||||||
|
points int not null comment '消费的积分数量',
|
||||||
|
created_at datetime default CURRENT_TIMESTAMP not null comment '消费时间',
|
||||||
|
constraint order_consumption_ibfk_1
|
||||||
|
foreign key (user_id) references user_info (uid)
|
||||||
|
on delete cascade,
|
||||||
|
constraint order_consumption_ibfk_2
|
||||||
|
foreign key (order_id) references orders_list (id)
|
||||||
|
on delete cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create index order_id
|
||||||
|
on order_consumption (order_id);
|
||||||
|
|
||||||
|
create index user_id
|
||||||
|
on order_consumption (user_id);
|
||||||
|
|
||||||
|
create table order_details
|
||||||
|
(
|
||||||
|
id int auto_increment comment '明细ID'
|
||||||
|
primary key,
|
||||||
|
order_id int not null comment '订单ID,关联订单表',
|
||||||
|
goods_id int not null comment '商品ID,关联商品表',
|
||||||
|
goods_name varchar(100) not null comment '商品名称(冗余存储,避免商品名称修改后订单显示异常)',
|
||||||
|
points int not null comment '购买时的积分(冗余存储)',
|
||||||
|
quantity int default 1 not null comment '购买数量',
|
||||||
|
created_at datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||||
|
constraint order_details_ibfk_1
|
||||||
|
foreign key (order_id) references orders_list (id)
|
||||||
|
on delete cascade,
|
||||||
|
constraint order_details_ibfk_2
|
||||||
|
foreign key (goods_id) references goods_list (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create index goods_id
|
||||||
|
on order_details (goods_id);
|
||||||
|
|
||||||
|
create index order_id
|
||||||
|
on order_details (order_id);
|
||||||
|
|
||||||
|
create table referral_codes
|
||||||
|
(
|
||||||
|
id int auto_increment comment '内推码Id'
|
||||||
|
primary key,
|
||||||
|
code int not null comment '内推码',
|
||||||
|
created_by varchar(40) not null comment '创建者ID',
|
||||||
|
valid_until datetime not null comment '有效期',
|
||||||
|
uses_num int not null comment '使用次数',
|
||||||
|
create_time datetime not null comment '创建时间',
|
||||||
|
constraint referral_codes_pk_2
|
||||||
|
unique (code),
|
||||||
|
constraint referral_codes_user_info_uid_fk
|
||||||
|
foreign key (created_by) references user_info (uid)
|
||||||
|
)
|
||||||
|
comment '内推码表';
|
||||||
|
|
||||||
|
create table lottery_campaigns
|
||||||
|
(
|
||||||
|
id int auto_increment comment '活动id'
|
||||||
|
primary key,
|
||||||
|
name varchar(255) not null comment '活动名称',
|
||||||
|
description text null comment '活动描述',
|
||||||
|
referral_code_id int not null comment '内推码id',
|
||||||
|
start_time datetime not null comment '活动开始时间',
|
||||||
|
end_time datetime not null comment '活动结束时间',
|
||||||
|
is_ended int not null comment '活动是否结束,1:结束,2:未结束',
|
||||||
|
created_time datetime not null comment '创建时间',
|
||||||
|
update_time datetime not null comment '更新时间',
|
||||||
|
max_lottery_per_user int default 1 not null comment '每个用户的最大抽奖次数',
|
||||||
|
constraint lottery_campaigns_referral_codes_id_fk
|
||||||
|
foreign key (referral_code_id) references referral_codes (id)
|
||||||
|
)
|
||||||
|
comment '抽奖活动表';
|
||||||
|
|
||||||
|
create table lottery_prizes
|
||||||
|
(
|
||||||
|
id int auto_increment comment '奖项id'
|
||||||
|
primary key,
|
||||||
|
campaign_id int not null comment '关联活动ID',
|
||||||
|
name varchar(255) not null comment '奖项名称',
|
||||||
|
image_url varchar(255) not null comment '奖项图片URL',
|
||||||
|
probability float not null comment '奖项中奖概率',
|
||||||
|
max_wins int not null comment '最大中奖次数',
|
||||||
|
current_wins int default 0 not null comment '当前中奖人数',
|
||||||
|
create_time datetime not null comment '创建时间',
|
||||||
|
update_time datetime not null comment '更新时间',
|
||||||
|
constraint lottery_prizes_lottery_campaigns_id_fk
|
||||||
|
foreign key (campaign_id) references lottery_campaigns (id)
|
||||||
|
)
|
||||||
|
comment '抽奖奖项表';
|
||||||
|
|
||||||
|
create table lottery_records
|
||||||
|
(
|
||||||
|
id int auto_increment comment '记录ID'
|
||||||
|
primary key,
|
||||||
|
user_id varchar(40) not null comment '抽奖用户ID',
|
||||||
|
campaign_id int not null comment '关联活动ID',
|
||||||
|
referral_code_id int not null,
|
||||||
|
prize_id int not null comment '中奖选项ID',
|
||||||
|
is_win int not null comment '是否中奖,1:中奖,2:未中奖',
|
||||||
|
create_time datetime not null comment '抽奖时间',
|
||||||
|
constraint lottery_records_lottery_campaigns_id_fk
|
||||||
|
foreign key (campaign_id) references lottery_campaigns (id),
|
||||||
|
constraint lottery_records_lottery_prizes_id_fk
|
||||||
|
foreign key (prize_id) references lottery_prizes (id),
|
||||||
|
constraint lottery_records_referral_codes_id_fk
|
||||||
|
foreign key (referral_code_id) references referral_codes (id)
|
||||||
|
)
|
||||||
|
comment '抽奖记录表';
|
||||||
|
|
||||||
|
create table referral_code_bindings
|
||||||
|
(
|
||||||
|
id int auto_increment comment '关联记录ID'
|
||||||
|
primary key,
|
||||||
|
code_id int not null comment '关联内推码ID',
|
||||||
|
entity_type varchar(50) not null comment '业务类型',
|
||||||
|
entity_id int not null comment '关联实体ID',
|
||||||
|
create_time datetime not null comment '创建时间',
|
||||||
|
constraint referral_code_bindings_referral_codes_id_fk
|
||||||
|
foreign key (code_id) references referral_codes (id)
|
||||||
|
)
|
||||||
|
comment '内推码业务关联表';
|
||||||
|
|
||||||
create table user_msg
|
create table user_msg
|
||||||
(
|
(
|
||||||
sender_id varchar(40) not null comment '消息发送者的ID',
|
id bigint auto_increment comment '通知消息ID'
|
||||||
receiver_id varchar(40) not null comment '接收者的ID',
|
primary key,
|
||||||
message_type varchar(40) not null,
|
sender_id varchar(40) not null comment '消息发送者的ID',
|
||||||
status tinyint not null comment '通知状态;1正常显示,2:软删除',
|
receiver_id varchar(40) not null comment '接收者的ID',
|
||||||
sequence varchar(50) not null,
|
msg_type varchar(40) not null,
|
||||||
created_at time not null,
|
status tinyint not null comment '通知状态;1正常显示,2:软删除',
|
||||||
content text not null comment '消息内容',
|
sequence bigint unsigned not null comment '特定用户的消息序列',
|
||||||
`is-read` tinyint default 0 not null comment '是否已读;1:已读,0:未读'
|
created_at datetime not null,
|
||||||
|
content text null comment '消息内容',
|
||||||
|
`is-read` tinyint default 0 not null comment '是否已读;1:已读,0:未读',
|
||||||
|
target varchar(255) not null comment '跳转目标',
|
||||||
|
constraint user_msg_user_info_uid_fk
|
||||||
|
foreign key (sender_id) references user_info (uid),
|
||||||
|
constraint user_msg_user_info_uid_fk_2
|
||||||
|
foreign key (receiver_id) references user_info (uid)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table user_points
|
||||||
|
(
|
||||||
|
id int auto_increment comment '添加积分操作的id'
|
||||||
|
primary key,
|
||||||
|
user_id varchar(40) not null comment '添加积分的用户',
|
||||||
|
points_change int not null comment '添加的积分',
|
||||||
|
source varchar(40) null comment '积分来源',
|
||||||
|
create_time datetime not null comment '创建时间',
|
||||||
|
constraint user_points_user_info_uid_fk
|
||||||
|
foreign key (user_id) references user_info (uid)
|
||||||
|
on delete cascade
|
||||||
);
|
);
|
||||||
|
|
||||||
create table user_votes
|
create table user_votes
|
||||||
@@ -209,40 +328,15 @@ create table user_votes
|
|||||||
unique (user_id, option_id, vote_article_id),
|
unique (user_id, option_id, vote_article_id),
|
||||||
constraint user_votes_article_list_articleId_fk
|
constraint user_votes_article_list_articleId_fk
|
||||||
foreign key (vote_article_id) references article_list (articleId)
|
foreign key (vote_article_id) references article_list (articleId)
|
||||||
|
on delete cascade
|
||||||
);
|
);
|
||||||
|
|
||||||
create index user_vote_article_vote_id_fk
|
create index idx_option_id
|
||||||
on user_votes (option_id);
|
on user_votes (option_id);
|
||||||
|
|
||||||
create table vote_article
|
create index idx_user_id
|
||||||
(
|
on user_votes (user_id);
|
||||||
id bigint auto_increment comment '文章ID'
|
|
||||||
primary key,
|
|
||||||
title varchar(255) not null comment '文章标题',
|
|
||||||
content text null comment '文章内容',
|
|
||||||
cover_image varchar(512) null comment '封面图片URL',
|
|
||||||
author_id bigint not null comment '作者ID',
|
|
||||||
status tinyint default 0 not null comment '状态(0:草稿;1:待审核;2:已发布;3:已结束;4:已下架)',
|
|
||||||
vote_start_time datetime not null comment '投票开始时间',
|
|
||||||
vote_end_time datetime not null comment '投票结束时间',
|
|
||||||
total_votes int default 0 not null comment '总投票数',
|
|
||||||
total_voters int default 0 not null comment '参与人数',
|
|
||||||
is_anonymous tinyint(1) default 0 not null comment '是否匿名投票(0:否;1:是)',
|
|
||||||
is_multiple tinyint(1) default 0 not null comment '是否允许多选(0:单选;1:多选)',
|
|
||||||
max_choices int default 1 not null comment '最大可选数量',
|
|
||||||
view_count int default 0 not null comment '浏览次数',
|
|
||||||
created_at datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
|
||||||
updated_at datetime null on update CURRENT_TIMESTAMP comment '更新时间',
|
|
||||||
deleted_at datetime null comment '软删除时间'
|
|
||||||
)
|
|
||||||
comment '投票文章表';
|
|
||||||
|
|
||||||
create index idx_author_id
|
create index idx_vote_article_id
|
||||||
on vote_article (author_id);
|
on user_votes (vote_article_id);
|
||||||
|
|
||||||
create index idx_created_at
|
|
||||||
on vote_article (created_at desc);
|
|
||||||
|
|
||||||
create index idx_status_time
|
|
||||||
on vote_article (status, vote_start_time, vote_end_time);
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"toutoukan/controllers/article/getArticleNum"
|
"toutoukan/controllers/article/getArticleNum"
|
||||||
"toutoukan/controllers/comments/getcomments"
|
"toutoukan/controllers/comments/getcomments"
|
||||||
"toutoukan/controllers/comments/publishComments"
|
"toutoukan/controllers/comments/publishComments"
|
||||||
|
"toutoukan/controllers/feedback"
|
||||||
"toutoukan/controllers/file"
|
"toutoukan/controllers/file"
|
||||||
"toutoukan/controllers/goods"
|
"toutoukan/controllers/goods"
|
||||||
"toutoukan/controllers/kills"
|
"toutoukan/controllers/kills"
|
||||||
@@ -21,14 +22,15 @@ import (
|
|||||||
|
|
||||||
func SetupRouter() *gin.Engine {
|
func SetupRouter() *gin.Engine {
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
apiGroup := r.Group("/user")
|
userGroup := r.Group("/user")
|
||||||
//apiGroup.Use(hystrix.CircuitBreakerMiddleware("user_api"))
|
//apiGroup.Use(hystrix.CircuitBreakerMiddleware("user_api"))
|
||||||
{
|
{
|
||||||
apiGroup.POST("/login", user.UserLogin)
|
userGroup.POST("/login", user.UserLogin)
|
||||||
apiGroup.POST("/kill", ratelimit.RateLimitMiddleware(), kills.Userkill)
|
userGroup.POST("/kill", ratelimit.RateLimitMiddleware(), kills.Userkill)
|
||||||
apiGroup.POST("/getscore", user.GetScore)
|
userGroup.POST("/getscore", user.GetScore)
|
||||||
apiGroup.POST("/getInfo", user.GetUserInfo)
|
userGroup.POST("/getInfo", user.GetUserInfo)
|
||||||
apiGroup.POST("/change", setting.ChangeUserSetting)
|
userGroup.POST("/change", setting.ChangeUserSetting)
|
||||||
|
userGroup.POST("/feedback", feedback.UpFeedback)
|
||||||
|
|
||||||
}
|
}
|
||||||
//r.GET("/socket", jwt.JWTAuthMiddleware(), func(c *gin.Context) {
|
//r.GET("/socket", jwt.JWTAuthMiddleware(), func(c *gin.Context) {
|
||||||
|
|||||||
Reference in New Issue
Block a user