使用webgl(three.js)創建3D機房(升級版)-普通機房

来源:https://www.cnblogs.com/yeyunfei/archive/2019/03/08/10473021.html
-Advertisement-
Play Games

three.js,webGL,3D庫房,3D機房,普通3D機房搭建,機櫃、伺服器、埠實時監控 數據聯動展示,機櫃動態添加、伺服器上下架,動力環境數據可視化展示(溫濕度雲圖,防盜門禁,配店,管線控制)、告警展示 ...


  序:

   目前市面上的數據中心主要分兩大類,一類屬於普通數據中心,機櫃按照XY軸 有序排放,一類屬於微模塊集合的數據中心,多個機櫃組合而成的微模塊。

   本節課主要詳細講解普通數據中心的可視化展示,瀏覽器直接查看機房實時3D數據。

   功能簡述:普通3D機房搭建,機櫃、伺服器、埠實時監控 數據聯動展示,機櫃動態添加、伺服器上下架,動力環境數據可視化展示(溫濕度雲圖,防盜門禁,配店,管線控制)、告警展示;

   技術難點:

    一、如何有效快速根據實際場景搭建機房模型

       解決方案:封裝各代碼模型,復用代碼模型,爭取快速有效搭建機房

    二、如何接入實時數據

      解決方案:使用一次請求,變化更新,訂閱通知機制

    三、如何有效控制各場景間的切換平滑過渡,無卡頓,無延遲

      解決方案:使用 狀態機 策略,有效控制狀態變更與回滾,及時把控各狀態之間的切換

    四、如何控制載入速度、瀏覽器記憶體、上萬台伺服器場景,如何有效控制幀率與處理速度

       解決方案:使用代碼模型,降低模型占中空間,使用瓦片策略,實現所見即所載,減少提筆瀏覽器提筆次數,保證幀率與速度。

   三維數據可視化執行的意義:

    為什麼需要可視化展示,我總結如下幾點:

    a、實用性:直觀快速的展示數據,提示告警,快速定位問題,為解決問題節省大量時間,

    b、成本管理:成本對於企業來講是至關重要的,三維可視化可以為高層領導者,執行者提供最快捷的管理方案

    c、去專業化:本著代碼改變世界的願望,可視化操控就是為了讓更多人的能夠看懂、操作所謂專業的東西,

    d、科技:越是科技的東西,越需要直觀的展示,越是複雜的東西越需要簡單的描述。可視化恰恰解決了這個痛點。

    e、體面:企業的數據大屏是企業的形象,三維可視化可快速提示企業高大上的企業形象,向客戶展示企業的實力與精緻,

    d、輕便:這是技術的實現方式,使用電腦瀏覽器 或者手機瀏覽器直接查看三維機房,方便快捷

  如有不妥之處,還望指出 交流郵箱:[email protected]

效果與功能展示:

 一、機房建模

a、普通機房

 

 數據中心代碼模型:

 

  var models = [{  // 地板
        "show": true,
        "uuid": "",
        "name": "DCR01_floor",
        "objType": "cube2",
        "length": 2350+400,
        "width": 2000+400,
        "height": 10,
        "x": 0,
        "y": 0,
        "z": 0,
        "style": {
            "skinColor": 16777215,
            "skin": {
                "skin_up": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    //"imgurl": "../../img/3dImg/proj/DCR01.png",
                    "imgurl": "../img/3dImg/wall/floor5.jpg",
                    "repeatx": true,
                    "width": 20,
                    "repeaty": true,
                    "height": 30
                },
                "skin_down": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_fore": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_behind": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_left": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_right": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                }
            }
        },
        "showSortNub": 1,
        "customType1": "",
        "customType2": "",
        "animation": null,
        "dbclickEvents": null,
        "rotation": [{
            "direction": "x",
            "degree": 0
        }, {
            "direction": "y",
            "degree": 0
        }, {
            "direction": "z",
            "degree": 0
        }],
        "thick": null,
        "scale": {
            "x": 1,
            "y": 1,
            "z": 1
        },
        "BindDevId": null,
        "BindDevName": null,
        "devInfo": null,
        "BindMeteId": null,
        "BindMeteName": null
    },/*空調開始*/
    {
        "show": true,
        "uuid": "",
        "name": "DCR01_airConditionMain_1",
        "objType": "cube2",
        "length": 450,
        "width": 150,
        "height": 400,
        "x": 0,
        "y": 210,
        "z": -680,
        "style": {
            "skinColor": 16777215,
            "skin": {
                "skin_up": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigTop.jpg"
                },
                "skin_down": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/rack_inside.jpg"
                },
                "skin_fore": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/rack_inside.jpg"
                },
                "skin_behind": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/rack_inside.jpg"
                },
                "skin_left": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/rack_inside.jpg"
                },
                "skin_right": {
                    "skinColor": 11579568,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfig.jpg"
                }
            }
        },
        "showSortNub": 31,
        "customType1": "",
        "customType2": "",
        "animation": null,
        "dbclickEvents": null,
        "rotation": [{
            "direction": "x",
            "degree": 0
        }, {
            "direction": "y",
            "degree": 0
        }, {
            "direction": "z",
            "degree": 0
        }],
        "thick": null,
        "scale": {
            "x": 1,
            "y": 1,
            "z": 1
        },
        "BindDevId": null,
        "BindDevName": null,
        "devInfo": null,
        "BindMeteId": null,
        "BindMeteName": null
    }, {
        "show": true,
        "uuid": "",
        "name": "DCR01_airConditionLogo_1",
        "objType": "cube2",
        "length": 70,
        "width": 20,
        "height": 150,
        "x": 165.066,
        "y": 339.192,
        "z": -605.478,
        "style": {
            "skinColor": 16777215,
            "skin": {
                "skin_up": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigLogoTop.jpg"
                },
                "skin_down": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigLogoTop.jpg"
                },
                "skin_fore": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigLogoTop.jpg"
                },
                "skin_behind": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigLogoTop.jpg"
                },
                "skin_left": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigLogoTop.jpg"
                },
                "skin_right": {
                    "skinColor": 11579568,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigLogo.jpg"
                }
            }
        },
        "showSortNub": 31,
        "customType1": "",
        "customType2": "",
        "animation": null,
        "dbclickEvents": null,
        "rotation": [{
            "direction": "x",
            "degree": 0
        }, {
            "direction": "y",
            "degree": 0
        }, {
            "direction": "z",
            "degree": 0
        }],
        "thick": null,
        "scale": {
            "x": 1,
            "y": 1,
            "z": 1
        },
        "BindDevId": null,
        "BindDevName": null,
        "devInfo": null,
        "BindMeteId": null,
        "BindMeteName": null
    },
    {
        "show": true,
        "uuid": "",
        "name": "DCR01_airConditionMain_2",
        "objType": "cube2",
        "length": 450,
        "width": 150,
        "height": 400,
        "x": 1045,
        "y": 210,
        "z": -270,
        "style": {
            "skinColor": 16777215,
            "skin": {
                "skin_up": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigTop.jpg"
                },
                "skin_down": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/rack_inside.jpg"
                },
                "skin_fore": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/rack_inside.jpg"
                },
                "skin_behind": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/rack_inside.jpg"
                },
                "skin_left": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/rack_inside.jpg"
                },
                "skin_right": {
                    "skinColor": 11579568,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfig.jpg"
                }
            }
        },
        "showSortNub": 31,
        "customType1": "",
        "customType2": "",
        "animation": null,
        "dbclickEvents": null,
        "rotation": [{
            "direction": "x",
            "degree": 0
        }, {
            "direction": "y",
            "degree": -Math.PI / 2
        }, {
            "direction": "z",
            "degree": 0
        }],
        "thick": null,
        "scale": {
            "x": 1,
            "y": 1,
            "z": 1
        },
        "BindDevId": null,
        "BindDevName": null,
        "devInfo": null,
        "BindMeteId": null,
        "BindMeteName": null
    }, {
        "show": true,
        "uuid": "",
        "name": "DCR01_airConditionLogo_2",
        "objType": "cube2",
        "length": 70,
        "width": 20,
        "height": 150,
        "x": 975.066,
        "y": 339.192,
        "z": -110.478,
        "style": {
            "skinColor": 16777215,
            "skin": {
                "skin_up": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigLogoTop.jpg"
                },
                "skin_down": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigLogoTop.jpg"
                },
                "skin_fore": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigLogoTop.jpg"
                },
                "skin_behind": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigLogoTop.jpg"
                },
                "skin_left": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigLogoTop.jpg"
                },
                "skin_right": {
                    "skinColor": 11579568,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/airconfigLogo.jpg"
                }
            }
        },
        "showSortNub": 31,
        "customType1": "",
        "customType2": "",
        "animation": null,
        "dbclickEvents": null,
        "rotation": [{
            "direction": "x",
            "degree": 0
        }, {
            "direction": "y",
            "degree": -Math.PI / 2
        }, {
            "direction": "z",
            "degree": 0
        }],
        "thick": null,
        "scale": {
            "x": 1,
            "y": 1,
            "z": 1
        },
        "BindDevId": null,
        "BindDevName": null,
        "devInfo": null,
        "BindMeteId": null,
        "BindMeteName": null
    },  /*空調結束*/
    {  /*牆面開始*/
        "show": true,
        "uuid": "",
        "name": "DCR01_wall_1",
        "objType": "cube2",
        "length": 20,
        "width": 1555, // 2530
        "height": 500,
        "x": -398,
        "y": 250,
        "z": -780,
        "style": {
            "skinColor": 16777215,
            "skin": {
                "skin_up": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_down": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_fore": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/wall/wall16.jpg",
                    "repeatx": true,
                    "width": 10,
                    "repeaty": true,
                    "height": 1
                },
                "skin_behind": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/wall/wall16.jpg",
                    "repeatx": true,
                    "width": 10,
                    "repeaty": true,
                    "height": 1
                },
                "skin_left": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_right": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                }
            }
        },
        "showSortNub": 447,
        "customType1": "",
        "customType2": "",
        "animation": null,
        "dbclickEvents": null,
        "rotation": [{
            "direction": "x",
            "degree": 0
        }, {
            "direction": "y",
            "degree": Math.PI / 2
        }, {
            "direction": "z",
            "degree": 0
        }],
        "thick": null,
        "scale": {
            "x": 1,
            "y": 1,
            "z": 1
        },
        "BindDevId": null,
        "BindDevName": null,
        "devInfo": null,
        "BindMeteId": null,
        "BindMeteName": null
    },
    {
        "show": true,
        "uuid": "",
        "name": "DCR01_wall_5",
        "objType": "cube2",
        "length": 20,
        "width": 395,
        "height": 500,
        "x": 985,
        "y": 250,
        "z": -780,
        "style": {
            "skinColor": 16777215,
            "skin": {
                "skin_up": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_down": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_fore": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/wall/wall16.jpg",
                    "repeatx": true,
                    "width": 10,
                    "repeaty": true,
                    "height": 1
                },
                "skin_behind": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/wall/wall16.jpg",
                    "repeatx": true,
                    "width": 10,
                    "repeaty": true,
                    "height": 1
                },
                "skin_left": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_right": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                }
            }
        },
        "showSortNub": 447,
        "customType1": "",
        "customType2": "",
        "animation": null,
        "dbclickEvents": null,
        "rotation": [{
            "direction": "x",
            "degree": 0
        }, {
            "direction": "y",
            "degree": Math.PI / 2
        }, {
            "direction": "z",
            "degree": 0
        }],
        "thick": null,
        "scale": {
            "x": 1,
            "y": 1,
            "z": 1
        },
        "BindDevId": null,
        "BindDevName": null,
        "devInfo": null,
        "BindMeteId": null,
        "BindMeteName": null
    },
    {
        "show": true,
        "uuid": "",
        "name": "DCR01_wall_6", // 門上牆
        "objType": "cube2",
        "length": 20,
        "width": 416,
        "height": 90,
        "x": 584.406,
        "y": 454.771,
        "z": -780.278,
        "style": {
            "skinColor": 16777215,
            "skin": {
                "skin_up": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_down": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_fore": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/wall/wall16.jpg",
                    "repeatx": true,
                    "width": 1,
                    "repeaty": true,
                    "height": 1
                },
                "skin_behind": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/wall/wall16.jpg",
                    "repeatx": true,
                    "width": 1,
                    "repeaty": true,
                    "height": 1
                },
                "skin_left": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_right": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                }
            }
        },
        "showSortNub": 467,
        "customType1": "",
        "customType2": "",
        "animation": null,
        "dbclickEvents": null,
        "rotation": [{
            "direction": "x",
            "degree": 0
        }, {
            "direction": "y",
            "degree": -Math.PI / 2
        }, {
            "direction": "z",
            "degree": 0
        }],
        "thick": null,
        "scale": {
            "x": 1,
            "y": 1,
            "z": 1
        },
        "BindDevId": null,
        "BindDevName": null,
        "devInfo": null,
        "BindMeteId": null,
        "BindMeteName": null
    },
    {
        "show": true,
        "uuid": "",
        "name": "DCR01_wall_2",
        "objType": "cube2",
        "length": 20,
        "width": 2350,
        "height": 500,
        "x": 0,
        "y": 250,
        "z": 1000,
        "style": {
            "skinColor": 16777215,
            "skin": {
                "skin_up": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_down": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_fore": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/wall/wall16.jpg",
                    "repeatx": true,
                    "width": 10,
                    "repeaty": true,
                    "height": 1
                },
                "skin_behind": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/wall/wall16.jpg",
                    "repeatx": true,
                    "width": 10,
                    "repeaty": true,
                    "height": 1
                },
                "skin_left": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_right": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                }
            }
        },
        "showSortNub": 447,
        "customType1": "",
        "customType2": "",
        "animation": null,
        "dbclickEvents": null,
        "rotation": [{
            "direction": "x",
            "degree": 0
        }, {
            "direction": "y",
            "degree": Math.PI / 2
        }, {
            "direction": "z",
            "degree": 0
        }],
        "thick": null,
        "scale": {
            "x": 1,
            "y": 1,
            "z": 1
        },
        "BindDevId": null,
        "BindDevName": null,
        "devInfo": null,
        "BindMeteId": null,
        "BindMeteName": null
    }, {
        "show": true,
        "uuid": "",
        "name": "DCR01_wall_3",
        "objType": "cube2",
        "length": 20,
        "width": 1795,
        "height": 500,
        "x": 1175,
        "y": 250,
        "z": 110,
        "style": {
            "skinColor": 16777215,
            "skin": {
                "skin_up": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_down": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_fore": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/wall/wall16.jpg",
                    "repeatx": true,
                    "width": 10,
                    "repeaty": true,
                    "height": 1
                },
                "skin_behind": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/wall/wall16.jpg",
                    "repeatx": true,
                    "width": 10,
                    "repeaty": true,
                    "height": 1
                },
                "skin_left": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_right": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                }
            }
        },
        "showSortNub": 447,
        "customType1": "",
        "customType2": "",
        "animation": null,
        "dbclickEvents": null,
        "rotation": [{
            "direction": "x",
            "degree": 0
        }, {
            "direction": "y",
            "degree": 0
        }, {
            "direction": "z",
            "degree": 0
        }],
        "thick": null,
        "scale": {
            "x": 1,
            "y": 1,
            "z": 1
        },
        "BindDevId": null,
        "BindDevName": null,
        "devInfo": null,
        "BindMeteId": null,
        "BindMeteName": null
    }, {
        "show": true,
        "uuid": "",
        "name": "DCR01_wall_4",
        "objType": "cube2",
        "length": 20,
        "width": 1795,
        "height": 500,
        "x": -1175,
        "y": 250,
        "z": 110,
        "style": {
            "skinColor": 16777215,
            "skin": {
                "skin_up": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_down": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_fore": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/wall/wall16.jpg",
                    "repeatx": true,
                    "width": 10,
                    "repeaty": true,
                    "height": 1
                },
                "skin_behind": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/wall/wall16.jpg",
                    "repeatx": true,
                    "width": 10,
                    "repeaty": true,
                    "height": 1
                },
                "skin_left": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_right": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                }
            }
        },
        "showSortNub": 447,
        "customType1": "",
        "customType2": "",
        "animation": null,
        "dbclickEvents": null,
        "rotation": [{
            "direction": "x",
            "degree": 0
        }, {
            "direction": "y",
            "degree": 0
        }, {
            "direction": "z",
            "degree": 0
        }],
        "thick": null,
        "scale": {
            "x": 1,
            "y": 1,
            "z": 1
        },
        "BindDevId": null,
        "BindDevName": null,
        "devInfo": null,
        "BindMeteId": null,
        "BindMeteName": null
    }, /*牆結束*/
    {
        "show": true,
        "uuid": "",
        "name": "DCR01_door_1",
        "objType": "cube2",
        "length": 8,
        "width": 208,
        "height": 410,
        "x": 480,
        "y": 210,
        "z": -780.213,
        "style": {
            "skinColor": 16777215,
            "skin": {
                "skin_up": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/rack_inside.jpg"
                },
                "skin_down": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1
                },
                "skin_fore": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/door_right.png"
                },
                "skin_behind": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/door_left.png"
                },
                "skin_left": {
                    "skinColor": 16777215,
                    "side": 1,
                    "opacity": 1,
                    "imgurl": "../img/3dImg/door_right.png"
                },
  

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 、什麼是對象:萬事萬物皆對象一切具有相同本質特征和行為的物質 或一切具有屬性和方法的事物,都稱作對象。對象具有兩個特性:屬性和方法 對象類型 存儲在堆中。 例如:var obj = { name : "jack"}var obj2 = obj ; 將obj的地址傳遞給obj2obj2.name = ...
  • 前端工作中經常遇到數字計算保留小數問題,由於不是四捨五入的方式不能使用toFixed函數,本文采用正則表達式匹配字元串的方式,解決對數字的向上或向下保留小數問題: 1、向上保留小數(只要目標小數位後有有效數字就進1,保證計算後的數值一定不小於原數值) 2、向下保留小數(目標小數位後的數字直接捨棄,保 ...
  • 一直出現這個問題,有試過重新npm安裝之類的,也試過替換文件,後來才知道原來是我在初始目錄下執行run,應該cd到該項目下在run,如圖 firsttest是我的項目名字 ...
  • 本講會對種子搜索網站的部署過程進行詳細的講解。 網站演示: https://bt.mypython.me 源碼地址: https://github.com/geeeeeeeek/bt 項目部署過程 系統要求:ubuntu 16.04(或以上) 環境搭建和配置,必須嚴格按照以下步驟來安裝部署!如有問題 ...
  • Javascript相關內容 1.序列化--json - stringify() 將對象轉換為字元串 - parse() 將字元串轉換為對象 2.字元串轉義--encodeURI - encodeURI(url); - decodeURI(url); - decodeURIComponent(url ...
  • 1、var var 聲明的變數為全局變數,並會進行變數提升;也可以只聲明變數而不進行賦值,輸出為undefined,以下寫法都是合法的。 2、let let 聲明的變數為局部變數,用於塊級作用域,使用前必須進行先聲明;不會進行變數提升;聲明變數以後不能夠在同一作用域進行重覆聲明變數,會報錯。 3、c ...
  • 1.引入template文件 <script src = js/template-native.js></script> 2.寫模板 <script type="text/template" id="模板ID"> 模板內容 </script> 3.執行模板 var html = template(" ...
  • 開始的開始,簡單粗暴。在微信小程式里,一行 wx.getUserInfo 即可彈窗用戶授權登陸。大部分小程式圖省事,直接在打開小程式的時候就調這個方法。所以那時候一個印象就是隨便打開一個小程式,進去就是彈窗讓我登陸,想拿我的微信信息,給人一種不安全的感覺。 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...