feat:完善信息

This commit is contained in:
henry
2022-01-25 11:45:53 +08:00
parent 26b58e3ca6
commit 932ed31450
13 changed files with 169 additions and 45 deletions

View File

@ -12,6 +12,7 @@ type Log struct{}
func (a *Log) Login(c *gin.Context) {
form := &struct {
api.TenantIDStringForm
Name string `json:"name" form:"name"`
api.PageForm
}{}
@ -19,6 +20,6 @@ func (a *Log) Login(c *gin.Context) {
api.APIFailure(err.(error))(c)
return
}
data, err := controller.NewLog()(api.GetSession()(c).(*session.Admin)).Login(form.Name, form.Page, form.PageSize)
data, err := controller.NewLog()(api.GetSession()(c).(*session.Admin)).Login(form.Convert(), form.Name, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}

View File

@ -21,7 +21,7 @@ type (
)
// Login 登录日志
func (c *Log) Login(name string, page, pageSize int) (*controller.ReturnPages, error) {
func (c *Log) Login(tenantID uint64, name string, page, pageSize int) (*controller.ReturnPages, error) {
mSysUserLoginLogs := model.NewSysUserLoginLog()
where := make([]*model2.ModelWhere, 0)
@ -29,6 +29,9 @@ func (c *Log) Login(name string, page, pageSize int) (*controller.ReturnPages, e
if c.TenantID > 0 {
where = append(where, model2.NewWhere("l.tenant_id", c.TenantID))
}
if tenantID > 0 {
where = append(where, model2.NewWhere("l.tenant_id", tenantID))
}
if name != "" {
where = append(where, model2.NewWhereLike("u.name", name))
}

View File

@ -3,10 +3,12 @@ package manage
import (
"SciencesServer/app/basic/config"
"SciencesServer/app/service"
"SciencesServer/serve/logger"
"strings"
)
type ESParams struct {
ID uint64
Identity int
Name string
Keywords, Industrys, Researchs []string
@ -18,11 +20,18 @@ func (this *ESParams) Set() {
for _, v := range this.Industrys {
_identitys = append(_identitys, config.GetIndustryInfo(v, "-", "-").Value)
}
_ = service.NewESManage(
//fmt.Println(utils.AnyToJSON(this))
//fmt.Println(this.Identity)
err := service.NewESManage(
service.WithManageID(this.ID),
service.WithManageIdentity(this.Identity),
service.WithManageTitle(this.Name),
service.WithManageIndustry(strings.Join(_identitys, "")),
service.WithManageKeyword(strings.Join(this.Keywords, "")),
service.WithManageResearch(strings.Join(this.Researchs, "")),
).Create()
if err != nil {
logger.ErrorF("ES 身份信息【%d】存储错误【%s】", this.Identity, err)
}
}

View File

@ -35,7 +35,7 @@ var examineHandle = map[int]func(id, tenantID uint64) (*ExamineManageInfo, error
func checkManage(IModel model2.IModel, id uint64) error {
IModel.SetID(id)
if isExist, err := model2.FirstField(IModel, []string{"id", "tenant_id", "examine_status"}); err != nil {
if isExist, err := model2.First(IModel); err != nil {
return err
} else if !isExist {
return errors.New("操作错误,数据信息不存在")
@ -231,6 +231,7 @@ func (c *Examine) Launch(id uint64, identity, status int, remark string, params
}
// 存放es中
(&ESParams{
ID: data.IModel.GetID(),
Identity: identity, Name: data.Name, Keywords: data.Keywords,
Industrys: data.Industrys, Researchs: data.Researchs,
}).Set()

View File

@ -25,7 +25,7 @@ func achievementSearch(page, pageSize int, keyword, industry string, params map[
service.WithAchievementKeyword(keyword),
)
if industry != "" {
service.WithAchievementIndustry(keyword)(manage)
service.WithAchievementIndustry(industry)(manage)
}
out, count, err := manage.Search(page, pageSize)

View File

@ -27,10 +27,10 @@ func (m *ManageExpert) Expert(limit int, where ...*model.ModelWhere) ([]*ManageE
db := orm.GetDB().Table(m.TableName()+" AS e").
Select("e.id", "e.name", "e.industry", "e.school", "e.major", "e.keyword",
"p.title AS patent_title").
Joins(fmt.Sprintf("LEFT JOIN %s AS e_u ON e.id = p.patent_id AND e_u.invalid_status = %d AND e_u.is_deleted = %d",
Joins(fmt.Sprintf("LEFT JOIN %s AS e_u ON e.id = e_u.expert_id AND e_u.invalid_status = %d AND e_u.is_deleted = %d",
model.NewUserExpert().TableName(), model.InvalidStatusForNot, model.DeleteStatusForNot)).
Joins(fmt.Sprintf(`LEFT JOIN (SELECT u.uid, SUBSTRING_INDEX(GROUP_CONCAT(p.title ORDER BY p.id DESC SEPARATOR '&&'), '&&', %d) AS title
FROM %s AS u LEFT JOIN %s AS p ON u.parent_id = p.id WHERE u.is_deleted = %d AND p.shelf_status = %d) AS p ON e_u.uid = p.uid`,
FROM %s AS u LEFT JOIN %s AS p ON u.patent_id = p.id WHERE u.is_deleted = %d AND p.shelf_status = %d GROUP BY u.uid) AS p ON e_u.uid = p.uid`,
limit, mUserPatent.TableName(), mSysPatent.TableName(), model.DeleteStatusForNot, model.ShelfStatusForUp)).
Where("e.examine_status = ?", model.ExamineStatusForAgree).
Where("e.is_deleted = ?", model.DeleteStatusForNot)
@ -58,10 +58,10 @@ func (m *ManageExpert) Detail(limit int, id uint64) (*ManageExpertInfo, error) {
db := orm.GetDB().Table(m.TableName()+" AS e").
Select("e.id", "e.name", "e.industry", "e.school", "e.major", "e.keyword", "e.research", "e.introduce",
"p.title AS patent_title").
Joins(fmt.Sprintf("LEFT JOIN %s AS e_u ON e.id = p.patent_id AND e_u.invalid_status = %d AND e_u.is_deleted = %d",
Joins(fmt.Sprintf("LEFT JOIN %s AS e_u ON e.id = e_u.expert_id AND e_u.invalid_status = %d AND e_u.is_deleted = %d",
model.NewUserExpert().TableName(), model.InvalidStatusForNot, model.DeleteStatusForNot)).
Joins(fmt.Sprintf(`LEFT JOIN (SELECT u.uid, SUBSTRING_INDEX(GROUP_CONCAT(p.title ORDER BY p.id DESC SEPARATOR '&&'), '&&', %d) AS title
FROM %s AS u LEFT JOIN %s AS p ON u.parent_id = p.id WHERE u.is_deleted = %d AND p.shelf_status = %d) AS p ON e_u.uid = p.uid`,
FROM %s AS u LEFT JOIN %s AS p ON u.patent_id = p.id WHERE u.is_deleted = %d AND p.shelf_status = %d GROUP BY u.uid) AS p ON e_u.uid = p.uid`,
limit, mUserPatent.TableName(), mSysPatent.TableName(), model.DeleteStatusForNot, model.ShelfStatusForUp)).
Where("e.id = ?", id)

View File

@ -33,13 +33,10 @@ func GetIndustryInfo(industry, mark, sep string) *Industry {
data, has := MemoryForIndustryInfo[v]
if !has {
data = "未知"
continue
}
out = append(out, data)
}
//return strings.Join(out, sep)
return &Industry{
Key: industry,
Value: strings.Join(out, sep),
}
return &Industry{Key: industry, Value: strings.Join(out, sep)}
}