| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace addons\OperationCenter\common\models;
- use common\models\user\User;
- /**
- * MallUser class
- */
- class MallUser extends User
- {
- /**
- * @param string $key_word
- * @return array
- */
- public static function getUserIdByUserKeyWord(int $mall_id, string $key_word)
- {
- return static::find()
- ->select(['id'])
- ->andWhere(['mall_id' => $mall_id])
- ->andWhere([
- 'or',
- ['like', 'nickname', $key_word],
- ['like', 'mobile', $key_word],
- ])
- ->column();
- }
- /**
- * 获取推荐人ID
- *
- * @param integer $user_id
- * @return string|int|null|false the value of the first column in the first row of the query result.
- */
- public static function getParentId(int $user_id)
- {
- return static::find()
- ->where(['id' => $user_id])
- ->select('parent_id')
- ->scalar();
- }
- }
|