1
|
<?php
|
1
|
<?php
|
2
|
|
2
|
|
3
|
-namespace App\Http\Controllers;
|
|
|
4
|
-
|
|
|
5
|
-use App\Models\Email;
|
|
|
6
|
-use App\Models\Host;
|
|
|
7
|
-use Helper\Mail\Imap;
|
|
|
8
|
-use Helper\Mail\Mail;
|
3
|
+namespace Controller;
|
9
|
|
4
|
|
10
|
/**
|
5
|
/**
|
11
|
- * 提供邮件各项数据
|
|
|
12
|
* @author:dc
|
6
|
* @author:dc
|
13
|
- * @time 2023/2/4 11:18
|
|
|
14
|
- * Class MailApi
|
|
|
15
|
- * @package App\Http\Controllers
|
7
|
+ * @time 2023/2/13 11:28
|
|
|
8
|
+ * Class Home
|
|
|
9
|
+ * @package Controller
|
16
|
*/
|
10
|
*/
|
17
|
-class MailApi
|
|
|
18
|
-{
|
11
|
+class Home {
|
|
|
12
|
+
|
19
|
|
13
|
|
20
|
/**
|
14
|
/**
|
21
|
- * 添加新的邮箱
|
15
|
+ * 登录操作
|
|
|
16
|
+ * @return int[]
|
22
|
* @author:dc
|
17
|
* @author:dc
|
23
|
- * @time 2023/2/4 15:37
|
18
|
+ * @time 2023/2/13 11:50
|
24
|
*/
|
19
|
*/
|
25
|
public function login(){
|
20
|
public function login(){
|
26
|
-// $mail,$password,$imap,$smtp
|
|
|
27
|
- $formData = request()->only(['email','password','imap','smtp']);
|
21
|
+ // $mail,$password,$imap,$smtp
|
|
|
22
|
+ $formData = app()->request(['email','password','imap','smtp']);
|
|
|
23
|
+
|
|
|
24
|
+ if(empty($formData['email']) || !preg_match("",$formData['email'])){
|
|
|
25
|
+ app()->e('email_verify_error');
|
|
|
26
|
+ }
|
|
|
27
|
+
|
|
|
28
|
+
|
28
|
$validator = validator($formData,[
|
29
|
$validator = validator($formData,[
|
29
|
'email' => ['required','email'],
|
30
|
'email' => ['required','email'],
|
30
|
'password' => ['required','min:8','max:32'],
|
31
|
'password' => ['required','min:8','max:32'],
|
|
@@ -78,25 +79,6 @@ class MailApi |
|
@@ -78,25 +79,6 @@ class MailApi |
78
|
'token' => token_en($model->id.','.$model->email.','.time())
|
79
|
'token' => token_en($model->id.','.$model->email.','.time())
|
79
|
])
|
80
|
])
|
80
|
->toJson();
|
81
|
->toJson();
|
81
|
- }
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
- /**
|
|
|
85
|
- * 读取服务器上已记录的各个邮箱的服务器地址
|
|
|
86
|
- * @author:dc
|
|
|
87
|
- * @time 2023/2/4 15:12
|
|
|
88
|
- */
|
|
|
89
|
- public function host(){
|
|
|
90
|
-
|
|
|
91
|
- $host = Host::_all();
|
|
|
92
|
-
|
|
|
93
|
- res()->data($host)->throw();
|
|
|
94
|
-
|
|
|
95
|
- }
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
|
|
|
99
|
- public function lists(){
|
|
|
100
|
|
82
|
|
101
|
}
|
83
|
}
|
102
|
|
84
|
|