|
|
@ -33,13 +33,14 @@ class UserAssetsRepository extends BaseRepository |
|
|
|
$this->dao = $dao; |
|
|
|
$this->dao = $dao; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getConfig(){ |
|
|
|
public function getConfig() |
|
|
|
|
|
|
|
{ |
|
|
|
// 配置信息 |
|
|
|
// 配置信息 |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @var GroupDataRepository $groupDataRepository |
|
|
|
* @var GroupDataRepository $groupDataRepository |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
$groupDataRepository = app()->make(GroupDataRepository::class); |
|
|
|
$groupDataRepository = app()->make(GroupDataRepository::class); |
|
|
|
$config = $groupDataRepository->getGroupDataLst(0, 100, 1, 100); |
|
|
|
$config = $groupDataRepository->getGroupDataLst(0, 100, 1, 100); |
|
|
|
return array_column($config['list'], "value", 'key'); |
|
|
|
return array_column($config['list'], "value", 'key'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -153,33 +154,34 @@ class UserAssetsRepository extends BaseRepository |
|
|
|
* @author zhangkxiang |
|
|
|
* @author zhangkxiang |
|
|
|
* @editor |
|
|
|
* @editor |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function sharePoint(){ |
|
|
|
public function sharePoint() |
|
|
|
|
|
|
|
{ |
|
|
|
$config = $this->getConfig(); |
|
|
|
$config = $this->getConfig(); |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @var StoreOrderBaseRepository $orderBase |
|
|
|
* @var StoreOrderBaseRepository $orderBase |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
$orderBase = app()->make(StoreOrderBaseRepository::class); |
|
|
|
$orderBase = app()->make(StoreOrderBaseRepository::class); |
|
|
|
$count = $orderBase->getTotalBase(date('Y-m-d', strtotime('-1day'))); |
|
|
|
$count = $orderBase->getTotalBase(date('Y-m-d', strtotime('-1day'))); |
|
|
|
if(empty($count)){ |
|
|
|
if (empty($count)) { |
|
|
|
return ; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
$shareData = $this->dao->getShareData(); |
|
|
|
$shareData = $this->dao->getShareData(); |
|
|
|
if(!$shareData['total']){ |
|
|
|
if (!$shareData['total']) { |
|
|
|
return ; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$base = round($config['share_award'] * $count / 100, 2); |
|
|
|
$base = round($config['share_award'] * $count / 100, 2); |
|
|
|
if($base < 0.01){ |
|
|
|
if ($base < 0.01) { |
|
|
|
$base = 0.01; |
|
|
|
$base = 0.01; |
|
|
|
} |
|
|
|
} |
|
|
|
$logList = array(); |
|
|
|
$logList = array(); |
|
|
|
foreach ($shareData['list'] as $item){ |
|
|
|
foreach ($shareData['list'] as $item) { |
|
|
|
$welfare = $base / $shareData['total'] * $item['share_point']; |
|
|
|
$welfare = $base / $shareData['total'] * $item['share_point']; |
|
|
|
if($welfare < 0.01){ |
|
|
|
if ($welfare < 0.01) { |
|
|
|
$welfare = 0.01; |
|
|
|
$welfare = 0.01; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$logList[] = array( |
|
|
|
$logList[] = array( |
|
|
|
'uid' => $item['uid'], |
|
|
|
'uid' => $item['uid'], |
|
|
|
'asset_type' => UserAssetsLogRepository::ASSET_TYPE_WELFARE, |
|
|
|
'asset_type' => UserAssetsLogRepository::ASSET_TYPE_WELFARE, |
|
|
|
'type' => UserAssetsLogRepository::CHANGE_TYPE_SHARE_GET, |
|
|
|
'type' => UserAssetsLogRepository::CHANGE_TYPE_SHARE_GET, |
|
|
@ -187,7 +189,7 @@ class UserAssetsRepository extends BaseRepository |
|
|
|
'count' => $welfare, |
|
|
|
'count' => $welfare, |
|
|
|
); |
|
|
|
); |
|
|
|
// 增加福利积分 |
|
|
|
// 增加福利积分 |
|
|
|
$this->changeEvent($item['uid'],UserAssetsLogRepository::STATUS_SUCCESS, array('welfare' => $welfare)); |
|
|
|
$this->changeEvent($item['uid'], UserAssetsLogRepository::STATUS_SUCCESS, array('welfare' => $welfare)); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|