|
@@ -69,13 +69,11 @@ class EmailController extends BaseController |
|
@@ -69,13 +69,11 @@ class EmailController extends BaseController |
|
69
|
public function set_smtp(Smtp $smtp)
|
69
|
public function set_smtp(Smtp $smtp)
|
|
70
|
{
|
70
|
{
|
|
71
|
$this->request->validate([
|
71
|
$this->request->validate([
|
|
72
|
- 'project_id' => ['required'],
|
|
|
|
73
|
'email' => ['required', 'email', 'max:200'],
|
72
|
'email' => ['required', 'email', 'max:200'],
|
|
74
|
'password' => ['required', 'max:200'],
|
73
|
'password' => ['required', 'max:200'],
|
|
75
|
'host' => ['required', 'max:200', 'regex:/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/'],
|
74
|
'host' => ['required', 'max:200', 'regex:/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/'],
|
|
76
|
'from_name' => ['required', 'max:200'],
|
75
|
'from_name' => ['required', 'max:200'],
|
|
77
|
], [
|
76
|
], [
|
|
78
|
- 'project_id.required' => '参数异常',
|
|
|
|
79
|
'email.required' => '邮箱必须',
|
77
|
'email.required' => '邮箱必须',
|
|
80
|
'email.email' => '邮箱格式错误',
|
78
|
'email.email' => '邮箱格式错误',
|
|
81
|
'password.required' => '授权码/密码必须',
|
79
|
'password.required' => '授权码/密码必须',
|
|
@@ -83,7 +81,7 @@ class EmailController extends BaseController |
|
@@ -83,7 +81,7 @@ class EmailController extends BaseController |
|
83
|
'host.regex' => 'smtp格式错误',
|
81
|
'host.regex' => 'smtp格式错误',
|
|
84
|
'from_name.required' => '发信人昵称必须',
|
82
|
'from_name.required' => '发信人昵称必须',
|
|
85
|
]);
|
83
|
]);
|
|
86
|
- $info = $smtp->read(['project_id' => $this->param['project_id']]);
|
84
|
+ $info = $smtp->read(['project_id' => $this->project['id']]);
|
|
87
|
if (!$info) {
|
85
|
if (!$info) {
|
|
88
|
$smtp->add($this->param);
|
86
|
$smtp->add($this->param);
|
|
89
|
} else {
|
87
|
} else {
|
|
@@ -93,7 +91,7 @@ class EmailController extends BaseController |
|
@@ -93,7 +91,7 @@ class EmailController extends BaseController |
|
93
|
}
|
91
|
}
|
|
94
|
|
92
|
|
|
95
|
public function get_smtp(Smtp $smtp){
|
93
|
public function get_smtp(Smtp $smtp){
|
|
96
|
- $info = $smtp->read(['project_id' => $this->param['project_id']]);
|
94
|
+ $info = $smtp->read(['project_id' => $this->project['id']]);
|
|
97
|
$this->response($info);
|
95
|
$this->response($info);
|
|
98
|
}
|
96
|
}
|
|
99
|
|
97
|
|