feat:完善项目
This commit is contained in:
@ -224,7 +224,7 @@ func (*Sys) AboutDetail(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := sys.NewAbout()(api.GetSession()(c).(*session.Admin)).Instance(form.Convert())
|
||||
data, err := sys.NewAbout()(api.GetSession()(c).(*session.Admin)).Detail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ func (*Sys) AboutForm(c *gin.Context) {
|
||||
api.TenantIDStringForm
|
||||
ParentID string `json:"parent_id" form:"parent_id"`
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
Content string `json:"content" form:"content" binding:"required"`
|
||||
Content string `json:"content" form:"content"`
|
||||
Sort int `json:"sort" form:"sort"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
@ -251,13 +251,12 @@ func (*Sys) AboutForm(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (*Sys) AboutDelete(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.TenantIDStringForm
|
||||
}{}
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := sys.NewAbout()(api.GetSession()(c).(*session.Admin)).Instance(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
err := sys.NewAbout()(api.GetSession()(c).(*session.Admin)).Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
131
app/api/admin/api/technology.go
Normal file
131
app/api/admin/api/technology.go
Normal file
@ -0,0 +1,131 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/admin/controller/technology"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/session"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type Technology struct{}
|
||||
|
||||
func (*Technology) Patent(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.TenantIDStringForm
|
||||
Title string `json:"title" form:"title"`
|
||||
IPCCode string `json:"ipc_code" form:"ipc_code"`
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology.NewPatent()(api.GetSession()(c).(*session.Admin)).Instance(form.Convert(), form.Title, form.IPCCode,
|
||||
form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Technology) PatentDetail(c *gin.Context) {
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology.NewPatent()(api.GetSession()(c).(*session.Admin)).Detail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Technology) PatentForm(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.TenantIDStringForm
|
||||
Kind int `json:"kind" form:"kind" binding:"kind"`
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
FileUrl string `json:"file_url" form:"file_url"`
|
||||
ApplyCode string `json:"apply_code" form:"apply_code" binding:"required"`
|
||||
ApplyName string `json:"apply_name" form:"apply_name" binding:"required"`
|
||||
ApplyAddress string `json:"apply_address" form:"apply_address" binding:"required"`
|
||||
ApplyAt string `json:"apply_at" form:"apply_at" binding:"required"`
|
||||
OpenCode string `json:"open_code" form:"open_code" binding:"required"`
|
||||
OpenAt string `json:"open_at" form:"open_at" binding:"required"`
|
||||
IPCCode string `json:"ipc_code" form:"ipc_code"`
|
||||
Inventor string `json:"inventor" form:"inventor"`
|
||||
PrincipalClaim string `json:"principal_claim" form:"principal_claim"`
|
||||
Description string `json:"description" form:"description"`
|
||||
ShelfStatus int `json:"shelf_status" form:"shelf_status" binding:"required"`
|
||||
Status int `json:"status" form:"status" binding:"required"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPatent()(api.GetSession()(c).(*session.Admin)).Form(&technology.PatentParams{
|
||||
ID: form.IDStringForm.Convert(), TenantID: form.TenantIDStringForm.Convert(),
|
||||
Kind: form.Kind, Title: form.Title, FileUrl: (&api.FileForm{File: form.FileUrl}).FilterURL(),
|
||||
ApplyCode: form.ApplyCode, ApplyName: form.ApplyName, ApplyAddress: form.ApplyAddress, ApplyAt: form.ApplyAt,
|
||||
OpenCode: form.OpenCode, OpenAt: form.OpenAt, Inventor: form.Inventor, IPCCode: form.IPCCode,
|
||||
Description: form.Description, PrincipalClaim: form.PrincipalClaim,
|
||||
ShelfStatus: form.ShelfStatus, Status: form.Status,
|
||||
})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Technology) PatentBind(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
UID string `json:"uid" form:"uid" binding:"required"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPatent()(api.GetSession()(c).(*session.Admin)).Bind(form.Convert(),
|
||||
(&api.IDStringForm{ID: form.UID}).Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Technology) PatentDelete(c *gin.Context) {
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPatent()(api.GetSession()(c).(*session.Admin)).Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Technology) PatentIPC(c *gin.Context) {
|
||||
data, err := technology.NewPatent()(api.GetSession()(c).(*session.Admin)).IPC()
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Technology) PatentIPCForm(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
ParentID string `json:"parent_id" form:"parent_id"`
|
||||
IPC string `json:"ipc" form:"ipc" binding:"required"`
|
||||
Industrys []string `json:"industrys" form:"industrys"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPatent()(api.GetSession()(c).(*session.Admin)).IPCForm(&technology.PatentIPCParams{
|
||||
ID: form.Convert(), ParentID: (&api.IDStringForm{ID: form.ParentID}).Convert(),
|
||||
IPC: form.IPC, Industrys: form.Industrys,
|
||||
})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Technology) PatentIPCDelete(c *gin.Context) {
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPatent()(api.GetSession()(c).(*session.Admin)).IPCDelete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
Reference in New Issue
Block a user