|
@@ -12,6 +12,8 @@ use App\Http\Controllers\Api\BaseController;
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Illuminate\Support\Facades\Input;
|
|
use Illuminate\Support\Facades\Input;
|
|
use Modules\Camera\Enum\CameraEnum;
|
|
use Modules\Camera\Enum\CameraEnum;
|
|
|
|
+use Modules\Mine\Entities\MineList;
|
|
|
|
+use Modules\Mine\Services\MineServices;
|
|
|
|
|
|
|
|
|
|
class TdwyController extends BaseController
|
|
class TdwyController extends BaseController
|
|
@@ -135,6 +137,62 @@ class TdwyController extends BaseController
|
|
return $result;
|
|
return $result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //天地伟业获取区域列表
|
|
|
|
+ protected function saveTree($regions, $parent_id)
|
|
|
|
+ {
|
|
|
|
+ $arr = [];
|
|
|
|
+ if (empty($regions['content'])) {
|
|
|
|
+ return [];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $mineService = new MineServices();
|
|
|
|
+ $mineService->initMineList();
|
|
|
|
+
|
|
|
|
+ $arr_count = $regions['count'];
|
|
|
|
+
|
|
|
|
+ foreach ($regions['content'][0]['data'] as $key => $value) {
|
|
|
|
+
|
|
|
|
+ $arr[$key]['parentOrgId'] = $value['parentOrgId'];
|
|
|
|
+ $arr[$key]['orgId'] = $value['orgId'];
|
|
|
|
+ $arr[$key]['name'] = str_replace('#', '号', $value['orgName']);
|
|
|
|
+
|
|
|
|
+ $id = MineList::where('index_code', $value['orgId'])->value('id');
|
|
|
|
+
|
|
|
|
+ $params = [
|
|
|
|
+ 'id' => $id,
|
|
|
|
+ 'parent_id' => $parent_id,
|
|
|
|
+ 'title' => $value['orgName'],
|
|
|
|
+ 'sort' => $arr_count - $key,
|
|
|
|
+ 'index_code' => $value['orgId'],
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ $result = $mineService->add($params);
|
|
|
|
+
|
|
|
|
+ $mine_id = $result->id;
|
|
|
|
+
|
|
|
|
+ Input::replace(
|
|
|
|
+ [
|
|
|
|
+ 'parentOrgIds' => $value['orgId'],
|
|
|
|
+ 'url' => Input::get('url', ''),
|
|
|
|
+ 'username' => Input::get('username', ''),
|
|
|
|
+ 'password' => Input::get('password', ''),
|
|
|
|
+ 'sysId' => 'PG',
|
|
|
|
+
|
|
|
|
+ ]
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $region_child = $this->getRegionByOrgId();
|
|
|
|
+
|
|
|
|
+ $arr[$key]['children'] = self::saveTree($region_child, $mine_id);
|
|
|
|
+ if (count($arr[$key]['children']) == 0) {
|
|
|
|
+ unset($arr[$key]['children']);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return array_values($arr);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 发送请求
|
|
* 发送请求
|
|
* @param string $url
|
|
* @param string $url
|