退订邮件功能
This commit is contained in:
@@ -31,6 +31,7 @@ class Main extends Controller {
|
||||
protected $sys_not_obj = '';
|
||||
protected $article_ltai_obj = '';
|
||||
protected $board_obj = '';
|
||||
protected $unsubscribe_obj = '';
|
||||
|
||||
public function __construct(\think\Request $request = null) {
|
||||
parent::__construct($request);
|
||||
@@ -48,6 +49,7 @@ class Main extends Controller {
|
||||
$this->sys_not_obj = Db::name('system_notices');
|
||||
$this->article_ltai_obj = Db::name('article_ltai');
|
||||
$this->board_obj = Db::name('board');
|
||||
$this->unsubscribe_obj = Db::name("unsubscribe");
|
||||
}
|
||||
|
||||
public function ttest(){
|
||||
@@ -110,6 +112,31 @@ class Main extends Controller {
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
public function unsubscribe(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"email"=>"require",
|
||||
"reason"=>"require",
|
||||
"satisfaction"=>"require",
|
||||
"connected"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
|
||||
$insert['email'] = trim($data['email']);
|
||||
$insert['reason'] = $data['reason'];
|
||||
$insert['satisfaction'] = $data['satisfaction'];
|
||||
$insert['connected'] = $data['connected'];
|
||||
if(isset($data['suggestions'])){
|
||||
$insert['suggestions'] = trim($data['suggestions']);
|
||||
}
|
||||
$this->unsubscribe_obj->insert($insert);
|
||||
|
||||
return jsonSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取book详情
|
||||
* @description 获取book详情
|
||||
|
||||
@@ -772,7 +772,7 @@ function add_usermsg($userid, $content, $url)
|
||||
return $msg_obj->insert($msgdata);
|
||||
}
|
||||
|
||||
function jsonSuccess($data)
|
||||
function jsonSuccess($data=[])
|
||||
{
|
||||
return json(['code' => 0, 'msg' => 'success', 'data' => $data]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user