/** * @Title: applyLink * @todo 申请友情链接 * @author Saki <*****@*****.**> */ public function applyLink() { $data['errcode'] = 0; if (isset($_POST['Links'])) { $check = $this->checkPost($_POST['Links']); if ($check['res']) { $model = new \Admin\Model\LinksModel(); $map['name'] = $_POST['Links']['name']; $map['url'] = $_POST['Links']['url']; $map['email'] = $_POST['Links']['email']; $map['_logic'] = 'OR'; $ishas = $model->where($map)->find(); if ($ishas) { $data['errcode'] = 500; $data['msg'] = '已经在友链申请列表中,请不要重复提交'; } else { $post = $_POST['Links']; $result = $model->createLink($post); $data['errcode'] = $result['errcode'] == 0 ? 0 : 500; $data['msg'] = $result['errcode'] == 0 ? '申请成功' : '申请失败'; } } else { $data['errcode'] = 500; $data['msg'] = $check['msg']; } } else { $data['msg'] = '请提交正确的友链信息'; } echo json_encode($data); }
public function sendMail() { if (isset($_POST['id'])) { $model = new \Admin\Model\LinksModel(); $map['id'] = $_POST['id']; $link_info = $model->where($map)->find(); if (isset($link_info['email'])) { $to_email = $link_info['email']; $title = '您的友链申请已经通过!'; $body = "<body>\n\t\t\t\t\t\t\t<table style='margin: 25px auto;background:#364050;background-image: url(http://500efuma.me/Template/css/images/bg1.png);' border='0' cellspacing='0' cellpadding='0' width='700' align='center'>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td style='color:#FFFFFF;'>\n\t\t\t\t\t\t\t\t\t\t<div style='height: 42px;width: 160px;background-color: #c94663;padding: 0.1em 0.1em 0.1em 0.1em;background-image: url(http://500efuma.me/Template/css/images/bg1.png);text-align: center;margin: 15px;border-radius: 0.4em;'>\n\t\t\t\t\t\t\t\t\t\t\t<h1 style='margin-top: 1px;margin-bottom: 1px;'>500efuma</h1>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td style='border-left: 1px solid #364050; padding: 10px 20px; background: #ffffff; border-right: 1px solid #364050;'>\n\t\t\t\t\t\t\t\t\t\t<p>你好:</p>\n\t\t\t\t\t\t\t\t\t\t<p>我已经通过了你的友链申请。</p>\n\t\t\t\t\t\t\t\t\t\t<p>你可以点击这里查看:<br><a href='http://www.500efuma.com/Home/Index/links' target='_blank'>http://www.500efuma.com/Home/Index/links</a>.</p>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td style='border-bottom: 1px solid #364050; border-left: 1px solid #364050; padding: 0px 20px 20px; background: #ffffff; border-right: 1px solid #364050;'>\n\t\t\t\t\t\t\t\t\t\t<hr style='color:#ccc;'>\n\t\t\t\t\t\t\t\t\t\t<p style='color:#c94663;font-size:9pt;'>想了解更多信息,请访问 <a href='http://www.500efuma.com/' target='_blank'>http://www.500efuma.com/</a></p>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>"; $is_send = sendMail($to_email, $to_email, $title, $body); $data = $is_send; } else { $data['errcode'] = 404; $data['msg'] = '该记录没有邮箱'; } } else { $data['errcode'] = 500; $data['msg'] = '请求参数错误'; } echo json_encode($data); }
public function links() { $links_model = new \Admin\Model\LinksModel(); $map['status'] = 1; $links_list = $links_model->where($map)->select(); /**/ $this->assign('links_list', $links_list); $this->display(); }