|
|
@@ -903,6 +903,37 @@ SQL;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Public member information lookup for guest declaration flows.
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
+ public function actionGuestFullInfo()
|
|
|
+ {
|
|
|
+ $userName = trim((string) \Yii::$app->request->get('userName', ''));
|
|
|
+ $userId = Info::getUserIdByUserName($userName);
|
|
|
+ $user = $userId ? User::findOneAsArray('ID=:ID', [':ID' => $userId]) : null;
|
|
|
+ if (!$user) {
|
|
|
+ return static::notice(Yii::t('app', 'memberNumberDoesNotExist'), 400);
|
|
|
+ }
|
|
|
+
|
|
|
+ $allChildUser = UserNetwork::getFirstFloorChildren($userId);
|
|
|
+ $isLocation = [1 => 'Left-Null', 2 => 'Right-Null'];
|
|
|
+ if ($allChildUser) {
|
|
|
+ foreach ($allChildUser as $child) {
|
|
|
+ if ($child['RELATIVE_LOCATION'] < '3' && isset($isLocation[$child['RELATIVE_LOCATION']])) {
|
|
|
+ $isLocation[$child['RELATIVE_LOCATION']] = str_replace('Null', 'Full', $isLocation[$child['RELATIVE_LOCATION']]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return static::notice([
|
|
|
+ 'REAL_NAME' => $user['REAL_NAME'],
|
|
|
+ 'countryId' => $user['COUNTRY_ID'],
|
|
|
+ 'userId' => $userId,
|
|
|
+ 'isLocation' => '(' . implode(',', $isLocation) . ')',
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
public function actionInspectNetwork()
|
|
|
{
|
|
|
// 推荐人信息
|
|
|
@@ -984,6 +1015,73 @@ SQL;
|
|
|
return static::notice(Yii::t('ctx', 'fillSponsorUpline'), 400);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Public sponsor relationship validation for guest declaration flows.
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
+ public function actionGuestInspectNetwork()
|
|
|
+ {
|
|
|
+ $recommenderName = trim((string) \Yii::$app->request->get('recommenderName', ''));
|
|
|
+ $recommenderActualName = trim((string) \Yii::$app->request->get('recommenderActualName', ''));
|
|
|
+ if ($recommenderName === '' || $recommenderActualName === '') {
|
|
|
+ return static::notice(Yii::t('app', 'memberNumberDoesNotExist'), 400);
|
|
|
+ }
|
|
|
+
|
|
|
+ $userId = Info::getUserIdByUserName($recommenderName);
|
|
|
+ $recommender = $userId ? User::findOneAsArray('ID=:ID', [':ID' => $userId]) : null;
|
|
|
+ if (!$recommender) {
|
|
|
+ return static::notice(Yii::t('app', 'memberNumberDoesNotExist'), 400);
|
|
|
+ }
|
|
|
+
|
|
|
+ $actualId = Info::getUserIdByUserName($recommenderActualName);
|
|
|
+ $recommenderActual = $actualId ? User::findOneAsArray('ID=:ID', [':ID' => $actualId]) : null;
|
|
|
+ if (!$recommenderActual) {
|
|
|
+ return static::notice(Yii::t('app', 'memberNumberDoesNotExist'), 400);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($actualId == $userId) {
|
|
|
+ return static::notice([
|
|
|
+ 'REAL_NAME' => $recommenderActual['REAL_NAME'],
|
|
|
+ 'userId' => $recommenderActual['ID'],
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ $sqlUp = <<<SQL
|
|
|
+ WITH recursive t_rec AS
|
|
|
+ (
|
|
|
+ SELECT m.USER_ID, U.USER_NAME, m.PARENT_UID, U2.USER_NAME AS PARENT_NAME, 1 AS node_level
|
|
|
+ FROM AR_USER_RELATION_NEW m
|
|
|
+ LEFT JOIN AR_USER U ON U.ID = m.USER_ID
|
|
|
+ LEFT JOIN AR_USER U2 ON U2.ID = m.PARENT_UID
|
|
|
+ WHERE U.USER_NAME = :USER_NAME
|
|
|
+
|
|
|
+ UNION ALL
|
|
|
+
|
|
|
+ SELECT t1.USER_ID, U.USER_NAME, t1.PARENT_UID, U2.USER_NAME AS PARENT_NAME,
|
|
|
+ t2.node_level + 1
|
|
|
+ FROM AR_USER_RELATION_NEW t1
|
|
|
+ JOIN t_rec t2 ON t2.PARENT_UID = t1.USER_ID
|
|
|
+ LEFT JOIN AR_USER U ON U.ID = t1.USER_ID
|
|
|
+ LEFT JOIN AR_USER U2 ON U2.ID = t1.PARENT_UID
|
|
|
+ )
|
|
|
+ SELECT * FROM t_rec
|
|
|
+SQL;
|
|
|
+
|
|
|
+ $relationNodeUp = \Yii::$app->db->createCommand($sqlUp)
|
|
|
+ ->bindValue(':USER_NAME', $recommenderName)
|
|
|
+ ->queryAll();
|
|
|
+ $relationNodeUp = array_column($relationNodeUp, 'USER_NAME');
|
|
|
+
|
|
|
+ if (in_array($recommenderActualName, $relationNodeUp, true)) {
|
|
|
+ return static::notice([
|
|
|
+ 'REAL_NAME' => $recommenderActual['REAL_NAME'],
|
|
|
+ 'userId' => $recommenderActual['ID'],
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ return static::notice(Yii::t('ctx', 'fillSponsorUpline'), 400);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 复消会员信息查询
|
|
|
* @return mixed
|