mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-27 03:46:36 +08:00
修改用户资料更新
This commit is contained in:
parent
ccd6d15bfb
commit
8126c17197
@ -43,10 +43,10 @@ class Wxapp extends Controller
|
|||||||
*/
|
*/
|
||||||
protected function initialize()
|
protected function initialize()
|
||||||
{
|
{
|
||||||
$option = sysdata('wxapp');
|
$wxapp = sysdata('wxapp');
|
||||||
$this->config = [
|
$this->config = [
|
||||||
'appid' => $option['appid'] ?? '',
|
'appid' => $wxapp['appid'] ?? '',
|
||||||
'appsecret' => $option['appkey'] ?? '',
|
'appsecret' => $wxapp['appkey'] ?? '',
|
||||||
'cache_path' => with_path('runtime/wechat'),
|
'cache_path' => with_path('runtime/wechat'),
|
||||||
];
|
];
|
||||||
if (empty(UserAdminService::TYPES[$this->type]['auth'])) {
|
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
|
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();
|
$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 (!$user->save($data)) throw new Exception("更新用户资料失败!");
|
||||||
// 刷新用户认证令牌
|
// 刷新用户认证令牌
|
||||||
if ($force) UserTokenService::token($user['id'], $type);
|
if ($force) UserTokenService::token($user['id'], $type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user