public function insert() { $address = request::postParam('mobileaddress'); $homeInfo = request::postParam('home'); $homeAddressId = implode(',', $address); $nowTime = time(); //获取省市地区的名字,组合后保存到社区地址详情里。 $addressList = addressService::getCacheFileAddress(); $cityAddressStr = ''; foreach ($address as $aid) { $cityAddressStr .= $addressList[$aid]['title']; } $homeData = array('title' => $homeInfo['title'], 'address_ids' => $homeAddressId, 'mobileaddress' => $cityAddressStr . $homeInfo['mobileaddress'], 'lng' => $homeInfo['lng'], 'lat' => $homeInfo['lat'], 'firstchar' => $homeInfo['firstchar'], 'image' => $homeInfo['image'], 'paddtime' => $nowTime); $homeModel = homeService::getSelfModel(homeService::$modelName); //判断是否添加了该社区。 $hasHomeInfo = homeService::getHomeInfoByTitle($homeData['title']); if (!$hasHomeInfo) { $homeId = $homeModel->insert($homeData); //保存对应地址信息 homeAddressService::getSelfModel(homeAddressService::$modelName); foreach ($address as $aid) { $addressData = array('address_id' => $aid, 'home_id' => $homeId); homeAddressService::$model->insert($addressData); } } else { utils::pexit('已有该社区'); } }
public function main() { $this->actionMenu = array(array('name' => '更新菜单缓存', 'url' => utils::getUrl('admin/menu/clear-menu-cache'))); $this->menuTitle = '系统信息'; utils::pexit($_SERVER); $this->setView(); }
public function getHomeListByShopPoint($point, $square = 0.5) { $pointInfo = utils::getSquarePoint($point['lat'], $point['lng'], $square); $homeParam = array('where' => "lat<>0 and lat>? and lat<? and lng>? and lng<?", 'param' => array($pointInfo['rightBottom']['lat'], $pointInfo['leftTop']['lat'], $pointInfo['leftTop']['lng'], $pointInfo['rightBottom']['lng'])); $homeList = $this->model->select($homeParam); utils::pexit($homeList); }