闫增涛
2025-04-14 28de42c3542059013d31e465e49de854dc789f07
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
 
declare (strict_types = 1);
 
namespace app\crud\controller;
 
use app\api\BaseController;
use think\facade\Console;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
 
class Crud extends BaseController
{
    public function index()
    {
        return view();
    }
 
    //一键crud
    public function crud()
    {
        $uid = $this->uid;
        if($uid!=1){
            return to_assign(1,'只有系统超级管理员才有权限使用一键crud功能!');
        }
        $param = get_params();
        $a = '-a'.$param['name'];
        $m = '-m'.$param['module'];
        $t = '-t'.$param['table'];
        $c = '-c'.$param['controller'];
        $y = '-y'.$param['types'];
        try {
            $output = Console::call('crud', [$a,$m,$t,$c,$y]);
            //return $output->fetch();
        } catch(\Exception $e) {
            return to_assign(1, $e->getMessage());
        }
    }
}