|
@@ -14,6 +14,7 @@ use App\Events\WebSocketMessage; |
|
@@ -14,6 +14,7 @@ use App\Events\WebSocketMessage; |
|
14
|
use App\Events\WebSocketMessageSent;
|
14
|
use App\Events\WebSocketMessageSent;
|
|
15
|
use App\Helper\Arr;
|
15
|
use App\Helper\Arr;
|
|
16
|
use App\Helper\Common;
|
16
|
use App\Helper\Common;
|
|
|
|
17
|
+use App\Helper\Socket;
|
|
17
|
use App\Helper\Translate;
|
18
|
use App\Helper\Translate;
|
|
18
|
use App\Helper\Wechat;
|
19
|
use App\Helper\Wechat;
|
|
19
|
use App\Http\Logic\Bside\User\UserLoginLogic;
|
20
|
use App\Http\Logic\Bside\User\UserLoginLogic;
|
|
@@ -78,12 +79,14 @@ class LoginController extends BaseController |
|
@@ -78,12 +79,14 @@ class LoginController extends BaseController |
|
78
|
*/
|
79
|
*/
|
|
79
|
public function autologin(UserLoginLogic $logic, EncryptUtils $encrypt)
|
80
|
public function autologin(UserLoginLogic $logic, EncryptUtils $encrypt)
|
|
80
|
{
|
81
|
{
|
|
|
|
82
|
+ @file_put_contents(storage_path('logs/lyh_error.log'), var_export(11111, true) . PHP_EOL, FILE_APPEND);
|
|
81
|
$serviceSettingModel = new Service();
|
83
|
$serviceSettingModel = new Service();
|
|
82
|
$info = $serviceSettingModel->read(['type'=>4]);
|
84
|
$info = $serviceSettingModel->read(['type'=>4]);
|
|
83
|
if($info === false){
|
85
|
if($info === false){
|
|
84
|
$this->response('当前访问地址不存在',Code::USER_ERROR);
|
86
|
$this->response('当前访问地址不存在',Code::USER_ERROR);
|
|
85
|
}
|
87
|
}
|
|
86
|
$data = $encrypt->unlock_url($this->param['code'], $info['values']);
|
88
|
$data = $encrypt->unlock_url($this->param['code'], $info['values']);
|
|
|
|
89
|
+ @file_put_contents(storage_path('logs/lyh_error.log'), var_export($data, true) . PHP_EOL, FILE_APPEND);
|
|
87
|
$data = json_decode($data, true);
|
90
|
$data = json_decode($data, true);
|
|
88
|
if(!isset($data['project_id']) && !isset($data['user_id'])){
|
91
|
if(!isset($data['project_id']) && !isset($data['user_id'])){
|
|
89
|
$this->response('无效Code',Code::USER_ERROR);
|
92
|
$this->response('无效Code',Code::USER_ERROR);
|
|
@@ -167,26 +170,15 @@ class LoginController extends BaseController |
|
@@ -167,26 +170,15 @@ class LoginController extends BaseController |
|
167
|
public function eventMessage(){
|
170
|
public function eventMessage(){
|
|
168
|
$message = file_get_contents("php://input");
|
171
|
$message = file_get_contents("php://input");
|
|
169
|
$message = simplexml_load_string($message, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOERROR);
|
172
|
$message = simplexml_load_string($message, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOERROR);
|
|
170
|
-<<<<<<< HEAD
|
|
|
|
171
|
@file_put_contents(storage_path('logs/hook/wx.log'), var_export($message, true) . PHP_EOL, FILE_APPEND);
|
173
|
@file_put_contents(storage_path('logs/hook/wx.log'), var_export($message, true) . PHP_EOL, FILE_APPEND);
|
|
172
|
-=======
|
|
|
|
173
|
- $arr = [
|
|
|
|
174
|
- 'ToUserName' => 'gh_27174ac5c9d8',
|
|
|
|
175
|
- 'FromUserName' => 'oMbcI6gRzvfrU8ssGsEyvzXOO94w',
|
|
|
|
176
|
- 'CreateTime' => '1693385898',
|
|
|
|
177
|
- 'MsgType' => 'event',
|
|
|
|
178
|
- 'Event' => 'subscribe',
|
|
|
|
179
|
- 'EventKey' => 'qrscene_global-v6_v6',
|
|
|
|
180
|
- 'Ticket' => 'gQF27zwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyWnppdHhWTlRjOEcxTlBpTE5BY2IAAgRjBO9kAwQQDgAA',
|
|
|
|
181
|
- ];
|
|
|
|
182
|
//查看当前账户是否绑定
|
174
|
//查看当前账户是否绑定
|
|
183
|
$userModel = new UserModel();
|
175
|
$userModel = new UserModel();
|
|
184
|
$info = $userModel->read(['wechat'=>$message->FromUserName]);
|
176
|
$info = $userModel->read(['wechat'=>$message->FromUserName]);
|
|
185
|
if($info === false){
|
177
|
if($info === false){
|
|
186
|
|
178
|
|
|
187
|
- }
|
179
|
+ $socket = new Socket();
|
|
|
|
180
|
+ $socket->socket(json_encode($data));
|
|
188
|
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($message, true) . PHP_EOL, FILE_APPEND);
|
181
|
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($message, true) . PHP_EOL, FILE_APPEND);
|
|
189
|
->>>>>>> cb4013abb5967a24f5c482c21f3a93a48789077d
|
|
|
|
190
|
return "<xml>
|
182
|
return "<xml>
|
|
191
|
<ToUserName><![CDATA[$message->FromUserName]]></ToUserName>
|
183
|
<ToUserName><![CDATA[$message->FromUserName]]></ToUserName>
|
|
192
|
<FromUserName><![CDATA[$message->ToUserName]]></FromUserName>
|
184
|
<FromUserName><![CDATA[$message->ToUserName]]></FromUserName>
|
|
@@ -223,4 +215,52 @@ class LoginController extends BaseController |
|
@@ -223,4 +215,52 @@ class LoginController extends BaseController |
|
223
|
$this->response('success',Code::SUCCESS,['info'=>$info]);
|
215
|
$this->response('success',Code::SUCCESS,['info'=>$info]);
|
|
224
|
}
|
216
|
}
|
|
225
|
|
217
|
|
|
|
|
218
|
+ /**
|
|
|
|
219
|
+ * @remark :微信登录处理数据
|
|
|
|
220
|
+ * @name :wechatLogin
|
|
|
|
221
|
+ * @author :lyh
|
|
|
|
222
|
+ * @method :post
|
|
|
|
223
|
+ * @time :2023/8/31 9:13
|
|
|
|
224
|
+ */
|
|
|
|
225
|
+ public function wechatLogin($wechat){
|
|
|
|
226
|
+ //查看当前账户是否绑定
|
|
|
|
227
|
+ $userModel = new UserModel();
|
|
|
|
228
|
+ $info = $userModel->read(['wechat'=>$wechat]);
|
|
|
|
229
|
+ if($info === false){
|
|
|
|
230
|
+ $data = [
|
|
|
|
231
|
+ 'code'=>Code::USER_LOGIN_ERROE,
|
|
|
|
232
|
+ 'message'=>'当前用户未绑定账户,请绑定后',
|
|
|
|
233
|
+ ];
|
|
|
|
234
|
+ }else {
|
|
|
|
235
|
+ //获取项目详情
|
|
|
|
236
|
+ $info = $this->assembleParam($info['mobile'],$info['project_id']);
|
|
|
|
237
|
+ if(isset($info['token']) && !empty($info['token'])){
|
|
|
|
238
|
+ //清除上一次用户缓存
|
|
|
|
239
|
+ Cache::pull($info['token']);
|
|
|
|
240
|
+ }
|
|
|
|
241
|
+ //生成新token
|
|
|
|
242
|
+ $token = md5(uniqid().$info['id']);
|
|
|
|
243
|
+ //存储缓存
|
|
|
|
244
|
+ $info['token'] = $token;
|
|
|
|
245
|
+ Cache::add($token,$info,3600);
|
|
|
|
246
|
+ //更新用户信息
|
|
|
|
247
|
+ $this->model->edit(['token'=>$token],['id'=>$info['id']]);
|
|
|
|
248
|
+ $data = [
|
|
|
|
249
|
+ 'code'=>Code::SUCCESS,
|
|
|
|
250
|
+ 'message'=>'当前用户未绑定账户,请绑定后',
|
|
|
|
251
|
+ 'data'=>$info
|
|
|
|
252
|
+ ];
|
|
|
|
253
|
+ }
|
|
|
|
254
|
+ return $data;
|
|
|
|
255
|
+ }
|
|
|
|
256
|
+
|
|
|
|
257
|
+
|
|
|
|
258
|
+ public function ceshi(){
|
|
|
|
259
|
+ $data = [
|
|
|
|
260
|
+ 'code'=>Code::USER_LOGIN_ERROE,
|
|
|
|
261
|
+ 'message'=>'当前用户未绑定账户,请绑定后',
|
|
|
|
262
|
+ ];
|
|
|
|
263
|
+ $socket = new Socket();
|
|
|
|
264
|
+ return $socket->socket(json_encode($data));
|
|
|
|
265
|
+ }
|
|
226
|
} |
266
|
} |