123456789101112131415161718192021222324252627282930313233343536373839 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package user
- import (
- "context"
- "github.com/jaryhe/gopkgs/database"
- "github.com/jaryhe/gopkgs/logger"
- "github.com/jinzhu/gorm"
- "go.uber.org/zap"
- "smart-enterprise-management/errors"
- dbmodel "smart-enterprise-management/model"
- pb_v1 "smart-enterprise-management/pb/v1"
- )
- func CompanyApproveStatus(ctx context.Context, req *pb_v1.CompanyApproveStatusRequest)(reply *pb_v1.CompanyApproveStatusReply, err error) {
- if req.SocialCode == ""{
- return nil, errors.ParamsError
- }
- p := dbmodel.TCompany{}
- where := map[string]interface{}{"social_code":req.SocialCode}
- err = p.FindSort(database.DB(), where, "created_at desc")
- if err != nil && err != gorm.ErrRecordNotFound {
- logger.Error("Login",
- zap.String("err", err.Error()))
- return nil, errors.DataBaseError
- }
- if p.Id == 0 {
- return nil, errors.UserNotExistError
- }
- reply = &pb_v1.CompanyApproveStatusReply{
- Status:int32(p.Status),
- Feedback:p.Feedback,
- }
- if p.Status > 0 {
- reply.ApproveTime = p.ApproveTime.Format("2006-01-02 15:04:05")
- }
- return reply, nil
- }
|