mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-05-22 14:59:14 +08:00
Update Balance.php
This commit is contained in:
parent
d17af7c3d1
commit
19b71be233
@ -3,7 +3,6 @@
|
|||||||
namespace app\data\controller\api\auth;
|
namespace app\data\controller\api\auth;
|
||||||
|
|
||||||
use app\data\controller\api\Auth;
|
use app\data\controller\api\Auth;
|
||||||
use app\data\controller\User;
|
|
||||||
use app\data\service\UserService;
|
use app\data\service\UserService;
|
||||||
use think\admin\extend\CodeExtend;
|
use think\admin\extend\CodeExtend;
|
||||||
|
|
||||||
@ -60,7 +59,7 @@ class Balance extends Auth
|
|||||||
$map = ['id' => $data['uid'], 'deleted' => 0];
|
$map = ['id' => $data['uid'], 'deleted' => 0];
|
||||||
$user = $this->app->db->name('DataUser')->where($map)->find();
|
$user = $this->app->db->name('DataUser')->where($map)->find();
|
||||||
if (empty($user)) $this->error('目标用户不存在!');
|
if (empty($user)) $this->error('目标用户不存在!');
|
||||||
// 检测用户是否有足够的余额
|
// 检测余额否有足够
|
||||||
[$total, $used] = UserService::instance()->balance($this->uuid);
|
[$total, $used] = UserService::instance()->balance($this->uuid);
|
||||||
if ($data['amount'] > $total - $used) $this->error('可转账余额不足!');
|
if ($data['amount'] > $total - $used) $this->error('可转账余额不足!');
|
||||||
// 写入余额转账记录
|
// 写入余额转账记录
|
||||||
|
Loading…
x
Reference in New Issue
Block a user