1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package mk_qr
- import (
- "context"
- "git.i2edu.net/i2/i2-bill-api/model"
- "net/http"
- "strings"
- "git.i2edu.net/i2/i2-bill-api/internal/svc"
- "git.i2edu.net/i2/i2-bill-api/internal/types"
- "git.i2edu.net/i2/go-zero/core/logx"
- )
- type MktQrGetLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewMktQrGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) MktQrGetLogic {
- return MktQrGetLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *MktQrGetLogic) MktQrGet(r *http.Request) (*types.Response, error) {
- // todo: add your logic here and delete this line
- r.ParseForm()
- mk_id := r.Form.Get("mk_id")
- bean := new(model.I2billMktQr)
- _, err := l.svcCtx.DB.Where("mk_id = ? and del_flag = 0", mk_id).Get(bean)
- if err != nil {
- return &types.Response{500, err.Error(), nil}, nil
- }
- if bean.Qr != "" {
- bean.Qr = strings.TrimLeft(bean.Qr, "/")
- domain := strings.TrimRight(l.svcCtx.Config.AliYunOss.FileUrl, "/")
- bean.Qr = domain + "/" + bean.Qr
- }
- return &types.Response{200, "", bean}, nil
- }
|