12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- package logic
- import (
- "app.yhyue.com/moapp/jyInfo/rpc/consumer/consumerclient"
- "context"
- "net/http"
- "app.yhyue.com/moapp/jybase/common"
- "app.yhyue.com/moapp/jyInfo/api/internal/svc"
- "app.yhyue.com/moapp/jyInfo/api/internal/types"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type PubSupplyInfoLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- r *http.Request
- }
- func NewPubSupplyInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *PubSupplyInfoLogic {
- return &PubSupplyInfoLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- r: r,
- }
- }
- func (l *PubSupplyInfoLogic) PubSupplyInfo(req *types.PubInfoReq) (resp *types.CommonRes, err error) {
- var contact consumerclient.Contact
- contact.Person = req.Contact.Person
- contact.Phone = req.Contact.Phone
- contact.Overt = req.Contact.Overt
- pubinfo, err1 := l.svcCtx.Consumer.PublishInfo(l.ctx, &consumerclient.PublishInfoReq{
- UserId: req.UserId,
- EntId: req.EntId,
- Title: req.Title,
- MsgType: req.MsgType,
- RelatedId: req.RelatedId,
- Code: req.Code,
- Province: req.Province,
- City: req.City,
- Industry: req.Industry,
- Buyer: req.Buyer,
- Budget: common.Float64All(req.Budget),
- Winner: req.Winner,
- Amount: common.Float64All(req.Amount),
- Detail: req.Detail,
- Attach: common.MapToJson(req.Attach),
- Contact: &contact,
- AppId: req.AppId,
- Phone: req.Phone,
- Deadline: req.ValidityTime,
- })
- if err1 != nil {
- return &types.CommonRes{
- Err_code: -1,
- Err_msg: "错误",
- Data: nil,
- }, nil
- }
- return &types.CommonRes{
- Err_code: common.IntAll(pubinfo.ErrCode),
- Err_msg: pubinfo.ErrMsg,
- Data: pubinfo.PublishId,
- }, nil
- }
|