| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- package logic
- import (
- "context"
- "git.i2edu.net/i2/go-zero/core/stores/sqlx"
- "git.i2edu.net/i2/i2-bill-api/internal/utils"
- "git.i2edu.net/i2/i2-bill-api/model"
- "time"
- "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 PartTimeUserUpdateLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewPartTimeUserUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) PartTimeUserUpdateLogic {
- return PartTimeUserUpdateLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *PartTimeUserUpdateLogic) PartTimeUserUpdate(req types.PartTimeUserAddRequest) (*types.Response, error) {
- // todo: add your logic here and delete this line
- userId := utils.GetUserIdByJwt(l.ctx)
- var bean = new(model.I2billMktPartTimeUser)
- err := l.svcCtx.SqlConn.QueryRow(bean, "select * from i2bill_mkt_part_time_user where user_id = ? and del_flag = 0", userId)
- if err != nil && err != sqlx.ErrNotFound {
- return &types.Response{Code: 500, Msg: err.Error(), Data: nil}, nil
- }
- if bean.Id == 0 {
- return &types.Response{Code: 500, Msg: "你还没有申请成为兼职人员", Data: nil}, nil
- }
- if bean.Id != 0 {
- if bean.CheckState == 54 {
- return &types.Response{Code: 500, Msg: "你的申请兼职人员的个人信息已提交,请等待审核!", Data: nil}, nil
- }
- if bean.CheckState == 57 {
- return &types.Response{Code: 500, Msg: "你已经是兼职人员:", Data: nil}, nil
- }
- }
- bean.LastUpdateTime = time.Now()
- bean.CheckState = 54
- bean.CheckDesc = ""
- bean.CityId = req.CityId
- bean.Sex = req.Sex
- bean.Name = req.Name
- bean.LastUpdateBy = userId
- err = model.NewI2billMktPartTimeUserModel(l.svcCtx.SqlConn).Update(*bean)
- if err != nil {
- return &types.Response{Code: 500, Msg: err.Error(), Data: nil}, nil
- }
- return &types.Response{Code: 200, Msg: "", Data: nil}, nil
- }
|