lingling
2025-03-14 6b5c0022a6fdf5c3026650d231530ff6b32a72b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using LifePayment.Application.Contracts;
using LifePayment.Domain.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using ZeroD.Util;
 
namespace HumanResourcesServices.Application
{
    public class AccountService : ApplicationService, IAccountService
    {
 
 
        private readonly IRepository<LifePayUser, Guid> _lifePayUserRepository;
 
 
        public AccountService(
               IRepository<LifePayUser, Guid> lifePayUserRepository
)
        {
            _lifePayUserRepository = lifePayUserRepository;
        }
 
        #region 查询
 
 
 
        #endregion
 
        #region 操作
 
 
 
        #region life pay
 
        /// <summary>
        /// 手机验证码登录
        /// 版本说明:使用验证码管理去校验和失效对应业务的验证码
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        /// <exception cref="UserFriendlyException"></exception>
        public async Task<Guid> LifePayPhoneMesssageCodeLogin(LifePayPhoneMesssageCodeLoginInput input)
        {
            //var vcodeType = VerificationCodeBusinessTypeEnum.LifePayPhoneMesssageCodeLogin;
 
            //var checkResult = await _verificationCodeManager.CheckVerificationCodeByBusinessType(vcodeType,
            //                                                                                     input.PhoneNumber,
            //                                                                                     input.Code,
            //                                                                                     true);
            //CheckExtensions.IfTrueThrowUserFriendlyException(!checkResult,
            //                                                 CustomeErrorMessage.SometingWrongOrSometing, "验证码", "已失效");
 
            var lifeUser = await _lifePayUserRepository.Where(x => x.PhoneNumber == input.PhoneNumber).FirstOrDefaultAsync();
            if (lifeUser == null)
            {
                lifeUser = new LifePayUser()
                {
                    Id = GuidGenerator.Create(),
                    PhoneNumber = input.PhoneNumber,
                    LastLoginTime = DateTime.Now
                };
 
                await _lifePayUserRepository.InsertAsync(lifeUser);
            }
            else
            {
                lifeUser.LastLoginTime = DateTime.Now;
                await _lifePayUserRepository.UpdateAsync(lifeUser);
            }
 
            return lifeUser.Id;
        }
 
        #endregion
 
        #endregion
 
     
    }
}