RecordModel.class.php 841 Bytes
<?php
/**
 * RecordModel.class.php
 * $author$
 */

namespace Common\Model;

class RecordModel extends AbstractModel
{

    /**
     * 构造方法
     */
    public function __construct()
    {

        parent::__construct();
    }

    /**
     * 根据问题ID获取该问题已回答的记录
     *
     * @param int $q_id 问题ID
     *
     * @return array
     */
    public function list_by_where($q_id = 0)
    {

        // 组装查询语句
        $where = "status <? AND domain=? and q_id=? and (answer<>'' or other<>'') ";
        // 操作状态和域名
        $params = [
            self::ST_DELETE,
            QY_DOMAIN,
            $q_id
        ];

        $sql = "SELECT * FROM __TABLE__ WHERE " . $where;

        return $this->_m->fetch_array($sql, $params);
    }
}