mirror of
https://github.com/v2board/v2board.git
synced 2025-01-25 23:49:09 +08:00
update mailsend,frontend
This commit is contained in:
parent
2b8456fdf5
commit
43e7bb6c9f
@ -12,14 +12,16 @@ class MailController extends Controller
|
|||||||
{
|
{
|
||||||
public function send(MailSend $request)
|
public function send(MailSend $request)
|
||||||
{
|
{
|
||||||
if ($request->input('type') == 2 && empty($request->input('receiver'))) {
|
|
||||||
abort(500, '收件人不能为空');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->input('receiver')) {
|
switch ($request->input('type')) {
|
||||||
$users = User::whereIn('id', $request->input('receiver'))->get();
|
case 1: $users = $this->getAllUser();
|
||||||
} else {
|
break;
|
||||||
$users = User::all();
|
case 2: $users = $this->getReceiver($request->input('receiver'));
|
||||||
|
break;
|
||||||
|
case 3: $users = $this->getSubscribeUser();
|
||||||
|
break;
|
||||||
|
case 4: $users = $this->getExpireUser();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
@ -39,4 +41,27 @@ class MailController extends Controller
|
|||||||
'data' => true
|
'data' => true
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getAllUser()
|
||||||
|
{
|
||||||
|
return User::all();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getReceiver($receiver)
|
||||||
|
{
|
||||||
|
if (empty($receiver)) {
|
||||||
|
abort(500, '收件人不能为空');
|
||||||
|
}
|
||||||
|
return User::whereIn('id', $receiver)->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getSubscribeUser()
|
||||||
|
{
|
||||||
|
return User::where('expired_at', '=>', time())->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getExpireUser()
|
||||||
|
{
|
||||||
|
return User::where('expired_at', '<', time())->get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ class MailSend extends FormRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'type' => 'required|in:1,2',
|
'type' => 'required|in:1,2,3,4',
|
||||||
'subject' => 'required',
|
'subject' => 'required',
|
||||||
'content' => 'required',
|
'content' => 'required',
|
||||||
'receiver' => 'array'
|
'receiver' => 'array'
|
||||||
|
2
public/assets/admin/umi.css
vendored
2
public/assets/admin/umi.css
vendored
File diff suppressed because one or more lines are too long
2
public/assets/admin/umi.js
vendored
2
public/assets/admin/umi.js
vendored
File diff suppressed because one or more lines are too long
2
public/assets/user/umi.css
vendored
2
public/assets/user/umi.css
vendored
File diff suppressed because one or more lines are too long
2
public/assets/user/umi.js
vendored
2
public/assets/user/umi.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user