Files
MBTI_wang/api/app/model/WechatUser.php
Ghost 1a66e77ab7 feat: 第三方渠道上下文与开放平台服务接入
1、修复了企业版/个人版在第三方入口下的人脸与测评跳转问题。

2、新增 ThirdPartyChannel/OpenPlatformService 及上下文 thirdPartyContext,补充相关迁移。

3、调整 Analyze/Auth/Test 等接口与小程序入口逻辑。

Made-with: Cursor
2026-04-03 14:18:34 +08:00

60 lines
1.6 KiB
PHP

<?php
namespace app\model;
use think\Model;
/**
* 微信小程序用户模型
*/
class WechatUser extends Model
{
protected $name = 'wechat_users';
protected $schema = [
'id' => 'int',
'openid' => 'string',
'unionid' => 'string',
'sessionKey' => 'string',
'nickname' => 'string',
'avatar' => 'string',
'phone' => 'string',
'ext_uid' => 'string',
'third_party_phone' => 'string',
'third_party_tid' => 'string',
'gender' => 'int',
'country' => 'string',
'province' => 'string',
'city' => 'string',
'birthday' => 'string',
'status' => 'int',
'lastLoginAt' => 'int',
'lastLoginIp' => 'string',
'enterpriseId' => 'int',
'createdAt' => 'int',
'updatedAt' => 'int',
];
protected $autoWriteTimestamp = 'int';
protected $createTime = 'createdAt';
protected $updateTime = 'updatedAt';
protected $hidden = ['sessionKey', 'openid'];
protected $type = [
'lastLoginAt' => 'integer',
'createdAt' => 'integer',
'updatedAt' => 'integer',
];
/**
* 返回给前端的用户信息(不包含敏感字段)
*/
public function toApiArray(): array
{
$row = $this->toArray();
unset($row['sessionKey'], $row['openid']);
$row['avatarUrl'] = $row['avatar'] ?? '';
return $row;
}
}