|
|
|
@ -62,7 +62,7 @@ class UserAssetsRepository extends BaseRepository |
|
|
|
|
$item = $this->dao->get($uid); |
|
|
|
|
if ($item) { |
|
|
|
|
return $item->toArray(); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
$ret = array( |
|
|
|
|
'uid' => $uid, |
|
|
|
|
'consume' => 0.00, |
|
|
|
@ -203,10 +203,13 @@ class UserAssetsRepository extends BaseRepository |
|
|
|
|
$shareStatistics = $this->shareDao->findOrCreate(['uid' => $item['uid']]); |
|
|
|
|
$shareStatistics->current = $shareStatistics->current + $welfare; |
|
|
|
|
$shareStatistics->save(); |
|
|
|
|
if($shareStatistics->current - $shareStatistics->last_point > $config['share_get_welfare_limit'] and $config['share_get_welfare_limit']){ |
|
|
|
|
if ($shareStatistics->current - $shareStatistics->last_point > $config['share_get_welfare_limit'] and $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->save(); |
|
|
|
|
if($share > $assets['share_point']){ |
|
|
|
|
$share = $assets['share_point']; |
|
|
|
|
} |
|
|
|
|
$logList[] = array( |
|
|
|
|
'uid' => $item['uid'], |
|
|
|
|
'asset_type' => UserAssetsLogRepository::ASSET_TYPE_SHARE_POINT, |
|
|
|
@ -237,10 +240,11 @@ class UserAssetsRepository extends BaseRepository |
|
|
|
|
* @author zhangkxiang |
|
|
|
|
* @editor |
|
|
|
|
*/ |
|
|
|
|
public function consumeToShare($uid, $count){ |
|
|
|
|
public function consumeToShare($uid, $count) |
|
|
|
|
{ |
|
|
|
|
$config = $this->getConfig(); |
|
|
|
|
$assets = $this->assets($uid); |
|
|
|
|
if($assets['consume'] < $config['consume_to_share'] * $count){ |
|
|
|
|
if ($assets['consume'] < $config['consume_to_share'] * $count) { |
|
|
|
|
throw new \Exception('消费积分不足'); |
|
|
|
|
} |
|
|
|
|
$logList = array(); |
|
|
|
@ -277,9 +281,10 @@ class UserAssetsRepository extends BaseRepository |
|
|
|
|
* @author zhangkxiang |
|
|
|
|
* @editor |
|
|
|
|
*/ |
|
|
|
|
public function sendHuitong($uid, $phone, $count){ |
|
|
|
|
public function sendHuitong($uid, $phone, $count) |
|
|
|
|
{ |
|
|
|
|
$assets = $this->assets($uid); |
|
|
|
|
if($assets['huitong'] < $count){ |
|
|
|
|
if ($assets['huitong'] < $count) { |
|
|
|
|
throw new \Exception('惠通宝不足'); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
@ -287,7 +292,7 @@ class UserAssetsRepository extends BaseRepository |
|
|
|
|
*/ |
|
|
|
|
$userRepository = app()->make(UserRepository::class); |
|
|
|
|
$toUser = $userRepository->getUserByPhone($phone); |
|
|
|
|
if(!$toUser){ |
|
|
|
|
if (!$toUser) { |
|
|
|
|
throw new \Exception('用户不存在'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -322,7 +327,6 @@ class UserAssetsRepository extends BaseRepository |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* notes |
|
|
|
|
* @param $uid |
|
|
|
@ -335,10 +339,11 @@ class UserAssetsRepository extends BaseRepository |
|
|
|
|
* @author zhangkxiang |
|
|
|
|
* @editor |
|
|
|
|
*/ |
|
|
|
|
public function huitongToConsume($uid, $count){ |
|
|
|
|
public function huitongToConsume($uid, $count) |
|
|
|
|
{ |
|
|
|
|
$current = app(HuitongRepository::class)->getCurrent(); |
|
|
|
|
$assets = $this->assets($uid); |
|
|
|
|
if($assets['huitong'] < $count){ |
|
|
|
|
if ($assets['huitong'] < $count) { |
|
|
|
|
throw new \Exception('惠通宝不足'); |
|
|
|
|
} |
|
|
|
|
$logList = array(); |
|
|
|
@ -372,7 +377,8 @@ class UserAssetsRepository extends BaseRepository |
|
|
|
|
* @author zhangkxiang |
|
|
|
|
* @editor |
|
|
|
|
*/ |
|
|
|
|
public function sign($uid, $consume){ |
|
|
|
|
public function sign($uid, $consume) |
|
|
|
|
{ |
|
|
|
|
$logList = array(); |
|
|
|
|
$logList[] = array( |
|
|
|
|
'uid' => $uid, |
|
|
|
@ -387,11 +393,13 @@ class UserAssetsRepository extends BaseRepository |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getSum($field){ |
|
|
|
|
public function getSum($field) |
|
|
|
|
{ |
|
|
|
|
return $this->dao->getSum($field); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getWhereCount($where){ |
|
|
|
|
public function getWhereCount($where) |
|
|
|
|
{ |
|
|
|
|
return $this->dao->getWhereCount($where); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|