feat : finish order
This commit is contained in:
67
app/Service/Common/Account/AccountOperateInterface.php
Normal file
67
app/Service/Common/Account/AccountOperateInterface.php
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user