fix 分红点小于0的bug

main
fengxinyhyl 8 months ago
parent fca7a59073
commit 5cd3beb5cb
  1. 22
      app/common/repositories/user/UserAssetsRepository.php

@ -207,6 +207,9 @@ class UserAssetsRepository extends BaseRepository
$share = floor(($shareStatistics->current - $shareStatistics->last_point) / $config['share_get_welfare_limit']); $share = floor(($shareStatistics->current - $shareStatistics->last_point) / $config['share_get_welfare_limit']);
$shareStatistics->last_point = $shareStatistics->last_point + $config['share_get_welfare_limit'] * $share; $shareStatistics->last_point = $shareStatistics->last_point + $config['share_get_welfare_limit'] * $share;
$shareStatistics->save(); $shareStatistics->save();
if($share > $assets['share_point']){
$share = $assets['share_point'];
}
$logList[] = array( $logList[] = array(
'uid' => $item['uid'], 'uid' => $item['uid'],
'asset_type' => UserAssetsLogRepository::ASSET_TYPE_SHARE_POINT, 'asset_type' => UserAssetsLogRepository::ASSET_TYPE_SHARE_POINT,
@ -237,7 +240,8 @@ class UserAssetsRepository extends BaseRepository
* @author zhangkxiang * @author zhangkxiang
* @editor * @editor
*/ */
public function consumeToShare($uid, $count){ public function consumeToShare($uid, $count)
{
$config = $this->getConfig(); $config = $this->getConfig();
$assets = $this->assets($uid); $assets = $this->assets($uid);
if ($assets['consume'] < $config['consume_to_share'] * $count) { if ($assets['consume'] < $config['consume_to_share'] * $count) {
@ -277,7 +281,8 @@ class UserAssetsRepository extends BaseRepository
* @author zhangkxiang * @author zhangkxiang
* @editor * @editor
*/ */
public function sendHuitong($uid, $phone, $count){ public function sendHuitong($uid, $phone, $count)
{
$assets = $this->assets($uid); $assets = $this->assets($uid);
if ($assets['huitong'] < $count) { if ($assets['huitong'] < $count) {
throw new \Exception('惠通宝不足'); throw new \Exception('惠通宝不足');
@ -322,7 +327,6 @@ class UserAssetsRepository extends BaseRepository
} }
/** /**
* notes * notes
* @param $uid * @param $uid
@ -335,7 +339,8 @@ class UserAssetsRepository extends BaseRepository
* @author zhangkxiang * @author zhangkxiang
* @editor * @editor
*/ */
public function huitongToConsume($uid, $count){ public function huitongToConsume($uid, $count)
{
$current = app(HuitongRepository::class)->getCurrent(); $current = app(HuitongRepository::class)->getCurrent();
$assets = $this->assets($uid); $assets = $this->assets($uid);
if ($assets['huitong'] < $count) { if ($assets['huitong'] < $count) {
@ -372,7 +377,8 @@ class UserAssetsRepository extends BaseRepository
* @author zhangkxiang * @author zhangkxiang
* @editor * @editor
*/ */
public function sign($uid, $consume){ public function sign($uid, $consume)
{
$logList = array(); $logList = array();
$logList[] = array( $logList[] = array(
'uid' => $uid, 'uid' => $uid,
@ -387,11 +393,13 @@ class UserAssetsRepository extends BaseRepository
} }
public function getSum($field){ public function getSum($field)
{
return $this->dao->getSum($field); return $this->dao->getSum($field);
} }
public function getWhereCount($where){ public function getWhereCount($where)
{
return $this->dao->getWhereCount($where); return $this->dao->getWhereCount($where);
} }
} }

Loading…
Cancel
Save