Files
2024-10-29 14:04:59 +08:00

39 lines
1.0 KiB
PHP
Executable File

<?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');
}
}
}
}