|接口地址|參數|備注|
|---|---|---|
|Route::post('api/:version/address','api/:version.user/getToken');|token,地址信息|token通過頭傳遞,地址信息需要過濾,根據驗證規則接收相應的字段數據|
**地址參數:**
備注: id 和user_id不允許從參數中傳入,需要進行過濾。id自動生成,user_id根據token獲取
~~~
{
name:xxxx,
province:xxx,
city:xxxx
country:xxx
detail:xxx
mobile:xxxx
}
~~~
**地址接口知識點:**
1.根據驗證規則獲取數據字段
~~~
public function goCheck(array $data){
if(empty($data)) throw new ParamExcepthion(['msg'=>'數據參數不能為空']);
$check=$this->batch()->check($data);
if(!$check){
$error=json_encode($this->error,JSON_UNESCAPED_UNICODE);
//拋出參數驗證異常層
throw new ParamExcepthion(['msg'=>$error]);
}else{
return true;
}
}
~~~