123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- package logic
- import (
- "app.yhyue.com/moapp/jyInfo/rpc/model"
- "app.yhyue.com/moapp/jyInfo/rpc/util"
- se "app.yhyue.com/moapp/jybase/encrypt"
- "context"
- "strings"
- "app.yhyue.com/moapp/jybase/common"
- "app.yhyue.com/moapp/jyInfo/rpc/manager/internal/svc"
- "app.yhyue.com/moapp/jyInfo/rpc/manager/type/manager"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type InfoDetailLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewInfoDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *InfoDetailLogic {
- return &InfoDetailLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- //InfoDetail 信息详情
- func (l *InfoDetailLogic) InfoDetail(in *manager.InfoDetailReq) (*manager.InfoDetailResp, error) {
- //userid := in.UserId
- var (
- dataRes manager.InfoDetailResp
- )
- //appid := in.AppId
- var (
- //公用信息
- infoData manager.InfoData
- applyInfo manager.ApplyInfo //申请人信息
- review manager.Review //审核信息
- contact manager.Contact //联系人信息
- sensitive manager.Sensitive //敏感词信息
- )
- data := make(map[string]interface{})
- msgId := se.SE.DecodeString(in.MsgId)
- switch in.Type {
- case 1, 2:
- if _d := model.Mysql.SelectBySql(`SELECT a.*,b.title as relatedTitle FROM information a
- LEFT JOIN information b on (a.related_id =b.id) where a.id =? and a.app_id = `+util.StrFormat(in.AppId), msgId); _d != nil && len(*_d) > 0 {
- data = (*_d)[0]
- var (
- related manager.Related
- )
- infoData.Code = common.InterfaceToStr(data["project_code"])
- infoData.Industry = strings.Split(common.InterfaceToStr(data["industry"]), ",")
- infoData.Buyer = common.InterfaceToStr(data["buyer"])
- infoData.Budget = common.Float64All(data["budget"])
- infoData.Winner = common.InterfaceToStr(data["winner"])
- infoData.Amount = common.Float64All(data["amount"])
- infoData.Detail = common.InterfaceToStr(data["detail"])
- if data["related_id"] != nil && common.IntAll(data["related_id"]) != 0 {
- related.Id = se.SE.EncodeString(common.InterfaceToStr(data["related_id"])) //关联信息id加密
- related.Title = common.InterfaceToStr(data["relatedTitle"])
- infoData.Related = &related
- }
- } else {
- dataRes.ErrCode = -1
- dataRes.ErrMsg = "查询数据失败"
- goto env
- }
- case 3:
- if _d := model.Mysql.SelectBySql(`SELECT * FROM supply_info where id = ? and app_id = `+util.StrFormat(in.AppId), msgId); _d != nil && len(*_d) > 0 {
- data = (*_d)[0]
- infoData.ValidityTime = common.InterfaceToStr(data["validity_time"])
- } else {
- dataRes.ErrCode = -1
- dataRes.ErrMsg = "查询数据失败"
- goto env
- }
- default:
- dataRes.ErrCode = -1
- dataRes.ErrMsg = "数据类型有误"
- return &dataRes, nil
- }
- infoData.Province = common.InterfaceToStr(data["province"])
- infoData.City = common.InterfaceToStr(data["city"])
- infoData.AppId = common.InterfaceToStr(data["app_id"])
- infoData.Title = common.InterfaceToStr(data["title"])
- infoData.MsgType = common.Int64All(data["type"])
- infoData.Detail = common.InterfaceToStr(data["detail"])
- infoData.Attach = common.InterfaceToStr(data["attach"])
- infoData.PublishStatus = common.Int64All(data["published"])
- infoData.Phone = common.InterfaceToStr(data["phone"])
- applyInfo.UserId = common.InterfaceToStr(data["user_id"]) //用户id加密
- applyInfo.Time = common.InterfaceToStr(data["create_time"])
- applyInfo.EntId = common.Int64All(data["ent_id"])
- applyInfo.Phone = common.InterfaceToStr(data["phone"])
- infoData.ApplyInfo = &applyInfo
- review.Status = common.Int64All(data["status"])
- review.Time = common.InterfaceToStr(data["review_time"])
- review.Detail = common.InterfaceToStr(data["review_desc"])
- review.Name = common.InterfaceToStr(data["review_name"])
- infoData.Review = &review
- contact.Name = common.InterfaceToStr(data["contact_person"])
- contact.Phone = common.InterfaceToStr(data["contact_phone"])
- contact.Overt = common.Int64All(data["contact_overt"])
- infoData.Contact = &contact
- sensitive.Detail = common.InterfaceToStr(data["sensitive_detail"])
- sensitive.Title = common.InterfaceToStr(data["sensitive_title"])
- sensitive.Attach = common.InterfaceToStr(data["sensitive_attach"])
- infoData.Sensitive = &sensitive
- dataRes.Data = &infoData
- env:
- return &dataRes, nil
- }
|