作者 lihan

留言模块、留言滚动功能、订单优化功能、以及其他功能优化

<?php
/**
* Created by PhpStorm.
* User: yhbr
* Date: 2018/8/29
* Time: 11:21
*/
namespace app\admin\controller;
use cmf\controller\AdminBaseController;
use think\Db;
class MessageController extends AdminBaseController
{
public function index()
{
$res = Db::name('message')->alias('m')
->field('m.*,u.user_nickname')
->join('user u', 'u.id=m.user_id')
->order('add_time DESC')
->paginate(20);
return $this->fetch('', [
'mes' => $res
]);
}
}
\ No newline at end of file
... ...
... ... @@ -75,10 +75,10 @@ class EscortController extends HomeBaseController
/**
* @title 编辑出行人
* @description 接口说明
* @description 接口说明(GET为该出行人的信息,只需传id即可;POST为更改出行人信息)
* @author sᴏᴜʟ ᴏғ ᴄɪɴᴅᴇʀ
* @url /escort/Escort/edit
* @method POST
* @method GET
*
* @param name:id type:int require:1 default:2 desc:出行人id
* @param name:name type:char require:1 default:lihan other: desc:出行人姓名
... ... @@ -90,6 +90,7 @@ class EscortController extends HomeBaseController
public function edit()
{
$request = request();
$id = $request->param('id');
if ($request->isPost()) {
$userId = session('user.id');
if (!empty($userId)) {
... ... @@ -123,13 +124,20 @@ class EscortController extends HomeBaseController
exit();
}
} else {
$id = $request->param('id');
return $this->fetch(':edit', [
'info' => Db::name('escort')->where(['id' => $id])->find()
]);
$info = Db::name('escort')->field('id,name,sex,tel,identity,wechat')->where(['id' => $id])->find();
echo json_encode(['data' => $info, 'code' => 20000]);
exit();
}
}
public function edit2() {
$request = request();
$id = $request->param('id');
return $this->fetch(':edit', [
'info' => Db::name('escort')->where(['id' => $id])->find()
]);
}
/**
* @title 删除出行人
* @description 接口说明
... ...
... ... @@ -140,12 +140,46 @@ class NewsController extends HomeBaseController
public function aboutUs()
{
return $this->fetch(':about_us');
$article = Db::name('portal_post')->field('post_content,more')->where(['id' => 35])->find();
$arr = json_decode($article['more'], true);
$article['post_content'] = html_entity_decode($article['post_content']);
$article['thumb'] = cmf_get_image_url($arr['thumbnail']);
unset($article['more']);
//滚动信息
$post = Db::name('portal_category_post')->alias('c')
->field('c.post_id,p.post_title')
->join('portal_post p', 'p.id=c.post_id')
->where(['category_id' => 14])
->select();
return $this->fetch(':about_us', [
'data' => $article,
'post' => $post
]);
}
public function message()
{
return $this->fetch(':message');
$request = request();
if ($request->isPost()) {
$data = [
'user_id' => session('user.id'),
'content' => $request->param('content'),
'add_time' => time()
];
if (Db::name('message')->insert($data)) {
$this->success('感谢您的反馈', '', true);
}
} else {
$article = Db::name('portal_post')->field('post_content,more')->where(['id' => 35])->find();
$arr = json_decode($article['more'], true);
$article['post_content'] = html_entity_decode($article['post_content']);
$article['thumb'] = cmf_get_image_url($arr['thumbnail']);
unset($article['more']);
return $this->fetch(':message', [
'data' => $article
]);
}
}
}
\ No newline at end of file
... ...
... ... @@ -13,6 +13,7 @@ class OrderController extends HomeBaseController
function _initialize()
{
session('user.id', 2);
if (empty(session('user.id'))) {
echo json_encode(['msg' => '登陆失败', 'code' => 40001]);
exit();
... ... @@ -87,14 +88,14 @@ class OrderController extends HomeBaseController
* @url /order/Order/done
* @method POST
*
* @param name:activity_id type:int require:1 default:19 desc:上一页选中的活动id
* @param name:schedule_id type:int require:1 default:68 desc:上一页选中的批次id
* @param name:num type:int require:1 default:2 desc:上一页选中的购买数量
* @param name:activity_id type:int require:1 default:19 desc:活动id
* @param name:schedule_id type:int require:1 default:68 desc:批次id
* @param name:num type:int require:1 default:2 desc:购买数量
* @param name:escort type:char require:1 default:同行人id字符串(逗号分隔) desc:1,2,3
* @param name:payment type:int require:1 default:支付方式 desc:0余额,1微信,2支付宝
* @param name:discount_coupon_id type:int require:1 default:112 desc:优惠券id
* @param name:discount_coupon_id type:int require:0 default:112 desc:优惠券id
* @param name:room type:char require:1 default:1 desc:房间信息
* @param name:desc type:text require:1 default:1 desc:商家备注
* @param name:desc type:text require:1 default:0 desc:商家备注
*/
public function done()
{
... ...
... ... @@ -47,6 +47,30 @@
'cid' => '\d+',
),
),
'关于我们/:id' =>
array (
0 => 'portal/Article/index?cid=13',
1 =>
array (
),
2 =>
array (
'id' => '\d+',
'cid' => '\d+',
),
),
'滚动消息/:id' =>
array (
0 => 'portal/Article/index?cid=14',
1 =>
array (
),
2 =>
array (
'id' => '\d+',
'cid' => '\d+',
),
),
'户外频道' =>
array (
0 => 'portal/List/index?id=10',
... ... @@ -91,4 +115,26 @@
'id' => '\d+',
),
),
'关于我们' =>
array (
0 => 'portal/List/index?id=13',
1 =>
array (
),
2 =>
array (
'id' => '\d+',
),
),
'滚动消息' =>
array (
0 => 'portal/List/index?id=14',
1 =>
array (
),
2 =>
array (
'id' => '\d+',
),
),
);
\ No newline at end of file
... ...
... ... @@ -10,7 +10,7 @@
// [ 入口文件 ]
// 调试模式开关
define("APP_DEBUG", true);
define("APP_DEBUG", false);
// 定义CMF根目录,可更改此目录
define('CMF_ROOT', __DIR__ . '/../');
... ...
<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">留言管理</a></li>
</ul>
<form class="js-ajax-form" action="" method="post">
<table class="table table-hover table-bordered table-list">
<tr>
<th>序号</th>
<th>留言人</th>
<th>内容</th>
<th>日期</th>
</tr>
<volist name="mes" id="vo" key="k">
<tr>
<td>{$k}</td>
<td>{$vo.user_nickname}</td>
<td>{$vo.content}</td>
<td>{$vo.add_time|date='Y-m-d', ###}</td>
</tr>
</volist>
</table>
<ul class="pagination">{$page|default=''}</ul>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
$(".form-control").change(function () {
$.ajax({
url:"{:url('Type/listOrder')}",
data:{
id:$(this).attr('data-id'),
listorder:$(this).val()
},
type:"POST",
dataType:"JSON"
})
})
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -36,7 +36,7 @@
</div>
<div class="bian">
<div class="bianji">
<a href="{:url('Escort/edit',['id'=>$vo['id']])}">
<a href="{:url('Escort/edit2',['id'=>$vo['id']])}">
<i class="iconfont icon-bianji"></i>编辑
</a>
</div>
... ...
... ... @@ -34,7 +34,7 @@
background-image: -moz-linear-gradient(top, #f05e6f, #c9394a); /* Firefox */
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #f05e6f), color-stop(1, #c9394a)); /* Saf4+, Chrome */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8fa1ff', endColorstr='#f05e6f', GradientType='0'); /* IE*/
border: 1px solid ##f05e6f;
border: 1px solid #f05e6f;
-moz-border-radius: 8px 8px 0 0; /* Gecko browsers */
-webkit-border-radius: 8px 8px 0 0; /* Webkit browsers */
border-radius: 8px 8px 0 0;
... ... @@ -85,67 +85,25 @@
<body>
<div class="pic">
<img src="__TMPL__/static/images/banner.png" alt="" />
<img src="{$data.thumb}" alt="" />
</div>
<div class="show">
平台简介
</div>
<div class="text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar tempor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus sapien nunc eget.
{$data.post_content}
</div>
<div class="phone">
<span>客服电话:XXXXXX</span>
<a href="{:url('news/News/message')}"><span class="yan">留言</span></a>
</div>
<!--<div>
<ul>
<a href="advisoryDetails.html">
<li>
·跟着萨米去玩户外
</li>
</a>
<a href="advisoryDetails.html">
<li>
·跟着萨米去玩户外
</li>
</a>
<a href="advisoryDetails.html">
<li>
·跟着萨米去玩户外
</li>
</a>
<a href="advisoryDetails.html">
<li>
·跟着萨米去玩户外
</li>
</a>
<a href="advisoryDetails.html">
<li>
·跟着萨米去玩户外
</li>
</a>
</ul>
</div>-->
<div id="moocBox">
<ul>
<volist name="post" id="vo">
<li>
<a href="advisoryDetails.html">·跟着萨米去玩户外</a></li>
<li>
<a href="advisoryDetails.html">·跟着萨米去玩户外</a></li>
<li>
<a href="advisoryDetails.html">·跟着萨米去玩户外</a></li>
<li>
<a href="advisoryDetails.html">·跟着萨米去玩户外</a></li>
<li>
<a href="advisoryDetails.html">·跟着萨米去玩户外</a></li>
<li>
<a href="advisoryDetails.html">·跟着萨米去玩户外</a></li>
<li>
<a href="advisoryDetails.html">·跟着萨米去玩户外</a></li>
<li>
<a href="advisoryDetails.html">·跟着萨米去玩户外</a></li>
<li>
<a href="advisoryDetails.html">·跟着萨米去玩户外</a></li>
<a href="{:url('news/News/detail',['id'=>$vo['post_id']])}">·{$vo.post_title}</a>
</li>
</volist>
</ul>
</div>
</body>
... ...
... ... @@ -9,23 +9,19 @@
<link rel="stylesheet" type="text/css" href="__TMPL__/static/assets/css/weui.min.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/static/assets/css/swiper-3.4.2.min.css" />
<link rel="stylesheet" type="text/css" href="http://at.alicdn.com/t/font_773803_6y9erxzbkn2.css" />
<script type="text/javascript" src="__TMPL__/static/assets/font/iconfont.js">
</script>
<script type="text/javascript" src="__TMPL__/static/assets/font/iconfont.js"></script>
<script type="text/javascript" src="__TMPL__/static/assets/js/jquery-2.1.0.js"></script>
<link rel="stylesheet" href="__TMPL__/static/css/aboutus.css" />
</head>
<body>
<div class="pic">
<img src="__TMPL__/static/images/banner.png" alt="" />
<img src="{$data.thumb}" alt="" />
</div>
<div class="show">
平台简介
</div>
<div class="text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar tempor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus sapien nunc eget.
</div>
<div class="phone">
<span>客服电话:XXXXXX</span>
<span class="liu">留言</span>
{$data.post_content}
</div>
<div class="ideaout">
<textarea class="idea" placeholder=" 说说您的想法吧"></textarea>
... ... @@ -37,7 +33,29 @@
</div>
</div>
</div>
<script>
$('.ok').click(function () {
var content = $('.idea').val();
if($.trim(content) == '') {
alert('请填写您的想法');
}else {
$.ajax({
url: "{:url('news/News/message')}",
data: {
content: content
},
type: "POST",
dataType: "JSON",
success: function (data) {
if(data.data === true) {
alert(data.msg)
}
}
})
}
})
</script>
</body>
</html>
... ...
... ... @@ -20,6 +20,10 @@ class HomeBaseController extends BaseController
public function _initialize()
{
// 指定允许其他域名访问
header('Access-Control-Allow-Origin:*');
// 响应头设置
header('Access-Control-Allow-Headers:x-requested-with,content-type');
// 监听home_init
hook('home_init');
parent::_initialize();
... ...