<?php
namespace app\service\model;

use think\Model;

/**
 * 报警模型
 */
class Alarm extends Model
{


    /**
     * 单数据筛选
     *
     * @access public
     * @param mixed $field 字段
     * @param mixed $where 条件
     * @param mixed $join 关联
     * @return array 返回类型
     */
    public function findAlarm($field, $where=[], $join=[])
    {
        $result = $this->field($field);
        if (empty($join) === false) {
            $result = $result->alias('a');
            foreach ($join as $k => $v) {
                $result = $result->join($k, $v);
            }
        }

        if (empty($where) === false) {
            $result = $result->where($where);
        }

        $result = $result->find();
        return $result;

    }//end findAlarm()


}//end class
