|
|
@@ -29,8 +29,10 @@ use common\models\Period;
|
|
|
use common\models\DecRole;
|
|
|
use common\models\EmployLevel;
|
|
|
use common\models\FlowExchangePoints;
|
|
|
+use common\models\PerfMonthPrepare;
|
|
|
use common\models\ScoreMonth;
|
|
|
use common\models\UserBonus;
|
|
|
+use common\models\UserRelation;
|
|
|
use common\models\UserWallet;
|
|
|
use frontendApi\modules\v1\models\User;
|
|
|
|
|
|
@@ -94,6 +96,67 @@ class BonusController extends BaseController {
|
|
|
return static::notice(['wallet' => $wallet,'dealSwitch'=>$dealSwitch]);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 团队查询
|
|
|
+ * @return mixed
|
|
|
+ * @throws \yii\web\HttpException
|
|
|
+ */
|
|
|
+ public function actionSearch() {
|
|
|
+ $userId = \Yii::$app->user->id;
|
|
|
+ // 查询此用户,月业绩
|
|
|
+ //期数显示
|
|
|
+ // 达标规则,小组底下有一个大于等于一万.或者个人情况里的合计大于等于一万
|
|
|
+ $period = Period::instance();
|
|
|
+ $periodNum = $period->getNowPeriodNum();
|
|
|
+ $month = $period->getNowMonth();
|
|
|
+ $data = PerfMonthPrepare::findUseSlaves()
|
|
|
+ ->where('USER_ID=:USER_ID AND CALC_MONTH=:CALC_MONTH', [':USER_ID' => $userId,':CALC_MONTH'=>$month])
|
|
|
+ ->asArray()
|
|
|
+ ->one();
|
|
|
+ // PV_PCS 个人业绩 PV_PSS 月新增团队业绩 PV_PSS_TOTAL月累计团队业绩
|
|
|
+ // 其中页面使用的是月新增团队业绩
|
|
|
+ // 获取用信息
|
|
|
+ $userInfo = User::getEnCodeInfo($userId);
|
|
|
+ $user = [
|
|
|
+ 'number' => $userInfo['USER_NAME'],
|
|
|
+ 'name' => $userInfo['REAL_NAME'],
|
|
|
+ 'perf_status' => '0', // 0 未达标 1为已达标
|
|
|
+ 'user_perf' => 0, // 个人业绩
|
|
|
+ 'team_perf' => 0, // 团队累计业绩
|
|
|
+ 'total_perf' => 0 // 合计业绩
|
|
|
+ ];
|
|
|
+ if (!empty($data)) {
|
|
|
+ $user['user_perf'] = $data['PV_PCS'];
|
|
|
+ $user['team_perf'] = $data['PV_PSS'];
|
|
|
+ $user['total_perf'] = $data['PV_PCS']+$data['PV_PSS'];
|
|
|
+ if ($user['total_perf'] >= 10000) {
|
|
|
+ $user['perf_status'] = '1';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $teamInfo = [];
|
|
|
+ // 查询此用户的推荐(开拓)团队一级信息
|
|
|
+ $relation = UserRelation::getChildrenWithDeepAndLayer($userId, 1, 1, $periodNum);
|
|
|
+ if ($relation) {
|
|
|
+ // 循环一级开拓用户
|
|
|
+ foreach($relation as $v) {
|
|
|
+ // 获取此用户预计算月业绩
|
|
|
+ $relationPerf = PerfMonthPrepare::findUseSlaves()
|
|
|
+ ->where('USER_ID=:USER_ID AND CALC_MONTH=:CALC_MONTH', [':USER_ID' => $userId,':CALC_MONTH'=>$month])
|
|
|
+ ->asArray()
|
|
|
+ ->one();
|
|
|
+ $teamInfo[]['number'] = $v['USER_NAME'];
|
|
|
+ $teamInfo[]['name'] = $v['REAL_NAME'];
|
|
|
+ $teamInfo[]['perf_status'] = 0;
|
|
|
+ $teamInfo[]['user_perf'] = 0;
|
|
|
+ $teamInfo[]['team_perf'] = 0;
|
|
|
+ $teamInfo[]['total_perf'] = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return static::notice(['user' => $user,'team'=>$teamInfo]);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 交易记录
|
|
|
* @return mixed
|