|
|
@@ -28,6 +28,7 @@ use common\models\PerfMonth;
|
|
|
use common\models\Period;
|
|
|
use common\models\DecRole;
|
|
|
use common\models\EmployLevel;
|
|
|
+use common\models\FlowExchangePoints;
|
|
|
use common\models\ScoreMonth;
|
|
|
use common\models\UserBonus;
|
|
|
use common\models\UserWallet;
|
|
|
@@ -43,7 +44,7 @@ class BonusController extends BaseController {
|
|
|
*/
|
|
|
public function actionIndex() {
|
|
|
$userId = \Yii::$app->user->id;
|
|
|
- $data = UserBonus::findUseSlaves()->select('BONUS,RECONSUME_POINTS')->where('USER_ID=:USER_ID', [':USER_ID' => $userId])->asArray()->one();
|
|
|
+ $data = UserBonus::findUseSlaves()->select('BONUS,RECONSUME_POINTS,EXCHANGE_POINTS')->where('USER_ID=:USER_ID', [':USER_ID' => $userId])->asArray()->one();
|
|
|
if (!$data) {
|
|
|
$data = [
|
|
|
'BONUS' => 0,
|
|
|
@@ -67,6 +68,7 @@ class BonusController extends BaseController {
|
|
|
$wallet[] = ['walletType' => 'bonus', 'walletName' => '会员奖金', 'amount' => Tool::formatPrice($data['BONUS'])];
|
|
|
$wallet[] = ['walletType' => 'cash', 'walletName' => '会员余额', 'amount' => Tool::formatPrice($data['CASH'])];
|
|
|
$wallet[] = ['walletType' => 'point', 'walletName' => '会员积分', 'amount' => Tool::formatPrice($data['RECONSUME_POINTS'])];
|
|
|
+ $wallet[] = ['walletType' => 'exchange', 'walletName' => '兑换积分', 'amount' => Tool::formatPrice($data['EXCHANGE_POINTS'])];
|
|
|
// if ($showCFLX) {
|
|
|
// $wallet[] = ['walletType' => 'cf', 'walletName' => '福利积分一', 'amount' => Tool::formatPrice($data['CF'])];
|
|
|
// $wallet[] = ['walletType' => 'lx', 'walletName' => '福利积分二', 'amount' => Tool::formatPrice($data['LX'])];
|
|
|
@@ -98,7 +100,7 @@ class BonusController extends BaseController {
|
|
|
*/
|
|
|
public function actionWalletFlow(){
|
|
|
$walletType = \Yii::$app->request->get('walletType');
|
|
|
- if(!in_array($walletType,['bonus','point','cash'])) return static::notice('错误的账户类型',400);
|
|
|
+ if(!in_array($walletType,['bonus','point','cash','exchange'])) return static::notice('错误的账户类型',400);
|
|
|
$dealType = \Yii::$app->request->get('dealType');
|
|
|
$createAt = \Yii::$app->request->get('createAt');
|
|
|
$remark = \Yii::$app->request->get('remark');
|
|
|
@@ -149,6 +151,13 @@ 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',
|
|
|
+ ]);
|
|
|
}
|
|
|
if($data) {
|
|
|
if($walletType != 'cash') {
|
|
|
@@ -265,6 +274,7 @@ class BonusController extends BaseController {
|
|
|
$data[] = ['name' => '实发奖金', 'value' => Tool::formatPrice($calcBonus['BONUS_REAL'])];
|
|
|
// $data[]=['name'=>'总奖金','value'=>Tool::formatPrice($calcBonus['BONUS_TOTAL'])];
|
|
|
$data[] = ['name' => '复消积分', 'value' => Tool::formatPrice($calcBonus['RECONSUME_POINTS'])];
|
|
|
+ $data[] = ['name' => '兑换积分', 'value' => Tool::formatPrice($calcBonus['EXCHANGE_POINTS'])];
|
|
|
// if($sysConfig['openLX']['VALUE']) {
|
|
|
// $data[] = ['name' => '福利积分二', 'value' => Tool::formatPrice($calcBonus['BONUS_LX'])];
|
|
|
// }
|
|
|
@@ -298,7 +308,14 @@ class BonusController extends BaseController {
|
|
|
public function actionOther(){
|
|
|
//获取可以查看几期奖金
|
|
|
$showBonusPeriodNum = Cache::getSystemConfig()['showBonusPeriodNum']['VALUE'];
|
|
|
- $calcBonus = CalcBonus::find()->where('USER_ID=:USER_ID AND IS_SENT=1', [':USER_ID' => \Yii::$app->user->id])->select('PERIOD_NUM,ORI_BONUS_QY,ORI_BONUS_YC,ORI_BONUS_VIP,ORI_BONUS_STANDARD,ORI_BONUS_BD,ORI_BONUS_TG,ORI_BONUS_XF,BONUS_TOTAL,MANAGE_TAX,BONUS_REAL,BONUS_INCOME,ORI_BONUS_YJ,ORI_BONUS_GX,ORI_BONUS_GL,RECONSUME_POINTS,LAST_DEC_LV,LAST_EMP_LV')->limit($showBonusPeriodNum)->orderBy('PERIOD_NUM DESC')->asArray()->all();
|
|
|
+ $calcBonus = CalcBonus::find()->where('USER_ID=:USER_ID AND IS_SENT=1', [':USER_ID' => \Yii::$app->user->id])
|
|
|
+ ->select('PERIOD_NUM,ORI_BONUS_QY,ORI_BONUS_YC,ORI_BONUS_VIP,ORI_BONUS_STANDARD,ORI_BONUS_BD,ORI_BONUS_TG,
|
|
|
+ ORI_BONUS_XF,BONUS_TOTAL,MANAGE_TAX,BONUS_REAL,BONUS_INCOME,ORI_BONUS_YJ,ORI_BONUS_GX,ORI_BONUS_GL,RECONSUME_POINTS,
|
|
|
+ LAST_DEC_LV,LAST_EMP_LV,EXCHANGE_POINTS')
|
|
|
+ ->limit($showBonusPeriodNum)
|
|
|
+ ->orderBy('PERIOD_NUM DESC')
|
|
|
+ ->asArray()
|
|
|
+ ->all();
|
|
|
$sysConfig = Cache::getSystemConfig();
|
|
|
|
|
|
//增加明细开关控制(0 只显示总奖金 1 全部显示)
|
|
|
@@ -344,7 +361,7 @@ class BonusController extends BaseController {
|
|
|
$calcBonus[$key]['MANAGE_TAX'] = ['name' => '管理费', 'value' => Tool::formatPrice($calcBonus[$key]['MANAGE_TAX'])];
|
|
|
$calcBonus[$key]['BONUS_REAL'] = ['name' => '实发奖金', 'value' => Tool::formatPrice($calcBonus[$key]['BONUS_REAL'])];
|
|
|
$calcBonus[$key]['RECONSUME_POINTS'] = ['name' => '复消积分', 'value' => Tool::formatPrice($calcBonus[$key]['RECONSUME_POINTS'])];
|
|
|
-
|
|
|
+ $calcBonus[$key]['EXCHANGE_POINTS'] = ['name' => '兑换积分', 'value' => Tool::formatPrice($calcBonus[$key]['EXCHANGE_POINTS'])];
|
|
|
}else{
|
|
|
|
|
|
$calcBonus[$key]['BONUS_TOTAL'] = ['name' => '总奖金', 'value' => Tool::formatPrice($calcBonus[$key]['BONUS_TOTAL'])];
|
|
|
@@ -386,6 +403,7 @@ class BonusController extends BaseController {
|
|
|
}
|
|
|
$tableKey[] = 'BONUS_TOTAL';
|
|
|
$tableKey[] = 'RECONSUME_POINTS';
|
|
|
+ $tableKey[] = 'EXCHANGE_POINTS';
|
|
|
$tableKey[] = 'MANAGE_TAX';
|
|
|
$tableKey[] = 'BONUS_REAL';
|
|
|
}else{
|