select(); $sn = []; if ($print->isEmpty()) return true; foreach ($print as $key => $value) { $sn[$key] = $value['sn']; } $resp = (new PrintService)->config(['appid' => sConf('dy.ex_appid'),'secret' => sConf('dy.ex_secret')])->deviceState($sn); if (!$resp['status']) return true; if (empty($resp['data'])) return true; foreach ($resp['data'] as $key => $val) { echo getDateFull()."===更新序列号=={$val['sn']}=={$val['status']}=={$val['deviceStatus']}\n"; $state = (new SaasPrint)->where("sn",$val['sn'])->update(["online" => $val['status'],"device_state" => $val['deviceStatus']]); echo "更新状态==={$state}\n"; } return true; } }