小程序登录

This commit is contained in:
2025-11-25 09:19:25 +08:00
parent d5491511f7
commit 48a77a09b0
7 changed files with 11 additions and 8 deletions
+2 -2
View File
@@ -88,7 +88,7 @@ class UploadController
$originalName = $file->getUploadName();
$result = Storage::adapter('oss')
->path('bsh_datax/' . $sceneUrl . date('Ymd'))
->path('bsh_info/' . $sceneUrl . date('Ymd'))
->size(1024*1024*100)
->upload($file);
@@ -129,7 +129,7 @@ class UploadController
}
$result = Storage::adapter('oss')
->path('bsh_datax/' . $sceneUrl . date('Ymd'))
->path('bsh_info/' . $sceneUrl . date('Ymd'))
->size(1024*1024*100)
->extYes(['image/jpeg','image/png'])
->extNo(['image/gif'])
+1 -1
View File
@@ -133,7 +133,7 @@ class UserController extends BaseController
{
try {
$params = $request->all();
$result = $this->service->wechatLogin($params['code'], $params['state']);
$result = $this->service->wechatLogin($params['login_code'], $params['phone_code']);
return $this->success($result);
} catch (\Throwable $th) {
+1 -1
View File
@@ -40,7 +40,7 @@ class PostCategory extends Model
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'parent_id', 'name', 'level', 'path', 'sort', 'status', 'created_at', 'updated_at'];
protected $fillable = ['id', 'parent_id', 'icon', 'name', 'level', 'path', 'sort', 'status', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
+1 -1
View File
@@ -98,7 +98,7 @@ class BasicDataService
*/
private function getAllLoginTypes()
{
return ['upwd', 'feishu', 'qrcode']; // 示例数据
return ['upwd', 'feishu', 'wechat', 'qrcode']; // 示例数据
}
/**
+4 -2
View File
@@ -187,7 +187,8 @@ class UserService
$session = $logic->miniCode2Session($loginCode);
if (!isset($session['openid'])) {
return json(['code'=>0, 'msg'=>'登录失败', 'data'=>$session]);
throw new BusinessException('登录失败');
// return json(['code'=>0, 'msg'=>'登录失败', 'data'=>$session]);
}
$openid = $session['openid'];
@@ -199,7 +200,8 @@ class UserService
$phoneData = $logic->getMiniPhoneNumber($access_token, $phoneCode);
if (!isset($phoneData['phone_info']['phoneNumber'])) {
return json(['code'=>0, 'msg'=>'获取手机号失败', 'data'=>$phoneData]);
throw new BusinessException('获取手机号失败');
// return json(['code'=>0, 'msg'=>'获取手机号失败', 'data'=>$phoneData]);
}
$phone = $phoneData['phone_info']['phoneNumber'];
+1
View File
@@ -13,6 +13,7 @@ class WechatService
{
protected array $web;
protected array $mini;
protected array $login;
protected $app;
+1 -1
View File
@@ -21,7 +21,7 @@ Route::any('/qrcode/url', [app\common\controller\UserController::class, 'getQrUr
Route::any('/user/info', [app\common\controller\UserController::class, 'getUserInfo']);
Route::any('/bind/user', [app\common\controller\UserController::class, 'bindUser']);
//Route::post('/api/wechat/login', [app\common\controller\UserController::class, 'wechatLogin']);
Route::post('/wechat/login', [app\common\controller\UserController::class, 'wechatLogin']);
// 代理oss文件地址
Route::any('/proxy/ossurl', [app\common\controller\UploadController::class, 'proxy']);