<?php /** * 照片墙照片表 * @author: houyingcai * @email: 594609175@qq.com * @date : 2017-08-29 16:02:21 * @version $Id$ */ namespace Common\Model; class PlanPicModel extends AbstractModel { public function __construct() { parent::__construct(); } /** * 更新点赞量 * @author wanghuan * * @param int $pic_id 照片id * @param int $type 更新类型:0=加1,1=减1 * * @return bool */ public function update_likes($pic_id, $type) { // 减1 if ($type) { return $this->_m->where('pic_id=' . $pic_id)->setDec('pic_likes', 1); } else { // 加1 return $this->_m->where('pic_id=' . $pic_id)->setInc('pic_likes', 1); } } }