|
...
|
...
|
@@ -14,6 +14,7 @@ use App\Events\WebSocketMessage; |
|
|
|
use App\Events\WebSocketMessageSent;
|
|
|
|
use App\Helper\Arr;
|
|
|
|
use App\Helper\Common;
|
|
|
|
use App\Helper\Socket;
|
|
|
|
use App\Helper\Translate;
|
|
|
|
use App\Helper\Wechat;
|
|
|
|
use App\Http\Logic\Bside\User\UserLoginLogic;
|
|
...
|
...
|
@@ -78,12 +79,14 @@ class LoginController extends BaseController |
|
|
|
*/
|
|
|
|
public function autologin(UserLoginLogic $logic, EncryptUtils $encrypt)
|
|
|
|
{
|
|
|
|
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(11111, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
$serviceSettingModel = new Service();
|
|
|
|
$info = $serviceSettingModel->read(['type'=>4]);
|
|
|
|
if($info === false){
|
|
|
|
$this->response('当前访问地址不存在',Code::USER_ERROR);
|
|
|
|
}
|
|
|
|
$data = $encrypt->unlock_url($this->param['code'], $info['values']);
|
|
|
|
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($data, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
$data = json_decode($data, true);
|
|
|
|
if(!isset($data['project_id']) && !isset($data['user_id'])){
|
|
|
|
$this->response('无效Code',Code::USER_ERROR);
|
|
...
|
...
|
@@ -167,26 +170,15 @@ class LoginController extends BaseController |
|
|
|
public function eventMessage(){
|
|
|
|
$message = file_get_contents("php://input");
|
|
|
|
$message = simplexml_load_string($message, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOERROR);
|
|
|
|
<<<<<<< HEAD
|
|
|
|
@file_put_contents(storage_path('logs/hook/wx.log'), var_export($message, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
=======
|
|
|
|
$arr = [
|
|
|
|
'ToUserName' => 'gh_27174ac5c9d8',
|
|
|
|
'FromUserName' => 'oMbcI6gRzvfrU8ssGsEyvzXOO94w',
|
|
|
|
'CreateTime' => '1693385898',
|
|
|
|
'MsgType' => 'event',
|
|
|
|
'Event' => 'subscribe',
|
|
|
|
'EventKey' => 'qrscene_global-v6_v6',
|
|
|
|
'Ticket' => 'gQF27zwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyWnppdHhWTlRjOEcxTlBpTE5BY2IAAgRjBO9kAwQQDgAA',
|
|
|
|
];
|
|
|
|
//查看当前账户是否绑定
|
|
|
|
$userModel = new UserModel();
|
|
|
|
$info = $userModel->read(['wechat'=>$message->FromUserName]);
|
|
|
|
if($info === false){
|
|
|
|
|
|
|
|
}
|
|
|
|
$socket = new Socket();
|
|
|
|
$socket->socket(json_encode($data));
|
|
|
|
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($message, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
>>>>>>> cb4013abb5967a24f5c482c21f3a93a48789077d
|
|
|
|
return "<xml>
|
|
|
|
<ToUserName><![CDATA[$message->FromUserName]]></ToUserName>
|
|
|
|
<FromUserName><![CDATA[$message->ToUserName]]></FromUserName>
|
|
...
|
...
|
@@ -223,4 +215,52 @@ class LoginController extends BaseController |
|
|
|
$this->response('success',Code::SUCCESS,['info'=>$info]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :微信登录处理数据
|
|
|
|
* @name :wechatLogin
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/31 9:13
|
|
|
|
*/
|
|
|
|
public function wechatLogin($wechat){
|
|
|
|
//查看当前账户是否绑定
|
|
|
|
$userModel = new UserModel();
|
|
|
|
$info = $userModel->read(['wechat'=>$wechat]);
|
|
|
|
if($info === false){
|
|
|
|
$data = [
|
|
|
|
'code'=>Code::USER_LOGIN_ERROE,
|
|
|
|
'message'=>'当前用户未绑定账户,请绑定后',
|
|
|
|
];
|
|
|
|
}else {
|
|
|
|
//获取项目详情
|
|
|
|
$info = $this->assembleParam($info['mobile'],$info['project_id']);
|
|
|
|
if(isset($info['token']) && !empty($info['token'])){
|
|
|
|
//清除上一次用户缓存
|
|
|
|
Cache::pull($info['token']);
|
|
|
|
}
|
|
|
|
//生成新token
|
|
|
|
$token = md5(uniqid().$info['id']);
|
|
|
|
//存储缓存
|
|
|
|
$info['token'] = $token;
|
|
|
|
Cache::add($token,$info,3600);
|
|
|
|
//更新用户信息
|
|
|
|
$this->model->edit(['token'=>$token],['id'=>$info['id']]);
|
|
|
|
$data = [
|
|
|
|
'code'=>Code::SUCCESS,
|
|
|
|
'message'=>'当前用户未绑定账户,请绑定后',
|
|
|
|
'data'=>$info
|
|
|
|
];
|
|
|
|
}
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function ceshi(){
|
|
|
|
$data = [
|
|
|
|
'code'=>Code::USER_LOGIN_ERROE,
|
|
|
|
'message'=>'当前用户未绑定账户,请绑定后',
|
|
|
|
];
|
|
|
|
$socket = new Socket();
|
|
|
|
return $socket->socket(json_encode($data));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|