CommentModel.class.php
754 Bytes
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
<?php
/**
* 培训评价表
* @author: houyingcai
* @email: 594609175@qq.com
* @date : 2017-08-29 16:06:33
* @version $Id$
*/
namespace Common\Model;
class CommentModel extends AbstractModel
{
public function __construct()
{
parent::__construct();
}
/**
* 更新点赞量
* @author wanghuan
*
* @param int $c_id 评论id
* @param int $type 更新类型:0=加1,1=减1
*
* @return bool
*/
public function update_likes($c_id, $type)
{
// 减1
if ($type) {
return $this->_m->where('c_id=' . $c_id)->setDec('c_likes', 1);
} else { // 加1
return $this->_m->where('c_id=' . $c_id)->setInc('c_likes', 1);
}
}
}