This commit is contained in:
boi 2025-05-19 23:35:50 +08:00
parent 3eb6ee9c8e
commit ddcdb963a9
9 changed files with 33 additions and 110 deletions

View File

@ -1,89 +0,0 @@
<?php
function ai_decdbg($systemrow) {
global $db;
$msg = '';
$func_succ = 0;
$func_fail = 0;
$csql = new \ciy\sql('zc_ai_decdbg');
$csql->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'] . "<br/>";
$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;
}

View File

@ -241,7 +241,7 @@
<div onclick="event.stopPropagation();ce.edit_off()">关闭<span>ESC</span></div> <div onclick="event.stopPropagation();ce.edit_off()">关闭<span>ESC</span></div>
</div> </div>
</div> </div>
<div class="ceedit_ts" onclick="event.stopPropagation();$5(this).next().toggleclass('close');">📦</div> <div class="ceedit_ts" onclick="event.stopPropagation();$5(this).next().toggleClass('close');">📦</div>
<div class="ceedit" onclick="event.stopPropagation();"> <div class="ceedit" onclick="event.stopPropagation();">
<div> <div>
<form> <form>
@ -1033,7 +1033,7 @@
function getmaploc(dom, tag) { function getmaploc(dom, tag) {
event.stopPropagation(); event.stopPropagation();
if ($5(dom).hasclass('def')) { if ($5(dom).hasClass('def')) {
Glob.cb_maploc = null; Glob.cb_maploc = null;
$5(dom).removeClass('def'); $5(dom).removeClass('def');
$5(dom).removeClass('imp'); $5(dom).removeClass('imp');

View File

@ -293,7 +293,7 @@
function deltree() { function deltree() {
var array = []; var array = [];
$5('[data-id]', '.table').each(function (dom) { $5('[data-id]', '.table').each(function (dom) {
if (!$5(dom).hasclass("selected")) if (!$5(dom).hasClass("selected"))
return; return;
var deep = toint($5('[data-deep]', dom).attr("data-deep")); var deep = toint($5('[data-deep]', dom).attr("data-deep"));
array.push({ id: $5(dom).attr("data-id"), deep: deep }); array.push({ id: $5(dom).attr("data-id"), deep: deep });

View File

@ -293,7 +293,7 @@
function deltree() { function deltree() {
var array = []; var array = [];
$5('[data-id]', '.table').each(function (dom) { $5('[data-id]', '.table').each(function (dom) {
if (!$5(dom).hasclass("selected")) if (!$5(dom).hasClass("selected"))
return; return;
var deep = toint($5('[data-deep]', dom).attr("data-deep")); var deep = toint($5('[data-deep]', dom).attr("data-deep"));
array.push({ id: $5(dom).attr("data-id"), deep: deep }); array.push({ id: $5(dom).attr("data-id"), deep: deep });

View File

@ -204,7 +204,7 @@
top: 4em; top: 4em;
width: 5px; width: 5px;
height: 3em; height: 3em;
background-color: var(--imp5); background-color: var(--succ5);
transition: top .5s; transition: top .5s;
-webkit-transition: top .5s; -webkit-transition: top .5s;
} }

View File

@ -76,7 +76,7 @@
if (s == 'Ins') if (s == 'Ins')
return '<kbd onclick="showdb(' + data.id + ')" style="background:var(--warn6)">新增操作</kbd>'; return '<kbd onclick="showdb(' + data.id + ')" style="background:var(--warn6)">新增操作</kbd>';
if (s == 'Upd') if (s == 'Upd')
return '<kbd onclick="showdb(' + data.id + ')" style="background:var(--imp6)">更新操作</kbd>'; return '<kbd onclick="showdb(' + data.id + ')" style="background:var(--succ6)">更新操作</kbd>';
} }
} }
} }

View File

@ -1077,6 +1077,9 @@ ciyfn.ajax = function (opn) { //IE8 OK
var timeout = opn.timeout || 10; var timeout = opn.timeout || 10;
if (timeout < 1) if (timeout < 1)
timeout = 3; timeout = 3;
if(timeout > 20)
header['ciy-timeout'] = timeout;
var method = opn.method || 'POST'; var method = opn.method || 'POST';
method = method.toUpperCase(); method = method.toUpperCase();
if (method == 'GET' && typeof (opn.data) == 'object') { if (method == 'GET' && typeof (opn.data) == 'object') {
@ -1120,6 +1123,11 @@ ciyfn.ajax = function (opn) { //IE8 OK
sendstr = "" + opn.data; sendstr = "" + opn.data;
} }
} }
request.timeout = timeout * 1000;
request.ontimeout = function() {
clearTimeout(aborttime);
console.warn('request timeout: ' + timeout + 's');
};
request.send(sendstr); request.send(sendstr);
request.onreadystatechange = function () { request.onreadystatechange = function () {
if (this.readyState === 4) { if (this.readyState === 4) {
@ -1145,7 +1153,10 @@ ciyfn.ajax = function (opn) { //IE8 OK
} }
} }
} }
var aborttime = window.setTimeout(function () { request.abort("timeout"); }, timeout * 1000); var aborttime = window.setTimeout(function () {
console.warn('ajax timeout abort: ' + timeout + 's');
request.abort("timeout");
}, timeout * 1000 + 3000);
} }
ciyfn._getform_dom = function (dom) { ciyfn._getform_dom = function (dom) {
var sep = ','; var sep = ',';
@ -1734,7 +1745,7 @@ ciyfn.showend = function (opn) {
if (opn.icon == 'warn') if (opn.icon == 'warn')
istyle = 'background:var(--warn5);'; istyle = 'background:var(--warn5);';
if (opn.icon == 'msg') if (opn.icon == 'msg')
istyle = 'background:var(--imp5);'; istyle = 'background:var(--succ5);';
var html = '<div class="ciy-showend-view"><i style="' + istyle + '"></i><b>×</b>'; var html = '<div class="ciy-showend-view"><i style="' + istyle + '"></i><b>×</b>';
if (opn.title) if (opn.title)
html += '<h3>' + opn.title + '</h3>'; html += '<h3>' + opn.title + '</h3>';

View File

@ -36,9 +36,9 @@ Version: 0.7.0
--mant: #ffffff; --mant: #ffffff;
/* 成功色 */ /* 成功色 */
--imp5: #03a547; --succ5: #03a547;
--imp6: #048238; --succ6: #048238;
--impt: #ffffff; --succt: #ffffff;
/* 警示色 */ /* 警示色 */
--warn5: #e39725; --warn5: #e39725;
--warn6: #b97a1c; --warn6: #b97a1c;
@ -920,9 +920,9 @@ pre {
} }
.btn.imp, .btn.succ { .btn.imp, .btn.succ {
background: var(--imp5); background: var(--succ5);
color: var(--impt); color: var(--succt);
border: 1px solid var(--imp6); border: 1px solid var(--succ6);
} }
.btn.warn { .btn.warn {
@ -975,9 +975,9 @@ span.dag {
} }
span.imp, span.succ { span.imp, span.succ {
background: var(--imp5); background: var(--succ5);
color: var(--impt); color: var(--succt);
border: 1px solid var(--imp6); border: 1px solid var(--succ6);
padding: 0.2em 0.5em; padding: 0.2em 0.5em;
border-radius: 0.3em; border-radius: 0.3em;
} }
@ -1911,7 +1911,7 @@ textarea.tran:focus, select.tran:focus, input.tran:focus {
} }
.ciy-loading.succ { .ciy-loading.succ {
background: var(--imp5); background: var(--succ5);
width: 100%; width: 100%;
transition: all 0.5s; transition: all 0.5s;
-webkit-transition: all 0.5s; -webkit-transition: all 0.5s;
@ -2188,10 +2188,10 @@ fieldset.tips>div>ul>li {
border-radius: 3px; border-radius: 3px;
} }
.cata_imp { .cata_imp, .cata_succ {
color: white; color: white;
font-size: 0.9em; font-size: 0.9em;
background: var(--imp6); background: var(--succ6);
padding: 0.2em 0.4em; padding: 0.2em 0.4em;
border-radius: 3px; border-radius: 3px;
} }

View File

@ -57,7 +57,8 @@
* file_down URL文件下载保存 * file_down URL文件下载保存
* fileext 获取文件扩展名如jpg * fileext 获取文件扩展名如jpg
*/ */
if(isset($_SERVER['HTTP_CIY_TIMEOUT']))
set_time_limit((int)$_SERVER['HTTP_CIY_TIMEOUT'] + 10);
error_reporting(E_ALL); //0禁用错误输出E_ALL打开错误输出 error_reporting(E_ALL); //0禁用错误输出E_ALL打开错误输出
date_default_timezone_set('Asia/Shanghai'); date_default_timezone_set('Asia/Shanghai');