|
@@ -34,6 +34,7 @@ func (l *InfoListLogic) InfoList(in *manager.InfoListReq) (*manager.InfoListResp
|
|
|
query []string
|
|
|
queryInfo string
|
|
|
count int64
|
|
|
+ results = []*manager.InfoList{}
|
|
|
)
|
|
|
if in.MsgType != 0 {
|
|
|
query = append(query, `type=`+common.InterfaceToStr(in.MsgType)+` `)
|
|
@@ -94,36 +95,30 @@ func (l *InfoListLogic) InfoList(in *manager.InfoListReq) (*manager.InfoListResp
|
|
|
allData := model.Mysql.SelectBySql(`SELECT a.id,a.type,a.status,a.phone,a.contact_person,a.contact_person,a.title,a.create_time from (SELECT id,type,status,phone,contact_person,contact_phone,title,create_time from information `+queryInfo+`
|
|
|
union all
|
|
|
SELECT id,type,status,phone,contact_person,contact_phone,title,create_time from supply_info `+queryInfo+` ) a order by a.create_time limit ?,? `, offset, in.PageSize)
|
|
|
- if allData == nil || len(*allData) == 0 {
|
|
|
- return &manager.InfoListResp{
|
|
|
- ErrCode: 0,
|
|
|
- ErrMsg: "暂无数据",
|
|
|
- Data: nil,
|
|
|
- }, nil
|
|
|
- }
|
|
|
-
|
|
|
- results := []*manager.InfoList{}
|
|
|
- for _, v := range *allData {
|
|
|
- res := manager.InfoList{}
|
|
|
- var contact manager.Contact
|
|
|
- if common.IntAll(v["type"]) == 1 || common.IntAll(v["type"]) == 2 {
|
|
|
- res.Checked = model.Sensitive.Information
|
|
|
- } else {
|
|
|
- res.Checked = model.Sensitive.SupplyInfo
|
|
|
+ if allData != nil && len(*allData) > 0 {
|
|
|
+ for _, v := range *allData {
|
|
|
+ res := manager.InfoList{}
|
|
|
+ var contact manager.Contact
|
|
|
+ if common.IntAll(v["type"]) == 1 || common.IntAll(v["type"]) == 2 {
|
|
|
+ res.Checked = model.Sensitive.Information
|
|
|
+ } else {
|
|
|
+ res.Checked = model.Sensitive.SupplyInfo
|
|
|
+ }
|
|
|
+ res.Id = se.SE.EncodeString(common.InterfaceToStr(v["id"])) //信息id加密
|
|
|
+ res.Title = common.InterfaceToStr(v["title"])
|
|
|
+ res.MsgType = common.Int64All(v["type"])
|
|
|
+ res.Phone = common.InterfaceToStr(v["phone"])
|
|
|
+ res.ReviewStatus = common.Int64All(v["status"])
|
|
|
+ res.Published = common.Int64All(v["published"])
|
|
|
+ res.IsDel = common.Int64All(v["published"])
|
|
|
+ res.ApplyTime = common.InterfaceToStr(v["create_time"])
|
|
|
+ contact.Name = common.InterfaceToStr(v["contact_person"])
|
|
|
+ contact.Phone = common.InterfaceToStr(v["contact_phone"])
|
|
|
+ res.Contact = &contact
|
|
|
+ results = append(results, &res)
|
|
|
}
|
|
|
- res.Id = se.SE.EncodeString(common.InterfaceToStr(v["id"])) //信息id加密
|
|
|
- res.Title = common.InterfaceToStr(v["title"])
|
|
|
- res.MsgType = common.Int64All(v["type"])
|
|
|
- res.Phone = common.InterfaceToStr(v["phone"])
|
|
|
- res.ReviewStatus = common.Int64All(v["status"])
|
|
|
- res.Published = common.Int64All(v["published"])
|
|
|
- res.IsDel = common.Int64All(v["published"])
|
|
|
- res.ApplyTime = common.InterfaceToStr(v["create_time"])
|
|
|
- contact.Name = common.InterfaceToStr(v["contact_person"])
|
|
|
- contact.Phone = common.InterfaceToStr(v["contact_phone"])
|
|
|
- res.Contact = &contact
|
|
|
- results = append(results, &res)
|
|
|
}
|
|
|
+
|
|
|
data := manager.Data{}
|
|
|
data.Count = count
|
|
|
data.List = results
|