where('reqsec=0'); $rows = $db->get($csql); foreach ($rows as $decdbgrow) { $id = $decdbgrow['id']; $inputparams = getstrparam($decdbgrow['inputparam'], '|'); $inputparams['id'] = $decdbgrow['decisionid']; $inputparams['_more'] = 'ok'; $retai = \web\amb\ai::json_aidecision($inputparams, true); $updata = array(); if ($retai['code'] == 1) { $updata['inputprompt'] = 'System:' . $retai['system'] . "\nPrompt:" . $retai['roleprompt']; $updata['aichat'] = json_encode($retai['messages'], JSON_UNESCAPED_UNICODE); $updata['resulttxt'] = json_encode($retai['ai'], JSON_UNESCAPED_UNICODE); $updata['reqsec'] = $retai['sec']; $updata['decci'] = $retai['ci'] * 100; } else { $updata['resulttxt'] = json_encode($retai, JSON_UNESCAPED_UNICODE); $updata['reqsec'] = -1; } $csql = new \ciy\sql('zc_ai_decdbg'); $csql->where('id', $id); if ($db->update($csql, $updata) === false) savelog($db, 0, 'CRONAI', '更新失败:' . $db->error); $systemrow['running'](); } if (empty($msg) && $func_fail == 0 && $func_succ == 0) $msg = ''; else $msg .= 'succ: ' . $func_succ . ', fail: ' . $func_fail; return $msg; } function ai_exhi_contract($systemrow) { global $db; $msg = ''; $func_succ = 0; $func_fail = 0; $csql = new \ciy\sql('ap_exhi_contrac_ai'); $csql->where('json=\'\''); $rows = $db->get($csql); $aiparam = array(); $aiparam['id'] = 2; foreach ($rows as $row) { $aiparam['ocr'] = $row['ocr']; $retai = \web\amb\ai::json_aidecision($aiparam); if (@$retai['code'] != 1) { $json = $retai; $msg .= $retai['errmsg'] . "
"; $func_fail++; } else { $func_succ++; $json = json_encode($retai['ai'], JSON_UNESCAPED_UNICODE); $zhiwei = $retai['ai']['zhiwei']; $isshow = 1; if ($zhiwei == 'CEO' || $zhiwei == '总经理' || $zhiwei == '董事长') { $isshow = 2; } $updata = array(); $updata['isshow'] = $isshow; $updata['name'] = $retai['ai']['name'] . ''; $updata['zw'] = $retai['ai']['zhiwei'] . ''; $updata['mobile'] = $retai['ai']['mobile'] . ''; $updata['mail'] = $retai['ai']['email'] . ''; $csql = new \ciy\sql('ap_exhi_contract'); $csql->where('id', $row['id']); if ($db->update($csql, $updata) === false) $func_fail++; } $updata = array(); $updata['json'] = $json; $csql = new \ciy\sql('ap_exhi_contrac_ai'); $csql->where('id', $row['id']); $execute = $db->update($csql, $updata); $systemrow['running'](); } if (empty($msg) && $func_fail == 0 && $func_succ == 0) $msg = ''; else $msg .= 'succ: ' . $func_succ . ', fail: ' . $func_fail; return $msg; }