123456789101112131415161718192021222324252627282930313233343536 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package staff
- import (
- "context"
- "github.com/jaryhe/gopkgs/database"
- "github.com/jaryhe/gopkgs/logger"
- "go.uber.org/zap"
- "smart-site-management/errors"
- "smart-site-management/model"
- "smart-site-management/pb/v1"
- )
- func LatestStaffData(ctx context.Context, req *v1.LatestStaffDataRequest) (reply *v1.LatestStaffDataReply, err error) {
- reply = &v1.LatestStaffDataReply{}
- if req.ProjectId == 0 {
- return nil,errors.ParamsError
- }
- p := model.TStaffAttendance{}
- result, err := p.Last(database.DB(), req.ProjectId)
- if err != nil {
- logger.Error("LatestStaffData",
- zap.String("err", err.Error()))
- return nil, errors.DataBaseError
- }
- reply.Group = result.Group
- reply.InOut = int32(result.InOut)
- reply.Name = result.Name
- reply.Photo = result.Photo
- reply.RecogTime = result.RecogTime
- reply.WorkNo = result.WorkNo
- reply.WorkType = result.WorkType
- return reply, nil
- }
|