mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
修改用户资料更新
This commit is contained in:
parent
ccd6d15bfb
commit
8126c17197
@ -43,10 +43,10 @@ class Wxapp extends Controller
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
$option = sysdata('wxapp');
|
||||
$wxapp = sysdata('wxapp');
|
||||
$this->config = [
|
||||
'appid' => $option['appid'] ?? '',
|
||||
'appsecret' => $option['appkey'] ?? '',
|
||||
'appid' => $wxapp['appid'] ?? '',
|
||||
'appsecret' => $wxapp['appkey'] ?? '',
|
||||
'cache_path' => with_path('runtime/wechat'),
|
||||
];
|
||||
if (empty(UserAdminService::TYPES[$this->type]['auth'])) {
|
||||
|
@ -61,8 +61,12 @@ class UserAdminService extends Service
|
||||
*/
|
||||
public static function set($map, array $data, string $type, bool $force = false): array
|
||||
{
|
||||
unset($data['id'], $data['deleted'], $data['create_at']);
|
||||
$user = DataUser::mk()->where($map)->where(['deleted' => 0])->findOrEmpty();
|
||||
unset($data['id'], $data['deleted'], $data['create_at']);
|
||||
// 不更新无效的用户字段
|
||||
if (!empty($user['nickname']) && $data['nickname'] === '微信用户') {
|
||||
unset($data['nickname'], $data['headimg']);
|
||||
}
|
||||
if (!$user->save($data)) throw new Exception("更新用户资料失败!");
|
||||
// 刷新用户认证令牌
|
||||
if ($force) UserTokenService::token($user['id'], $type);
|
||||
|
Loading…
x
Reference in New Issue
Block a user