<?php
namespace app\common\model;
use think\Model;
class Area extends Base
{
   protected $autoCheckFields = true;

//是否存在地区名
   public function isAreaName($name){
     $where['name'] = $name;
     $result = $this->where($where)->find();
     if($result){
       return true;
     }else{
       return false;
     }
   }

 public function getAreaName($id){
    $where['id'] = $id;
    $data = $this->allowField('name')->where($where)->find();
    if($data){
      return $data;
    }else{
      return false;
    }
 }
 public function getAreaAll(){
   return $this->select()->toArray();
 }

 public function getAreaById($id){
   $where = " id IN (".$id.")";
   return $this->where($where)->select()->toArray();
 }
}
