feat : login wx

This commit is contained in:
2024-11-11 17:09:57 +08:00
parent 3a5739ee19
commit 2f9786bd05
2 changed files with 15 additions and 3 deletions

View File

@@ -14,6 +14,9 @@ use App\Exception\ApiException;
use App\Model\UserThird; use App\Model\UserThird;
use App\Service\ServiceTrait\Api\WxMiniTrait; use App\Service\ServiceTrait\Api\WxMiniTrait;
use Hyperf\DbConnection\Db; use Hyperf\DbConnection\Db;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use RedisException;
class WxFastLoginService extends LoginBaseService class WxFastLoginService extends LoginBaseService
{ {
@@ -24,7 +27,12 @@ class WxFastLoginService extends LoginBaseService
*/ */
const int LOGIN_TYPE = 2; const int LOGIN_TYPE = 2;
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws RedisException
*/
public function handle() public function handle()
{ {
$this->jsCode = $this->request->input('js_code'); $this->jsCode = $this->request->input('js_code');
@@ -46,6 +54,10 @@ class WxFastLoginService extends LoginBaseService
return $this->getReturn(); return $this->getReturn();
} }
/**
* 注册
* @return void
*/
protected function register(): void protected function register(): void
{ {
$thirdInfo = $this->userThirdModel->getThirdInfoByOpenId($this->openId); $thirdInfo = $this->userThirdModel->getThirdInfoByOpenId($this->openId);

View File

@@ -22,7 +22,7 @@ return [
// admin 默认密码 // admin 默认密码
'admin_default_password' => '123456', 'admin_default_password' => '123456',
// 微信小程序的appid // 微信小程序的appid
'wx_appid' => env('WX_APPID',''), 'wx_appid' => env('WX_APPID','wxc2bc0e47e212d831'),
// 微信小程序的secret // 微信小程序的secret
'wx_secret' => env('WX_SECRET',''), 'wx_secret' => env('WX_SECRET','5d89ebae17d836625f0e155216d71f2d'),
]; ];