123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use app\common\model\Config;
- use app\common\model\Industry;
- use think\Db;
- use think\facade\Validate;
- use think\Request;
- use app\common\model\Category;
- use app\common\model\SearchHistory;
- use OSS\OssClient;
- use app\common\model\User;
- use OSS\Core\OssException;
- use app\common\model\Order;
- class Publics extends Api
- {
-
- public function uploadLocality(){
- $file = request()->file('file');
- $dir = dirname(realpath(dirname($_SERVER['SCRIPT_FILENAME']))) . '/public/upload';
- if(!file_exists($dir)){
-
- mkdir($dir, 0700,true);
- }
- $info = $file->move($dir);
- $newName = $info->getSaveName();
- $storage_type = self::getOneValues('storage_type');
- if ($storage_type == 'oss'){
- $file_path = dirname($_SERVER['SCRIPT_FILENAME']) . "/upload/".$newName;
- $result = $ossClient->uploadFile(self::getOneValues('storage_oss_bucket'), $newName, $file_path);
- $data['url'] = $result['info']['url'];
- unlink($file_path);
- }elseif ($storage_type=='local'){
-
-
- $data['url'] = 'http://'.$_SERVER['SERVER_NAME']."/upload/{$newName}";
- }
- $this->success('上传成功',$data);
- }
-
- public function config_info(){
- $name = input('name');
- if(!empty($name)){
- $nameArray = [
- $name
- ];
- }
- else {
- $nameArray = [
- 'about_us',
- 'introduction_to',
- 'registration',
- 'poster'
- ];
- }
- $array = getConfig($nameArray);
- $this->success('成功',$array);
- }
-
- public function working(){
- $list = Db::name('store_company')->where('is_deleted',0)->field('id,name')->select();
- $this->success('工会单位',$list);
- }
-
- public function work_nature(){
- $list = Db::name('store_work_nature')->where('is_deleted',0)->field('id,name')->select();
- $this->success('工作性质',$list);
- }
-
- public function area(){
- $field=['id','pid','shortname','name'];
- $list=Db::table('store_area')->where('pid',0)->field($field)->select();
- foreach ($list as $k=>&$v){
- $v['children']= Db::table('store_area')->where('pid',$v['id'])->field($field)->select();
- if(!empty($v['children'])){
- foreach ($v['children'] as $kk=>&$vv){
- $vv['children']=Db::table('store_area')->where('pid',$vv['id'])->field($field)->select();
- }
- }
- }
- $this->success('省级数据',$list);
- }
- }
|