This commit is contained in:
2025-03-17 11:27:07 +08:00
parent 7a7f432006
commit 5febeca83f
6805 changed files with 6 additions and 6 deletions

View File

@@ -0,0 +1,63 @@
<?php
/*
* description
* authorwh
* email
* createTime{2023/11/19} {22:32}
*/
namespace app\index\controller;
use think\Controller;
use wanghua\general_utility_tools_php\tool\Tools;
use wanghua\general_utility_tools_php\wechat\TmpWexinauth;
use wanghua\general_utility_tools_php\wechat\UserAuth;
use wanghua\general_utility_tools_php\wechat\WechatLogic;
/**
*
*/
class Login extends Controller
{
function login()
{
$username = input('username');
$password = input('password');
return json(Tools::set_res(200,'ok',['username'=>$username]));
}
/**
* desc微信授权
* authorwh
*/
function wxauth()
{
try {
$code = input('code');
if(empty($code)){
return Tools::set_fail('CODE参数错误');
}
$wxconfig = get_boom_union_wechat_config();
$res = (new UserAuth($wxconfig,$wxconfig['access_token_path']))->usrAccessTokenApplet($code);
//绑定客户端ID和用户openid
return json(Tools::set_ok('ok',$res));
}catch (\Exception $e){
Tools::log_to_write_text([
'error'=>'微信授权异常。'.$e->getMessage(),
'input'=>input(),
'error_info'=>$e->getTraceAsString()
]);
return json(Tools::set_fail('请求异常'));
}
}
}