| 
...
 | 
...
 | 
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\V2; | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
 use App\Fun;
 | 
| 
 | 
 | 
 use Illuminate\Support\Facades\View;
 | 
| 
 | 
 | 
 use function Swoole\Coroutine\Http\get;
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
 /**
 | 
| 
 | 
 | 
  * 第二版的控制器
 | 
| 
...
 | 
...
 | 
@@ -117,6 +118,28 @@ class Index extends Base | 
| 
 | 
 | 
     }
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
     /**
 | 
| 
 | 
 | 
      * 设置模板,保存
 | 
| 
 | 
 | 
      * @author:dc
 | 
| 
 | 
 | 
      * @time 2022/12/30 16:44
 | 
| 
 | 
 | 
      */
 | 
| 
 | 
 | 
     public function template(){
 | 
| 
 | 
 | 
         $name = request()->get('name');
 | 
| 
 | 
 | 
         $data = $this->getData('template',['name'=>$name],false);
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
         if($data){
 | 
| 
 | 
 | 
             // 保存文件
 | 
| 
 | 
 | 
             $filename = resource_path('views'.$data['path'].'.blade.php');
 | 
| 
 | 
 | 
             // 是否存在
 | 
| 
 | 
 | 
             if(!is_dir(dirname($filename))){
 | 
| 
 | 
 | 
                 mkdir(dirname($filename),0775,true);
 | 
| 
 | 
 | 
             }
 | 
| 
 | 
 | 
             @file_put_contents($filename,$data['html']);
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
         }
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
     }
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
 
 | 
| 
 | 
 | 
 
 | 
...
 | 
...
 | 
 |