init
This commit is contained in:
38
app/us/controller/Email.php
Executable file
38
app/us/controller/Email.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: kingliang
|
||||
* Date: 2020-10-21
|
||||
* Time: 14:57
|
||||
*/
|
||||
|
||||
namespace app\us\controller;
|
||||
use think\Request;
|
||||
use think\Config;
|
||||
use think\Loader;
|
||||
class Email extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->post();
|
||||
if (empty($data) || !is_array($data)) {
|
||||
return $this->json(404, 'Email not find!!');
|
||||
}
|
||||
$model = Loader::model('Email');
|
||||
$data['ip'] = Request::instance()->ip();
|
||||
$data['createtime'] = time();
|
||||
$chick = $model->chickEmail($data['email']);
|
||||
if($chick==false){
|
||||
return $this->json(500, 'Duplicate mailbox!');
|
||||
}
|
||||
$model = $model->insertRow($data);
|
||||
if ($model) {
|
||||
return $this->json(200, 'Success');
|
||||
} else {
|
||||
return $this->json(500, 'Internal server error');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user