| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace api\models\user;
- use common\enums\StatusEnum;
- use common\models\user\User;
- use common\models\user\UserInfo as UserUserInfo;
- /**
- * 用户详情
- * @package api\models
- */
- class UserInfo extends UserUserInfo
- {
- /**
- * 微信公众号Openid
- *
- * @param integer $mall_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 getWechatOpenid(int $mall_id, int $user_id)
- {
- return static::find()
- ->where([
- 'user_id' => $user_id,
- 'mall_id' => $mall_id,
- 'status' => StatusEnum::ENABLED,
- 'platform' => User::TYPE_WECHAT,
- ])
- ->select(['openid'])
- ->cache(10)
- ->scalar();
- }
- }
|