filterCondition([ 'periodNum' => 'PERIOD_NUM', 'year' => 'CALC_YEAR', 'month' => 'CALC_MONTH', 'startTime' => 'START_TIME', 'endTime' => 'END_TIME', 'closedAt' => 'CLOSED_AT', 'perfStartedAt' => 'PERF_STARTED_AT', 'perfedAt' => 'PERFED_AT', 'calStartedAt' => 'CALCULATE_STARTED_AT', 'calculatedAt' => 'CALCULATED_AT', 'sendStartedAt' => 'SEND_STARTED_AT', 'sentAt' => 'SENT_AT', ]); $condition = $filter['condition']; $params = $filter['params']; $periodObj = Period::instance(); $nowPeriodNum = $periodObj->getNowPeriodNum(); $condition .= ' AND PERIOD_NUM<=:PERIOD_NUM'; $params[':PERIOD_NUM'] = $nowPeriodNum; $data = Period::lists($condition, $params, ['orderBy' => 'PERIOD_NUM DESC']); foreach ($data['list'] as $key => $value) { // 是否可封期 $data['list'][$key]['IS_CAN_CLOSE'] = $periodObj->isCanClose($value['PERIOD_NUM']); // 是否可生成业绩单 $data['list'][$key]['IS_CAN_PERF'] = $periodObj->isCanPerf($value['PERIOD_NUM']); // 是否可结算 $data['list'][$key]['IS_CAN_CALC'] = $periodObj->isCanCalc($value['PERIOD_NUM']); // 是否可挂网 $data['list'][$key]['IS_CAN_SENT'] = $periodObj->isCanSend($value['PERIOD_NUM']); // 操作数据按钮是否可用 $data['list'][$key]['BUTTON_IS_CAN'] = $periodObj->isCanClose($value['PERIOD_NUM']) || $periodObj->isCanPerf($value['PERIOD_NUM']) || $periodObj->isCanCalc($value['PERIOD_NUM']) || $periodObj->isCanSend($value['PERIOD_NUM']); } return static::notice($data); } /** * 封期 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionClosePeriod() { $periodNum = \Yii::$app->request->get('periodNum'); if (!$periodNum) { return static::notice('期数不存在', 400); } $formModel = new PeriodForm(); if ($formModel->load(Yii::$app->request->get(), '') && $formModel->closePeriod()) { // Log::adminHandle('第' . $periodNum . '期封期成功'); return static::notice('封期成功'); } else { return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400); } } /** * 计算业绩并生成业绩单 * @return mixed * @throws \yii\web\HttpException */ public function actionPerfPeriod() { $periodNum = \Yii::$app->request->get('periodNum'); if (!$periodNum) { return static::notice('期数不存在', 400); } $formModel = new PeriodForm(); $formModel->scenario = 'perf'; if ($formModel->load(Yii::$app->request->get(), '') && $formModel->perfWebToAsync()) { // Log::adminHandle('第' . $periodNum . '期封生成业绩单'); return static::notice('生成业绩单已开始处理,请等待'); } else { return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400); } } /** * 结算封期 * @return mixed * @throws \yii\web\HttpException */ public function actionCalcPeriod() { $periodNum = \Yii::$app->request->get('periodNum'); if (!$periodNum) { return static::notice('期数不存在', 400); } $formModel = new PeriodForm(); $formModel->scenario = 'calc'; if ($formModel->load(Yii::$app->request->get(), '') && $formModel->calcWebToAsync()) { // Log::adminHandle('第' . $periodNum . '期结算'); return static::notice('结算已开始处理,请等待'); } else { return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400); } } /** * 挂网 * @return mixed * @throws \yii\web\HttpException */ public function actionSendPeriod() { $periodNum = \Yii::$app->request->get('periodNum'); if (!$periodNum) { return static::notice('期数不存在', 400); } $formModel = new PeriodForm(); $formModel->scenario = 'send'; if ($formModel->load(Yii::$app->request->get(), '') && $formModel->sendWebToAsync()) { // Log::adminHandle('第' . $periodNum . '期挂网'); return static::notice('挂网已开始处理,请等待'); } else { return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400); } } /** * 查看业绩 * @return mixed * @throws \yii\web\HttpException */ public function actionPerf() { // 获取当前年月 $period = Period::instance(); $yearMonth = $period->getNowYearMonth(); $yearMonth = Yii::$app->request->get('yearMonth', $yearMonth); //$filter = $this->filterCondition(Perf::tableName(), ['periodNum'=>'P.PERIOD_NUM', 'userName'=>'UI.USER_NAME']); $condition = ''; $params = []; $data = PerfPeriod::lists($condition, $params, [ 'select' => 'P.*, UI.USER_NAME', 'yearMonth' => $yearMonth, 'from' => PerfPeriod::tableName() . ' AS P', 'join' => [ ['LEFT JOIN', UserInfo::tableName() . ' AS UI', 'P.USER_ID=UI.USER_ID'] ], 'orderBy' => 'P.PERIOD_NUM DESC', ]); $data['request'] = []; $data['request']['yearMonth'] = $yearMonth; return static::notice($data); } /** * 奖金流水 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionFlowBonus() { $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', 'REAL_NAME' => 'U.REAL_NAME', 'IS_DEC' => 'U.IS_DEC', 'userIds' => 'USER_ID', 'CREATED_AT' => 'FB.CREATED_AT', 'PERIOD_NUM' => 'PERIOD_NUM', 'CALC_MONTH' => 'CALC_MONTH', 'DEAL_TYPE_NAME' => 'DEAL_TYPE_ID', 'LAST_DEC_LV_NAME' => 'LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'LAST_EMP_LV', // 'LAST_STATUS_NAME' => 'LAST_STATUS', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'ADMIN_NAME' => 'ADMIN_NAME', 'REMARK' => 'REMARK', 'TRANSFER_SN' => 'TRANSFER_SN', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new FlowBonusList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 奖金流水 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionFlowBonusExport() { $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', 'REAL_NAME' => 'U.REAL_NAME', 'IS_DEC' => 'U.IS_DEC', 'userIds' => 'USER_ID', 'CREATED_AT' => 'FB.CREATED_AT', 'PERIOD_NUM' => 'PERIOD_NUM', 'CALC_MONTH' => 'CALC_MONTH', 'DEAL_TYPE_NAME' => 'DEAL_TYPE_ID', 'LAST_DEC_LV_NAME' => 'LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'LAST_EMP_LV', 'LAST_STATUS_NAME' => 'LAST_STATUS', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'ADMIN_NAME' => 'ADMIN_NAME', 'REMARK' => 'REMARK', 'TRANSFER_SN' => 'TRANSFER_SN', ]); $form = new BonusExportForm(); $result = $form->run($filter, '奖金流水'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 复消积分流水 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionFlowRp() { $filter = $this->filterCondition([ 'userIds' => 'USER_ID', 'CREATED_AT' => 'CREATED_AT', 'PERIOD_NUM' => 'PERIOD_NUM', 'CALC_MONTH' => 'CALC_MONTH', 'DEAL_TYPE_NAME' => 'DEAL_TYPE_ID', 'LAST_DEC_LV_NAME' => 'LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'LAST_EMP_LV', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'ADMIN_NAME' => 'ADMIN_NAME', 'REMARK' => 'REMARK', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new FlowReconsumePointsList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 复消积分流水导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionFlowRpExport() { $filter = $this->filterCondition([ 'userIds' => 'USER_ID', 'CREATED_AT' => 'CREATED_AT', 'PERIOD_NUM' => 'PERIOD_NUM', 'CALC_MONTH' => 'CALC_MONTH', 'DEAL_TYPE_NAME' => 'DEAL_TYPE_ID', 'LAST_DEC_LV_NAME' => 'LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'LAST_EMP_LV', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'ADMIN_NAME' => 'ADMIN_NAME', 'REMARK' => 'REMARK', ]); $form = new BonusExportForm(); $result = $form->run($filter, '复消积分流水'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 会员余额流水 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionFlowBalance() { $filter = $this->filterCondition([ 'USER_NAME' => 'USER_NAME', 'REAL_NAME' => 'REAL_NAME', 'CALC_MONTH' => 'CALC_MONTH', 'PERIOD_NUM' => 'PERIOD_NUM', 'TRANSFER_SN' => 'TRANSFER_SN', 'CREATED_AT' => 'FW.CREATED_AT', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'REMARK' => 'REMARK', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new FlowBalanceList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 会员余额流水导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionFlowBalanceExport() { $filter = $this->filterCondition([ 'USER_NAME' => 'USER_NAME', 'REAL_NAME' => 'REAL_NAME', 'CALC_MONTH' => 'CALC_MONTH', 'PERIOD_NUM' => 'PERIOD_NUM', 'TRANSFER_SN' => 'TRANSFER_SN', 'CREATED_AT' => 'FW.CREATED_AT', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'REMARK' => 'REMARK', ]); $form = new BonusExportForm(); $result = $form->run($filter, '会员余额流水'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 兑换积分流水 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionFlowExchange() { $filter = $this->filterCondition([ 'userIds' => 'USER_ID', 'CREATED_AT' => 'CREATED_AT', 'PERIOD_NUM' => 'PERIOD_NUM', 'CALC_MONTH' => 'CALC_MONTH', 'DEAL_TYPE_NAME' => 'DEAL_TYPE_ID', 'LAST_DEC_LV_NAME' => 'LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'LAST_EMP_LV', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'ADMIN_NAME' => 'ADMIN_NAME', 'REMARK' => 'REMARK', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new FlowExchangePointsList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 兑换积分流水导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionFlowExchangeExport() { $filter = $this->filterCondition([ 'userIds' => 'USER_ID', 'CREATED_AT' => 'CREATED_AT', 'PERIOD_NUM' => 'PERIOD_NUM', 'CALC_MONTH' => 'CALC_MONTH', 'DEAL_TYPE_NAME' => 'DEAL_TYPE_ID', 'LAST_DEC_LV_NAME' => 'LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'LAST_EMP_LV', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'ADMIN_NAME' => 'ADMIN_NAME', 'REMARK' => 'REMARK', ]); $form = new BonusExportForm(); $result = $form->run($filter, '兑换积分流水'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 现金钱包流水 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionFlowWallet() { $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', 'REAL_NAME' => 'U.REAL_NAME', 'IS_DEC' => 'U.IS_DEC', 'userIds' => 'USER_ID', 'CREATED_AT' => 'CREATED_AT', 'PERIOD_NUM' => 'PERIOD_NUM', 'CALC_MONTH' => 'CALC_MONTH', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'ADMIN_NAME' => 'ADMIN_NAME', 'REMARK' => 'REMARK', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new FlowWalletList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 现金钱包流水导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionFlowWalletExport() { $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', 'REAL_NAME' => 'U.REAL_NAME', 'IS_DEC' => 'U.IS_DEC', 'userIds' => 'USER_ID', 'CREATED_AT' => 'CREATED_AT', 'PERIOD_NUM' => 'PERIOD_NUM', 'CALC_MONTH' => 'CALC_MONTH', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'ADMIN_NAME' => 'ADMIN_NAME', 'REMARK' => 'REMARK', ]); $form = new BonusExportForm(); $result = $form->run($filter, '现金钱包流水'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 车房流水 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionFlowCf() { $filter = $this->filterCondition([ 'userIds' => 'USER_ID', 'CREATED_AT' => 'CREATED_AT', 'PERIOD_NUM' => 'PERIOD_NUM', 'CALC_MONTH' => 'CALC_MONTH', 'DEAL_TYPE_NAME' => 'DEAL_TYPE_ID', 'LAST_DEC_LV_NAME' => 'LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'LAST_EMP_LV', 'LAST_STATUS_NAME' => 'LAST_STATUS', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'ADMIN_NAME' => 'ADMIN_NAME', 'REMARK' => 'REMARK', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new FlowCfList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 车房养老奖流水导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionFlowCfExport() { $filter = $this->filterCondition([ 'userIds' => 'USER_ID', 'CREATED_AT' => 'CREATED_AT', 'PERIOD_NUM' => 'PERIOD_NUM', 'CALC_MONTH' => 'CALC_MONTH', 'DEAL_TYPE_NAME' => 'DEAL_TYPE_ID', 'LAST_DEC_LV_NAME' => 'LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'LAST_EMP_LV', 'LAST_STATUS_NAME' => 'LAST_STATUS', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'ADMIN_NAME' => 'ADMIN_NAME', 'REMARK' => 'REMARK', ]); $form = new BonusExportForm(); $result = $form->run($filter, '车房养老奖流水'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 领袖分红流水 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionFlowLx() { $filter = $this->filterCondition([ 'userIds' => 'USER_ID', 'CREATED_AT' => 'CREATED_AT', 'PERIOD_NUM' => 'PERIOD_NUM', 'CALC_MONTH' => 'CALC_MONTH', 'DEAL_TYPE_NAME' => 'DEAL_TYPE_ID', 'LAST_DEC_LV_NAME' => 'LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'LAST_EMP_LV', 'LAST_STATUS_NAME' => 'LAST_STATUS', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'ADMIN_NAME' => 'ADMIN_NAME', 'REMARK' => 'REMARK', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new FlowLxList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionFlowLxExport() { $filter = $this->filterCondition([ 'userIds' => 'USER_ID', 'CREATED_AT' => 'CREATED_AT', 'PERIOD_NUM' => 'PERIOD_NUM', 'CALC_MONTH' => 'CALC_MONTH', 'DEAL_TYPE_NAME' => 'DEAL_TYPE_ID', 'LAST_DEC_LV_NAME' => 'LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'LAST_EMP_LV', 'LAST_STATUS_NAME' => 'LAST_STATUS', 'AMOUNT' => 'AMOUNT', 'TOTAL' => 'TOTAL', 'ADMIN_NAME' => 'ADMIN_NAME', 'REMARK' => 'REMARK', ]); $form = new BonusExportForm(); $result = $form->run($filter, '领袖分红奖流水'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 车房养老奖和领袖分红年度发放审核列表 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionCfLxAuditList() { $filter = $this->filterCondition([ 'userIds' => 'CFLXA.USER_ID', 'CF' => 'CFLXA.CF', 'LX' => 'CFLXA.LX', 'CREATE_ADMIN_NAME' => 'ADM.ADMIN_NAME', 'CREATED_AT' => 'CFLXA.CREATED_AT', 'AUDIT_ADMIN_NAME' => 'ADMA.ADMIN_NAME', 'AUDITED_AT' => 'CFLXA.AUDITED_AT', 'CREATE_REMARK' => 'CFLXA.CREATE_REMARK', 'filterStatus' => 'CFLXA.AUDIT_STATUS', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new CfLxAuditList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 车房养老奖和领袖分红年度发放审核导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionCfLxAuditExport() { $filter = $this->filterCondition([ 'userIds' => 'CFLXA.USER_ID', 'CF' => 'CFLXA.CF', 'LX' => 'CFLXA.LX', 'CREATE_ADMIN_NAME' => 'ADM.ADMIN_NAME', 'CREATED_AT' => 'CFLXA.CREATED_AT', 'AUDIT_ADMIN_NAME' => 'ADMA.ADMIN_NAME', 'AUDITED_AT' => 'CFLXA.AUDITED_AT', 'CREATE_REMARK' => 'CFLXA.CREATE_REMARK', 'filterStatus' => 'CFLXA.AUDIT_STATUS', ]); $form = new BonusExportForm(); $result = $form->run($filter, '年度奖金发放审核'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 申请发放车房养老奖和领袖分红 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionCfLxApply() { if (Yii::$app->request->isPost) { $formModel = new SendCFAndLXForm(); $formModel->scenario = 'apply'; if ($formModel->load(Yii::$app->request->post(), '') && $result = $formModel->apply()) { if(!empty($result['logs'])){ return static::notice('申请成功,请在年度奖管理中审核'); }else{ return static::notice('申请失败,无符合发放条件会员',400); } } else { return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400); } } return static::notice('非法请求', 400); } /** * 审核车房养老奖和领袖分红 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionCfLxAudit() { $formModel = new SendCFAndLXForm(); $formModel->scenario = 'audit'; if ($formModel->load(Yii::$app->request->post(), '') && $result = $formModel->audit()) { return static::notice('审核年度奖申请完成'); } return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400); } /** * 删除车房领袖审核信息 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionCfLxAuditDelete() { $sendCFAndLXForm = new SendCFAndLXForm(); $result = static::delete(CFLXAudit::class, function ($selected) use ($sendCFAndLXForm) { $sendCFAndLXForm->beforeDelete($selected); // Log::adminHandle('删除审核会员余额信息'); }, function ($selected) use ($sendCFAndLXForm) { $sendCFAndLXForm->delete($selected); // Log::adminHandle('删除审核会员余额信息'); }, true); return $result; } /** * 查看所传期数的各项奖金 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionPeriodDetail() { $periodNum = \Yii::$app->request->get('periodNum'); $period = Period::instance(); $periodInfo = $period->setPeriodNum($periodNum); $yearMonth = $period->getYearMonth($periodNum); // $filter = $this->filterCondition('UT', [ // 'userName' => 'UI.USER_NAME', // ]); $condition = ''; $params = []; $condition .= ' AND C.PERIOD_NUM=:PERIOD_NUM'; $params[':PERIOD_NUM'] = $periodNum; if (!$period->isClosed($periodNum)) { return static::notice('该期不能查看'); } $data = CalcBonus::lists($condition, $params, [ 'yearMonth' => $yearMonth, 'select' => 'C.*,UI.USER_NAME', 'from' => CalcBonus::tableName() . ' AS C', 'join' => [ ['LEFT JOIN', UserInfo::tableName() . ' AS UI', 'C.USER_ID=UI.USER_ID'], ], 'orderBy' => 'C.CREATED_AT DESC', ]); $data['periodInfo'] = $periodInfo; return static::notice($data); } /** * 获取最新一期结算的奖金 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionNewPeriodBonus() { $periodNum = Period::calculatedMaxPeriodNum(); $data = $this->_periodBonus($periodNum); return static::notice($data); } /** * 最新一期奖金导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionNewPeriodBonusExport() { $filter = $this->filterCondition([ 'LAST_USER_NAME' => 'CB.LAST_USER_NAME', 'LAST_REAL_NAME' => 'CB.LAST_REAL_NAME', 'LAST_DEC_LV_NAME' => 'CB.LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'CB.LAST_EMP_LV', 'LAST_MOBILE' => 'CB.LAST_MOBILE', 'LAST_PERIOD_AT' => 'CB.LAST_PERIOD_AT', 'LAST_CREATED_AT' => 'CB.LAST_CREATED_AT', 'LAST_REC_USER_NAME' => 'CB.LAST_REC_USER_NAME', 'LAST_REC_REAL_NAME' => 'CB.LAST_REC_REAL_NAME', 'LAST_CON_USER_NAME' => 'CB.LAST_CON_USER_NAME', 'LAST_CON_REAL_NAME' => 'CB.LAST_CON_REAL_NAME', 'BONUS_BD' => 'CB.BONUS_BD', 'BONUS_TG' => 'CB.BONUS_TG', 'BONUS_YJ' => 'CB.BONUS_YJ', 'BONUS_GX' => 'CB.BONUS_GX', // 'BONUS_GL' => 'CB.BONUS_BS', 'BONUS_GL' => 'CB.BONUS_GL', 'BONUS_QY' => 'CB.BONUS_QY', 'BONUS_YC' => 'CB.BONUS_YC', 'PV_1L' => 'CB.PV_1L', 'SURPLUS_1L' => 'CB.SURPLUS_1L', 'PV_2L' => 'CB.PV_2L', 'SURPLUS_2L' => 'CB.SURPLUS_2L', 'PV_3L' => 'CB.PV_3L', 'SURPLUS_3L' => 'CB.SURPLUS_3L', 'CALCULATED_AT' => 'CB.CALCULATED_AT', 'CALC_MONTH' => 'CB.CALC_MONTH', 'BONUS_QY_MONTH' => 'CB.BONUS_QY_MONTH', ]); $periodNum = Period::calculatedMaxPeriodNum(); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter['condition'] .= ' AND PERIOD_NUM=:PERIOD_NUM'; $filter['params'][':PERIOD_NUM'] = $periodNum; $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth]]), '最新奖金'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 获取往期已结算的奖金 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionOtherPeriodBonus() { $periodNumRequest = \Yii::$app->request->get('periodNum'); if(!$periodNumRequest){ $periodNum = Period::calculatedMaxPeriodNum(); //return static::notice('请填写期数',400); }else{ $periodNum = explode(",", $periodNumRequest)[1]; } $data = $this->_periodBonus($periodNum,false); if( isset($data['filterTypes']) && is_array($data['filterTypes']) ) { $data['filterTypes'] = array_merge(['periodNum'=>['isUserTable'=> false, 'name'=> 'Number of settlement periods']], $data['filterTypes']); } return static::notice($data); } /** * 往期奖金导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionOtherPeriodBonusExport() { $filter = $this->filterCondition([ 'periodNum' => 'CB.PERIOD_NUM', 'LAST_USER_NAME' => 'CB.LAST_USER_NAME', 'LAST_REAL_NAME' => 'CB.LAST_REAL_NAME', 'LAST_DEC_LV_NAME' => 'CB.LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'CB.LAST_EMP_LV', 'LAST_MOBILE' => 'CB.LAST_MOBILE', 'LAST_PERIOD_AT' => 'CB.LAST_PERIOD_AT', 'LAST_CREATED_AT' => 'CB.LAST_CREATED_AT', 'LAST_REC_USER_NAME' => 'CB.LAST_REC_USER_NAME', 'LAST_REC_REAL_NAME' => 'CB.LAST_REC_REAL_NAME', 'LAST_CON_USER_NAME' => 'CB.LAST_CON_USER_NAME', 'LAST_CON_REAL_NAME' => 'CB.LAST_CON_REAL_NAME', 'BONUS_BD' => 'CB.BONUS_BD', 'BONUS_TG' => 'CB.BONUS_TG', 'BONUS_YJ' => 'CB.BONUS_YJ', 'BONUS_GX' => 'CB.BONUS_GX', 'BONUS_GL' => 'CB.BONUS_GL', // 'BONUS_GL' => 'CB.BONUS_BS', 'BONUS_QY' => 'CB.BONUS_QY', 'BONUS_YC' => 'CB.BONUS_YC', 'PV_1L' => 'CB.PV_1L', 'SURPLUS_1L' => 'CB.SURPLUS_1L', 'PV_2L' => 'CB.PV_2L', 'SURPLUS_2L' => 'CB.SURPLUS_2L', 'PV_3L' => 'CB.PV_3L', 'SURPLUS_3L' => 'CB.SURPLUS_3L', 'CALCULATED_AT' => 'CB.CALCULATED_AT', 'CALC_MONTH' => 'CB.CALC_MONTH', 'BONUS_QY_MONTH' => 'CB.BONUS_QY_MONTH', ]); $periodNumRequest = \Yii::$app->request->get('periodNum'); if(!$periodNumRequest){ $periodNum = Period::calculatedMaxPeriodNum(); }else{ $periodNum = explode(",", $periodNumRequest)[1]; } // if(!isset($filter['params'][':PERIODNUM'])){ // return static::notice('请填写期数',400); // } // $periodNum = $filter['params'][':PERIODNUM']; $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); // $filter['condition'] .= ' AND CB.PERIOD_NUM=:PERIOD_NUM'; // $filter['params'][':PERIOD_NUM'] = $periodNum; $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth]]), '往期奖金'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 获取筛选类型 * @return mixed * @throws \yii\web\HttpException */ public function actionOtherPeriodBonusFilterTypes(){ $listObj = new PeriodBonusList(); $filterTypes = $listObj->getFilterTypes(); $filterTypes = array_merge(['periodNum'=>['isUserTable'=> false, 'name'=> '结算期数']], $filterTypes); return static::notice($filterTypes); } /** * 期数对应的奖金 * @param $periodNum * @param $periodFilter * @return array * @throws \yii\base\Exception * @throws \yii\db\Exception */ private function _periodBonus($periodNum,$periodFilter = true) { $filter = $this->filterCondition([ 'periodNum' => 'CB.PERIOD_NUM', 'LAST_USER_NAME' => 'CB.LAST_USER_NAME', 'LAST_REAL_NAME' => 'CB.LAST_REAL_NAME', 'LAST_DEC_LV_NAME' => 'CB.LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'CB.LAST_EMP_LV', 'LAST_MOBILE' => 'CB.LAST_MOBILE', 'LAST_PERIOD_AT' => 'CB.LAST_PERIOD_AT', 'LAST_CREATED_AT' => 'CB.LAST_CREATED_AT', 'LAST_REC_USER_NAME' => 'CB.LAST_REC_USER_NAME', 'LAST_REC_REAL_NAME' => 'CB.LAST_REC_REAL_NAME', 'LAST_CON_USER_NAME' => 'CB.LAST_CON_USER_NAME', 'LAST_CON_REAL_NAME' => 'CB.LAST_CON_REAL_NAME', 'BONUS_BD' => 'CB.BONUS_BD', 'BONUS_TG' => 'CB.BONUS_TG', 'BONUS_XF' => 'CB.BONUS_XF', 'BONUS_YJ' => 'CB.BONUS_YJ', 'BONUS_GX' => 'CB.BONUS_GX', 'BONUS_GL' => 'CB.BONUS_GL', // 'BONUS_GL' => 'CB.BONUS_BS', 'BONUS_QY' => 'CB.BONUS_QY', 'BONUS_YC' => 'CB.BONUS_YC', 'ORI_BONUS_STANDARD' => 'CB.ORI_BONUS_STANDARD', 'PV_1L' => 'CB.PV_1L', 'SURPLUS_1L' => 'CB.SURPLUS_1L', 'PV_2L' => 'CB.PV_2L', 'SURPLUS_2L' => 'CB.SURPLUS_2L', 'PV_3L' => 'CB.PV_3L', 'SURPLUS_3L' => 'CB.SURPLUS_3L', 'CALCULATED_AT' => 'CB.CALCULATED_AT', 'CALC_MONTH' => 'CB.CALC_MONTH', 'BONUS_QY_MONTH' => 'CB.BONUS_QY_MONTH', ]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $condition = $filter['condition']; $params = $filter['params']; if($periodFilter){ $condition .= ' AND CB.PERIOD_NUM=:PERIOD_NUM'; $params[':PERIOD_NUM'] = $periodNum; } $listObj = new PeriodBonusList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth]]); return $data; } /** * 团队奖奖金向下追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownQy() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice('请填写期数', 400); $userName = Yii::$app->request->get('userName'); if (!$userName) return static::notice('请填写会员编号', 400); $period = Period::instance(); if (!$period->isCalculated($periodNum)) { return static::notice([]); } $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'decType' => 'PO.DEC_TYPE', 'periodNum' => 'PO.PERIOD_NUM', ]); $qyFilter = $this->_qyFilterCondition($filter['request']); $filter = array_merge($filter, $qyFilter); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceDownQyList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 获取 * @param $request * @return array|string[] */ private function _qyFilterCondition($request) { //根据USER_NAME获取USER_ID $user = User::find()->select('ID')->where('USER_NAME=:USER_NAME', ['USER_NAME'=>$request['userName']])->asArray()->one(); if( !$user ) return []; //找到这个会员的LOCATION_TAG $userNetwork = UserNetwork::find()->select(['LOCATION_TAG'])->where('USER_ID=:USER_ID', ['USER_ID'=>$user['ID']])->asArray()->one(); $searchLocationTag = $userNetwork['LOCATION_TAG']; if( isset($request['location']) && $request['location'] ) { $searchLocationTag .= $request['location']; } return [ 'LOCATION_TAG' => 'LIKE ' . $searchLocationTag . '%' ]; } /** * 团队奖向下追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownQyExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice('请填写期数', 400); $userName = Yii::$app->request->get('userName'); if (!$userName) return static::notice('请填写会员编号', 400); $period = Period::instance(); if (!$period->isCalculated($periodNum)) { return static::notice([]); } $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'decType' => 'PO.DEC_TYPE', 'periodNum' => 'PO.PERIOD_NUM', ]); $qyFilter = $this->_qyFilterCondition($filter['request']); $filter = array_merge($filter, $qyFilter); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '团队奖向下追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 团队奖向上追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionTraceUpQy() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice('请填写期数', 400); if (!$userName = Yii::$app->request->get('userName')) return static::notice('请填写会员编号', 400); if(!$userId = Info::getUserIdByUserName($userName)) return static::notice('会员不存在', 400); //会员是否有业绩单 if(!PerfOrder::find()->where('USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM',[':USER_ID'=>$userId,':PERIOD_NUM'=>$periodNum])->exists()){ return static::notice('该会员本期没有业绩单', 400); } $listObj = new TraceUpQyList(); $data = $listObj->getList(['condition'=>'', 'params'=>[], 'others'=>['userId'=>$userId, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 团队奖向上追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpQyExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice('请填写期数', 400); if (!$userName = Yii::$app->request->get('userName')) return static::notice('请填写会员编号', 400); if(!$userId = Info::getUserIdByUserName($userName)) return static::notice('会员不存在', 400); //会员是否有业绩单 if(!PerfOrder::find()->where('USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM',[':USER_ID'=>$userId,':PERIOD_NUM'=>$periodNum])->exists()){ return static::notice('该会员本期没有业绩单', 400); } $form = new BonusExportForm(); $result = $form->run(array_merge(['condition'=>'', 'params'=>[]], ['others'=>['userId'=>$userId, 'periodNum'=>$periodNum]]), '团队奖向上追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 荣衔奖向下追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownYc() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CBY.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceDownYcList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 荣衔奖向下追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownYcExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CBY.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '荣衔奖向下追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 服务奖向下追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownBd() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CBB.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceDownBdList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 服务奖向下追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownBdExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CBB.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '服务奖向下追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 推广奖向下追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownTg() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CTG.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceDownTgList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 推广奖向下追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownTgExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CTG.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '推广奖向下追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 消费奖向下追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownXf() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CXF.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceDownXfList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 消费奖向下追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownXfExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CXF.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '推广奖向下追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 业绩奖向下追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownYj() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CYJ.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceDownYjList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 业绩奖向下追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownYjExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CYJ.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '业绩奖向下追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 共享奖向下追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownGx() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CGX.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceDownGxList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 共享奖向下追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownGxExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CGX.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '共享奖向下追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 管理奖向下追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownGl() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CGL.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceDownGlList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 管理奖向下追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownGlExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CGL.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '管理奖向下追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 荣衔奖向上追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpYc() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CBY.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceUpYcList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 荣衔奖向上追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpYcExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CBY.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '荣衔奖向上追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 服务奖向上追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpBd() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CBB.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceUpBdList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 服务奖向上追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpBdExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CBY.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '荣衔奖向上追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 推广奖向上追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpTg() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CTG.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceUpTgList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 推广奖向上追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpTgExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CTG.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '荣衔奖向上追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 消费奖向上追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpXf() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CXF.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceUpXfList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 推广奖向上追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpXfExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CXF.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '荣衔奖向上追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 业绩奖向上追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpYj() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CYJ.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceUpYjList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 业绩奖向上追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpYjExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CYJ.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '荣衔奖向上追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 共享奖向上追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpGx() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CGX.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceUpGxList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 共享奖向上追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpGxExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CGX.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '荣衔奖向上追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 管理奖向上追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpGl() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CGL.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceUpGlList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 管理奖向上追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpGlExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CGL.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '荣衔奖向上追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 复销奖向下追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownFx() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CBF.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceDownFxList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 复销奖向下追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceDownFxExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CBF.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '复销奖向下追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 复销奖向上追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpFx() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CBF.PERIOD_NUM', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new TraceUpFxList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params, 'others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]); return static::notice($data); } /** * 复销奖向上追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceUpFxExport() { $periodNum = Yii::$app->request->get('periodNum'); if (!$periodNum) return static::notice([]); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', 'periodNum' => 'CBF.PERIOD_NUM', ]); $form = new BonusExportForm(); $result = $form->run(array_merge($filter, ['others'=>['yearMonth'=>$yearMonth, 'periodNum'=>$periodNum]]), '复销奖向上追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 核算会员区域津贴 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionCalcQy() { $periodNum = Yii::$app->request->get('periodNum'); $userName = Yii::$app->request->get('userName'); $period = Period::instance(); $yearMonth = $period->getYearMonth($periodNum); if (!$userId = Info::getUserIdByUserName($userName)) { return static::notice('会员不存在', 400); } $data = CalcBonus::findUseSlaves()->yearMonth($yearMonth)->where('PERIOD_NUM=:PERIOD_NUM AND USER_ID=:USER_ID', [':PERIOD_NUM' => $periodNum, ':USER_ID' => $userId])->asArray()->one(); if ($data) { $data['REAL_NAME'] = Info::getUserRealNameByUserId($userId); $data['LAST_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$data['LAST_DEC_LV']]['LEVEL_NAME']??''; $data['LAST_EMP_LV_NAME'] = Cache::getEmpLevelConfig()[$data['LAST_EMP_LV']]['LEVEL_NAME']??''; $data['LAST_STATUS_NAME'] = \Yii::$app->params['userStatus'][$data['LAST_STATUS']]['label']??''; $data['AUDIT_STATUS'] = false; if ($resendQy = ResendQYAudit::find()->where('USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM AND (AUDIT_STATUS=:AUDIT_STATUS_UN OR AUDIT_STATUS=:AUDIT_STATUS_TRUE)', [':USER_ID' => $userId, ':PERIOD_NUM' => $periodNum, ':AUDIT_STATUS_UN' => \Yii::$app->params['auditStatus']['un']['value'], ':AUDIT_STATUS_TRUE' => \Yii::$app->params['auditStatus']['true']['value']])->asArray()->one()) { $data['AUDIT_STATUS'] = $resendQy['AUDIT_STATUS']; } } return static::notice($data); } /** * 补发区域津贴列表 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionResendQyList() { $filter = $this->filterCondition([ 'userIds' => 'USER_ID', 'filterStatus' => 'RESEND_STATUS', 'PERIOD_NUM' => 'PERIOD_NUM', 'LAST_DEC_LV_NAME' => 'LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'LAST_EMP_LV', 'LAST_STATUS_NAME' => 'LAST_STATUS', 'LAST_SUB_COM_NAME' => 'LAST_SUB_COM_ID', 'LAST_AREA_NAME' => [ 'FIELD' => ['LAST_PROVINCE', 'LAST_CITY', 'LAST_COUNTY'], 'BIND' => ['LAST_PROVINCE', 'LAST_CITY', 'LAST_COUNTY'], ], 'LAST_SYSTEM_NAME' => 'LAST_SYSTEM_ID', 'BONUS_QY' => 'BONUS_QY', 'SHOULD_QY' => 'SHOULD_QY', 'QY_1L' => 'QY_1L', 'SURPLUS_1L' => 'SURPLUS_1L', 'QY_2L' => 'QY_2L', 'SURPLUS_2L' => 'SURPLUS_2L', 'QY_3L' => 'QY_3L', 'SURPLUS_3L' => 'SURPLUS_3L', 'QY_4L' => 'QY_4L', 'SURPLUS_4L' => 'SURPLUS_4L', 'QY_5L' => 'QY_5L', 'SURPLUS_5L' => 'SURPLUS_5L', 'SURPLUS_LS' => 'SURPLUS_LS', 'QY_LS' => 'QY_LS', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new ResendQyList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 区域津贴补发列表导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionResendQyListExport() { $filter = $this->filterCondition([ 'userIds' => 'USER_ID', 'filterStatus' => 'RESEND_STATUS', 'PERIOD_NUM' => 'PERIOD_NUM', 'LAST_DEC_LV_NAME' => 'LAST_DEC_LV', 'LAST_EMP_LV_NAME' => 'LAST_EMP_LV', 'LAST_STATUS_NAME' => 'LAST_STATUS', 'LAST_SUB_COM_NAME' => 'LAST_SUB_COM_ID', 'LAST_AREA_NAME' => [ 'FIELD' => ['LAST_PROVINCE', 'LAST_CITY', 'LAST_COUNTY'], 'BIND' => ['LAST_PROVINCE', 'LAST_CITY', 'LAST_COUNTY'], ], 'LAST_SYSTEM_NAME' => 'LAST_SYSTEM_ID', 'BONUS_QY' => 'BONUS_QY', 'SHOULD_QY' => 'SHOULD_QY', 'QY_1L' => 'QY_1L', 'SURPLUS_1L' => 'SURPLUS_1L', 'QY_2L' => 'QY_2L', 'SURPLUS_2L' => 'SURPLUS_2L', 'QY_3L' => 'QY_3L', 'SURPLUS_3L' => 'SURPLUS_3L', 'QY_4L' => 'QY_4L', 'SURPLUS_4L' => 'SURPLUS_4L', 'QY_5L' => 'QY_5L', 'SURPLUS_5L' => 'SURPLUS_5L', 'SURPLUS_LS' => 'SURPLUS_LS', 'QY_LS' => 'QY_LS', ]); $form = new BonusExportForm(); $result = $form->run($filter, '区域津贴补发列表'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 补发区域津贴 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionResendQy() { if (Yii::$app->request->isPost) { $formModel = new ResendQYForm(); $formModel->scenario = 'apply'; if ($formModel->load(Yii::$app->request->post(), '') && $result = $formModel->apply()) { if($result['logs']){ /*foreach ($result['logs'] as $k => $value) { $userName = Info::getUserNameByUserId($value); // Log::adminHandle('申请为会员' . $userName . '发放补发区域津贴', 0, $value, $userName); }*/ return static::notice('申请成功,请在补发区域津贴审核管理中审核'); }else{ return static::notice('没有符合补发条件的记录',400); } } else { return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400); } } return static::notice('非法请求', 400); } /** * 补发审核表 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionResendQyAuditList() { $filter = $this->filterCondition([ 'userIds' => 'RQYA.USER_ID', 'filterStatus' => 'RQYA.AUDIT_STATUS', 'SHOULD_BONUS' => 'RQYA.SHOULD_BONUS', 'PERIOD_NUM' => 'RQYA.PERIOD_NUM', 'CREATED_AT' => 'RQYA.CREATED_AT', 'AUDITED_AT' => 'RQYA.AUDITED_AT', 'RESEND_REMARK' => 'RQYA.RESEND_REMARK', 'CREATE_ADMIN_NAME' => 'ADMC.ADMIN_NAME', 'AUDIT_ADMIN_NAME' => 'ADMA.ADMIN_NAME', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new ResendQyAuditList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 补发审核表导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionResendQyAuditListExport() { $filter = $this->filterCondition([ 'userIds' => 'RQYA.USER_ID', 'filterStatus' => 'RQYA.AUDIT_STATUS', 'SHOULD_BONUS' => 'RQYA.SHOULD_BONUS', 'PERIOD_NUM' => 'RQYA.PERIOD_NUM', 'CREATED_AT' => 'RQYA.CREATED_AT', 'AUDITED_AT' => 'RQYA.AUDITED_AT', 'RESEND_REMARK' => 'RQYA.RESEND_REMARK', 'CREATE_ADMIN_NAME' => 'ADMC.ADMIN_NAME', 'AUDIT_ADMIN_NAME' => 'ADMA.ADMIN_NAME', ]); $form = new BonusExportForm(); $result = $form->run($filter, '补发区域津贴审核列表'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 审核补发区域津贴 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionResendQyAudit() { $formModel = new ResendQYForm(); $formModel->scenario = 'audit'; if ($formModel->load(Yii::$app->request->post(), '') && $result = $formModel->audit()) { /*foreach ($result['logs'] as $k => $value) { $userName = Info::getUserNameByUserId($value); // Log::adminHandle('审核为会员' . $userName . '补发区域津贴', 1, $value, $userName); }*/ return static::notice('审核补发区域津贴成功'); } return static::notice(Form::formatErrorsForApi($formModel->getErrors()), 400); } /** * 删除补发区域津贴审核信息 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionResendQyAuditDelete() { $resendQYForm = new ResendQYForm(); $result = static::delete(ResendQYAudit::class, function ($selected) use ($resendQYForm) { $resendQYForm->beforeDelete($selected); // Log::adminHandle('删除审核会员余额信息'); }, function ($selected) use ($resendQYForm) { $resendQYForm->delete($selected); // Log::adminHandle('删除审核会员余额信息'); }, true); return $result; } /** * 余额列表 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionBalanceList() { $filter = $this->filterCondition([ 'USER_NAME' => 'UI.USER_NAME', 'REAL_NAME' => 'UI.REAL_NAME', 'userIds' => 'UB.USER_ID', 'BONUS' => 'BONUS', // 'RECONSUME_POINTS' => 'RECONSUME_POINTS', 'CASH' => 'CASH', 'IS_DEC' => 'UI.IS_DEC', 'PERIOD_AT' => 'UI.PERIOD_AT', 'MOBILE' => 'UI.MOBILE', 'TEL' => 'UI.TEL', // 'CF' => 'CF', // 'LX' => 'LX', // 'HIGHEST_EMP_LV_NAME' => 'UI.HIGHEST_EMP_LV', // 'SYSTEM_NAME' => 'UI.SYSTEM_ID', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new BalanceList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 会员奖金余额导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionBalanceExport() { $filter = $this->filterCondition([ 'USER_NAME' => 'UI.USER_NAME', 'REAL_NAME' => 'UI.REAL_NAME', 'userIds' => 'UB.USER_ID', 'BONUS' => 'BONUS', 'IS_DEC' => 'UI.IS_DEC', 'PERIOD_AT' => 'UI.PERIOD_AT', 'MOBILE' => 'UI.MOBILE', 'TEL' => 'UI.TEL', // 'CF' => 'CF', // 'LX' => 'LX', ]); $form = new BonusExportForm(); $result = $form->run($filter, '会员奖金余额'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 报单中心店补/补贴追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionTraceBt() { $startPeriodNum = Yii::$app->request->get('startPeriodNum'); $endPeriodNum = Yii::$app->request->get('endPeriodNum'); if (!$startPeriodNum || !$endPeriodNum) return static::notice([]); $filterStatus = Yii::$app->request->get('filterStatus'); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', ]); $condition = $filter['condition']; $params = $filter['params']; if ($startPeriodNum) { $condition .= ' AND CBT.PERIOD_NUM>=:START_PERIOD_NUM'; $params[':START_PERIOD_NUM'] = $startPeriodNum; } if ($endPeriodNum) { $condition .= ' AND CBT.PERIOD_NUM<=:END_PERIOD_NUM'; $params[':END_PERIOD_NUM'] = $endPeriodNum; } if ($filterStatus) { $condition .= ' AND CBT.BT_TYPE=:BT_TYPE'; $params[':BT_TYPE'] = $filterStatus; } $listObj = new TraceBtList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 报单中心补贴追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceBtExport() { $startPeriodNum = Yii::$app->request->get('startPeriodNum'); $endPeriodNum = Yii::$app->request->get('endPeriodNum'); if (!$startPeriodNum || !$endPeriodNum) return static::notice([]); $filterStatus = Yii::$app->request->get('filterStatus'); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', ]); $condition = $filter['condition']; $params = $filter['params']; if ($startPeriodNum) { $condition .= ' AND CBT.PERIOD_NUM>=:START_PERIOD_NUM'; $params[':START_PERIOD_NUM'] = $startPeriodNum; } if ($endPeriodNum) { $condition .= ' AND CBT.PERIOD_NUM<=:END_PERIOD_NUM'; $params[':END_PERIOD_NUM'] = $endPeriodNum; } if ($filterStatus) { $condition .= ' AND CBT.BT_TYPE=:BT_TYPE'; $params[':BT_TYPE'] = $filterStatus; } $form = new BonusExportForm(); $result = $form->run(['condition'=>$condition, 'params'=>$params], '报单中心补贴追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 报单中心货补追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionTraceFl() { $startPeriodNum = Yii::$app->request->get('startPeriodNum'); $endPeriodNum = Yii::$app->request->get('endPeriodNum'); if (!$startPeriodNum || !$endPeriodNum) return static::notice([]); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', ]); $condition = $filter['condition']; $params = $filter['params']; if ($startPeriodNum) { $condition .= ' AND CFL.PERIOD_NUM>=:START_PERIOD_NUM'; $params[':START_PERIOD_NUM'] = $startPeriodNum; } if ($endPeriodNum) { $condition .= ' AND CFL.PERIOD_NUM<=:END_PERIOD_NUM'; $params[':END_PERIOD_NUM'] = $endPeriodNum; } $listObj = new TraceFlList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 报单中心货补追溯导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceFlExport() { $startPeriodNum = Yii::$app->request->get('startPeriodNum'); $endPeriodNum = Yii::$app->request->get('endPeriodNum'); if (!$startPeriodNum || !$endPeriodNum) return static::notice([]); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', ]); $condition = $filter['condition']; $params = $filter['params']; if ($startPeriodNum) { $condition .= ' AND CFL.PERIOD_NUM>=:START_PERIOD_NUM'; $params[':START_PERIOD_NUM'] = $startPeriodNum; } if ($endPeriodNum) { $condition .= ' AND CFL.PERIOD_NUM<=:END_PERIOD_NUM'; $params[':END_PERIOD_NUM'] = $endPeriodNum; } $form = new BonusExportForm(); $result = $form->run(['condition'=>$condition, 'params'=>$params], '报单中心货补追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 区域业绩提成追溯 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionTraceFw() { $startPeriodNum = Yii::$app->request->get('startPeriodNum'); $endPeriodNum = Yii::$app->request->get('endPeriodNum'); if (!$startPeriodNum || !$endPeriodNum) return static::notice([]); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', ]); $condition = $filter['condition']; $params = $filter['params']; if ($startPeriodNum) { $condition .= ' AND CFW.PERIOD_NUM>=:START_PERIOD_NUM'; $params[':START_PERIOD_NUM'] = $startPeriodNum; } if ($endPeriodNum) { $condition .= ' AND CFW.PERIOD_NUM<=:END_PERIOD_NUM'; $params[':END_PERIOD_NUM'] = $endPeriodNum; } $listObj = new TraceFwList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 区域业绩提成导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionTraceFwExport() { $startPeriodNum = Yii::$app->request->get('startPeriodNum'); $endPeriodNum = Yii::$app->request->get('endPeriodNum'); if (!$startPeriodNum || !$endPeriodNum) return static::notice([]); $filter = $this->filterCondition([ 'userName' => 'UI.USER_NAME', ]); $condition = $filter['condition']; $params = $filter['params']; if ($startPeriodNum) { $condition .= ' AND CFW.PERIOD_NUM>=:START_PERIOD_NUM'; $params[':START_PERIOD_NUM'] = $startPeriodNum; } if ($endPeriodNum) { $condition .= ' AND CFW.PERIOD_NUM<=:END_PERIOD_NUM'; $params[':END_PERIOD_NUM'] = $endPeriodNum; } $form = new BonusExportForm(); $result = $form->run(['condition'=>$condition, 'params'=>$params], '区域业绩提成追溯'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 业绩单 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionPerfOrder(){ $filter = $this->filterCondition([ 'PERIOD_NUM' => 'PO.PERIOD_NUM', 'SN' => 'PO.SN', 'DEC_STATUS_NAME' => 'PO.DEC_STATUS', 'USER_NAME' => 'U.USER_NAME', 'REAL_NAME' => 'U.REAL_NAME', 'userIds' => 'PO.USER_ID', 'filterType' => 'PO.DEC_TYPE', 'LAST_REC_USER_NAME' => 'PO.LAST_REC_USER_NAME', 'LAST_REC_REAL_NAME' => 'PO.LAST_REC_REAL_NAME', 'PV' => 'PO.PV', 'DEC_AMOUNT' => 'PO.DEC_AMOUNT', 'DEC_SN' => 'PO.DEC_SN', 'CREATED_AT' => 'PO.CREATED_AT', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new PerfOrderList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 业绩单导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionPerfOrderExport() { $filter = $this->filterCondition([ 'PERIOD_NUM' => 'PO.PERIOD_NUM', 'SN' => 'PO.SN', 'DEC_STATUS_NAME' => 'PO.DEC_STATUS', 'userIds' => 'PO.USER_ID', 'filterType' => 'PO.DEC_TYPE', 'LAST_REC_USER_NAME' => 'PO.LAST_REC_USER_NAME', 'LAST_REC_REAL_NAME' => 'PO.LAST_REC_REAL_NAME', 'PV' => 'PO.PV', 'DEC_AMOUNT' => 'PO.DEC_AMOUNT', 'DEC_SN' => 'PO.DEC_SN', 'LAST_SUB_COM_NAME' => 'PO.LAST_SUB_COM_ID', 'LAST_SYSTEM_NAME' => 'PO.LAST_SYSTEM_ID', 'LAST_AREA' => [ 'FIELD' => ['PO.LAST_PROVINCE', 'PO.LAST_CITY', 'PO.LAST_COUNTY'], 'BIND' => ['LAST_PROVINCE', 'LAST_CITY', 'LAST_COUNTY'], ], 'DEC_USER_NAME' => 'DUI.USER_NAME', 'LAST_DEC_DEC_LV_NAME' => 'PO.LAST_DEC_DEC_LV', 'LAST_DEC_SUB_COM_NAME' => 'PO.LAST_DEC_SUB_COM_ID', 'LAST_DEC_AREA' => [ 'FIELD' => ['PO.LAST_DEC_PROVINCE', 'PO.LAST_DEC_CITY', 'PO.LAST_DEC_COUNTY'], 'BIND' => ['LAST_DEC_PROVINCE', 'LAST_DEC_CITY', 'LAST_DEC_COUNTY'], ], 'CREATED_AT' => 'PO.CREATED_AT', 'CLOSED_AT' => 'PO.CLOSED_AT', ]); $condition = $filter['condition']; $params = $filter['params']; $form = new BonusExportForm(); $result = $form->run(['condition'=>$condition, 'params'=>$params], '业绩单'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 月积分 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionScoreMonth(){ $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', 'userIds' => 'SM.USER_ID', 'CALC_MONTH' => 'SM.CALC_MONTH', 'CREATED_AT' => 'SM.CREATED_AT', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new ScoreMonthList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 月积分导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionScoreMonthExport() { $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', 'userIds' => 'SM.USER_ID', 'CALC_MONTH' => 'SM.CALC_MONTH', 'CREATED_AT' => 'SM.CREATED_AT', ]); $condition = $filter['condition']; $params = $filter['params']; $form = new BonusExportForm(); $result = $form->run(['condition'=>$condition, 'params'=>$params], '月积分'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 月业绩 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionPerfMonth(){ $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', 'REC_USER_NAME' => 'RU.USER_NAME', 'userIds' => 'PM.USER_ID', 'CALC_MONTH' => 'PM.CALC_MONTH', 'CREATED_AT' => 'PM.CREATED_AT', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new PerfMonthList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 月业绩导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionPerfMonthExport() { $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', 'REC_USER_NAME' => 'RU.USER_NAME', 'userIds' => 'PM.USER_ID', 'CALC_MONTH' => 'PM.CALC_MONTH', 'CREATED_AT' => 'PM.CREATED_AT', ]); $condition = $filter['condition']; $params = $filter['params']; $form = new BonusExportForm(); $result = $form->run(['condition'=>$condition, 'params'=>$params], '月业绩'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 期业绩 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionPerfPeriodList(){ $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', 'userIds' => 'PP.USER_ID', 'PERIOD_NUM' => 'PP.PERIOD_NUM', 'CREATED_AT' => 'PP.CREATED_AT', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new PerfPeriodList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 期业绩导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionPerfPeriodListExport() { $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', 'userIds' => 'PP.USER_ID', 'PERIOD_NUM' => 'PP.PERIOD_NUM', 'CREATED_AT' => 'PP.CREATED_AT', ]); $condition = $filter['condition']; $params = $filter['params']; $form = new BonusExportForm(); $result = $form->run(['condition'=>$condition, 'params'=>$params], '期业绩'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 达标业绩 * @return mixed * @throws \yii\base\Exception * @throws \yii\web\HttpException */ public function actionPerfStandard(){ $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', 'REC_USER_NAME' => 'RU.USER_NAME', 'userIds' => 'PS.USER_ID', 'CALC_MONTH' => 'PS.CALC_MONTH', 'CREATED_AT' => 'PS.CREATED_AT', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new PerfStandardList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 达标业绩导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionPerfStandardExport() { $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', 'REC_USER_NAME' => 'RU.USER_NAME', 'userIds' => 'PS.USER_ID', 'CALC_MONTH' => 'PS.CALC_MONTH', 'CREATED_AT' => 'PS.CREATED_AT', ]); $condition = $filter['condition']; $params = $filter['params']; $form = new BonusExportForm(); $result = $form->run(['condition'=>$condition, 'params'=>$params], '达标业绩'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } /** * 会员实时业绩 * @return mixed * @throws \yii\web\HttpException */ public function actionRealTimePerf() { $userName = Yii::$app->request->get('userName'); if (!$userId = Info::getUserIdByUserName($userName)) { return static::notice('会员不存在', 400); } $period = Period::instance(); $newPerf = Perf::getPeriodNewPerf($userId); $weekData = [['PV_1L' => $newPerf['PV_1L'], 'PV_2L' => $newPerf['PV_2L'], 'PV_3L' => $newPerf['PV_3L'], 'PV_4L' => $newPerf['PV_4L'], 'PV_5L' => $newPerf['PV_5L'], 'PV_PCS'=>Tool::formatPrice($newPerf['PV_PCS']), 'PV_PSS'=>Tool::formatPrice($newPerf['PV_PSS'])]]; $monthPerf = Perf::getMonthPerf($userId); $monthData = [['PV_1L' => Tool::formatPrice($monthPerf['PV_1L']), 'PV_2L' => Tool::formatPrice($monthPerf['PV_2L']), 'PV_3L' => Tool::formatPrice($monthPerf['PV_3L']), 'PV_4L' => Tool::formatPrice($monthPerf['PV_4L']), 'PV_5L' => Tool::formatPrice($monthPerf['PV_5L']), 'PV_PCS'=>Tool::formatPrice($monthPerf['PV_PCS']), 'PV_PSS'=>Tool::formatPrice($monthPerf['PV_PSS'])]]; $lastMonth = PerfMonth::getMonthPerf($period->getLastMonth()['yearMonth'], $userId); $lastData = [['PV_1L' => Tool::formatPrice($lastMonth['PV_1L_TOTAL']), 'PV_2L' => Tool::formatPrice($lastMonth['PV_2L_TOTAL']), 'PV_3L' => Tool::formatPrice($lastMonth['PV_3L_TOTAL']), 'PV_4L' => Tool::formatPrice($lastMonth['PV_4L_TOTAL']), 'PV_5L' => Tool::formatPrice($lastMonth['PV_5L_TOTAL']), 'PV_PCS'=>Tool::formatPrice($lastMonth['PV_PCS']), 'PV_PSS'=>Tool::formatPrice($lastMonth['PV_PSS']), 'PV_PSS_TOTAL'=>Tool::formatPrice($lastMonth['PV_PSS_TOTAL'])]]; //是否合格 // $lastChkStatus = ''; // $lastMonthPerfChk = Cache::getSystemConfig()['lastMonthPerfChk']['VALUE']; // $lastArr = [$lastMonth['PV_1L_TOTAL'], $lastMonth['PV_2L_TOTAL'], $lastMonth['PV_3L_TOTAL'], $lastMonth['PV_4L_TOTAL'], $lastMonth['PV_5L_TOTAL']]; // if (array_sum($lastArr) >= $lastMonthPerfChk) { // $lastChkStatus = '已合格'; // } //判断大区 // $bigLocation = array_search(max($lastArr), $lastArr) + 1; return static::notice(['weekData' => $weekData, 'monthData' => $monthData, 'lastData' => $lastData]); } /** * 荣衔业绩 * @return mixed * @throws \yii\web\HttpException */ public function actionYcPerf() { $userName = Yii::$app->request->get('userName'); if (!$userId = Info::getUserIdByUserName($userName)) { return static::notice('会员不存在', 400); } $userPerfData = Perf::getUserPerf($userId); $ycPerfList = []; //查找推荐的子会员 $childrenList = UserInfo::findUseDbCalc()->select('USER_ID')->where('REC_UID=:REC_UID', [ 'REC_UID' => $userId ])->asArray()->all(); $maxPvPss = 0; $childSumPerf = 0; foreach ($childrenList as $child) { $childBaseUser = Info::getBaseUserById($child['USER_ID']); if( !$childBaseUser ) continue; $childPerfData = Perf::getUserPerf($child['USER_ID']); if( !$childPerfData ) continue; $childPvPcs = $childPerfData['PV_PCS_ZC'] + $childPerfData['PV_PCS_FX']; $childPvPssTotal = $childPvPcs + $childPerfData['PV_PSS']; $childSumPerf += $childPvPssTotal; if( $childPvPssTotal >= $maxPvPss ) { $maxPvPss = $childPvPssTotal; } $ycPerfList[] = [ 'USER_NAME'=>$childBaseUser['USER_NAME'], 'REAL_NAME'=>$childBaseUser['REAL_NAME'], 'PV_PCS' => $childPerfData['PV_PCS_ZC'] + $childPerfData['PV_PCS_FX'], 'PV_PSS_TOTAL' => $childPerfData['PV_PSS_TOTAL'], 'MAX_DEPART_PERF' => '-', 'OTHER_DEPART_PERF' => '-', 'PV_PSS_SUM_TOTAL' => round($childPerfData['PV_PCS_ZC'] + $childPerfData['PV_PCS_FX'] + $childPerfData['PV_PSS_TOTAL'],2), ]; } if( $userPerfData ) { $baseUser = Info::getBaseUserById($userId); $ycPerfData = [ 'USER_NAME'=>$baseUser['USER_NAME'], 'REAL_NAME'=>$baseUser['REAL_NAME'], 'PV_PCS' => $userPerfData['PV_PCS_ZC'] + $userPerfData['PV_PCS_FX'], 'PV_PSS_TOTAL' => $userPerfData['PV_PSS_TOTAL'], 'MAX_DEPART_PERF' => round($maxPvPss, 2), 'OTHER_DEPART_PERF' => round($childSumPerf-$maxPvPss, 2), 'PV_PSS_SUM_TOTAL' => round($userPerfData['PV_PCS_ZC'] + $userPerfData['PV_PCS_FX'] + $userPerfData['PV_PSS_TOTAL'],2), ]; array_unshift($ycPerfList, $ycPerfData); } return static::notice(['ycPerfList' => $ycPerfList]); } /** * 用户业绩 * @return mixed * @throws \yii\web\HttpException */ public function actionUserPerf() { $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', ]); $condition = $filter['condition']; $params = $filter['params']; $listObj = new UserPerfList(); $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]); return static::notice($data); } /** * 月业绩导出 * @return mixed * @throws \yii\db\Exception * @throws \yii\web\HttpException */ public function actionUserPerfExport() { $filter = $this->filterCondition([ 'USER_NAME' => 'U.USER_NAME', ]); $condition = $filter['condition']; $params = $filter['params']; $form = new BonusExportForm(); $result = $form->run(['condition'=>$condition, 'params'=>$params], '用户业绩'); if (!$result) { return static::notice(Form::formatErrorsForApi($form->getErrors()), 400); } return static::notice('导出开始,请到文件管理-导出文件查看'); } }