Skip to content

Commit

Permalink
提现中的问题 #2807 && 点击门店管理里的佣金明细按钮报错 #2809
Browse files Browse the repository at this point in the history
  • Loading branch information
gbzhurui authored and twinh committed Feb 12, 2017
1 parent d4b0f24 commit 0c958ae
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/Service/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,37 @@ public function getAccountTypeName()
return $this->accountTypeNames[$this['accountType']];
}

/**
* 待审核和待发放的总金额
* @param User $user
* @return string
*/
public function getFrozenMoney(User $user = null)
{
$user || $user = wei()->curUser;

$toAuditMoney = wei()->transaction()
->curApp()
->select('sum(amount) as amountSum')
->andWhere(['type' => Transaction::TYPE_WITHDRAWAL])
->andWhere(['userId' => $user['id']])
->andWhere(['audit' => 0])
->fetch();

$toTransferMoney = wei()->transaction()
->curApp()
->select('sum(amount) as amountSum')
->andWhere(['type' => Transaction::TYPE_WITHDRAWAL])
->andWhere(['userId' => $user['id']])
->andWhere([
'audit' => 1,
'passed' => 0
])
->fetch();

return sprintf('%.2f', abs($toAuditMoney['amountSum'] + $toTransferMoney['amountSum']));
}

/**
* 获取用户的可提款金额
*
Expand Down

0 comments on commit 0c958ae

Please sign in to comment.