[ 'class' => QueryParamAuth::className(), 'tokenParam' => "token",//access-token修改为token 'optional' => [//不需要认证方法名 array ], ] ]); } /** * 设计师,项目经理信息 */ public function actionInfo() { $id =Yii::$app->request->post('id'); $type = Yii::$app->request->post('type'); if(empty($id)) return Apireturn::sent(0,'缺少id'); if($type == 1)//设计师 { $data = Designer::find()->where(['id'=>$id])->select('id,realname,introduction')->asArray()->one(); $image = ImageSource::find()->where(['type'=>ImageSource::TYPE_DESIGNER,'status'=>ImageSource::STATUS_YES,'topid'=>$id])->select('pic')->one(); $data['type'] = 1; if(!empty($image)) $data['pic'] =$image->pic; }else{ $data = Manager::find()->where(['id'=>$id])->select('id,realname,introduction')->asArray()->one(); $image = ImageSource::find()->where(['type'=>ImageSource::TYPE_MANAGER,'status'=>ImageSource::STATUS_YES,'topid'=>$id])->select('pic')->one(); $data['type'] = 2; if(!empty($image)) $data['pic'] =$image->pic; } return Apireturn::sent(1,'success',200,$data); } /** * 作品列表 */ public function actionWorkList() { $id = Yii::$app->request->post('id'); $type = Yii::$app->request->post('type'); $page = Yii::$app->request->post('page', 1);//分页页数 $display = Yii::$app->request->post('display', self::DISPLAY);//分页页数 $latitude = Yii::$app->request->post('latitude'); $longitude = Yii::$app->request->post('longitude'); $lists = array(); if(empty($id)) return Apireturn::sent(0,'缺少id'); if($type == 1) { $list= Building::find()->select('id,type,address,latitude,longitude,layout,style,acreage')->where(['designer_id'=>$id,'posted'=>Building::POSTED_YES])->offset(($page - 1) * $display)->limit($display)->orderBy('id DESC')->all(); if(!empty($list)) { $geohash = new ZM_Geohash(); foreach ($list as $key => $val) { foreach ($val->getOldAttributes() as $key2 =>$value2) { $lists[$key][$key2] = $value2; } $lists[$key]['pic'] = $val->all?$val->all->pic:""; if(!empty($val->latitude) && !empty($val->longitude) && !empty($latitude) && !empty($longitude)) { $lists[$key]['distance'] = sprintf("%.1f",$geohash->getDistance($latitude,$longitude,$val->latitude,$val->longitude)/1000); }else{ $lists[$key]['distance'] = ""; } } } }else{ $list= Building::find()->select('id,type,address,latitude,longitude,layout,style,acreage')->where(['manager_id'=>$id,'posted'=>Building::POSTED_YES])->offset(($page - 1) * $display)->limit($display)->orderBy('id DESC')->all(); if(!empty($list)) { $geohash = new ZM_Geohash(); foreach ($list as $key => $val) { foreach ($val->getOldAttributes() as $key2 =>$value2) { $lists[$key][$key2] = $value2; } $lists[$key]['pic'] = $val->all?$val->all->pic:""; if(!empty($val->latitude) && !empty($val->longitude) && !empty($latitude) && !empty($longitude)) { $lists[$key]['distance'] = sprintf("%.1f",$geohash->getDistance($latitude,$longitude,$val->latitude,$val->longitude)/1000); }else{ $lists[$key]['distance'] = ""; } } } } return Apireturn::sent(1,'success',200,$lists); } }