DESKTOP-9JTA2JJ\HP 5 anni fa
parent
commit
800339def3

+ 2 - 0
api/application/controllers/Lampcontrol.php

@@ -514,6 +514,8 @@ class Lampcontrol extends Base_Controller {
             exit(send_websocket($clientid,$data));
         }else{
             $res['msg'] = unpack('H*', $res['msg'])[1];
+
+            set_log('dimming_asy.txt',$res['msg']);
             if (strtolower(crc16(pack('H*',substr($res['msg'], 0,-4)))) == strtolower(substr($res['msg'], -4)) && strtolower(substr($res['msg'], 18,2)) == '01') {
                 if ($lightness != 0) {
                     $this->Lamp_model->update(array('status'=>1,'lighteness'=>$lightness),array('id'=>$lampData['id']));

+ 8 - 0
api/application/helpers/function_helper.php

@@ -3,6 +3,14 @@
 ** 通用函数helper
 */
 
+function set_log($file,$data){
+
+    $file = fopen('../upload/'.$file, 'a+');
+    fwrite($file, $data.'---'.date('Y-m-d H:i:s',time()).'
+');
+    fclose($file);
+}
+
 //移除空参数
 function remove_null_params($data = array()) {
 	foreach ($data as $key => $value) {