예제 #1
0
 public function testAction()
 {
     $this->view->disable();
     $sync = new BeautyParlorSyncLocation();
     for ($i = 0; $i < 30; $i++) {
         var_dump($sync->sync($i));
     }
     return;
     /*
     $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';
     
     //$key = '549d506ed90f2ba7a8e209dfbdf814f5';
     //$signKey = 'db03113aafe7ef14612c809ef8a690f3';
     //$tableId = '54bfb255e4b053daeafa61d7';
     
     $lbs = new LBSCloud($key, $signKey, $tableId, $syncLogTableName);
     var_dump($lbs->around(106.493225, 29.567485, 10, 1));
     //echo $lbs->getList(10, 1);
     */
     //echo $this->hashPassword('123456');
     /*
     foreach(QuestionAnswer::listByQuestionId(14, 10, 0) as $d) {
         echo $d->user_id, '<br />';
     }
     */
     echo rand(1000, 9999);
 }
예제 #2
0
 /**
  * 设置美容院状态
  * @return $this|ResponseResult
  */
 public function setStateAction()
 {
     $req = $this->request;
     if ($req->isPost()) {
         $id = intval($req->getPost('id', null, 0));
         $state = intval($req->getPost('state', null, -10000));
         if (!in_array($state, [-1, 0, 1])) {
             return (new ResponseResult())->sendError(ResponseResultStatus::PARAM_CANNOT_EMPTY, '请求异常');
         }
         if ($state == -1) {
             // 查询美容院是否在首页推荐!
             $bannerBp = OmBanner::query()->columns('banner_data')->where('city_id > 0 AND banner_name = :key:', ['key' => 'index_bp'])->execute();
             foreach ($bannerBp as $bb) {
                 if (intval($bb->banner_data) == $id) {
                     return (new ResponseResult())->sendError(ResponseResultStatus::BUSINESS, '此美容院在首页推荐,不能删除!');
                 }
             }
         }
         $info = BeautyParlor::findFirst('bp_id=' . $id);
         if ($info) {
             $info->update(['bp_state' => $state]);
         }
         $syncMap = new BeautyParlorSyncLocation();
         if ($state == 1) {
             $syncMap->sync($id);
         } else {
             $syncMap->delete($id);
         }
         SearchASync::Instance()->noticeSync($id, SearchDataType::BeautyParlors);
         return (new ResponseResult())->sendResult('ok');
     } else {
         return (new ResponseResult())->sendError(ResponseResultStatus::PARAM_CANNOT_EMPTY, '请求异常');
     }
 }