| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- package part_time_user
- import (
- "context"
- "git.i2edu.net/i2/go-zero/core/stores/sqlx"
- "git.i2edu.net/i2/i2-bill-api/model"
- "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 PartTimeUserGetLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewPartTimeUserGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) PartTimeUserGetLogic {
- return PartTimeUserGetLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *PartTimeUserGetLogic) PartTimeUserGet() (*types.Response, error) {
- // todo: add your logic here and delete this line
- userId := l.svcCtx.GetUserIdByJwt(l.ctx)
- partTimeUser := new(model.I2billMktPartTimeUser)
- err := l.svcCtx.SqlConn.QueryRow(partTimeUser, "select * from i2bill_mkt_part_time_user where user_id = ? and del_flag = 0", userId)
- if err == sqlx.ErrNotFound {
- return &types.Response{Code: 500, Msg: "你还没有申请成为兼职人员!", Data: nil}, nil
- }
- if err != nil {
- return &types.Response{Code: 500, Msg: err.Error(), Data: nil}, nil
- }
- return &types.Response{Code: 200, Msg: "", Data: partTimeUser}, nil
- }
|