Opadmin = new Opadmin(); if (!$this->Opadmin->islogin()) { $this->redirect(url('/admin/login/index')->build()); } $this->cinfo = $this->Opadmin->info; $this->admin_id = $this->Opadmin->info['id']; $menulist = $this->Opadmin->menu(); View::assign('menulist', $menulist); View::assign('cinfo', $this->Opadmin->info); View::assign('menuitem', Request()->controller(TRUE) . '-' . Request()->action(TRUE)); } protected function getCountrychildrenids($id): array { $where['father_id'] = $id; $result = Db::name('country_code')->field('id as value,cate_name as label')->where($where)->cacheAlways(TRUE, 0, 'country_codes')->order('order_id asc,id asc')->select()->toArray(); if ($result) { foreach ($result as &$val) { $val['children'] = $this->getCountrychildrenids($val['value']); //// } return $result; } else { return []; } } /** * 上传文件到cos * @param string $file * @return object|string|void */ protected function uploadFileToCos(string $file = '') { if ($file && Config::get('qcloud.isopencos') == 1) { $key = getCosName($file); $localPath = '.' . $file; $cos = new \common\Uploadcos(); return $cos->cosUpload($key, $localPath); } } /** * 删除cos中的文件 * @param string $file * @param string $versionId * @return object|string|void */ protected function deleteFileFromCos(string $file = '', string $versionId = '') { if ($file && Config::get('qcloud.isopencos') == 1) { $key = getCosName($file); $cos = new \common\Uploadcos(); return $cos->cosDelete($key, $versionId); } } }