feat:完善信息
This commit is contained in:
@ -91,16 +91,18 @@ func (c *Agent) Instance(tenantID uint64, name string, status int, page, pageSiz
|
|||||||
Total int `json:"total"`
|
Total int `json:"total"`
|
||||||
Complete int `json:"complete"`
|
Complete int `json:"complete"`
|
||||||
}{}
|
}{}
|
||||||
// 筛选处理需求信息
|
if v.Demand != "" {
|
||||||
for _, val := range strings.Split(v.Demand, ";") {
|
// 筛选处理需求信息
|
||||||
objs := strings.Split(val, ":")
|
for _, val := range strings.Split(v.Demand, ";") {
|
||||||
|
objs := strings.Split(val, ":")
|
||||||
|
|
||||||
count := utils.StringToInt(objs[1])
|
count := utils.StringToInt(objs[1])
|
||||||
|
|
||||||
if model2.TechnologyDemandServiceStatus(utils.StringToInt(objs[0])) == model2.TechnologyDemandServiceStatusForClosedQuestions {
|
if model2.TechnologyDemandServiceStatus(utils.StringToInt(objs[0])) == model2.TechnologyDemandServiceStatusForClosedQuestions {
|
||||||
demand.Complete = count
|
demand.Complete = count
|
||||||
|
}
|
||||||
|
demand.Total += count
|
||||||
}
|
}
|
||||||
demand.Total += count
|
|
||||||
}
|
}
|
||||||
list = append(list, &AgentInfo{
|
list = append(list, &AgentInfo{
|
||||||
ID: v.GetEncodeID(), Name: v.Name, Mobile: v.Mobile, Industrys: industrys,
|
ID: v.GetEncodeID(), Name: v.Name, Mobile: v.Mobile, Industrys: industrys,
|
||||||
|
@ -70,7 +70,7 @@ func (*Activity) ApplyDelete(c *gin.Context) {
|
|||||||
func (*Activity) Joins(c *gin.Context) {
|
func (*Activity) Joins(c *gin.Context) {
|
||||||
form := &struct {
|
form := &struct {
|
||||||
Title string `json:"title" form:"title"`
|
Title string `json:"title" form:"title"`
|
||||||
Status int `json:"status" form:"status"` // 1:未开始,2:进行中,3:已结束
|
Status int `json:"status" form:"status"`
|
||||||
api.PageForm
|
api.PageForm
|
||||||
}{}
|
}{}
|
||||||
if err := api.Bind(form)(c); err != nil {
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
@ -139,7 +139,7 @@ func (this *Instance) Handle() {
|
|||||||
&synchronized{iModel: model.NewTechnologyProject()}, &synchronized{iModel: model.NewTechnologyTopic()},
|
&synchronized{iModel: model.NewTechnologyProject()}, &synchronized{iModel: model.NewTechnologyTopic()},
|
||||||
&synchronized{iModel: model.NewTechnologyDemandService()}, &synchronized{iModel: model.NewTechnologyDemandServiceProgress()},
|
&synchronized{iModel: model.NewTechnologyDemandService()}, &synchronized{iModel: model.NewTechnologyDemandServiceProgress()},
|
||||||
&synchronized{iModel: model.NewTechnologyPatent()}, &synchronized{iModel: model.NewTechnologyPatentExpert()}, &synchronized{iModel: model.NewTechnologyPatentClassify()},
|
&synchronized{iModel: model.NewTechnologyPatent()}, &synchronized{iModel: model.NewTechnologyPatentExpert()}, &synchronized{iModel: model.NewTechnologyPatentClassify()},
|
||||||
&synchronized{iModel: model.NewServiceDocking()},
|
&synchronized{iModel: model.NewServiceDocking()}, &synchronized{iModel: model.NewServiceDemand()},
|
||||||
&synchronized{iModel: model.NewServiceMessage()}, &synchronized{iModel: model.NewServiceMessageLog()},
|
&synchronized{iModel: model.NewServiceMessage()}, &synchronized{iModel: model.NewServiceMessageLog()},
|
||||||
&synchronized{iModel: model.NewServiceSolutionCase()}, &synchronized{iModel: model.NewServiceSolutionCaseKind()},
|
&synchronized{iModel: model.NewServiceSolutionCase()}, &synchronized{iModel: model.NewServiceSolutionCaseKind()},
|
||||||
&synchronized{iModel: model.NewServiceInnovate()}, &synchronized{iModel: model.NewServiceInnovateKind()},
|
&synchronized{iModel: model.NewServiceInnovate()}, &synchronized{iModel: model.NewServiceInnovateKind()},
|
||||||
|
@ -5,16 +5,34 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// [1,2,3, 4, 5,6,7]
|
||||||
|
// 7
|
||||||
|
// mid: 3
|
||||||
func InArray(search, needle interface{}) bool {
|
func InArray(search, needle interface{}) bool {
|
||||||
val := reflect.ValueOf(needle)
|
val := reflect.ValueOf(needle)
|
||||||
|
|
||||||
kind := val.Kind()
|
kind := val.Kind()
|
||||||
|
|
||||||
if kind == reflect.Slice || kind == reflect.Array {
|
if kind == reflect.Slice || kind == reflect.Array {
|
||||||
for i := 0; i < val.Len(); i++ {
|
_length := val.Len()
|
||||||
|
|
||||||
|
if _length <= 0 {
|
||||||
|
return false
|
||||||
|
} else if _length == 1 {
|
||||||
|
return val.Index(0).Interface() == search
|
||||||
|
}
|
||||||
|
mid := _length >> 1
|
||||||
|
|
||||||
|
for i := 0; i < mid; i++ {
|
||||||
if val.Index(i).Interface() == search {
|
if val.Index(i).Interface() == search {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if val.Index((_length-1)-i).Interface() == search {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _length%2 > 0 {
|
||||||
|
return val.Index(mid+1).Interface() == search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -84,6 +84,10 @@ func StructToMap(s interface{}, m map[string]interface{}) {
|
|||||||
fieldNum := tRef.NumField()
|
fieldNum := tRef.NumField()
|
||||||
|
|
||||||
for index := 0; index < fieldNum; index++ {
|
for index := 0; index < fieldNum; index++ {
|
||||||
|
if mark, isExist := tRef.Field(index).Tag.Lookup("json"); isExist {
|
||||||
|
m[mark] = vRef.FieldByName(tRef.Field(index).Name).Interface()
|
||||||
|
continue
|
||||||
|
}
|
||||||
m[tRef.Field(index).Name] = vRef.FieldByName(tRef.Field(index).Name).Interface()
|
m[tRef.Field(index).Name] = vRef.FieldByName(tRef.Field(index).Name).Interface()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user