feat : finish order

This commit is contained in:
2025-04-02 16:05:24 +08:00
parent 4620a0f1ba
commit ea374d578f
8 changed files with 498 additions and 7 deletions

View File

@@ -0,0 +1,67 @@
<?php
/**
* This service file is part of item.
*
* @author ctexthuang
* @contact ctexthuang@qq.com
*/
declare(strict_types=1);
namespace App\Service\Common\Account;
use App\Exception\ErrException;
use App\Model\UserAccount;
use Hyperf\Di\Annotation\Inject;
abstract class AccountOperateInterface
{
/**
* @var UserAccount
*/
#[Inject]
protected UserAccount $userAccountModel;
/**
* 检查num是否正确
* @param $num
* @return void
*/
protected function checkNum($num): void
{
if ($num < 0) throw new ErrException('数值错误');
}
/**
* @param int $userId
* @param string $value
* @param int $businessCode
* @param array $data
* @param string $description
* @return bool
*/
abstract public function inc(
int $userId,
string $value,
int $businessCode,
array $data,
string $description = ''
): bool;
/**
* @param int $userId
* @param string $value
* @param int $businessCode
* @param array $data
* @param string $description
* @return bool
*/
abstract public function dec(
int $userId,
string $value,
int $businessCode,
array $data,
string $description = ''
): bool;
}