|
|
@@ -87,13 +87,13 @@ class BonusController extends BaseController {
|
|
|
$country = Countries::getById($user['COUNTRY_ID']);
|
|
|
$currency = Currency::getById($country['LOCAL_CURRENCY_ID']);
|
|
|
|
|
|
- // PRP账户
|
|
|
+ // 绩效奖金
|
|
|
$userPerformance = UserPerformance::getAmountByUserId($userId);
|
|
|
- $data['PRP'] = $userPerformance['AMOUNTS'] ?? 0;
|
|
|
+ $data['userPerformanceBonus'] = $userPerformance['AMOUNTS'] ?? 0;
|
|
|
|
|
|
$wallet[] = ['walletType' => 'bonus', 'walletName' => Yii::t('app', 'memberBonus'), 'amount' => Tool::formatPrice($data['BONUS'])];//会员奖金
|
|
|
$wallet[] = ['walletType' => 'cash', 'walletName' => Yii::t('app', 'memberEcoin'), 'amount' => Tool::formatPrice($data['CASH']), 'coin' => $currency['CODE']];//会员余额
|
|
|
- $wallet[] = ['walletType' => 'prp', 'walletName' => Yii::t('app', 'memberPrp'), 'amount' => Tool::formatPrice($data['PRP']), 'coin' => $currency['CODE']];//绩效奖金
|
|
|
+ $wallet[] = ['walletType' => 'userPerformanceBonus', 'walletName' => Yii::t('app', 'userPerformanceBonus'), 'amount' => Tool::formatPrice($data['userPerformanceBonus']), 'coin' => $currency['CODE']];//绩效奖金
|
|
|
|
|
|
$dealSwitch = isset(Cache::getSystemConfig()['dealSwitch']) ? Cache::getSystemConfig()['dealSwitch']['VALUE'] : '';
|
|
|
|
|
|
@@ -200,7 +200,7 @@ class BonusController extends BaseController {
|
|
|
*/
|
|
|
public function actionWalletFlow(){
|
|
|
$walletType = \Yii::$app->request->get('walletType');
|
|
|
- if(!in_array($walletType,['bonus', 'cash', 'exchange', 'prp'])) {
|
|
|
+ if(!in_array($walletType,['bonus', 'cash', 'userPerformanceBonus'])) {
|
|
|
return static::notice('walletType error',400);
|
|
|
}
|
|
|
|
|
|
@@ -208,7 +208,7 @@ class BonusController extends BaseController {
|
|
|
$createAt = \Yii::$app->request->get('createAt');
|
|
|
$remark = \Yii::$app->request->get('remark');
|
|
|
|
|
|
- //获取可以查看几期流水
|
|
|
+ // 获取可以查看几期流水
|
|
|
$showFlowPeriodNum = Cache::getSystemConfig()['showFlowPeriodNum']['VALUE'];
|
|
|
$periodArr = Period::getNearlyPeriodNum($showFlowPeriodNum);
|
|
|
$condition = ' AND USER_ID=:USER_ID AND PERIOD_NUM>=:PERIOD_NUM_MIN AND PERIOD_NUM<=:PERIOD_NUM_MAX';
|
|
|
@@ -254,39 +254,30 @@ class BonusController extends BaseController {
|
|
|
'select' => 'AMOUNT,TOTAL,IS_INCR,REMARK,PERIOD_NUM,CALC_MONTH,CREATED_AT',
|
|
|
'orderBy' => 'CREATED_AT DESC',
|
|
|
]);
|
|
|
- }else if ($walletType == 'exchange') {
|
|
|
- $dealLists = FlowExchangePoints::find()->groupBy('DEAL_TYPE_ID')->select('DEAL_TYPE_ID')->where('USER_ID=:USER_ID', [':USER_ID' => \Yii::$app->user->id])->asArray()->all();
|
|
|
- $data = FlowExchangePoints::lists($condition, $params, [
|
|
|
- 'useSlaves' => true,
|
|
|
- 'select' => 'AMOUNT,TOTAL,IS_INCR,REMARK,REMARK_IS_SHOW,PERIOD_NUM,CALC_MONTH,CREATED_AT,DEAL_TYPE_ID,DEAL_TYPE_IS_PRESET',
|
|
|
- 'orderBy' => 'CREATED_AT DESC',
|
|
|
- ]);
|
|
|
- }else if ($walletType == 'prp') {
|
|
|
- $dealLists = FlowExchangePoints::find()->groupBy('DEAL_TYPE_ID')->select('DEAL_TYPE_ID')->where('USER_ID=:USER_ID', [':USER_ID' => \Yii::$app->user->id])->asArray()->all();
|
|
|
- $data = FlowExchangePoints::lists($condition, $params, [
|
|
|
- 'useSlaves' => true,
|
|
|
- 'select' => 'AMOUNT,TOTAL,IS_INCR,REMARK,REMARK_IS_SHOW,PERIOD_NUM,CALC_MONTH,CREATED_AT,DEAL_TYPE_ID,DEAL_TYPE_IS_PRESET',
|
|
|
- 'orderBy' => 'CREATED_AT DESC',
|
|
|
+ }else if ($walletType == 'userPerformanceBonus') {
|
|
|
+ $condition = 'USER_ID=:USER_ID AND STATUS_ID<20 AND AMOUNTS>0';
|
|
|
+ $params = [':USER_ID' => \Yii::$app->user->id];
|
|
|
+ $data = UserPerformance::lists($condition, $params, [
|
|
|
+ 'select' => 'ID,USER_ID,AMOUNTS,ORIGINAL,EXPIRED_AT',
|
|
|
+ 'orderBy' => 'EXPIRED_AT ASC, CREATED_AT ASC',
|
|
|
]);
|
|
|
} else {
|
|
|
return static::notice('walletType error',400);
|
|
|
}
|
|
|
|
|
|
- if($data) {
|
|
|
- if($walletType != 'cash') {
|
|
|
- foreach ($data['list'] as $key => $value) {
|
|
|
- if ($value['DEAL_TYPE_IS_PRESET'] == 0) {
|
|
|
- $data['list'][$key]['DEAL_TYPE_NAME'] = $value['AMOUNT'] > 0 ? Yii::t('app', 'increase') : Yii::t('app', 'reduce');
|
|
|
- } else {
|
|
|
- $data['list'][$key]['DEAL_TYPE_NAME'] = DealType::getAllTypesForShow()[$value['DEAL_TYPE_ID']]['TYPE_NAME'] ?? '';
|
|
|
- }
|
|
|
-
|
|
|
- if ($value['REMARK_IS_SHOW'] == 0) $data['list'][$key]['REMARK'] = '';
|
|
|
+ if($data && $walletType == 'bonus') {
|
|
|
+ foreach ($data['list'] as $key => $value) {
|
|
|
+ if ($value['DEAL_TYPE_IS_PRESET'] == 0) {
|
|
|
+ $data['list'][$key]['DEAL_TYPE_NAME'] = $value['AMOUNT'] > 0 ? Yii::t('app', 'increase') : Yii::t('app', 'reduce');
|
|
|
+ } else {
|
|
|
+ $data['list'][$key]['DEAL_TYPE_NAME'] = DealType::getAllTypesForShow()[$value['DEAL_TYPE_ID']]['TYPE_NAME'] ?? '';
|
|
|
}
|
|
|
+
|
|
|
+ if ($value['REMARK_IS_SHOW'] == 0) $data['list'][$key]['REMARK'] = '';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if($dealLists){
|
|
|
+ if ($dealLists && $walletType != 'userPerformanceBonus') {
|
|
|
foreach ($dealLists as $key=>$value){
|
|
|
if(!$value['DEAL_TYPE_ID']) continue;
|
|
|
$dealType = DealType::getAllTypesForShow()[$value['DEAL_TYPE_ID']];
|