Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c43e10
commit 7d84504
Showing
5 changed files
with
52 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Api\V1; | ||
|
||
use App\Http\Controllers\Api\V1\ApiController; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Http\Response; | ||
use App\Http\Controllers\Controller; | ||
use App\Services\Api; | ||
|
||
use Queue; | ||
use App\Jobs\Email; | ||
|
||
class EmailController extends ApiController | ||
{ | ||
/** | ||
* 发送邮件 | ||
* | ||
* @param Request $request: | ||
* @return apiReturn | ||
*/ | ||
public function postEmail(Request $request) | ||
{ | ||
return Api::apiReturn(SUCCESS, '发送成功', $this->_send($request->email, $request->subject, $request->content)); | ||
} | ||
|
||
/** | ||
* 发送邮件 | ||
* | ||
* @param string $email 收件箱, string $subject 主题, string $content 内容 | ||
* @return array | ||
*/ | ||
public function _send($email, $subject, $content) | ||
{ | ||
$this->apiValidate(compact('email', 'subject', 'content'), [ | ||
'email' => 'required|email', | ||
'subject' => 'required', | ||
'content' => 'required' | ||
]); | ||
|
||
Queue::push(new Email(parent::getAppId(), parent::getUserId(), $email, $subject, $content)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters