| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace App\Http\Controllers\Admins;
- 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)
- {
- return showJson(101, 1001, [
- 'list' => Area::wherePid($id)->select(['id', 'name', 'code'])->get()
- ]);
- }
- /**
- * 获取开放地区列表
- * @author wsl
- * @date 2018/12/21
- * @param $id
- * @description
- */
- public function openArea($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()
- ]);
- }
- }
|