feat:增加科技产品数据模型管理
This commit is contained in:
@ -9,6 +9,7 @@ import (
|
||||
|
||||
type Identity struct{}
|
||||
|
||||
// Expert 专家信息
|
||||
func (*Identity) Expert(c *gin.Context) {
|
||||
form := &struct {
|
||||
Name string `json:"name" form:"name"`
|
||||
@ -23,3 +24,7 @@ func (*Identity) Expert(c *gin.Context) {
|
||||
Expert(form.Name, form.Mobile, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Identity) Company(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
package api
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
type Menu struct{}
|
||||
|
||||
func (*Menu) Menu(c *gin.Context) {
|
||||
|
||||
}
|
@ -28,9 +28,9 @@ type (
|
||||
Prototype int `json:"prototype" form:"prototype"`
|
||||
Source int `json:"source" form:"source"`
|
||||
Transaction int `json:"transaction" form:"transaction"`
|
||||
Status int `json:"status" form:"status"`
|
||||
Products []string `json:"products" form:"products"`
|
||||
Keywords []string `json:"keywords" form:"keywords"`
|
||||
IsSubmit int `json:"is_submit" form:"is_submit"`
|
||||
}
|
||||
// paperForm 论文参数
|
||||
paperForm struct {
|
||||
@ -95,12 +95,35 @@ type (
|
||||
Research string `json:"research" form:"research" binding:"required"`
|
||||
Describe string `json:"describe" form:"describe"`
|
||||
}
|
||||
// productForm 产品参数
|
||||
productForm struct {
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
api.ImageForm
|
||||
Video string `json:"video" form:"video"`
|
||||
Material string `json:"material" form:"material"`
|
||||
Industrys []string `json:"industrys" form:"industrys"`
|
||||
Customers []string `json:"customers" form:"customers"`
|
||||
Maturity int `json:"maturity" form:"maturity"`
|
||||
LeadStandard int `json:"lead_standard" form:"lead_standard"`
|
||||
CooperationMode int `json:"cooperation_mode" form:"cooperation_mode"`
|
||||
Keywords []string `json:"keywords" form:"keywords"`
|
||||
Introduce string `json:"introduce" form:"introduce"`
|
||||
IsSubmit int `json:"is_submit" form:"is_submit"`
|
||||
}
|
||||
)
|
||||
|
||||
func (a *instanceForm) FilterProveImages() string {
|
||||
return strings.Replace(a.ProveImages, config2.SettingInfo.Domain, "", -1)
|
||||
}
|
||||
|
||||
func (a *productForm) FilterVideo() string {
|
||||
return (&api.ImageForm{Image: a.Video}).FilterImageURL()
|
||||
}
|
||||
|
||||
func (a *productForm) FilterMaterial() string {
|
||||
return (&api.ImageForm{Image: a.Material}).FilterImageURL()
|
||||
}
|
||||
|
||||
func (a *Technology) Instance(c *gin.Context) {
|
||||
form := &struct {
|
||||
Status int `json:"status" form:"status"`
|
||||
@ -127,7 +150,7 @@ func (a *Technology) InstanceAdd(c *gin.Context) {
|
||||
PatentID: form.PatentID, Territory: form.Territory, Title: form.Title, Company: form.Company,
|
||||
Images: form.FilterImageURL(), ProveImages: form.FilterProveImages(), Introduce: form.Introduce, Purpose: form.Purpose,
|
||||
Remark: form.Remark, Maturity: form.Maturity, Prototype: form.Prototype, Source: form.Source,
|
||||
Transaction: form.Transaction, Status: form.Status, Products: form.Products, Keywords: form.Keywords,
|
||||
Transaction: form.Transaction, Products: form.Products, Keywords: form.Keywords, IsSubmit: form.IsSubmit,
|
||||
})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -147,7 +170,7 @@ func (a *Technology) InstanceEdit(c *gin.Context) {
|
||||
PatentID: form.PatentID, Territory: form.Territory, Title: form.Title, Company: form.Company,
|
||||
Images: form.FilterImageURL(), ProveImages: form.FilterProveImages(), Introduce: form.Introduce, Purpose: form.Purpose,
|
||||
Remark: form.Remark, Maturity: form.Maturity, Prototype: form.Prototype, Source: form.Source,
|
||||
Transaction: form.Transaction, Status: form.Status, Products: form.Products, Keywords: form.Keywords,
|
||||
Transaction: form.Transaction, Products: form.Products, Keywords: form.Keywords,
|
||||
})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -509,3 +532,80 @@ func (a *Technology) EquipmentDelete(c *gin.Context) {
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Technology) Product(c *gin.Context) {
|
||||
form := &struct {
|
||||
Title string `json:"title" form:"title"`
|
||||
Status int `json:"status" form:"status"`
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
List(form.Title, form.Status, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Technology) ProductAdd(c *gin.Context) {
|
||||
form := new(productForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.ProductParams{
|
||||
Title: form.Title, Image: form.FilterImageURL(), Video: form.FilterVideo(),
|
||||
Material: form.FilterMaterial(), Introduce: form.Introduce, Industrys: form.Industrys,
|
||||
Maturity: form.Maturity, LeadStandard: form.LeadStandard, CooperationMode: form.CooperationMode,
|
||||
Customers: form.Customers, Keywords: form.Keywords, IsSubmit: form.IsSubmit,
|
||||
})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Technology) ProductEdit(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
productForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.ProductParams{
|
||||
ID: form.Convert(), Title: form.Title, Image: form.FilterImageURL(), Video: form.FilterVideo(),
|
||||
Material: form.FilterMaterial(), Introduce: form.Introduce, Industrys: form.Industrys,
|
||||
Maturity: form.Maturity, LeadStandard: form.LeadStandard, CooperationMode: form.CooperationMode,
|
||||
Customers: form.Customers, Keywords: form.Keywords,
|
||||
})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Technology) ProductShelf(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
Status int `json:"status" form:"status" binding:"required"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Shelf(form.Convert(), form.Status)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Technology) ProductDelete(c *gin.Context) {
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
Reference in New Issue
Block a user