Files

748 lines
27 KiB
Go

package api
import (
technology2 "SciencesServer/app/api/enterprise/controller/technology"
"SciencesServer/app/basic/api"
"SciencesServer/app/session"
config2 "SciencesServer/config"
"github.com/gin-gonic/gin"
"strings"
)
type Technology struct{}
type (
// instanceForm 技术参数
instanceForm struct {
PatentID uint64 `json:"patent_id" form:"patent_id" binding:"required"`
Territory uint64 `json:"territory" form:"territory"`
Title string `json:"title" form:"title" binding:"required"`
Company string `json:"company" form:"company" binding:"required"`
api.ImageForm
ProveImages string `json:"prove_images" form:"prove_images" binding:"required"`
Introduce string `json:"introduce" form:"introduce" binding:"required"`
Purpose string `json:"purpose" form:"purpose" binding:"required"`
Remark string `json:"remark" form:"remark"`
Maturity int `json:"maturity" form:"maturity"`
Prototype int `json:"prototype" form:"prototype"`
Source int `json:"source" form:"source"`
Transaction int `json:"transaction" form:"transaction"`
Products []string `json:"products" form:"products"`
Keywords []string `json:"keywords" form:"keywords"`
IsSubmit int `json:"is_submit" form:"is_submit"`
}
// paperForm 论文参数
paperForm struct {
Title string `json:"title" form:"title" binding:"required"` // 题目
Ext string `json:"ext" form:"ext" binding:"required"` // 格式
Author string `json:"author" form:"author" binding:"required"` // 作者
PublishAt string `json:"publish_at" form:"publish_at" binding:"required"` // 出版日期
Keyword string `json:"keyword" form:"keyword"` // 关键词
Tags []string `json:"tags" form:"tags"` // 标签
Remark string `json:"remark" form:"remark"` // 备注
}
// patentForm 专利参数
patentForm struct {
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"`
Status int `json:"status" form:"status" binding:"status"`
}
// demandForm 需求参数
demandForm struct {
Title string `json:"title" form:"title" binding:"required"`
Introduce string `json:"introduce" form:"introduce" binding:"required"`
Name string `json:"name" form:"name" binding:"required"`
Mobile string `json:"mobile" form:"mobile" binding:"required"`
Deadline string `json:"deadline" form:"deadline" binding:"required"`
Industry []string `json:"industry" form:"industry" binding:"required"`
Kinds []string `json:"kinds" form:"kinds" binding:"required"`
Budget float64 `json:"budget" form:"budget"`
BudgetMode int `json:"budget_mode" form:"budget_mode"`
Expects []string `json:"expects" form:"expects"` // 期望合作的企业及模式
DemandBasic string `json:"demand_basic" form:"demand_basic"` // 基础
DemandExpect string `json:"demand_expect" form:"demand_expect"` // 预期
DemandBenefit string `json:"demand_benefit" form:"demand_benefit"` // 效益
IsSubmit int `json:"is_submit" form:"is_submit"`
}
// topicForm 课题参数
topicForm struct {
Title string `json:"title" form:"title" binding:"required"`
Emcee string `json:"emcee" form:"emcee" binding:"required"`
Mechanism string `json:"mechanism" form:"mechanism" binding:"required"`
Code string `json:"code" form:"code" binding:"required"`
BeginAt string `json:"begin_at" form:"begin_at" binding:"required"`
FinishAt string `json:"finish_at" form:"finish_at" binding:"required"`
Amount float64 `json:"amount" form:"amount" binding:"required"`
Source int `json:"source" form:"source" binding:"required"`
Kind int `json:"kind" form:"kind" binding:"required"`
Keywords []string `json:"keywords" form:"keywords"`
}
// 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"`
}
// projectForm 项目参数
projectForm struct {
Title string `json:"title" form:"title" binding:"required"`
Kind string `json:"kind" form:"kind" binding:"required"`
Role int `json:"role" form:"v" binding:"required"`
BeginAt string `json:"begin_at" form:"begin_at" binding:"required"`
FinishAt string `json:"finish_at" form:"finish_at" binding:"required"`
Amount float64 `json:"amount" form:"amount" binding:"required"`
Source string `json:"source" form:"source" binding:"required"`
Director string `json:"director" form:"director" binding:"required"`
}
// achievementForm 成果参数
achievementForm struct {
Mode int `json:"mode" form:"mode" binding:"required"`
Title string `json:"title" form:"title" binding:"required"`
api.ImageForm
File string `json:"file" form:"file" binding:"required"`
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 *achievementForm) FilterFile() string {
return (&api.ImageForm{Image: a.File}).FilterImageURL()
}
func (a *Technology) Instance(c *gin.Context) {
form := &struct {
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.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
List(form.Status, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (a *Technology) InstanceAdd(c *gin.Context) {
form := new(instanceForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.InstanceParams{
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, Products: form.Products, Keywords: form.Keywords, IsSubmit: form.IsSubmit,
})
api.APIResponse(err)(c)
}
func (a *Technology) InstanceEdit(c *gin.Context) {
form := &struct {
api.IDStringForm
instanceForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.InstanceParams{
ID: form.Convert(),
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, Products: form.Products, Keywords: form.Keywords,
})
api.APIResponse(err)(c)
}
func (a *Technology) InstanceShelf(c *gin.Context) {
form := &struct {
api.IDStringForm
Status int `json:"status" form:"status"`
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Shelf(form.Convert(), form.Status)
api.APIResponse(err)(c)
}
func (a *Technology) InstanceDelete(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Delete(form.Convert())
api.APIResponse(err)(c)
}
func (a *Technology) Paper(c *gin.Context) {
form := &struct {
Title string `json:"title" form:"title"`
api.PageForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
List(form.Title, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (a *Technology) PaperAdd(c *gin.Context) {
form := new(paperForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.PaperParams{
Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
Keyword: form.Keyword, Tags: form.Tags, Remark: form.Remark,
})
api.APIResponse(err)(c)
}
func (a *Technology) PaperEdit(c *gin.Context) {
form := &struct {
api.IDStringForm
paperForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.PaperParams{
ID: form.Convert(), Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
Keyword: form.Keyword, Tags: form.Tags, Remark: form.Remark,
})
api.APIResponse(err)(c)
}
func (a *Technology) PaperDelete(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Delete(form.Convert())
api.APIResponse(err)(c)
}
func (a *Technology) Patent(c *gin.Context) {
form := &struct {
Kind int `json:"kind" form:"kind"`
Title string `json:"title" form:"title"`
ApplyCode string `json:"apply_code" form:"apply_code"`
OpenCode string `json:"open_code" form:"open_code"`
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 := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
List(form.Kind, form.Title, form.ApplyCode, form.OpenCode, form.IPCCode, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (a *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 := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Detail(form.Convert())
api.APIResponse(err, data)(c)
}
func (a *Technology) PatentAdd(c *gin.Context) {
form := new(patentForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.PatentParams{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,
})
api.APIResponse(err)(c)
}
func (a *Technology) PatentEdit(c *gin.Context) {
form := &struct {
api.IDStringForm
patentForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.PatentParams{ID: form.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, Status: form.Status,
})
api.APIResponse(err)(c)
}
func (a *Technology) PatentDelete(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Delete(form.Convert())
api.APIResponse(err)(c)
}
func (a *Technology) Demand(c *gin.Context) {
form := &struct {
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.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
List(form.Status, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (a *Technology) DemandDetail(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Detail(form.Convert())
api.APIResponse(err, data)(c)
}
func (a *Technology) DemandAdd(c *gin.Context) {
form := new(demandForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.DemandParams{
Title: form.Title, Introduce: form.Introduce, Name: form.Name, Mobile: form.Mobile, Deadline: form.Deadline,
Industry: form.Industry, Kinds: form.Kinds, Budget: form.Budget, BudgetMode: form.BudgetMode,
Expects: form.Expects, Demand: struct {
Basic string
Expect string
Benefit string
}{Basic: form.DemandBasic, Expect: form.DemandExpect, Benefit: form.DemandBenefit}, IsSubmit: form.IsSubmit,
})
api.APIResponse(err)(c)
}
func (a *Technology) DemandEdit(c *gin.Context) {
form := &struct {
api.IDStringForm
demandForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.DemandParams{
ID: form.Convert(), Title: form.Title, Introduce: form.Introduce, Name: form.Name, Mobile: form.Mobile, Deadline: form.Deadline,
Industry: form.Industry, Kinds: form.Kinds, Budget: form.Budget, BudgetMode: form.BudgetMode,
Expects: form.Expects, Demand: struct {
Basic string
Expect string
Benefit string
}{Basic: form.DemandBasic, Expect: form.DemandExpect, Benefit: form.DemandBenefit}, IsSubmit: form.IsSubmit,
})
api.APIResponse(err)(c)
}
func (a *Technology) DemandDelete(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Delete(form.Convert())
api.APIResponse(err)(c)
}
func (a *Technology) Topic(c *gin.Context) {
form := &struct {
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.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
List(form.Status, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (a *Technology) TopicDetail(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Detail(form.Convert())
api.APIResponse(err, data)(c)
}
func (a *Technology) TopicAdd(c *gin.Context) {
form := new(topicForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.TopicParams{Title: form.Title, Emcee: form.Emcee, Mechanism: form.Mechanism, Code: form.Code,
BeginAt: form.BeginAt, FinishAt: form.FinishAt, Amount: form.Amount, Source: form.Source, Kind: form.Kind,
Keywords: form.Keywords})
api.APIResponse(err)(c)
}
func (a *Technology) TopicEdit(c *gin.Context) {
form := &struct {
api.IDStringForm
topicForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.TopicParams{ID: form.Convert(), Title: form.Title, Emcee: form.Emcee, Mechanism: form.Mechanism,
Code: form.Code, BeginAt: form.BeginAt, FinishAt: form.FinishAt, Amount: form.Amount, Source: form.Source,
Kind: form.Kind, Keywords: form.Keywords})
api.APIResponse(err)(c)
}
func (a *Technology) TopicDelete(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
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) ProductVisit(c *gin.Context) {
form := &struct {
api.IDStringForm
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)).
Visit(form.Convert(), 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)
}
func (a *Technology) Project(c *gin.Context) {
form := &struct {
Title string `json:"title" form:"title"`
api.PageForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
List(form.Title, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (a *Technology) ProjectAdd(c *gin.Context) {
form := new(projectForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.ProjectParams{
Title: form.Title, Kind: form.Kind, Source: form.Source, Director: form.Director,
BeginAt: form.BeginAt, FinishAt: form.FinishAt, Amount: form.Amount, Role: form.Role,
})
api.APIResponse(err)(c)
}
func (a *Technology) ProjectEdit(c *gin.Context) {
form := &struct {
api.IDStringForm
projectForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.ProjectParams{ID: form.Convert(),
Title: form.Title, Kind: form.Kind, Source: form.Source, Director: form.Director,
BeginAt: form.BeginAt, FinishAt: form.FinishAt, Amount: form.Amount, Role: form.Role,
})
api.APIResponse(err)(c)
}
func (*Technology) ProjectShelf(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.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Shelf(form.Convert(), form.Status)
api.APIResponse(err)(c)
}
func (a *Technology) ProjectDelete(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Delete(form.Convert())
api.APIResponse(err)(c)
}
func (*Technology) Achievement(c *gin.Context) {
form := &struct {
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.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Instance(form.Status, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (*Technology) AchievementAdd(c *gin.Context) {
form := new(achievementForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.AchievementParams{Mode: form.Mode,
Title: form.Title, Image: form.FilterImageURL(), File: form.FilterFile(),
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) AchievementEdit(c *gin.Context) {
form := &struct {
api.IDStringForm
achievementForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.AchievementParams{ID: form.Convert(), Mode: form.Mode,
Title: form.Title, Image: form.FilterImageURL(), File: form.FilterFile(),
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) AchievementShelf(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.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Shelf(form.Convert(), form.Status)
api.APIResponse(err)(c)
}
func (*Technology) AchievementDelete(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Delete(form.Convert())
api.APIResponse(err)(c)
}