feat: Admin 友链申请回链复检按钮
调用 RecheckReciprocal,开启检测且有回链页时可复检。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -143,7 +143,7 @@
|
|||||||
- [x] 用户申请(名称、URL、Logo、是否上首页、回链页)— `POST /links/apply`
|
- [x] 用户申请(名称、URL、Logo、是否上首页、回链页)— `POST /links/apply`
|
||||||
- [x] Logo 上传 — 表单 multipart 或 `POST /links/logo`
|
- [x] Logo 上传 — 表单 multipart 或 `POST /links/logo`
|
||||||
- [x] 我的申请列表;取消待审 — `/links`(修改待审:取消后重提)
|
- [x] 我的申请列表;取消待审 — `/links`(修改待审:取消后重提)
|
||||||
- [x] 管理员审核:通过 / 拒绝 — SSR `/admin/friend-links`(复检按钮未迁;创建时可异步检测)
|
- [x] 管理员审核:通过 / 拒绝 / 回链复检 — SSR `/admin/friend-links`(创建时可异步检测)
|
||||||
- [x] 管理员维护品牌友链列表 — `/admin/friend-links` 增删
|
- [x] 管理员维护品牌友链列表 — `/admin/friend-links` 增删
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -188,7 +188,7 @@
|
|||||||
| Dashboard | 看计数与待办;点进对应列表 |
|
| Dashboard | 看计数与待办;点进对应列表 |
|
||||||
| Boards | 拖拽或数字排序;图标/色板选择;增删改 |
|
| Boards | 拖拽或数字排序;图标/色板选择;增删改 |
|
||||||
| Pages | 列表发布开关;编辑正文(HTML textarea);nav/footer 勾选 — SSR `/admin/pages` |
|
| Pages | 列表发布开关;编辑正文(HTML textarea);nav/footer 勾选 — SSR `/admin/pages` |
|
||||||
| Links | 品牌友链增删;申请通过/拒绝;回链检测开关;nav/footer/aside 开关 — SSR `/admin/friend-links`(aside 与 Settings 侧栏组件共用 `aside_widgets`;复检按钮未迁) |
|
| Links | 品牌友链增删;申请通过/拒绝/回链复检;回链检测开关;nav/footer/aside 开关 — SSR `/admin/friend-links`(aside 与 Settings 侧栏组件共用 `aside_widgets`) |
|
||||||
| Posts | 审核通过/拒绝 — SSR `/admin/moderation`;置顶/版顶/精华/锁编/锁评/软删 — 帖详情 Admin 条;回收站恢复/清除 — SSR `/admin/trash` |
|
| Posts | 审核通过/拒绝 — SSR `/admin/moderation`;置顶/版顶/精华/锁编/锁评/软删 — 帖详情 Admin 条;回收站恢复/清除 — SSR `/admin/trash` |
|
||||||
| Comments | 审核 — SSR `/admin/moderation`;修订查看未迁 |
|
| Comments | 审核 — SSR `/admin/moderation`;修订查看未迁 |
|
||||||
| Reports | 处理动作:dismiss / resolve / reject_post / reject_comment — SSR `/admin/reports` |
|
| Reports | 处理动作:dismiss / resolve / reject_post / reject_comment — SSR `/admin/reports` |
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ type adminFriendLinkApplyRow struct {
|
|||||||
RecipNote string
|
RecipNote string
|
||||||
CreatedAt string
|
CreatedAt string
|
||||||
CanReview bool
|
CanReview bool
|
||||||
|
CanRecheck bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type adminFriendLinksData struct {
|
type adminFriendLinksData struct {
|
||||||
@@ -92,6 +93,7 @@ func (d Deps) renderAdminFriendLinks(ctx *webctx.Context, errMsg string) {
|
|||||||
RecipNote: a.ReciprocalCheckNote,
|
RecipNote: a.ReciprocalCheckNote,
|
||||||
CreatedAt: a.CreatedAt.Format("2006-01-02 15:04"),
|
CreatedAt: a.CreatedAt.Format("2006-01-02 15:04"),
|
||||||
CanReview: a.Status == models.FriendLinkApplyStatusPending,
|
CanReview: a.Status == models.FriendLinkApplyStatusPending,
|
||||||
|
CanRecheck: data.ReciprocalCheck && strings.TrimSpace(a.ReciprocalPageURL) != "",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -210,3 +212,23 @@ func (d Deps) AdminFriendLinkRejectPost(c *gin.Context) {
|
|||||||
ctx.SetFlash("已拒绝友链申请")
|
ctx.SetFlash("已拒绝友链申请")
|
||||||
ctx.Redirect("/admin/friend-links")
|
ctx.Redirect("/admin/friend-links")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AdminFriendLinkRecheckPost 重新检测回链
|
||||||
|
func (d Deps) AdminFriendLinkRecheckPost(c *gin.Context) {
|
||||||
|
ctx := d.ctx(c)
|
||||||
|
if !ctx.CheckCSRF() {
|
||||||
|
d.renderAdminFriendLinks(ctx, "无效请求,请重试")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if d.FriendLink == nil {
|
||||||
|
d.renderAdminFriendLinks(ctx, "友链服务未就绪")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
id64, _ := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||||
|
if _, err := d.FriendLink.RecheckReciprocal(uint(id64), d.publicBaseURL(c)); err != nil {
|
||||||
|
d.renderAdminFriendLinks(ctx, err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.SetFlash("已开始重新检测回链")
|
||||||
|
ctx.Redirect("/admin/friend-links")
|
||||||
|
}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ func Register(r *gin.Engine, deps Deps, authMW *auth.AuthMiddleware) {
|
|||||||
admin.POST("/friend-links/brand/delete", deps.AdminFriendLinksBrandDeletePost)
|
admin.POST("/friend-links/brand/delete", deps.AdminFriendLinksBrandDeletePost)
|
||||||
admin.POST("/friend-links/applies/:id/approve", deps.AdminFriendLinkApprovePost)
|
admin.POST("/friend-links/applies/:id/approve", deps.AdminFriendLinkApprovePost)
|
||||||
admin.POST("/friend-links/applies/:id/reject", deps.AdminFriendLinkRejectPost)
|
admin.POST("/friend-links/applies/:id/reject", deps.AdminFriendLinkRejectPost)
|
||||||
|
admin.POST("/friend-links/applies/:id/recheck", deps.AdminFriendLinkRecheckPost)
|
||||||
admin.GET("/pages", deps.AdminPagesGet)
|
admin.GET("/pages", deps.AdminPagesGet)
|
||||||
admin.POST("/pages", deps.AdminPageCreate)
|
admin.POST("/pages", deps.AdminPageCreate)
|
||||||
admin.GET("/pages/:id/edit", deps.AdminPageEditGet)
|
admin.GET("/pages/:id/edit", deps.AdminPageEditGet)
|
||||||
|
|||||||
@@ -82,6 +82,12 @@
|
|||||||
<button type="submit">拒绝</button>
|
<button type="submit">拒绝</button>
|
||||||
</form>
|
</form>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{if .CanRecheck}}
|
||||||
|
<form method="post" action="/admin/friend-links/applies/{{.ID}}/recheck" class="j13-inline-form">
|
||||||
|
<input type="hidden" name="_csrf" value="{{$.CSRF}}"/>
|
||||||
|
<button type="submit" class="j13-btn-secondary">复检</button>
|
||||||
|
</form>
|
||||||
|
{{end}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
Reference in New Issue
Block a user