<?php
/**
 * Created by PhpStorm.
 * User: stanley-king
 * Date: 2017/8/10
 * Time: 下午9:38
 */

defined('InShopNC') or exit('Access Invalid!');

class appreciateModel extends Model
{
    public function __construct()
    {
        parent::__construct('appreciate');
    }
    public function counts($special_id)
    {
        return $this->where(['special_id' => $special_id])->count();
    }
    public function getListBySpecialid($special_id,$field='*',$page_size = 0,$total_count = 0,$lock = false)
    {
        return $this->field($field)->where(['special_id' => $special_id])->order('appreciate_id desc')->page($page_size, $total_count)->lock($lock)->select();
    }
    public function getTopAppreciate($special_id,$field='*',$limit = 20,$lock = false)
    {
        return $this->field($field)->where(['special_id' => $special_id])->order('appreciate_id desc')->limit($limit)->lock($lock)->select();
    }
}