feat:优化项目信息
This commit is contained in:
@ -97,7 +97,7 @@ func (c *Company) Form(params *BasicParams, other *config.IdentityForCompany) er
|
||||
if params.ID > 0 {
|
||||
mManageCompany.ID = params.ID
|
||||
|
||||
isExist, err := model2.FirstField(mManageCompany.ManageCompany, []string{"id", "name", "code", "tenant_id", "created_at"})
|
||||
isExist, err := model2.FirstField(mManageCompany.ManageCompany, []string{"id", "name", "code", "tenant_id", "examine_status", "created_at"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -5,10 +5,12 @@ import (
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/app/session"
|
||||
config2 "SciencesServer/config"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -136,7 +138,7 @@ func (c *Expert) Form(params *BasicParams, other *config.IdentityForExpert) erro
|
||||
if params.ID > 0 {
|
||||
mManageExpert.ID = params.ID
|
||||
|
||||
isExist, err := model2.FirstField(mManageExpert.ManageExpert, []string{"id", "name", "mobile", "tenant_id", "created_at"})
|
||||
isExist, err := model2.FirstField(mManageExpert.ManageExpert, []string{"id", "name", "mobile", "tenant_id", "examine_status", "created_at"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@ -158,6 +160,7 @@ func (c *Expert) Form(params *BasicParams, other *config.IdentityForExpert) erro
|
||||
}
|
||||
}
|
||||
mManageExpert.TenantID = c.TenantID
|
||||
mManageExpert.Name = params.Name
|
||||
mManageExpert.ResearchID = other.ConvertResearch()
|
||||
mManageExpert.LaboratoryID = other.ConvertLaboratory()
|
||||
mManageExpert.Image.Image = params.Image
|
||||
@ -179,11 +182,26 @@ func (c *Expert) Form(params *BasicParams, other *config.IdentityForExpert) erro
|
||||
if c.TenantID <= 0 {
|
||||
mManageExpert.TenantID = params.TenantID
|
||||
}
|
||||
_industrys := make([]string, 0)
|
||||
|
||||
for _, v := range params.Industrys {
|
||||
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "-").Value)
|
||||
}
|
||||
manage := service.NewESManage(
|
||||
service.WithManageIdentity(config.TenantUserIdentityForExpert),
|
||||
service.WithManageIndustry(strings.Join(_industrys, ";")),
|
||||
service.WithManageKeyword(strings.Join(params.Keywords, ";")),
|
||||
)
|
||||
if mManageExpert.ID > 0 {
|
||||
return model2.Updates(mManageExpert.ManageExpert, mManageExpert.ManageExpert)
|
||||
if err := model2.Updates(mManageExpert.ManageExpert, mManageExpert.ManageExpert); err != nil {
|
||||
return err
|
||||
}
|
||||
if mManageExpert.ExamineStatus == model2.ExamineStatusForAgree {
|
||||
_ = manage.Update()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// 查询手机号码是否在当前租户下是否已经注册了
|
||||
mManageExpert.Name = params.Name
|
||||
mManageExpert.Mobile = params.Mobile
|
||||
mManageExpert.ExamineStatus = model2.ExamineStatusForAgree
|
||||
mManageExpert.ExamineRemark = "主动创建,无需审核"
|
||||
@ -194,7 +212,13 @@ func (c *Expert) Form(params *BasicParams, other *config.IdentityForExpert) erro
|
||||
} else if isExist {
|
||||
return errors.New("操作错误,已存在相同手机号码")
|
||||
}
|
||||
return model2.Create(mManageExpert.ManageExpert)
|
||||
if err := model2.Create(mManageExpert.ManageExpert); err != nil {
|
||||
return err
|
||||
}
|
||||
service.WithManageID(mManageExpert.ID)(manage)
|
||||
service.WithManageTitle(params.Name)(manage)
|
||||
|
||||
return manage.Create()
|
||||
}
|
||||
|
||||
// Patent 专利信息
|
||||
|
@ -119,7 +119,7 @@ func (c *Laboratory) Form(params *BasicParams, other *config.IdentityForLaborato
|
||||
|
||||
if params.ID > 0 {
|
||||
mManageLaboratory.ID = params.ID
|
||||
isExist, err := model2.FirstField(mManageLaboratory.ManageLaboratory, []string{"id", "name", "code", "tenant_id", "created_at"})
|
||||
isExist, err := model2.FirstField(mManageLaboratory.ManageLaboratory, []string{"id", "name", "code", "tenant_id", "examine_status", "created_at"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -128,7 +128,7 @@ func (c *Research) Form(params *BasicParams, other *config.IdentityForResearch)
|
||||
|
||||
if params.ID > 0 {
|
||||
mManageResearch.ID = params.ID
|
||||
isExist, err := model2.FirstField(mManageResearch.ManageResearch, []string{"id", "name", "code", "tenant_id", "created_at"})
|
||||
isExist, err := model2.FirstField(mManageResearch.ManageResearch, []string{"id", "name", "code", "tenant_id", "examine_status", "created_at"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
99
app/api/admin/controller/order/instance.go
Normal file
99
app/api/admin/controller/order/instance.go
Normal file
@ -0,0 +1,99 @@
|
||||
package order
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/admin/model"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type Instance struct {
|
||||
*session.Admin
|
||||
}
|
||||
|
||||
type InstanceHandle func(session *session.Admin) *Instance
|
||||
|
||||
type (
|
||||
// InstanceInfo 订单信息
|
||||
InstanceInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model.OrderInstanceInfo
|
||||
}
|
||||
// InstanceDetail 订单详细信息
|
||||
InstanceDetail struct {
|
||||
ID string `json:"id"`
|
||||
*model.OrderInstanceInfo
|
||||
Params *model2.OrderInstanceParams `json:"params"`
|
||||
}
|
||||
// InstancePageInfo 订单分页信息
|
||||
InstancePageInfo struct {
|
||||
*controller.ReturnPages
|
||||
Amount float64 `json:"amount"`
|
||||
}
|
||||
)
|
||||
|
||||
// Index 首页信息
|
||||
func (c *Instance) Index(orderNo, name, mobile, status string, page, pageSize int) (*InstancePageInfo, error) {
|
||||
mOrderInstance := model.NewOrderInstance()
|
||||
|
||||
var count int64
|
||||
|
||||
where := make([]*model2.ModelWhere, 0)
|
||||
|
||||
if orderNo != "" {
|
||||
where = append(where, model2.NewWhereLike("o.order_no", orderNo))
|
||||
}
|
||||
if name != "" {
|
||||
where = append(where, model2.NewWhereLike("u.name", name))
|
||||
}
|
||||
if mobile != "" {
|
||||
where = append(where, model2.NewWhereLike("u.mobile", mobile))
|
||||
}
|
||||
if status != "" {
|
||||
where = append(where, model2.NewWhereLike("o.status", utils.StringToInt(status)))
|
||||
}
|
||||
var amount float64
|
||||
|
||||
out, err := mOrderInstance.Orders(page, pageSize, &count, &amount)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*InstanceInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &InstanceInfo{
|
||||
ID: v.GetEncodeID(), OrderInstanceInfo: v,
|
||||
})
|
||||
}
|
||||
return &InstancePageInfo{
|
||||
ReturnPages: &controller.ReturnPages{Data: list, Count: count},
|
||||
Amount: amount,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Detail 详细信息
|
||||
func (c *Instance) Detail(id uint64) (*InstanceDetail, error) {
|
||||
mOrderInstance := model.NewOrderInstance()
|
||||
|
||||
out, err := mOrderInstance.Detail(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if out.ID <= 0 {
|
||||
return nil, errors.New("操作错误,订单信息不存在或已被删除")
|
||||
}
|
||||
return &InstanceDetail{
|
||||
ID: mOrderInstance.GetEncodeID(),
|
||||
OrderInstanceInfo: out,
|
||||
Params: out.GetParamsAttribute(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
return func(session *session.Admin) *Instance {
|
||||
return &Instance{session}
|
||||
}
|
||||
}
|
@ -50,10 +50,10 @@ type (
|
||||
}
|
||||
// SolutionCaseKindParams 案例分类参数信息
|
||||
SolutionCaseKindParams struct {
|
||||
ID, TenantID uint64
|
||||
Mode int
|
||||
Title, Image string
|
||||
Sort int
|
||||
ID, TenantID uint64
|
||||
Mode int
|
||||
Title, Image, Description string
|
||||
Sort int
|
||||
}
|
||||
)
|
||||
|
||||
@ -260,7 +260,8 @@ func (c *SolutionCase) KindForm(params *SolutionCaseKindParams) error {
|
||||
if params.ID > 0 {
|
||||
mServiceSolutionCaseKind.ID = params.ID
|
||||
|
||||
isExist, err := model2.FirstField(mServiceSolutionCaseKind.ServiceSolutionCaseKind, []string{"id", "tenant_id", "created_at"})
|
||||
isExist, err := model2.FirstField(mServiceSolutionCaseKind.ServiceSolutionCaseKind,
|
||||
[]string{"id", "tenant_id", "created_at"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@ -274,6 +275,7 @@ func (c *SolutionCase) KindForm(params *SolutionCaseKindParams) error {
|
||||
mServiceSolutionCaseKind.Mode = model2.ServiceSolutionCaseMode(params.Mode)
|
||||
mServiceSolutionCaseKind.Title = params.Title
|
||||
mServiceSolutionCaseKind.Image.Image = params.Image
|
||||
mServiceSolutionCaseKind.Description = params.Description
|
||||
mServiceSolutionCaseKind.Sort = params.Sort
|
||||
|
||||
if mServiceSolutionCaseKind.ID > 0 {
|
||||
|
@ -8,13 +8,8 @@ import (
|
||||
func TestNewBanner(t *testing.T) {
|
||||
banner := new(Banner)
|
||||
out := []string{
|
||||
"首页banner",
|
||||
"登录注册",
|
||||
"首页>1>首页",
|
||||
"解决方案>中小型企业",
|
||||
"解决方案>大型企业",
|
||||
"找专家>专家列表",
|
||||
"找专家>专家列表1",
|
||||
"找专家>专家列表>专家详情",
|
||||
}
|
||||
_out := banner.filter(out, ">")
|
||||
t.Log(_out)
|
||||
|
@ -248,7 +248,7 @@ func (c *Patent) Filter(applyName, inventor string) (*PatentFilterInfo, error) {
|
||||
|
||||
experts := make([]*model2.ManageExpert, 0)
|
||||
|
||||
if err = model2.ScanFields(mManageExpert.ManageExpert, &experts, []string{"id", "uid", "name", "mobile"},
|
||||
if err = model2.ScanFields(mManageExpert.ManageExpert, &experts, []string{"id", "name", "mobile"},
|
||||
&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("name", inventor),
|
||||
}, &model2.ModelWhereOrder{
|
||||
@ -288,7 +288,7 @@ func (c *Patent) Delete(id uint64) error {
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
mTechnologyPatent.ID = id
|
||||
|
||||
isExist, err := model2.FirstField(mTechnologyPatent.TechnologyPatent, []string{"id", "uid", "tenant_id"})
|
||||
isExist, err := model2.FirstField(mTechnologyPatent.TechnologyPatent, []string{"id"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user