| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Modes\Area;
- use App\Modes\Proxy;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- class AreaController extends Controller
- {
- /**
- * 获取地区列表
- * @author fatty
- * @date 2018/12/21
- * @param $id
- * @description
- */
- public function Index($id)
- {
- //先查找已开放和未冻结的区域
-
- $allowarea=Proxy::whereStatus(1)->select('province','city','district')->get()->toArray();
- $arr=[];
- if(!empty($allowarea)){
- foreach($allowarea as $key=>$value){
- $arr[]=$value['province'];
- $arr[]=$value['city'];
- $arr[]=$value['district'];
- }
- }
- return showJson(101, 1001, [
- 'list' => Area::wherePid($id)->whereIn('id',$arr)->select(['id', 'name', 'code'])->get()
- ]);
- }
- public function allareas($id)
- {
- return showJson(101, 1001, [
- 'list' => Area::wherePid($id)->select(['id', 'name', 'code'])->get()
- ]);
- }
- }
|