Ejemplo n.º 1
0
 public function run()
 {
     if (false == $this->verifyUserAuth()) {
         return false;
     }
     $page = $this->getDataItem('page', 1);
     $limit = 10;
     $offset = ($page - 1) * $limit;
     $userId = $this->getUserAuth()->userId;
     if ($userId == '') {
         return $this->errorLog(ResultStatus::URL_PARAM_CANNOT_EMPTY, '参数异常');
     }
     //$userId=1;
     $my_favorites = BpFavorites::query()->where("user_id = {$userId}")->limit($limit, $offset)->execute()->toArray();
     foreach ($my_favorites as $fav) {
         $bp_list[] = BeautyParlor::findFirst(["bp_id = " . $fav['bp_id'], "columns" => ['bp_id as id', 'bp_name as name', 'bp_cover as cover', 'bp_address as address']])->toArray();
     }
     foreach ($bp_list as $k => $v) {
         $bp_list[$k]['cover'] = "http://img.meelier.com/" . $bp_list[$k]['cover'];
         $tagarr = BeautyParlorTag::query()->columns('i.tag_title')->leftJoin('Apps\\Common\\Models\\BeautyParlorTagInfo', 'Apps\\Common\\Models\\BeautyParlorTag.tag_id = i.tag_id', 'i')->where("Apps\\Common\\Models\\BeautyParlorTag.bp_id = " . $bp_list[$k]['id'])->orderby("Apps\\Common\\Models\\BeautyParlorTag.sort asc")->limit(3, 0)->execute()->toArray();
         $newarr = [];
         foreach ($tagarr as $key => $val) {
             $newarr[] = $tagarr[$key]['tag_title'];
         }
         $bp_list[$k]['tags'] = $newarr;
     }
     $this->setResult($bp_list);
 }
Ejemplo n.º 2
0
 private function getBeautyParlor($id)
 {
     $info = BeautyParlor::query()->columns(['bp_id as id', 'bp_name as name', 'bp_medal as medal', 'bp_address as address', 'bp_tel as tel', 'AsText(bp_coordinate) as bp_coordinate'])->where('bp_id=:id:')->bind(['id' => $id])->execute()->getFirst();
     $coordinate = str_replace("POINT(", '', $info->bp_coordinate);
     $coordinate = str_replace(")", '', $coordinate);
     $coordinate = explode(" ", $coordinate);
     if ($info) {
         return ['id' => $info->id, 'name' => $info->name, 'medal_refund' => \Apps\Common\Libs\BeautyParlor::getMedalRefund($info->medal), 'medal_verify' => \Apps\Common\Libs\BeautyParlor::getMedalVerify($info->medal), 'latitude' => $coordinate[0], 'longitude' => $coordinate[1], 'tel' => $info->tel, 'address' => $info->address];
     }
     return null;
 }
Ejemplo n.º 3
0
 public function sync($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);
     // 获取店铺信息
     $shop = BeautyParlor::query()->columns(['bp_id', 'bp_name', 'bp_address', 'bp_cover', 'bp_tel', 'bp_medal', 'X(bp_coordinate) x', 'Y(bp_coordinate) y'])->where('bp_id=:id:', ['id' => $id])->execute()->getFirst();
     if (!$shop) {
         return false;
     }
     $name = $shop->bp_name;
     $location = $shop->x . ',' . $shop->y;
     $address = $shop->bp_address;
     $customData = ['bp_id' => $shop->bp_id, 'bp_cover' => PicUrl::BeautyParlorCover($shop->bp_cover, $this->di), 'tel' => $shop->bp_tel, 'bp_tags' => implode(',', \Apps\Common\Libs\BeautyParlor::getTags($id)), 'medal_refund' => \Apps\Common\Libs\BeautyParlor::getMedalRefund($shop->bp_medal), 'medal_verify' => \Apps\Common\Libs\BeautyParlor::getMedalVerify($shop->bp_medal)];
     // 获取已经同步的数据
     $aMapData = BeautyParlorAmap::findFirst("source_id={$id}");
     if ($aMapData) {
         // 更新
         $result = $lbsColud->update($id, $aMapData->amap_data_id, $name, $location, $address, $customData, CoordType::AUTONAVI);
         if ($result->status) {
             // 记录更新时间
             $aMapData->sync_time = new RawValue('NOW()');
             if ($aMapData->save() == false) {
                 $this->logDatabaseError($aMapData);
             }
         }
     } else {
         // 新添加
         $result = $lbsColud->create($id, $name, $location, $address, $customData, CoordType::AUTONAVI);
         if ($result->status) {
             // 记录关系数据
             $aMapData = new BeautyParlorAmap();
             $aMapData->source_id = $id;
             $aMapData->amap_data_id = $result->id;
             $aMapData->sync_time = new RawValue('NOW()');
             if ($aMapData->save() == false) {
                 $this->logDatabaseError($aMapData);
             }
         }
     }
     return $result->status;
 }
Ejemplo n.º 4
0
 private function getRecommend($cityId)
 {
     $bannerBp = OmBanner::query()->columns('banner_data')->where('city_id = :cid: AND banner_name = :key:', ['cid' => $cityId, 'key' => 'index_bp'])->execute()->getFirst();
     if ($bannerBp) {
         $data = BeautyParlor::query()->columns(['bp_id as id', 'bp_name as name', 'bp_cover as cover', 'bp_address as address', 'bp_medal as medal'])->where('bp_state>0 and bp_id=:id:')->bind(['id' => $bannerBp->banner_data])->execute()->getFirst();
         $bpData = ["id" => $data->id, "name" => $data->name, "cover" => PicUrl::BeautyParlorCover($data->cover, $this->getDi()), "address" => $data->address, "tags" => $this->getBeautyParlorTags($data->id), "medal_refund" => \Apps\Common\Libs\BeautyParlor::getMedalRefund($data->medal), "medal_verify" => \Apps\Common\Libs\BeautyParlor::getMedalVerify($data->medal)];
     } else {
         $bpData = null;
     }
     $pics = OmBanner::query()->columns('banner_data')->where('city_id = :cid: AND banner_name = :key:', ['cid' => $cityId, 'key' => 'index_pics'])->execute()->getFirst();
     if ($pics) {
         $picsData = json_decode($pics->banner_data, true);
     } else {
         $picsData = [];
     }
     for ($i = 0; $i < count($picsData); $i++) {
         $picsData[$i]['url'] = PicUrl::DefaultPics($picsData[$i]['url'], $this->getDi());
     }
     return ['pic' => $picsData, 'beauty_parlor' => $bpData];
 }
Ejemplo n.º 5
0
 public function run()
 {
     /**
      * 验证用户权限
      */
     if (false == $this->verifyUserAuth()) {
         return false;
     }
     $page = intval($this->getDataItem('page', 1));
     $limit = $this->getConfig()->limit;
     $offset = ($page - 1) * $limit;
     $user_id = $this->getUserAuth()->userId;
     $list = CosOnlineAppointment::query()->columns(['id', 'set_man_id', 'shop_id', 'shop_name', 'online_product_id', 'product_name', 'appointment_time', 'appointment_state', 'set_time', 'type'])->where('appointment_state in(0, 1) and set_man_id = ' . $user_id)->orderBy('appointment_time DESC')->limit($limit, $offset)->execute()->toArray();
     $result = [];
     foreach ($list as $val) {
         $cover = '';
         $price = '';
         // 初始单价
         if ($val['type'] == 1) {
             // 美容院
             if ($BeautyParlorAttr = BeautyParlorAttr::findFirst('beauty_parlor_id = ' . $val['shop_id'])) {
                 $price = $BeautyParlorAttr->low_price . '元';
             }
             if ($BeautyParlor = BeautyParlor::findFirst('bp_id = ' . $val['shop_id'])) {
                 $cover = $BeautyParlor->bp_cover;
             }
             $result[] = ['id' => $val['id'], 'order_id' => $val['shop_id'], 'title' => $val['shop_name'], 'cover' => $cover ? PicUrl::BeautyParlorCover($cover, $this->getDi()) : '', 'price' => $price, 'time' => $val['appointment_time'], 'add_time' => $val['set_time'], 'status' => $val['appointment_state'], 'type' => '1'];
         } elseif ($val['type'] == '2') {
             if ($BeautyParlorService = BeautyParlorService::findFirst('service_id = ' . $val['online_product_id'])) {
                 $price = $BeautyParlorService->service_price . '元' . ($BeautyParlorService->service_unit ? '/' . $BeautyParlorService->service_unit : '');
                 $cover = $BeautyParlorService->service_cover;
             }
             $result[] = ['id' => $val['id'], 'order_id' => $val['online_product_id'], 'title' => $val['product_name'] ?: '', 'cover' => $cover ? PicUrl::BeautyParlorCover($cover, $this->getDi()) : '', 'price' => $price, 'time' => $val['appointment_time'], 'add_time' => $val['set_time'], 'status' => $val['appointment_state'], 'type' => '2'];
         } else {
             continue;
         }
     }
     $this->setResult($result);
 }
Ejemplo n.º 6
0
 private function syncBPS($id)
 {
     $info = BeautyParlorService::findFirst('service_id = ' . $id);
     if (!$info) {
         return false;
     }
     // 删除数据
     if ($info->service_state <= 0) {
         $this->delete(SearchDataType::BeautyParlorService, $info->service_id);
         return true;
     }
     // 店铺数据
     $bpInfo = \Apps\Common\Models\BeautyParlor::findFirst('bp_id = ' . $info->beauty_parlor_id);
     // 同步数据
     // 标题中包含的内容
     $titleArr = [$info->service_name, $info->service_description];
     $title = implode(',', $titleArr);
     $searchContent = \Apps\Common\Libs\BeautyParlor::formatServiceIntro($info->service_intro, $this->getDI());
     $tagInt = $info->service_is_sell;
     $tagStr = '';
     $showData = json_encode(['id' => $info->service_id, 'name' => $info->service_name, 'cover' => $info->service_cover, 'price' => $info->service_price, 'unit' => $info->service_unit, 'description' => $info->service_description, 'bp_id' => $bpInfo->bp_id, 'bp_name' => $bpInfo->bp_name]);
     $this->save(SearchDataType::BeautyParlorService, $id, $showData, $title, $searchContent, $tagInt, $tagStr);
     return true;
 }
Ejemplo n.º 7
0
 /**
  * 更新数据
  * @return ResponseResult
  */
 private function updateSave()
 {
     $req = $this->request;
     $response = new ResponseResult();
     $response->callback = $req->getPost('callback', null, 'parent.setFormResult');
     $response->callbackJavascriptTag = true;
     $id = intval($req->getPost('bp_id'));
     if ($id < 1) {
         $response->sendError(ResponseResultStatus::PARAM_CANNOT_EMPTY, '参数异常!');
         return $response;
     }
     $name = $req->getPost('bp_name');
     $district = intval($req->getPost('bp_district', null, 0));
     $address = $req->getPost('bp_address');
     $coordinate = $req->getPost('bp_coordinate');
     $tel = $req->getPost('bp_tel');
     $isSell = intval($req->getPost('bp_is_sell', null, 0));
     $medalRefund = intval($req->getPost('bp_medal_refund', null, 0));
     $medalVerify = intval($req->getPost('bp_medal_verify', null, 0));
     $tags = $req->getPost('bp_tags');
     $ownerMobile = $req->getPost('bp_owner_mobile');
     $intro = $req->getPost('bp_intro');
     // 判断空数据
     if (empty($name) || $district <= 0 || empty($address) || empty($coordinate) || empty($tel) || empty($tags) || empty($intro) || empty($ownerMobile)) {
         $response->sendError(ResponseResultStatus::PARAM_CANNOT_EMPTY, '参数异常!');
         return $response;
     }
     // 保存封面
     $uploadFile = new UploadPic();
     $uploadFile->request = $req;
     $cover = $uploadFile->beautyParlorCover();
     if ($cover == false || !is_array($cover) || count($cover) == 0 || $cover[0] == false) {
         $bpCover = null;
     } else {
         $bpCover = $cover[0];
     }
     // 保存基础数据
     $coordinate = str_replace(',', ' ', $coordinate);
     $bp = BeautyParlor::findFirst('bp_id = ' . $id);
     $data = [];
     if ($bp->bp_name != $name) {
         $data['bp_name'] = $name;
     }
     if (!!$bpCover) {
         $data['bp_cover'] = $bpCover;
     }
     if ($bp->bp_address != $address) {
         $data['bp_address'] = $address;
     }
     if ($bp->bp_district != $district) {
         $data['bp_district'] = $district;
     }
     $data['bp_coordinate'] = new RawValue("GeomFromText('POINT({$coordinate})')");
     if ($bp->bp_tel != $tel) {
         $data['bp_tel'] = $tel;
     }
     if ($bp->bp_owner_mobile != $ownerMobile) {
         $data['bp_owner_mobile'] = $ownerMobile;
     }
     if ($bp->bp_intro != $intro) {
         $data['bp_intro'] = $intro;
     }
     if ($bp->bp_is_sell != $isSell) {
         $data['bp_is_sell'] = $isSell;
     }
     $data['bp_medal'] = strval($medalRefund) . strval($medalVerify);
     $bp->update($data);
     /*标签排序  */
     $tagsarr = explode(",", $tags);
     $status = BeautyParlorTag::find("bp_id = {$id}")->delete();
     if (!$status) {
         $response->sendError(ResponseResultStatus::PARAM_ERROR, '保存标签失败!');
     }
     foreach ($tagsarr as $k => $tag) {
         $taginfo = BeautyParlorTagInfo::find("tag_id = {$tag} and tag_state = 1")->toArray();
         $count = count($taginfo);
         if ($count < 1) {
             $response->sendError(ResponseResultStatus::PARAM_ERROR, '没有ID为' . $tag . '的标签!');
         }
         $tagDb = new BeautyParlorTag();
         $tagDb->bp_id = $id;
         $tagDb->tag_id = $tag;
         $tagDb->sort = $k + 1;
         if ($tagDb->save() == false) {
             $this->databaseErrorLog($tagDb);
         }
     }
     /* 
             $tagsArr = explode(',', $tags);
            	foreach($tagsArr as $tag) {
                 $tagDb = BeautyParlorTag::query()
                     ->columns('bp_tag_id, bp_id, tag_id')
                     ->where('bp_id = :bid: AND tag_id = :tid:')
                     ->bind(['bid'=>$id, 'tid'=>$tag])
                     ->execute()->getFirst();
                 if(!$tagDb) {
                     $tagDb = new BeautyParlorTag();
                     $tagDb->bp_id = $id;
                     $tagDb->tag_id = $tag;
                     if ($tagDb->save() == false) {
                         $this->databaseErrorLog($tagDb);
                     }
                 }
             } */
     // 获取所有的标签
     /* $tagList = BeautyParlorTag::query()
            ->where('bp_id = :bid:')
            ->bind(['bid'=>$id])
            ->execute();
        foreach($tagList as $t) {
            if(in_array(strval($t->tag_id), $tagsArr) == false) {
                $t->delete();
            }
        } */
     // 保存轮播图片
     // 轮播图片
     $pics = $uploadFile->beautyParlorPics();
     if ($pics) {
         foreach ($pics as $pic) {
             $picDb = new BeautyParlorPhotos();
             $picDb->beauty_parlor_id = $id;
             $picDb->photo_url = $pic;
             if ($picDb->save() == false) {
                 $this->databaseErrorLog($picDb);
             }
         }
     }
     SearchASync::Instance()->noticeSync($id, SearchDataType::BeautyParlors);
     $response->sendResult('ok');
     return $response;
 }
Ejemplo n.º 8
0
 public function run()
 {
     $page = intval($this->getDataItem('page', 1));
     $keyword = $this->getDataItem('keyword');
     if (empty($keyword)) {
         $offset = ($page - 1) * 10;
         $list = BeautyParlorServiceModel::query()->leftJoin('Apps\\Common\\Models\\BeautyParlor', 'Apps\\Common\\Models\\BeautyParlorService.beauty_parlor_id = b.bp_id', 'b')->where("Apps\\Common\\Models\\BeautyParlorService.service_state = 1 and b.bp_state = 1 ")->limit(10, $offset)->execute()->toArray();
         foreach ($list as $arr) {
             foreach ($arr as $k => $v) {
                 $k = str_replace("service_", "", $k);
                 $arrs[$k] = $v;
             }
             $newarr[] = $arrs;
         }
         $list = $newarr;
         foreach ($list as $k => $v) {
             $arr = BeautyParlorModel::query()->columns(['bp_name'])->where("bp_id = " . $list[$k]['beauty_parlor_id'])->execute()->toArray();
             /* echo "bp_id = ".$list[$k]['beauty_parlor_id']." and bp_state = 1";
              		echo "<br>"; */
             if (count($arr) == 0) {
                 unset($list[$k]);
             } else {
                 $list[$k]['bp_name'] = $arr[0]['bp_name'];
                 $list[$k]['bp_id'] = $list[$k]['beauty_parlor_id'];
                 $list[$k]['cover'] = "http://img.meelier.com/" . $list[$k]['cover'];
             }
         }
         $this->setResult($list);
     } else {
         /*多关键字搜索*/
         $keywordarr = explode(" ", trim($keyword));
         foreach ($keywordarr as $r) {
             $wherearr[] = "Apps\\Common\\Models\\BeautyParlorService.service_name like '%" . $r . "%'";
         }
         $where = implode(" or ", $wherearr);
         ////////////////////////////////////////////////////////////////
         /* $limit = $this->getConfig()->limit;
            $offset = ($page-1) * $limit;
            $data = $this->searchBPS($keyword, $limit, $offset);
            $this->setResult($data); */
         $offset = ($page - 1) * 10;
         $list = BeautyParlorServiceModel::query()->leftJoin('Apps\\Common\\Models\\BeautyParlor', 'Apps\\Common\\Models\\BeautyParlorService.beauty_parlor_id = b.bp_id', 'b')->where("{$where} and Apps\\Common\\Models\\BeautyParlorService.service_state = 1 and b.bp_state = 1")->limit(10, $offset)->execute()->toArray();
         foreach ($list as $arr) {
             foreach ($arr as $k => $v) {
                 $k = str_replace("service_", "", $k);
                 $arrs[$k] = $v;
             }
             $newarr[] = $arrs;
         }
         $list = $newarr;
         foreach ($list as $k => $v) {
             $arr = BeautyParlorModel::query()->columns(['bp_name'])->where("bp_id = " . $list[$k]['beauty_parlor_id'] . " and bp_state = 1")->execute()->toArray();
             if (count($arr) == 0) {
                 unset($list[$k]);
             } else {
                 $list[$k]['bp_name'] = $arr[0]['bp_name'];
                 $list[$k]['bp_id'] = $list[$k]['beauty_parlor_id'];
                 $list[$k]['cover'] = "http://img.meelier.com/" . $list[$k]['cover'];
             }
         }
         $this->setResult($list);
     }
 }
Ejemplo n.º 9
0
 /**
  * 美容院服务
  */
 public function beautyParlorServiceAction()
 {
     $id = $this->request->getQuery('id');
     if (empty($id)) {
         echo '美容院服务项目不存在!';
         $this->view->disable();
         return;
     }
     $service = BeautyParlorService::query()->columns(['service_id as id', 'service_cover cover', 'service_name as name', 'service_price as price', 'service_unit as price_show', 'service_description as description', 'service_intro as intro', 'beauty_parlor_id as bp_id'])->where('service_state>0 and service_id=:id:')->bind(['id' => $id])->execute()->getFirst();
     if (!$service) {
         echo '美容院服务项目不存在!';
         $this->view->disable();
         return;
     }
     $data = ['id' => $service->id, 'cover' => PicUrl::BeautyParlorCover($service->cover, $this->getDi()), 'name' => $service->name, 'price' => $service->price, 'description' => $service->description, 'intro' => \Apps\Common\Libs\BeautyParlor::formatServiceIntro($service->intro, $this->di)];
     if ($service->price > 0) {
         $unit = $service->price_show;
         $data['price_show'] = $service->price . '元' . ($unit ? '/' . $unit : '');
     }
     $data['beauty_parlor'] = BeautyParlor::query()->columns(['bp_id as id', 'bp_name as name', 'bp_medal as medal'])->where('bp_id=:id:')->bind(['id' => $service->bp_id])->execute()->getFirst();
     $this->view->setVar('service', $data);
     $this->tag->setTitle($data['beauty_parlor']->name);
 }
Ejemplo n.º 10
0
 public function run()
 {
     $id = intval($this->getDataItem('id', 0));
     $user_id = intval($this->getDataItem('user_id', 0));
     if (0 < $id) {
         /**
          * 查询基础信息
          */
         $info = BeautyParlorModel::query()->columns(['bp_id as id', 'bp_name as name', 'bp_cover as cover', 'bp_address as address', 'bp_tel as tel', 'bp_medal as medal', 'bp_intro as intro', 'X(bp_coordinate) latitude', 'Y(bp_coordinate) longitude'])->where('bp_state>0 and bp_id=:id:')->bind(['id' => $id])->execute()->getFirst();
     } else {
         return $this->errorLog(ResultStatus::URL_PARAM_CANNOT_EMPTY, '参数异常');
     }
     if ($info) {
         $this->parlor['id'] = $info->id;
         $this->parlor['name'] = $info->name;
         $this->parlor['cover'] = $info->cover;
         $this->parlor['address'] = $info->address;
         $this->parlor['tel'] = $info->tel;
         $this->parlor['intro'] = $info->intro;
         $this->parlor['latitude'] = $info->latitude;
         $this->parlor['longitude'] = $info->longitude;
         $this->parlor['medal_refund'] = \Apps\Common\Libs\BeautyParlor::getMedalRefund($info->medal);
         $this->parlor['medal_verify'] = \Apps\Common\Libs\BeautyParlor::getMedalVerify($info->medal);
         /**
          * 增加图片列表
          */
         $pics = BeautyParlorPhotos::query()->columns(['photo_url url'])->where('photo_state>0 and beauty_parlor_id=:bid:')->bind(['bid' => $id])->execute()->toArray();
         $this->parlor['pics'] = [];
         foreach ($pics as $pic) {
             $this->parlor['pics'][] = PicUrl::BeautyParlorPic($pic['url'], $this->getDi());
         }
         /**
          * 增加服务范围列表
          */
         $service = BeautyParlorService::query()->columns(['service_id id', 'service_cover cover', 'service_name name', 'service_price price', 'service_unit unit', 'service_description description'])->where('service_state>0 and service_is_sell = 1 and beauty_parlor_id=:bid:')->bind(['bid' => $id])->execute()->toArray();
         $this->parlor['services'] = [];
         foreach ($service as $d) {
             $d['cover'] = PicUrl::BeautyParlorCover($d['cover'], $this->getDi());
             $unit = $d['unit'];
             unset($d['unit']);
             $d['price_show'] = '';
             if ($d['price'] > 0) {
                 $d['price_show'] = $d['price'] . '元' . ($unit ? '/' . $unit : '');
             }
             $this->parlor['services'][] = $d;
         }
         // 评论总数
         $this->parlor['comment_num'] = BeautyParlorComment::count(['conditions' => 'beauty_parlor_id = :bid: and comment_state = 1', 'bind' => ['bid' => $id]]);
     } else {
         $this->errorLog(ResultStatus::QUERY_DATA_NOT_EXIST, 'ID不存在');
     }
     $this->parlor['favorite_num'] = BpFavorites::count(['conditions' => "bp_id = " . $this->parlor['id']]);
     if ($user_id != '') {
         $is_favorite = BpFavorites::findFirst("user_id = {$user_id} and bp_id =" . $this->parlor['id']);
         /* var_dump($is_favorite);
            exit; */
         if ($is_favorite) {
             $this->parlor['is_favorite'] = 1;
             //已收藏
         } else {
             $this->parlor['is_favorite'] = 0;
             //未收藏
         }
     } else {
         $this->parlor['is_favorite'] = 0;
     }
     $this->setResult($this->parlor);
 }
Ejemplo n.º 11
0
 public function run()
 {
     $id = intval($this->getDataItem('id', 0));
     $user_id = intval($this->getDataItem('user_id', 0));
     if (0 < $id) {
         /**
          * 查询基础信息
          */
         $info = BeautyParlorModel::query()->columns(['bp_id as id', 'bp_name as name', 'bp_cover as cover', 'bp_address as address', 'bp_tel as tel', 'bp_medal as medal', 'bp_intro as intro', 'X(bp_coordinate) latitude', 'Y(bp_coordinate) longitude', 'bpa.open_time', 'bpa.close_time', 'bpa.low_price', 'bpa.open_year', 'bpa.shop_area', 'bpa.service_num', 'bpa.facilities'])->leftJoin('Apps\\Common\\Models\\BeautyParlorAttr', 'Apps\\Common\\Models\\BeautyParlor.bp_id = bpa.beauty_parlor_id', 'bpa')->where('Apps\\Common\\Models\\BeautyParlor.bp_state>0 and Apps\\Common\\Models\\BeautyParlor.bp_id=:id:')->bind(['id' => $id])->execute()->getFirst();
     } else {
         return $this->errorLog(ResultStatus::URL_PARAM_CANNOT_EMPTY, '参数异常');
     }
     if ($info) {
         $this->parlor['id'] = $info->id;
         $this->parlor['name'] = $info->name;
         $this->parlor['cover'] = PicUrl::BeautyParlorCover($info->cover, $this->getDi());
         $this->parlor['address'] = $info->address;
         $this->parlor['tel'] = $info->tel;
         $this->parlor['intro'] = $info->intro;
         $this->parlor['latitude'] = $info->latitude;
         $this->parlor['longitude'] = $info->longitude;
         $this->parlor['medal_refund'] = \Apps\Common\Libs\BeautyParlor::getMedalRefund($info->medal);
         $this->parlor['medal_verify'] = \Apps\Common\Libs\BeautyParlor::getMedalVerify($info->medal);
         $this->parlor['open_time'] = $info->open_time == null ? '' : $info->open_time;
         $this->parlor['close_time'] = $info->close_time == null ? '' : $info->close_time;
         $this->parlor['low_price'] = $info->low_price == null ? '' : $info->low_price;
         $this->parlor['open_year'] = $info->open_year == null ? '' : $info->open_year;
         $this->parlor['shop_area'] = $info->shop_area == null ? '' : $info->shop_area;
         $this->parlor['facilities'] = $info->facilities == null ? [] : (json_decode($info->facilities) ?: []);
         $this->parlor['pics'] = [];
         $this->parlor['services'] = [];
         /**
          * 增加图片列表 如果深度验店 
          */
         if ($this->parlor['medal_verify']) {
             $pics = BeautyParlorPhotos::query()->columns(['photo_url url'])->where('photo_state>0 and beauty_parlor_id=:bid:')->bind(['bid' => $id])->execute()->toArray();
             foreach ($pics as $pic) {
                 $this->parlor['pics'][] = PicUrl::BeautyParlorPic($pic['url'], $this->getDi());
             }
             /**
              * 增加服务范围列表
              */
             $service = BeautyParlorService::query()->columns(['service_id id', 'service_cover cover', 'service_name name', 'service_price price', 'service_unit unit', 'service_description description'])->where('service_state>0 and service_is_sell = 1 and beauty_parlor_id=:bid:')->bind(['bid' => $id])->limit(3, 0)->execute()->toArray();
             foreach ($service as $d) {
                 $d['cover'] = PicUrl::BeautyParlorCover($d['cover'], $this->getDi());
                 $unit = $d['unit'];
                 unset($d['unit']);
                 $d['price_show'] = '';
                 if ($d['price'] > 0) {
                     $d['price_show'] = $d['price'] . '元' . ($unit ? '/' . $unit : '');
                 }
                 $this->parlor['services'][] = $d;
             }
         }
         /**
          * 增加tag列表
          */
         $tag = BeautyParlorTag::query()->columns(['i.tag_title'])->leftJoin('Apps\\Common\\Models\\BeautyParlorTagInfo', 'Apps\\Common\\Models\\BeautyParlorTag.tag_id = i.tag_id', 'i')->where('i.tag_state=1 and bp_id=:bid:')->bind(['bid' => $id])->orderBy('sort desc,bp_tag_addtime asc')->execute()->toArray();
         $this->parlor['tags'] = $tag;
         // 评论总数
         $this->parlor['comment_num'] = BeautyParlorComment::count(['conditions' => 'beauty_parlor_id = :bid: and comment_state = 1', 'bind' => ['bid' => $id]]);
         //获取3条评论
         $comments = BeautyParlorComment::query()->columns(['u.user_id', 'u.user_nickname', 'u.user_cover', 'u.user_gender', 'u.user_expert', 'Apps\\Common\\Models\\BeautyParlorComment.comment_id as comment_id', 'Apps\\Common\\Models\\BeautyParlorComment.comment_info as comment_info', 'Apps\\Common\\Models\\BeautyParlorComment.comment_photos as comment_photos', 'Apps\\Common\\Models\\BeautyParlorComment.comment_floor as comment_floor', 'Apps\\Common\\Models\\BeautyParlorComment.comment_addtime as addtime'])->leftJoin('Apps\\Common\\Models\\UserBase', 'Apps\\Common\\Models\\BeautyParlorComment.user_id=u.user_id', 'u')->where('Apps\\Common\\Models\\BeautyParlorComment.beauty_parlor_id=' . $id . ' and Apps\\Common\\Models\\BeautyParlorComment.comment_state = 1')->orderBy('Apps\\Common\\Models\\BeautyParlorComment.comment_addtime desc')->limit(3, 0)->execute()->toArray();
         foreach ($comments as $arr) {
             $arr['user_cover'] = PicUrl::UserCover($arr['user_cover'], $this->getDi());
             $arr['comment_photos'] = PicUrl::BeautyParlorComment(json_decode($arr['comment_photos']), $this->getDi());
             if (unserialize(base64_decode($arr['comment_info']))) {
                 $arr['comment_info'] = unserialize(base64_decode($arr['comment_info']));
             }
             $data[] = $arr;
         }
         $this->parlor['comments'] = $data;
     } else {
         return $this->errorLog(ResultStatus::QUERY_DATA_NOT_EXIST, 'ID不存在');
     }
     $this->parlor['favorite_num'] = BpFavorites::count(['conditions' => "bp_id = " . $this->parlor['id']]);
     if ($user_id != '') {
         $is_favorite = BpFavorites::findFirst("user_id = {$user_id} and bp_id =" . $this->parlor['id']);
         /* var_dump($is_favorite);
            exit; */
         if ($is_favorite) {
             $this->parlor['is_favorite'] = 1;
             //已关注
         } else {
             $this->parlor['is_favorite'] = 0;
             //未关注
         }
     } else {
         $this->parlor['is_favorite'] = 0;
     }
     $this->setResult($this->parlor);
 }
Ejemplo n.º 12
0
 /**
  * 服务项目预览
  * @date: 2016年1月29日 
  * @author: chenxiaolin
  */
 public function servicePreviewAction()
 {
     $id = $this->request->getQuery('id');
     if (empty($id)) {
         echo '美容院服务项目不存在!';
         $this->view->disable();
         return;
     }
     $service = BeautyParlorService::query()->columns(['service_id as id', 'service_cover cover', 'service_name as name', 'service_price as price', 'service_unit as unit', 'service_intro as intro', 'beauty_parlor_id as bp_id'])->where('service_state>0 and service_id=:id:')->bind(['id' => $id])->execute()->getFirst();
     if (!$service) {
         echo '美容院服务项目不存在!';
         $this->view->disable();
         return;
     }
     $service->cover = PicUrl::BeautyParlorCover($service->cover, $this->getDI());
     $bp_info = BeautyParlor::query()->columns(['bp_id', 'bp_name', 'bp_address', 'bp_owner_mobile'])->where('bp_id=:id:')->bind(['id' => $service->bp_id])->execute()->getFirst();
     $this->view->setVar('service', $service);
     $this->view->setVar('bp', $bp_info);
     $this->tag->setTitle($bp_info->bp_name);
 }
Ejemplo n.º 13
0
 /**
  * 1.0版本
  * 
  * @return $this|ResponseResult
  */
 public function addBpAction()
 {
     $this->setLeftNav('bp_list');
     $req = $this->request;
     $id = intval($req->getQuery('id', null, 0));
     $page = intval($req->getQuery('page', null, 1));
     $page = $page > 0 ? $page : 1;
     $limit = $this->pageNavLimit;
     $offset = $limit * ($page - 1);
     $filterProvince = $req->getQuery('filterProvince', null, '');
     $filterCity = $req->getQuery('filterCity', null, '');
     $filterDistrict = intval($req->getQuery('filterDistrict', null, -10000));
     $filterName = $req->getQuery('filterName', null, '');
     $columns = ['bp_id', 'bp_name', 'bp_cover', 'bp_address', 'bp_district', 'FULL_NAME district', 'bp_coordinate', 'bp_tel', 'bp_intro', 'bp_state', 'bp_is_sell', 'bp_medal', 'bp_addtime'];
     $where = ['bp_state > 0'];
     $bind = [];
     if (!!$filterName) {
         $where[] = 'bp_name LIKE :fname:';
         $bind['fname'] = '%' . $filterName . '%';
     }
     $districts = [];
     // 地区
     if ($filterDistrict > -10000) {
         $where[] = 'bp_district = :district:';
         $bind['district'] = $filterDistrict;
     } elseif (!empty($filterCity)) {
         // 获取所有城市的下级区县值
         $dids = SysAreaZipDistrictPhonecode::query()->columns(['K_ID id'])->where('P_NM = :province: AND C_NM = :city:', ['province' => $filterProvince, 'city' => $filterCity])->execute();
         foreach ($dids as $d) {
             $districts[] = $d->id;
         }
     } elseif (!empty($filterProvince)) {
         // 获取所有城市的下级区县值
         $dids = SysAreaZipDistrictPhonecode::query()->columns(['K_ID id'])->where('P_NM = :p:', ['p' => $filterProvince])->execute();
         foreach ($dids as $d) {
             $districts[] = $d->id;
         }
     }
     if (count($districts) > 0) {
         $where[] = 'bp_district IN(' . implode(', ', $districts) . ')';
     }
     $whereStr = implode(' AND ', $where);
     $query = BeautyParlor::query()->columns($columns)->leftJoin('Apps\\Common\\Models\\SysAreaZipDistrictPhonecode', 'K_ID=bp_district', 'area');
     if (!empty($whereStr)) {
         $query = $query->where($whereStr);
     }
     if (count($bind) > 0) {
         $query = $query->bind($bind);
     }
     $bpList = $query->orderBy('bp_id DESC')->limit($limit, $offset)->execute()->toArray();
     // 总数
     $total = BeautyParlor::count(['conditions' => $whereStr, 'bind' => $bind]);
     // 查看是否已经在此活动中
     // 查询所有参与的列表
     $joinList = ActivityBeautyParlor::find('state > 0 AND activity_id = ' . $id);
     $joinBpIds = [];
     foreach ($joinList as $j) {
         $joinBpIds[] = strval($j->beauty_parlor_id);
     }
     for ($i = 0; $i < count($bpList); $i++) {
         if (in_array(strval($bpList[$i]['bp_id']), $joinBpIds)) {
             $bpList[$i]['bp_state'] = 1;
         } else {
             $bpList[$i]['bp_state'] = 0;
         }
     }
     $this->view->setVar('id', $id);
     $this->view->setVar('filterProvince', $filterProvince);
     $this->view->setVar('filterCity', $filterCity);
     $this->view->setVar('filterDistrict', $filterDistrict);
     $this->view->setVar('filterName', $filterName);
     $this->view->setVar('total', $total);
     $this->view->setVar('page', $page);
     $this->view->setVar('limit', $limit);
     $this->view->setVar('data', $bpList);
 }
Ejemplo n.º 14
0
 public function run()
 {
     //验证是否登录
     if (false == $this->verifyUserAuth()) {
         return false;
     }
     $type = $this->getDataItem('type', 1);
     //预约类型
     $bp_id = intval(trim($this->getDataItem('bp_id', 0)));
     //美容院ID
     $service_id = intval(trim($this->getDataItem('service_id')));
     //服务id
     $set_man = trim($this->getDataItem('set_man'));
     //预约人
     $set_time = trim($this->getDataItem('set_time'));
     //预约时间
     $tel = trim($this->getDataItem('tel'));
     //联系电话
     //验证参数
     if ($bp_id == "" || $set_man == "" || $set_time == "" || $tel == '' || $type == 2 && $service_id == '') {
         return $this->errorLog(ResultStatus::POST_BODY_PARAM_ERROR);
     }
     if ($this->utf8_strlen($set_man) > 10) {
         return $this->errorLog(ResultStatus::POST_BODY_FORMAT_ERROR, "预约人不可超过10个字符");
     }
     //预约时间不可小于当前时间 不可大于7天
     if (strtotime($set_time) < time() || strtotime($set_time) > strtotime(' +7 day')) {
         return $this->errorLog(ResultStatus::POST_BODY_FORMAT_ERROR, "预约时间不合法");
     }
     //
     if ($this->utf8_strlen($tel) != 11) {
         return $this->errorLog(ResultStatus::POST_BODY_FORMAT_ERROR, "请输入11位电话号码");
     }
     //验证美容院是否可预约
     $bp_name = BeautyParlor::query()->columns(['bp_name'])->where('bp_id = :bp_id: AND bp_state = 1 ')->bind(['bp_id' => $bp_id])->execute()->getFirst();
     if (!$bp_name) {
         return $this->errorLog(ResultStatus::POST_BODY_FORMAT_ERROR, "美容院不存在");
     }
     if ($type == 2) {
         //当预约服务时 验证服务是可用
         $service = BeautyParlorService::query()->columns('service_name')->where('service_state>0 and service_is_sell = 1 and beauty_parlor_id=:bid: and service_id = :sid:')->bind(['bid' => $bp_id, 'sid' => $service_id])->execute()->getFirst();
         if (!$service) {
             return $this->errorLog(ResultStatus::POST_BODY_FORMAT_ERROR, "服务不可预约");
         }
     }
     $data['online_product_id'] = $service_id;
     $data['product_name'] = empty($service) ? '' : $service->product_name;
     $data['appointment_time'] = $set_time;
     $data['set_man'] = $set_man;
     $data['set_man_id'] = $this->getUserAuth()->userId;
     $data['tel'] = $tel;
     $data['set_time'] = date("Y-m-d h:i:s", time());
     $data["appointment_state"] = 0;
     $data["shop_id"] = $bp_id;
     $data["shop_name"] = $bp_name->bp_name;
     $data['type'] = $type;
     $appointment = new CosOnlineAppointment();
     if ($appointment->save($data)) {
         $this->id = $appointment->id;
         $this->success = 1;
         return $this->setResult(['id' => $this->id, 'success' => $this->success]);
     } else {
         return $this->databaseErrorLog($appointment);
     }
 }
Ejemplo n.º 15
0
 /**
  * 添加首页推荐美容院
  * @date: 2016-1-8 
  * @author: futao
  */
 public function bannerBpAddAction()
 {
     $this->setLeftNav('bannerbp');
     $req = $this->request;
     if (!$req->isPost()) {
         $this->view->setVar('bp_id', $req->getQuery('id', null, 0));
         $this->view->setVar('openCity', $this->openCityList());
         $this->view->pick("bp/bannerBpAdd");
         return;
     }
     $response = new ResponseResult();
     $response->callback = $req->getPost('callback', null, 'parent.setFormResult');
     $response->callbackJavascriptTag = true;
     $bp_id = intval($req->getPost('bp_id'));
     $city = $req->getPost('city');
     $addr = $city;
     $sort = $req->getPost('sort');
     $time = $req->getPost('time');
     // 判断空数据
     if (empty($bp_id) || empty($addr) || empty($sort)) {
         $response->sendError(ResponseResultStatus::PARAM_CANNOT_EMPTY, '参数异常!');
         return $response;
     }
     //判断要推荐的美容是否存在
     $bp = BeautyParlor::findFirst(" bp_id = {$bp_id} and bp_state = 1");
     if (empty($bp)) {
         $response->sendError(ResponseResultStatus::BUSINESS, '当前推荐的美容院不存在或未发布或已删除!');
         return $response;
     }
     //保存推荐美容院图片
     $uploadFile = new UploadPic();
     $uploadFile->request = $req;
     $cover = $uploadFile->beautyParlorCover();
     if ($cover == false || !is_array($cover) || count($cover) == 0 || $cover[0] == false) {
         if ($_FILES['bp_cover']['error'] == 1) {
             $response->sendError(ResponseResultStatus::UPLOAD_FILE_ERROR, '文件大小超过了1M!');
         }
         return $response;
     }
     //判断美容院是否已经存在3个
     /* if(CosPointBp::count("addr = $addr") >= 3){
       		$response->sendError(ResponseResultStatus::BUSINESS, '首页推荐美容院只能添加3个!');
       		return $response;
       	} */
     //判断要添加的美容院是否已存在
     /* if(CosPointBp::count('bp_id = ' . $bp_id.' and addr = '.$addr)){
       		$response->sendError(ResponseResultStatus::BUSINESS, '该美容院已经加入首页推荐!');
       		return $response;
       	}elseif(CosPointBp::count('sort = ' . $sort . ' and addr = '.$addr)){
       		$response->sendError(ResponseResultStatus::BUSINESS, '排序已经存在!');
       		return $response;
       	} */
     //实例化Model,组装数据
     $cosPointBp = new CosPointBp();
     $cosPointBp->bp_id = $bp_id;
     $cosPointBp->addr = $addr;
     $cosPointBp->sort = $sort;
     $cosPointBp->img_url = $cover[0];
     if ($time != '') {
         $timeArr = explode("至", $time);
         $show_start_time = trim($timeArr[0]);
         $show_end_time = trim($timeArr[1]);
         $cosPointBp->show_start_time = $show_start_time;
         $cosPointBp->show_end_time = $show_end_time;
     }
     //保存数据
     if ($cosPointBp->save() == false) {
         $this->databaseErrorLog($cosPointBp);
         $response->sendError(ResponseResultStatus::DATABASE_ERROR, '保存数据异常!');
     } else {
         $response->sendResult($cosPointBp->id);
     }
     return $response;
 }
Ejemplo n.º 16
0
 private function getsql($keyword)
 {
     $tmp = [];
     $wherearr = [];
     $newarr = [];
     $keywordarr = explode(" ", $keyword);
     foreach ($keywordarr as $k => $v) {
         unset($tmp);
         $tmp = BeautyParlorTagInfo::query()->columns("tag_id")->where("tag_title = '" . $v . "'")->execute()->toArray();
         if (count($tmp) > 0) {
             //$arr['tag'][]=$tmp;
             $tag_id = BeautyParlorTag::query()->columns("bp_id")->where("tag_id = " . $tmp[0]['tag_id'] . " and sort < 4")->execute()->toArray();
             if (count($tag_id) > 0) {
                 foreach ($tag_id as $r) {
                     $newarr[] = $r['bp_id'];
                 }
                 $bp_ids = implode(",", $newarr);
                 $wherearr[] = "bp_id in ({$bp_ids})";
                 $order = " find_in_set(bp_id,'{$bp_ids}') ";
             }
         }
     }
     foreach ($keywordarr as $k => $v) {
         unset($tmp);
         $tmp = BeautyParlorModel::query()->columns("bp_name")->where("bp_name like '%" . $v . "%'")->execute()->toArray();
         if (count($tmp) > 0) {
             $wherearr[] = "bp_name like '%" . $v . "%'";
         }
     }
     foreach ($keywordarr as $k => $v) {
         unset($tmp);
         $tmp = BeautyParlorModel::query()->columns("bp_address")->where("bp_address like '%" . $v . "%'")->execute()->toArray();
         if (count($tmp) > 0) {
             $wherearr[] = "bp_address like '%" . $v . "%'";
         }
     }
     foreach ($keywordarr as $k => $v) {
         unset($tmp);
         $tmp = BeautyParlorModel::query()->columns("bp_intro")->where("bp_intro like '%" . $v . "%'")->execute()->toArray();
         if (count($tmp) > 0) {
             $wherearr[] = "bp_intro like '%" . $v . "%'";
         }
     }
     $where = implode(" or ", $wherearr);
     if ($where != '') {
         $data['where'] = "(" . $where . ") and (bp_state = 1)";
     } else {
         $data['where'] = "";
     }
     if ($order == '') {
         $order = " bp_id desc";
     }
     $data['order'] = $order;
     return $data;
 }
Ejemplo n.º 17
0
 /**
  * 美容院信息
  * @param $id
  * @return BeautyParlor
  */
 protected function getBPInfo($id)
 {
     $bpInfo = BeautyParlor::findFirst('bp_id = ' . $id);
     $this->view->setVar('bpInfo', $bpInfo);
     return $bpInfo;
 }
Ejemplo n.º 18
0
 public function run()
 {
     /**
      * 验证用户权限
      */
     if (false == $this->verifyUserAuth()) {
         return false;
     }
     $bp_id = intval($this->getDataItem('beauty_parlor_id', 0));
     $appoint_id = intval($this->getDataItem('appoint_id', 0));
     $comment_info = Keyword::Filter($this->getDataItem('content', ''));
     //关键字替换
     $keyword = CosQKeyword::query()->execute()->toArray();
     foreach ($keyword as $k => $v) {
         $comment_info = str_replace($v['keyword'], '***', $comment_info);
     }
     $comment_info = base64_encode(serialize($comment_info));
     //$type = intval($this -> getDataItem('type'));
     $type = $this->getDataItem('type');
     //评论图片
     $up = new UploadPic();
     $comment_photos = json_encode($up->beautyParlorComment());
     if ($type !== null && $type >= 0 && in_array($type, array(0, 1))) {
         if ($type == 0) {
             //添加美容院评论
             if ($bp_id > 0 && !empty($comment_info)) {
                 // 查询最大楼层
                 $floor = BeautyParlorComment::maximum(["column" => "comment_floor", "conditions" => "beauty_parlor_id = :id: and type = 0", "bind" => ["id" => $bp_id]]);
                 $bpc = new BeautyParlorComment();
                 $bpc->user_id = $this->getUserAuth()->userId;
                 $bpc->comment_floor = ($floor ? $floor : 0) + 1;
                 $bpc->beauty_parlor_id = $bp_id;
                 $bpc->comment_info = $comment_info;
                 $bpc->comment_photos = $comment_photos;
                 $bpc->type = $type;
                 if ($bpc->save()) {
                     $this->id = $bpc->comment_id;
                     $this->success = 1;
                 } else {
                     return $this->databaseErrorLog($bpc);
                 }
             } else {
                 return $this->errorLog(ResultStatus::POST_BODY_PARAM_ERROR, "");
             }
             //评论成功,推送消息
             $branch = BeautyParlor::findFirst("bp_id = {$bp_id}")->toArray();
             $branchId = $branch['branch_id'];
             if (empty($branchId)) {
                 //没有分店,不推送
                 return $this->setResult(['id' => $this->id, 'success' => $this->success]);
             } else {
                 $num = Branch::query()->columns('s.shop_uid')->leftJoin('Apps\\Common\\Models\\CosShop', 'Apps\\Common\\Models\\Branch.shop_id = s.shop_id', 's')->where('Apps\\Common\\Models\\Branch.branch_id = ' . $branchId)->execute()->toArray();
                 $phoneNum = $num[0]['shop_uid'];
                 $param = array('type' => 7, 'ispushservice' => 0, 'phone' => $phoneNum, 'content' => '有人对您的美容院进行了评论,快去看看吧!', 'shop_id' => 0);
                 $push = new Jpush();
                 $rs = $push->setval($param);
                 if (!empty($rs)) {
                     $data = json_decode($rs, true);
                     $status = $data['status'];
                     if ($status == 400) {
                         //数据错误
                         return $this->setResult(['id' => $this->id, 'success' => $this->success]);
                     }
                 } else {
                     $rs = $push->push();
                     return $this->setResult(['id' => $this->id, 'success' => $this->success]);
                 }
             }
         }
         if ($type == 1) {
             //添加预约评论
             if ($bp_id > 0 && $appoint_id > 0 && !empty($comment_info)) {
                 //判断预约是否已被当前用户评论
                 $is_comment = BeautyParlorComment::count(["conditions" => "appointment_id = :id: and beauty_parlor_id = :bp_id: and user_id = :user_id:", "bind" => ["id" => $appoint_id, "bp_id" => $bp_id, "user_id" => $this->getUserAuth()->userId]]);
                 if ($is_comment > 0) {
                     //已评论
                     return $this->errorLog(ResultStatus::POST_BODY_PARAM_ERROR, "预约已评论");
                 } else {
                     //查询最大楼层
                     $floor = BeautyParlorComment::maximum(["column" => "comment_floor", "conditions" => "appointment_id = :id: and beauty_parlor_id = :bp_id:", "bind" => ["id" => $appoint_id, "bp_id" => $bp_id]]);
                     $bpc = new BeautyParlorComment();
                     $query = new CosOnlineAppointment();
                     $appoint = $query->findFirst("id = {$appoint_id}");
                     if ($appoint) {
                         $data['state'] = 1;
                         $rs = $appoint->update($data);
                     } else {
                         return $this->errorLog(ResultStatus::POST_BODY_PARAM_ERROR, "当前预约不存在");
                     }
                     $bpc->user_id = $this->getUserAuth()->userId;
                     $bpc->comment_floor = ($floor ? $floor : 0) + 1;
                     $bpc->beauty_parlor_id = $bp_id;
                     $bpc->comment_info = $comment_info;
                     $bpc->comment_photos = $comment_photos;
                     $bpc->type = $type;
                     $bpc->appointment_id = $appoint_id;
                     if ($bpc->save() && $rs) {
                         $this->id = $bpc->comment_id;
                         $this->success = 1;
                     } else {
                         return $this->databaseErrorLog($bpc);
                     }
                 }
             } else {
                 return $this->errorLog(ResultStatus::POST_BODY_PARAM_ERROR, "");
             }
             return $this->setResult(['id' => $this->id, 'success' => $this->success]);
         }
     } else {
         return $this->errorLog(ResultStatus::POST_BODY_PARAM_ERROR, "评论类型错误");
     }
     /*  $bp_id = intval($this->getDataItem('beauty_parlor_id',0));
             $comment_info = Keyword::Filter($this->getDataItem('content',''));
             $up = new UploadPic();
             $comment_photos = json_encode($up->beautyParlorComment());
     
             if($bp_id > 0 && !empty($comment_info)) {
                 // 查询最大楼层
                 $floor = BeautyParlorComment::maximum([
                     "column" => "comment_floor",
                     "conditions" => "beauty_parlor_id = :id:",
                     "bind" => [
                         "id" => $bp_id
                     ]
                 ]);
                 //关键字替换
                 $keyword = CosQKeyword::query() -> execute() -> toArray();
                 foreach ($keyword as $k => $v){
                 	
                 	$comment_info = str_replace($v['keyword'], '***', $comment_info);
                 	//$comment_info = str_replace($v['keyword'], str_repeat('*', strlen($v['keyword'])/3), $comment_info);
                 	
                 }
     
                 $bpc = new BeautyParlorComment();
                 $bpc->user_id = $this->getUserAuth()->userId;
                 $bpc->comment_floor = ($floor ? $floor : 0) + 1;
                 $bpc->beauty_parlor_id=$bp_id;
                 $bpc->comment_info=$comment_info;
                 $bpc->comment_photos=$comment_photos;
                 if($bpc->save()){
                     $this->id = $bpc->comment_id;
                     $this->success = 1;
                 }else{
                     return $this->databaseErrorLog($bpc);
                 }
             } else {
                 return $this->errorLog(ResultStatus::POST_BODY_PARAM_ERROR, "");
             }
     
             $this->setResult([
                 'id'=>$this->id,
                 'success'=>$this->success
             ]);   */
 }