one($where); return $data; } # 获取地址列表 public function getAddress($uid) { $where['uid'] = $uid; $data = Dever::db('passport/address')->getList($where); return $data; } # 添加或者更新地址接口 public function up() { $uid = $this->check(); $id = Dever::input('id'); $type = Dever::input('type', 2); $province = Dever::input('province'); $city = Dever::input('city'); $county = Dever::input('county'); $address = Dever::input('address'); $country = Dever::input('country'); $sex = Dever::input('sex'); $house_number = Dever::input('house_number'); $tag = Dever::input('tag'); return $this->upAddress($id, $uid, $type, $province, $city, $county, $address, $country, $sex, $house_number, $tag); } # 添加或者更新地址 public function upAddress($id, $uid, $type = 2, $province = '', $city = '', $county = '', $address = '', $country = '', $sex = '', $house_number = '', $tag = '') { if ($country) { $update['country'] = $country; } if ($province && $city && $county && $address) { $update['province'] = $province; $update['city'] = $city; $update['county'] = $county; $update['area'] = $province . ',' . $city . ',' . $county; $update['address'] = $address; } $update['type'] = $type; if ($sex) { $update['sex'] = $sex; } if ($house_number) { $update['house_number'] = $house_number; } if ($tag) { $update['tag'] = $tag; } if ($id) { $update['where_id'] = $id; Dever::db('passport/address')->update($update); } else { $update['uid'] = $uid; $id = Dever::db('passport/address')->insert($update); } return $id; } }