用户发布权限

This commit is contained in:
2025-12-18 13:16:40 +08:00
parent 581ba7ee52
commit d7e780a49f
4 changed files with 72 additions and 4 deletions
+11 -2
View File
@@ -3,6 +3,7 @@
namespace app\common\service;
use app\common\logic\AuthLogic;
use app\common\model\UserOld;
use app\common\validate\UserValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\User;
@@ -256,7 +257,8 @@ class UserService
$wxinfo = $wechatService->xcxOpenid($data['code']);
Log::info('wxinfo',[$wxinfo]);
$name = '微信用户_' . self::generate(8);
$sn = self::generate(8);
$name = '微信用户_' . $sn;
// 用户信息
$user = User::firstOrCreate(
['openid' => $wxinfo['openid']],
@@ -264,6 +266,7 @@ class UserService
'nickname' => $name,
//'unionid' => $wxinfo['unionid'],
'name' => $name,
'sn' => $sn,
'avatar' => 'bsh_datax/user/20251021/a4ee815405a1506abeec1af0f738f70f_68f6e76514b66.jpg'
]
);
@@ -287,8 +290,14 @@ class UserService
$wechatService = new WechatService();
$wxinfo = $wechatService->xcxPhoneNumber($data['phone_code']);
$mobile = $wxinfo['phone_info']['phoneNumber'];
$old = UserOld::where('mobile', $mobile)->first();
$uinfo = User::where('id', $request->user->uid)->first();
$uinfo->mobile = $wxinfo['phone_info']['phoneNumber'];
if ($old) {
$uinfo->name = $old->name;
$uinfo->is_release = 1;
}
$uinfo->mobile = $mobile;
$uinfo->save();
return $wxinfo;