Просмотр исходного кода

调整opc数据库连接方法

SWAT 3 лет назад
Родитель
Сommit
456928492b
1 измененных файлов с 5 добавлено и 80 удалено
  1. 5 80
      Modules/OpcData/Http/Controllers/Api/OpcDataController.php

+ 5 - 80
Modules/OpcData/Http/Controllers/Api/OpcDataController.php

@@ -11,85 +11,6 @@ use Modules\OpcData\Entities\OpcDataDict;
 
 
 class OpcDataController extends Controller
 class OpcDataController extends Controller
 {
 {
-    protected $opcDB;
-    // private $opcDictArr = array();
-    protected $opcConnectName   = 'mysql_opc_jinjiaqu';
-    // private $dictTableName      = 'tb_dev_dict_list';
-    // private $dataTableName      = 'equipment';
-    
-    public function __construct() {
-        $this->opcDB =  DB::connection($this->opcConnectName);
-    }
-
-    /**
-     * Display a listing of the resource.
-     * @return Renderable
-     */
-    public function index()
-    {
-        return view('opcdata::index');
-    }
-
-    /**
-     * Show the form for creating a new resource.
-     * @return Renderable
-     */
-    public function create()
-    {
-        return view('opcdata::create');
-    }
-
-    /**
-     * Store a newly created resource in storage.
-     * @param Request $request
-     * @return Renderable
-     */
-    public function store(Request $request)
-    {
-        //
-    }
-
-    /**
-     * Show the specified resource.
-     * @param int $id
-     * @return Renderable
-     */
-    public function show($id)
-    {
-        return view('opcdata::show');
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     * @param int $id
-     * @return Renderable
-     */
-    public function edit($id)
-    {
-        return view('opcdata::edit');
-    }
-
-    /**
-     * Update the specified resource in storage.
-     * @param Request $request
-     * @param int $id
-     * @return Renderable
-     */
-    public function update(Request $request, $id)
-    {
-        //
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     * @param int $id
-     * @return Renderable
-     */
-    public function destroy($id)
-    {
-        //
-    }
-    
     protected $opcConf = [
     protected $opcConf = [
         'ventilation_zb'    => 1,
         'ventilation_zb'    => 1,
         'ventilation_bb'    => 2,
         'ventilation_bb'    => 2,
@@ -105,6 +26,10 @@ class OpcDataController extends Controller
         $getDataType = $request->system_type;   // 获取需要的数据
         $getDataType = $request->system_type;   // 获取需要的数据
         $getMineCode = $request->mine_code;     // 矿分类
         $getMineCode = $request->mine_code;     // 矿分类
         $dataArr = array();                     // 返回数据数组
         $dataArr = array();                     // 返回数据数组
+
+        $opcConnectName   = 'mysql_opc_jinjiaqu';
+
+        $opcDB =  DB::connection($opcConnectName);
         
         
         if (array_key_exists($getDataType, $this->opcConf)) {
         if (array_key_exists($getDataType, $this->opcConf)) {
             $groupId = $this->opcConf[$getDataType];
             $groupId = $this->opcConf[$getDataType];
@@ -127,7 +52,7 @@ class OpcDataController extends Controller
             and t1.is_show = 1
             and t1.is_show = 1
             order by t1.dev_type_id, t1.row_number, t1.device_num, t1.device_name
             order by t1.dev_type_id, t1.row_number, t1.device_num, t1.device_name
             ";
             ";
-            $dbResult = $this->opcDB->select($sqlStr);
+            $dbResult = $opcDB->select($sqlStr);
             switch($getDataType) {
             switch($getDataType) {
                 // 中部风机
                 // 中部风机
                 case 'ventilation_zb':
                 case 'ventilation_zb':