mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-05-23 15:21:36 +08:00
修改余额
This commit is contained in:
parent
19b7ff8f7c
commit
afb4828477
@ -74,7 +74,7 @@ class UserBalance extends Controller
|
|||||||
protected function _form_filter(array &$data)
|
protected function _form_filter(array &$data)
|
||||||
{
|
{
|
||||||
if (empty($data['code'])) {
|
if (empty($data['code'])) {
|
||||||
$data['code'] = CodeExtend::uniqidDate('16', 'B');
|
$data['code'] = CodeExtend::uniqidDate('20', 'B');
|
||||||
}
|
}
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$data['create_by'] = AdminService::instance()->getUserId();
|
$data['create_by'] = AdminService::instance()->getUserId();
|
||||||
|
@ -93,8 +93,8 @@ class UserUpgradeService extends Service
|
|||||||
*/
|
*/
|
||||||
public function syncBalance(int $uuid, array $nots = []): array
|
public function syncBalance(int $uuid, array $nots = []): array
|
||||||
{
|
{
|
||||||
$total = abs($this->app->db->name('DataUserBalance')->where("uid='{$uuid}' and status=1 and amount>0 and deleted=0")->sum('amount'));
|
$total = abs($this->app->db->name('DataUserBalance')->where("uid='{$uuid}' and amount>0 and deleted=0")->sum('amount'));
|
||||||
$count = abs($this->app->db->name('DataUserBalance')->where("uid='{$uuid}' and status=1 and amount<0 and deleted=0")->sum('amount'));
|
$count = abs($this->app->db->name('DataUserBalance')->where("uid='{$uuid}' and amount<0 and deleted=0")->sum('amount'));
|
||||||
if (empty($nots)) {
|
if (empty($nots)) {
|
||||||
$this->app->db->name('DataUser')->where(['id' => $uuid])->update(['balance_total' => $total, 'balance_used' => $count]);
|
$this->app->db->name('DataUser')->where(['id' => $uuid])->update(['balance_total' => $total, 'balance_used' => $count]);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user