Comment.php
1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
use Action\WebAction;
use WebPlugin\Helpers;
use Home\UserModel;
use Home\CommentModel;
use LibModels\Web\Home\CommentData;
/**
* 个人中心——我的评论
*/
class CommentController extends WebAction
{
/**
* 我的评论
*/
public function indexAction()
{
//判断是否登录
$this->auditJumpLogin();
//头部导航
$channel = Helpers::getChannelNameByCookie();
$this->setWebNavHeader($channel);
$uid = $this->getUid();
//接收是否评论,和分页参数
$isComment = $this->get('isComment');
$page = $this->get('page','1');
//调用模型获得数据(每页显示十条订单的评论数据)
$data = CommentModel::getCommentList($uid, $isComment, $page, $limit = 10);
$this->_view->display('comment', array('meCommentPage' => true, 'comment' => $data));
}
//提交评论
public function saveCommentAction()
{
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
return;
}
$uid = $this->getUid();
//接收评论相关参数
$productSkn = $this->post('productSkn');
$productId = $this->post('productId');
$content = $this->post('content');
$goodsId = $this->post('goodsId');
$orderId = $this->post('orderId');
$erpSkuId = $this->post('erpSkuId');
//调用评论接口完成评论
$result = CommentData::saveShareOrder($uid, $productSkn, $productId, $content, $goodsId, $orderId, $erpSkuId);
$this->echoJson($result);
}
}