mirror of
http://124.126.16.154:8888/singularity/hdk-pay.git
synced 2026-01-15 05:55:08 +08:00
feat(账户): 添加邮箱管理功能并重构账户仓库
- 创建 Email 值对象用于封装邮箱信息 - 扩展 AccountRepoInterface 添加邮箱管理方法 - 重命名 AccountBalanceRepo 为 AccountRepo 并实现邮箱功能 - 更新相关测试用例和配置以适配新功能
This commit is contained in:
@@ -12,7 +12,7 @@ use Carbon\Carbon;
|
||||
use Singularity\HDK\Pay\Application\Command\InitialAccountCmd;
|
||||
use Singularity\HDK\Pay\Domain\Account\Enum\PointType;
|
||||
|
||||
use Singularity\HDK\Pay\Infrastructure\Repository\AccountBalanceRepo;
|
||||
use Singularity\HDK\Pay\Infrastructure\Repository\AccountRepo;
|
||||
|
||||
use function Hyperf\Support\make;
|
||||
|
||||
@@ -41,12 +41,12 @@ it('should initial account balance', function () {
|
||||
type: PointType::from($point_balance['type']),
|
||||
basic: $point_balance['basic'],
|
||||
bonus: $point_balance['bonus'],
|
||||
expiredAt:$point_balance['expired_at'],
|
||||
expiredAt: $point_balance['expired_at'],
|
||||
version: $point_balance['version'],
|
||||
);
|
||||
}
|
||||
|
||||
$repo = make(AccountBalanceRepo::class);
|
||||
$repo = make(AccountRepo::class);
|
||||
$repo->initial($cmd);
|
||||
|
||||
expect(true)->toBeTrue();
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
*/
|
||||
|
||||
use Singularity\HDK\Pay\Domain\Account\Aggregate\Account\AccountBalance;
|
||||
use Singularity\HDK\Pay\Infrastructure\Repository\AccountBalanceRepo;
|
||||
use Singularity\HDK\Pay\Infrastructure\Repository\AccountRepo;
|
||||
|
||||
use function Hyperf\Support\make;
|
||||
|
||||
it('should be able to query account information', function () {
|
||||
$uid = '123456';
|
||||
$repo = make(AccountBalanceRepo::class);
|
||||
$repo = make(AccountRepo::class);
|
||||
$result = $repo->getAccount($uid);
|
||||
expect($result)
|
||||
->toBeInstanceOf(AccountBalance::class)
|
||||
|
||||
35
tests/Feature/Account/QueryEmailTest.php
Normal file
35
tests/Feature/Account/QueryEmailTest.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* QueryEmailTest.php@Pay
|
||||
*
|
||||
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
|
||||
* Powered by PhpStorm
|
||||
* Created on 2025/11/28
|
||||
*/
|
||||
|
||||
use Singularity\HDK\Pay\Domain\Account\ValueObject\Email;
|
||||
use Singularity\HDK\Pay\Infrastructure\Repository\AccountRepo;
|
||||
|
||||
use function Hyperf\Support\make;
|
||||
|
||||
it('should be able to get user email', function () {
|
||||
$uid = '123456';
|
||||
$repo = make(AccountRepo::class);
|
||||
$result = $repo->getEmail($uid);
|
||||
expect($result)
|
||||
->toBeInstanceOf(Email::class);
|
||||
});
|
||||
|
||||
it('should be able to update user email', function () {
|
||||
$uid = '123456';
|
||||
$newEmail = 'test@example.com';
|
||||
$repo = make(AccountRepo::class);
|
||||
|
||||
$email = new Email($newEmail);
|
||||
$repo->updateEmail($uid, $email);
|
||||
|
||||
// 验证更新后的邮箱
|
||||
$result = $repo->getEmail($uid);
|
||||
expect($result->getValue())->toBe($newEmail);
|
||||
});
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
use Singularity\HDK\Pay\Domain\Account\Aggregate\Account\PointsBalance;
|
||||
use Singularity\HDK\Pay\Domain\Account\Enum\PointType;
|
||||
use Singularity\HDK\Pay\Infrastructure\Repository\AccountBalanceRepo;
|
||||
use Singularity\HDK\Pay\Infrastructure\Repository\AccountRepo;
|
||||
|
||||
use function Hyperf\Support\make;
|
||||
|
||||
it('should query point balance', function () {
|
||||
$uid = 'cn3221';
|
||||
$repo = make(AccountBalanceRepo::class);
|
||||
$repo = make(AccountRepo::class);
|
||||
$point_balance = $repo->getPointBalance($uid, PointType::EMA);
|
||||
expect($point_balance)
|
||||
->toBeInstanceOf(PointsBalance::class)
|
||||
|
||||
Reference in New Issue
Block a user