feat:完善信息
This commit is contained in:
77
app/api/enterprise/api/account.go
Normal file
77
app/api/enterprise/api/account.go
Normal file
@ -0,0 +1,77 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
account2 "SciencesServer/app/api/enterprise/controller/account"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type Account struct{}
|
||||
|
||||
type (
|
||||
accountLoginForm struct {
|
||||
Mode int `json:"mode" form:"mode" binding:"required"`
|
||||
Mobile string `json:"mobile" form:"mobile"`
|
||||
Captcha string `json:"captcha" form:"captcha"`
|
||||
Password string `json:"password" form:"password"`
|
||||
}
|
||||
accountRegisterForm struct {
|
||||
Name string `json:"name" form:"name" binding:"required"`
|
||||
Mobile string `json:"mobile" form:"mobile" binding:"required"`
|
||||
Captcha string `json:"captcha" form:"captcha" binding:"required"`
|
||||
Password string `json:"password" form:"password" binding:"required"`
|
||||
RepeatPass string `json:"repeat_pass" form:"repeat_pass" binding:"required"`
|
||||
Identity int `json:"identity" form:"identity" binding:"required"`
|
||||
}
|
||||
)
|
||||
|
||||
func (a *Account) Login(c *gin.Context) {
|
||||
form := new(accountLoginForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := account2.NewLogin()(api.GetLocal()(c).(string)).Launch(account2.LoginMode(form.Mode), &account2.LoginParams{
|
||||
Captcha: struct {
|
||||
Mobile string
|
||||
Captcha string
|
||||
}{Mobile: form.Mobile, Captcha: form.Captcha},
|
||||
Password: struct {
|
||||
Mobile string
|
||||
Password string
|
||||
}{Mobile: form.Mobile, Password: form.Password},
|
||||
})
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (a *Account) Register(c *gin.Context) {
|
||||
form := new(accountRegisterForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := account2.NewRegister()(api.GetLocal()(c).(string)).Launch(&account2.RegisterParams{
|
||||
Name: form.Name, Mobile: form.Mobile, Captcha: form.Captcha,
|
||||
Password: form.Password, RepeatPass: form.RepeatPass, Identity: form.Identity,
|
||||
})
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (a *Account) BindMobile() {
|
||||
//account.NewOther()().BindMobile()
|
||||
}
|
||||
|
||||
func (a *Account) Logout(c *gin.Context) {
|
||||
handle := api.GetSession()(c)
|
||||
|
||||
session := new(service.SessionEnterprise)
|
||||
|
||||
if handle != nil {
|
||||
session = handle.(*service.SessionEnterprise)
|
||||
}
|
||||
err := account2.NewLogout()(session, api.GetLocal()(c).(uint64)).Launch()
|
||||
api.APIResponse(err)(c)
|
||||
}
|
35
app/api/enterprise/api/config.go
Normal file
35
app/api/enterprise/api/config.go
Normal file
@ -0,0 +1,35 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/controller/config"
|
||||
"SciencesServer/app/basic/api"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type Config struct{}
|
||||
|
||||
func (a *Config) Identity(c *gin.Context) {
|
||||
data := config.NewConfig().Identity()
|
||||
api.APISuccess(data)
|
||||
}
|
||||
|
||||
func (a *Config) Transaction(c *gin.Context) {
|
||||
data := config.NewConfig().Transaction()
|
||||
api.APISuccess(data)
|
||||
}
|
||||
|
||||
func (a *Config) Industry(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
func (a *Config) Area(c *gin.Context) {
|
||||
form := &struct {
|
||||
Key string `json:"key" form:"key"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data := config.NewConfig().Area(form.Key)
|
||||
api.APIResponse(nil, data)(c)
|
||||
}
|
270
app/api/enterprise/api/technology.go
Normal file
270
app/api/enterprise/api/technology.go
Normal file
@ -0,0 +1,270 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
technology2 "SciencesServer/app/api/enterprise/controller/technology"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type Technology struct{}
|
||||
|
||||
type (
|
||||
// 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 {
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
IPCCode string `json:"ipc_code" form:"ipc_code" binding:"required"`
|
||||
CPCCode string `json:"cpc_code" form:"cpc_code" binding:"required"`
|
||||
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"`
|
||||
ApplyZipCode string `json:"apply_zip_code" form:"apply_zip_code" binding:"required"`
|
||||
Inventor string `json:"inventor" form:"inventor" binding:"required"`
|
||||
PriorityCode string `json:"priority_code" form:"priority_code" binding:"required"`
|
||||
OpenCode string `json:"open_code" form:"open_code" binding:"required"`
|
||||
ApplyAt string `json:"apply_at" form:"apply_at" binding:"required"`
|
||||
PriorityAt string `json:"priority_at" form:"priority_at" binding:"required"`
|
||||
OpenAt string `json:"open_at" form:"open_at" binding:"required"`
|
||||
}
|
||||
// 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"`
|
||||
config.Area
|
||||
Budget float64 `json:"budget" form:"budget"`
|
||||
BudgetMode int `json:"budget_mode" form:"budget_mode"`
|
||||
Expect []string `json:"expect" form:"expect"` // 期望合作的企业及模式
|
||||
DemandBasic string `json:"demand_basic" form:"demand_basic"` // 基础
|
||||
DemandExpect string `json:"demand_expect" form:"demand_expect"` // 预期
|
||||
DemandBenefit string `json:"demand_benefit" form:"demand_benefit"` // 效益
|
||||
Status int `json:"status" form:"status"`
|
||||
}
|
||||
)
|
||||
|
||||
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).(*service.SessionEnterprise), 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).(*service.SessionEnterprise), 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).(*service.SessionEnterprise), 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).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (a *Technology) Patent(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.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
List(form.Title, 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).(*service.SessionEnterprise), 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).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.PatentParams{
|
||||
Title: form.Title, IPCCode: form.IPCCode, CPCCode: form.CPCCode, ApplyCode: form.ApplyCode,
|
||||
ApplyName: form.ApplyName, ApplyAddress: form.ApplyAddress, ApplyZipCode: form.ApplyZipCode,
|
||||
Inventor: form.Inventor, PriorityCode: form.PriorityCode, OpenCode: form.OpenCode, ApplyAt: form.ApplyAt,
|
||||
PriorityAt: form.PriorityAt, OpenAt: form.OpenAt,
|
||||
})
|
||||
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).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.PatentParams{
|
||||
ID: form.Convert(), Title: form.Title, IPCCode: form.IPCCode, CPCCode: form.CPCCode,
|
||||
ApplyCode: form.ApplyCode, ApplyName: form.ApplyName, ApplyAddress: form.ApplyAddress,
|
||||
ApplyZipCode: form.ApplyZipCode, Inventor: form.Inventor, PriorityCode: form.PriorityCode, OpenCode: form.OpenCode,
|
||||
ApplyAt: form.ApplyAt, PriorityAt: form.PriorityAt, OpenAt: form.OpenAt,
|
||||
})
|
||||
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).(*service.SessionEnterprise), 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).(*service.SessionEnterprise), 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).(*service.SessionEnterprise), 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).(*service.SessionEnterprise), 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, Area: form.Area, Budget: form.Budget, BudgetMode: form.BudgetMode,
|
||||
Expect: form.Expect, Demand: struct {
|
||||
Basic string `json:"basic"`
|
||||
Expect string `json:"expect"`
|
||||
Benefit string `json:"benefit"`
|
||||
}{Basic: form.DemandBasic, Expect: form.DemandExpect, Benefit: form.DemandBenefit}, Status: form.Status,
|
||||
})
|
||||
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).(*service.SessionEnterprise), 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, Area: form.Area, Budget: form.Budget, BudgetMode: form.BudgetMode,
|
||||
Expect: form.Expect, Demand: struct {
|
||||
Basic string `json:"basic"`
|
||||
Expect string `json:"expect"`
|
||||
Benefit string `json:"benefit"`
|
||||
}{Basic: form.DemandBasic, Expect: form.DemandExpect, Benefit: form.DemandBenefit}, Status: form.Status,
|
||||
})
|
||||
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).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
3
app/api/enterprise/api/tenant.go
Normal file
3
app/api/enterprise/api/tenant.go
Normal file
@ -0,0 +1,3 @@
|
||||
package api
|
||||
|
||||
type Tenant struct{}
|
149
app/api/enterprise/api/user.go
Normal file
149
app/api/enterprise/api/user.go
Normal file
@ -0,0 +1,149 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
user2 "SciencesServer/app/api/enterprise/controller/user"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type User struct{}
|
||||
|
||||
type (
|
||||
// userSettledForm 入驻平台参数
|
||||
userSettledForm struct {
|
||||
api.IDStringForm
|
||||
api.ImageForm
|
||||
Name string `json:"name" form:"name"`
|
||||
Code string `json:"code" form:"code"`
|
||||
config.Area
|
||||
Introduce string `json:"introduce" form:"introduce"`
|
||||
Industry uint64 `json:"industry" form:"industry"`
|
||||
Keywords []string `json:"keywords" form:"keywords"`
|
||||
}
|
||||
// userBankForm 银行平台信息参数
|
||||
userBankForm struct {
|
||||
Name string `json:"name" form:"name" binding:"required"`
|
||||
IDCard string `json:"id_card" form:"id_card" binding:"required"`
|
||||
BackCard string `json:"back_card" form:"back_card" binding:"required"`
|
||||
BackName string `json:"back_name" form:"back_name" binding:"required"`
|
||||
Captcha string `json:"captcha" form:"captcha" binding:"required"`
|
||||
}
|
||||
)
|
||||
|
||||
func (a *User) Info(c *gin.Context) {
|
||||
data := user2.NewInstance()(api.GetSession()(c).(*service.SessionEnterprise)).Info()
|
||||
api.APISuccess(data)
|
||||
}
|
||||
|
||||
func (a *User) Detail(c *gin.Context) {
|
||||
data, err := user2.NewInstance()(api.GetSession()(c).(*service.SessionEnterprise)).Detail()
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (a *Tenant) SettledCompany(c *gin.Context) {
|
||||
form := &struct {
|
||||
userSettledForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user2.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Company(&user2.SettledParams{
|
||||
ID: form.Convert(), Image: form.FilterImageURL(), Name: form.Name, Code: form.Code,
|
||||
Area: form.Area, Introduce: form.Introduce, Industry: form.Industry, Keywords: form.Keywords,
|
||||
}, nil)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (a *Tenant) SettledExpert(c *gin.Context) {
|
||||
form := &struct {
|
||||
userSettledForm
|
||||
config.IdentityForExpert
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user2.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Expert(&user2.SettledParams{
|
||||
ID: form.Convert(), Area: form.Area, Introduce: form.Introduce, Industry: form.Industry, Keywords: form.Keywords,
|
||||
}, &form.IdentityForExpert)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (a *Tenant) SettledResearch(c *gin.Context) {
|
||||
form := &struct {
|
||||
userSettledForm
|
||||
config.IdentityForResearch
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user2.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Research(&user2.SettledParams{
|
||||
ID: form.Convert(), Image: form.FilterImageURL(), Name: form.Name, Code: form.Code,
|
||||
Area: form.Area, Introduce: form.Introduce, Industry: form.Industry, Keywords: form.Keywords,
|
||||
}, &form.IdentityForResearch)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (a *Tenant) SettledLaboratory(c *gin.Context) {
|
||||
form := &struct {
|
||||
userSettledForm
|
||||
config.IdentityForLaboratory
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user2.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Laboratory(&user2.SettledParams{
|
||||
ID: form.Convert(), Image: form.FilterImageURL(), Name: form.Name, Code: form.Code,
|
||||
Area: form.Area, Introduce: form.Introduce, Industry: form.Industry, Keywords: form.Keywords,
|
||||
}, &form.IdentityForLaboratory)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (a *User) SwitchIdentity(c *gin.Context) {
|
||||
form := &struct {
|
||||
Identity int `json:"identity" form:"identity" binding:"required"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user2.NewInstance()(api.GetSession()(c).(*service.SessionEnterprise)).SwitchIdentity(form.Identity)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (a *User) Back(c *gin.Context) {
|
||||
data, err := user2.NewBack()(api.GetSession()(c).(*service.SessionEnterprise)).List()
|
||||
api.APIResponse(err, data)
|
||||
}
|
||||
|
||||
func (a *User) BackBind(c *gin.Context) {
|
||||
form := new(userBankForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user2.NewBack()(api.GetSession()(c).(*service.SessionEnterprise)).Bind(&user2.BackParams{
|
||||
Name: form.Name,
|
||||
IDCard: form.IDCard,
|
||||
BackCard: form.BackCard,
|
||||
BackName: form.BackName,
|
||||
}, form.Captcha)
|
||||
api.APIResponse(err)
|
||||
}
|
||||
|
||||
func (a *User) BackUnbind(c *gin.Context) {
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user2.NewBack()(api.GetSession()(c).(*service.SessionEnterprise)).Unbind(form.Convert())
|
||||
api.APIResponse(err)
|
||||
}
|
Reference in New Issue
Block a user