<?php
namespace Smi\Model;

use Think\Model;

header("Content-type:text/html;charset=utf-8");
class RegionCountyModel extends Model
{
    /**
     * 保存表单
     */
    public function saveForm()
    {
        $city_id = $_REQUEST['city_id'];
        $name = I("name");
        $sort = I("sort");
        $data['city_id'] = $city_id;
        $data['name'] = $name;
        if (is_numeric($sort)) $data['sort'] = $sort;
        if ($_POST['id']) {
            $result = $this->where("`id`={$_POST['id']}")->save($data);
        } else {
            $result = $this->add($data);
        }
        return $result;
    }
}