/**
  * 删除
  * @param $id
  * @return bool
  */
 public function delete($id)
 {
     $config = $this->di->get('appConfig')->amap->lbs_cloud;
     $key = $config->key;
     $signKey = $config->sign_key;
     $tableId = $config->table_id;
     $syncLogTableName = 'beauty_parlor_amap_sync_log';
     $lbsColud = new LBSCloud($key, $signKey, $tableId, $syncLogTableName);
     // 获取已经同步的数据
     $aMapData = BeautyParlorAmap::findFirst("source_id={$id}");
     if ($aMapData) {
         $result = $lbsColud->delete($id, $aMapData->amap_data_id);
         if ($result) {
             $aMapData->delete();
         }
     }
     return false;
 }
Exemple #2
0
 public function run()
 {
     $longitude = $this->getDataItem('longitude', 0);
     $latitude = $this->getDataItem('latitude', 0);
     $page = intval($this->getDataItem('page', 1));
     $limit = $this->getConfig()->limit;
     $config = $this->getDi()->get('appConfig')->amap->lbs_cloud;
     $key = $config->key;
     $signKey = $config->sign_key;
     $tableId = $config->table_id;
     $syncLogTableName = 'beauty_parlor_amap_sync_log';
     $lbs = new LBSCloud($key, $signKey, $tableId, $syncLogTableName);
     $result = $lbs->around($latitude, $longitude, $limit, $page);
     if ($result->status) {
         //var_dump($result);
         foreach ($result->response as $data) {
             $this->parlors[] = ['id' => $data['bp_id'], 'name' => $data['_name'], 'cover' => $data['bp_cover'], 'address' => $data['_address'], 'tags' => $this->formatTags($data['bp_tags'], $data['bp_id']), 'distance' => $this->formatDistance($data['_distance']), 'medal_refund' => $data['medal_refund'], 'medal_verify' => $data['medal_verify']];
         }
     }
     $this->setResult($this->parlors);
 }
Exemple #3
0
 public function run()
 {
     //先验证城市是否开通 modify by tanjinyun 2016/01/11
     $city_code = $this->getDataItem('city_code');
     if ($city_code == null || $city_code == '') {
         return $this->errorLog(ResultStatus::POST_BODY_PARAM_ERROR, "城市编码为空");
         exit;
     }
     $is_open = SysOpenCity::findFirst(['columns' => "city_id", 'conditions' => "city_code = {$city_code} AND city_state = 1"]);
     if (!$is_open->city_id > 0) {
         return $this->errorLog(ResultStatus::CITY_NOT_OPEN, "城市未开通");
         exit;
     }
     $longitude = $this->getDataItem('longitude', 0);
     $latitude = $this->getDataItem('latitude', 0);
     $page = intval($this->getDataItem('page', 1));
     $medal = intval($this->getDataItem('medal', 0));
     $keyword = trim($this->getDataItem('keyword', null));
     $limit = $this->getConfig()->limit;
     //                $longitude = 106.515605;
     //                $latitude = 29.539727;
     $config = $this->getDi()->get('appConfig')->amap->lbs_cloud;
     $key = $config->key;
     $signKey = $config->sign_key;
     $tableId = $config->table_id;
     $syncLogTableName = 'beauty_parlor_amap_sync_log';
     //v2.0新增 筛选
     $filter = $medal == 1 ? "medal_verify:1" : null;
     $keywords = $keyword != null ? $keyword : null;
     $lbs = new LBSCloud($key, $signKey, $tableId, $syncLogTableName);
     $result = $lbs->around($latitude, $longitude, $limit, $page, $filter, $keywords);
     if ($result->status) {
         //         	var_dump($result);exit;
         foreach ($result->response as $data) {
             /**
              * modify by jinyu
              * 查询美容院扩展信息
              */
             $info = BeautyParlorAttr::query()->columns(['b.bp_id', 'b.bp_name', 'b.bp_address', 'b.bp_cover', 'b.bp_tel', 'b.bp_medal', 'open_time', 'close_time', 'low_price', 'open_year', 'shop_area', 'service_num', 'facilities'])->rightJoin('Apps\\Common\\Models\\BeautyParlor', 'b.bp_id = Apps\\Common\\Models\\BeautyParlorAttr.beauty_parlor_id', 'b')->where('beauty_parlor_id=:bp_id: AND bp_state >0')->bind(['bp_id' => $data['bp_id']])->execute()->getFirst();
             if ($info) {
                 $this->parlors[] = ['id' => $info['bp_id'], 'name' => $info['bp_name'], 'cover' => PicUrl::BeautyParlorCover($info['bp_cover'], $this->getDi()), 'address' => $info['bp_address'], 'tel' => $info['bp_tel'], 'tags' => $this->formatTagsV2($info['bp_id']), 'distance' => $this->formatDistance($data['_distance']), 'medal_verify' => \Apps\Common\Libs\BeautyParlor::getMedalVerify($info['bp_medal']), 'open_time' => $info['open_time'] == null ? '' : $info['open_time'], 'close_time' => $info['close_time'] == null ? '' : $info['close_time'], 'low_price' => $info['low_price'] == null ? '' : $info['low_price'], 'open_year' => $info['open_year'] == null ? '' : $info['open_year'], 'shop_area' => $info['shop_area'] == null ? '' : $info['shop_area'], 'service_num' => $info['service_num'] == null ? '' : $info['service_num'], 'facilities' => $info['facilities'] == null ? null : (json_decode($info['facilities']) ?: null)];
             } else {
                 continue;
             }
         }
     }
     /**
      * 第一页获取banner
      */
     if ($page == 1) {
         $banner = OmBanner::query()->columns(['banner_data'])->where('state = 1 AND banner_name =3 AND city_id =:city_id:')->bind(['city_id' => $is_open->city_id])->execute()->toArray();
         foreach ($banner as $k => $v) {
             $data = json_decode($v['banner_data']);
             $temp[$k]['url'] = PicUrl::DefaultPics($data->url, $this->getDi());
             $temp[$k]['link_type'] = $data->link_type;
             $temp[$k]['link_data'] = !empty(json_decode($data->link_data)) ? json_decode($data->link_data) : null;
         }
     }
     $list['banner'] = $temp;
     $list['parlors'] = empty($this->parlors) ? null : $this->parlors;
     $this->setResult($list);
 }