|
@@ -24,60 +24,6 @@ class TestController extends BaseController
|
|
|
}
|
|
|
|
|
|
public function tt(){dd(1);
|
|
|
- $model_box = DB::connection("mysqlT9");
|
|
|
- $u8 = $model_box->table('setting')
|
|
|
- ->where('setting_name','u8')
|
|
|
- ->where('setting_value','<>','')
|
|
|
- ->first();
|
|
|
- if(empty($u8)) return [false, 'u8配置参数不存在!'];
|
|
|
-
|
|
|
- $u8 = $u8->setting_value;
|
|
|
- // 使用 eval() 函数执行字符串并转换为数组
|
|
|
- $u8 = eval("return {$u8};");
|
|
|
- if(empty($u8['domain'])) return [false, '外部域名不能为空!'];
|
|
|
- if(empty($u8['u8_api_port'])) return [false, 'u8程序API端口不能为空!'];
|
|
|
- if(empty($u8['u8_database_port'])) return [false, 'u8程序数据库端口不能为空!'];
|
|
|
- if(empty($u8['database'])) return [false, 'u8程序数据库不能为空!'];
|
|
|
- if(empty($u8['database_account'])) return [false, 'u8程序数据库登录账号不能为空!'];
|
|
|
- if(empty($u8['database_password'])) return [false, 'u8程序数据库登录密码不能为空!'];
|
|
|
- if(empty($u8['sAccID'])) return [false, 'u8程序sAccID不能为空!'];
|
|
|
- if(empty($u8['sServer'])) return [false, 'u8程序sServer不能为空!'];
|
|
|
- if(empty($u8['sUserID'])) return [false, 'u8程序sUserID不能为空!'];
|
|
|
- if(empty($u8['sPassword'])) return [false, 'u8程序sPassword不能为空!'];
|
|
|
-
|
|
|
- $config = [
|
|
|
- 'driver' => 'sqlsrv',
|
|
|
- 'host' => $u8['domain'],
|
|
|
- 'port' => $u8['u8_database_port'],
|
|
|
- 'database' => $u8['database'],
|
|
|
- 'username' => $u8['database_account'],
|
|
|
- 'password' => $u8['database_password'],
|
|
|
- ];
|
|
|
-
|
|
|
- // 数据库配置设置
|
|
|
- Config::set('database.connections.sqlsrvs', $config);
|
|
|
-
|
|
|
- // 连接
|
|
|
- try {
|
|
|
- $pdo = DB::connection('sqlsrvs')->getPdo();
|
|
|
- if ($pdo instanceof \PDO) {
|
|
|
- // 连接成功的逻辑代码
|
|
|
- $db = DB::connection('sqlsrvs');
|
|
|
- $result = $db->table('ST_SNState')
|
|
|
- ->select('cinvCode as code','cInvSN as sn','AutoID as auto_id')
|
|
|
- ->whereIn("cWhCode", [001,003])
|
|
|
- ->where("cInvCode", "100000003")
|
|
|
- ->where("iSNState", 2)
|
|
|
- ->orderBy('cSNDefine1','desc')
|
|
|
- ->orderBy('AutoID','asc')
|
|
|
- ->get()->toArray();
|
|
|
- dd($result);
|
|
|
- } else {
|
|
|
- dd(1233);
|
|
|
- }
|
|
|
- } catch (\Throwable $e) {
|
|
|
- dd($e->getMessage());
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
public function test(){dd(1);
|