This commit is contained in:
parent
fa0cf7e41c
commit
ecd3a90dcd
|
|
@ -2,7 +2,17 @@ namespace VendingMachine.Domain.Entities;
|
||||||
|
|
||||||
public class User
|
public class User
|
||||||
{
|
{
|
||||||
public string Uid { get; set; } = Guid.NewGuid().ToString("N")[..12];
|
private static readonly Random _random = new();
|
||||||
|
|
||||||
|
public string Uid { get; set; } = GenerateUid();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成6位随机数字UID,不以0开头(100000-999999)
|
||||||
|
/// </summary>
|
||||||
|
public static string GenerateUid()
|
||||||
|
{
|
||||||
|
return _random.Next(100000, 999999).ToString();
|
||||||
|
}
|
||||||
public string Phone { get; set; } = string.Empty;
|
public string Phone { get; set; } = string.Empty;
|
||||||
public string AreaCode { get; set; } = string.Empty;
|
public string AreaCode { get; set; } = string.Empty;
|
||||||
public string Nickname { get; set; } = string.Empty;
|
public string Nickname { get; set; } = string.Empty;
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,16 @@ public class UserService : IUserService
|
||||||
|
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
|
// 生成唯一的6位UID
|
||||||
|
string uid;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
uid = User.GenerateUid();
|
||||||
|
} while (await _db.Users.IgnoreQueryFilters().AnyAsync(u => u.Uid == uid));
|
||||||
|
|
||||||
user = new User
|
user = new User
|
||||||
{
|
{
|
||||||
|
Uid = uid,
|
||||||
Phone = request.Phone,
|
Phone = request.Phone,
|
||||||
AreaCode = request.AreaCode,
|
AreaCode = request.AreaCode,
|
||||||
Nickname = IUserService.GenerateDefaultNickname()
|
Nickname = IUserService.GenerateDefaultNickname()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="login-page">
|
<view class="login-page">
|
||||||
<!-- 全屏背景图 -->
|
<!-- 全屏背景图 -->
|
||||||
<image class="bg-image" src="/static/login_bg.png" mode="aspectFill" />
|
<image class="bg-image" src="/static/logo_bg.png" mode="aspectFill" />
|
||||||
|
|
||||||
<!-- 自定义导航栏 -->
|
<!-- 自定义导航栏 -->
|
||||||
<view class="custom-nav" :style="{ paddingTop: statusBarHeight + 'px' }">
|
<view class="custom-nav" :style="{ paddingTop: statusBarHeight + 'px' }">
|
||||||
|
|
|
||||||
BIN
mobile/static/logo_bg.png
Normal file
BIN
mobile/static/logo_bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
Loading…
Reference in New Issue
Block a user