|
@@ -3,6 +3,7 @@
|
|
namespace App\Service;
|
|
namespace App\Service;
|
|
|
|
|
|
use App\Model\BoxDetail;
|
|
use App\Model\BoxDetail;
|
|
|
|
+use App\Model\Employee;
|
|
use App\Model\Orders;
|
|
use App\Model\Orders;
|
|
use App\Model\SaleOrdersProduct;
|
|
use App\Model\SaleOrdersProduct;
|
|
use Illuminate\Support\Facades\Config;
|
|
use Illuminate\Support\Facades\Config;
|
|
@@ -30,15 +31,30 @@ class FyySqlServerService extends Service
|
|
|
|
|
|
public function __construct($user_id = '')
|
|
public function __construct($user_id = '')
|
|
{
|
|
{
|
|
|
|
+ //用户信息校验
|
|
|
|
+ if(empty($user_id)) {
|
|
|
|
+ $this->error = '福羊羊数据库连接用户参数不能为空!';
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ $emp = Employee::where('id',$user_id)->select('sqlserver_account','sqlserver_password')->first();
|
|
|
|
+ if(empty($emp)) {
|
|
|
|
+ $this->error = '福羊羊连接构造失败!';
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ //用友接口统一登录账号密码
|
|
|
|
+ $this->sUserID = $emp->sqlserver_account ?? '';
|
|
|
|
+ $this->sPassword = $emp->sqlserver_password ?? '';
|
|
|
|
+
|
|
|
|
+ //缓存数据提取 主要是账套
|
|
$key = 'fyy_sql_server' . $user_id;
|
|
$key = 'fyy_sql_server' . $user_id;
|
|
$fyy_array = Redis::get($key);
|
|
$fyy_array = Redis::get($key);
|
|
if(! empty($fyy_array)) {
|
|
if(! empty($fyy_array)) {
|
|
$fyy_array = json_decode($fyy_array,true);
|
|
$fyy_array = json_decode($fyy_array,true);
|
|
|
|
+ if(! empty($fyy_array['sqlserver_database'])) $this->database = $this->database_select[$fyy_array['sqlserver_zt']];
|
|
|
|
+ if(! empty($fyy_array['sqlserver_zt'])) $this->sAccID = '(default)@' . $fyy_array['sqlserver_zt'];
|
|
if(! empty($fyy_array['sqlserver_host'])) $this->host = $fyy_array['sqlserver_host'];
|
|
if(! empty($fyy_array['sqlserver_host'])) $this->host = $fyy_array['sqlserver_host'];
|
|
if(! empty($fyy_array['sqlserver_host_api'])) $this->host_api = $fyy_array['sqlserver_host_api'];
|
|
if(! empty($fyy_array['sqlserver_host_api'])) $this->host_api = $fyy_array['sqlserver_host_api'];
|
|
if(! empty($fyy_array['sqlserver_port'])) $this->port = $fyy_array['sqlserver_port'];
|
|
if(! empty($fyy_array['sqlserver_port'])) $this->port = $fyy_array['sqlserver_port'];
|
|
- if(! empty($fyy_array['sqlserver_database'])) $this->database = $this->database_select[$fyy_array['sqlserver_zt']];
|
|
|
|
- if(! empty($fyy_array['sqlserver_zt'])) $this->sAccID = '(default)@' . $fyy_array['sqlserver_zt'];
|
|
|
|
if(! empty($fyy_array['sqlserver_account'])) $this->sUserID = $fyy_array['sqlserver_account'];
|
|
if(! empty($fyy_array['sqlserver_account'])) $this->sUserID = $fyy_array['sqlserver_account'];
|
|
if(! empty($fyy_array['sqlserver_password'])) $this->sPassword = $fyy_array['sqlserver_password'];
|
|
if(! empty($fyy_array['sqlserver_password'])) $this->sPassword = $fyy_array['sqlserver_password'];
|
|
}
|
|
}
|
|
@@ -73,6 +89,7 @@ class FyySqlServerService extends Service
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //假数据
|
|
private function fakeData(){
|
|
private function fakeData(){
|
|
$return = [
|
|
$return = [
|
|
[
|
|
[
|