1 from sqlhelper import Mysqls 3 sql_ = Mysqls() 6 def tev(age): 7 """ 8 :return: 9 """ 10 print(age) 11 sql = f'UPDATE cabinet_content set electric={age[3]},average={age[4]},max={age[5]},threshold={age[6]},pulse_number={age[7]} where sensor_id={age[2]};' 12 sql_.mul_mode(sql) 15 """ 16 tev 17 电量 electric 18 平均 average 19 最大 max 20 阈值 threshold 21 脉冲数pulse_number 23 """ 26 def AE(age): 27 """ 28 :return: 29 """ 30 print(age) 31 sql = f'UPDATE cabinet_content set electric={age[3]},average={age[4]},max={age[5]},threshold={age[6]} where sensor_id={age[2]};' 32 sql_.mul_mode(sql) 35 """ 36 AE 37 电量 electric 38 平均 average 39 最大 max 40 阈值 threshold 41 0 42 """ 45 def time(age): 46 """ 47 :return: 48 """ 49 print(age) 50 sql = f'UPDATE cabinet_content set electric={age[3]},Tropism={age[4]},number={age[5]} where sensor_id={age[2]};' 51 sql_.mul_mode(sql) 54 """ 55 温度 56 电量 electric 57 向位 Tropism 58 温度 number 59 0 60 0 61 """ 64 def hfct(age): 65 """ 66 :return: 67 """ 68 print(age) 69 sql = f'UPDATE cabinet_content set electric={age[3]},average={age[4]},max={age[5]},threshold={age[6]},pulse_number={age[7]} where sensor_id={age[2]};' 70 sql_.mul_mode(sql) 73 """ 74 hfct 75 电量 electric 76 平均 average 77 最大 max 78 阈值 threshold 79 脉冲数pulse_number 80 """ 82 codedict = { 83 1: tev, 84 2: AE, 85 3: time, 86 4: hfct, 87 }