dao251108

This commit is contained in:
众产-王坤 2025-11-08 16:34:04 +08:00
parent 095b8860c1
commit 05ff18700f
57 changed files with 2357 additions and 846 deletions

View File

@ -51,6 +51,10 @@ func setWebRoute_adm(web *c.CiyWebServer) {
"del": rigger.Logdb_del,
"multiread": rigger.Logdb_multiread,
},
"luser": {
"init": rigger.Luser_init,
"del": rigger.Luser_del,
},
"funcslow": {
"init": rigger.Funcslow_init,
"del": rigger.Funcslow_del,

View File

@ -94,7 +94,7 @@
<div class="ciy-form col-24 col-sm-18 top">
<label class="lang">缩略图</label>
<div>
<ciy-upload com="img" num="1" type="jpg,png" />
<ciy-upload com="img" num="1" type="jpg,png,webp" />
</div>
</div>
<div class="ciy-form col-24 col-sm-24 top">

View File

@ -40,7 +40,7 @@
<div class="ciy-form col-24 col-sm-8">
<label class="lang imp">轮播图</label>
<div>
<ciy-upload com="img" num="1" type="jpg,png" />
<ciy-upload com="img" num="1" type="jpg,png,webp" />
</div>
</div>
<div class="ciy-form col-24 col-sm-16">

113
web/admin/ap/logdb.html Normal file
View File

@ -0,0 +1,113 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<link href="/jscss/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="/jscss/theme.js"></script>
</head>
<body>
<div class="container">
<form class="search" onsubmit="table.search(this,'btn');return false;">
<ul></ul>
<div>
<div class="sinps"></div>
<div class="sbtns">
<button class="lang btn" type="submit">查询</button>
</div>
</div>
</form>
<div class="table">
<div class="loading col-24">Loading...</div>
<div class="list"></div>
<div>
<div class="btmbtn">
<a class="lang btn def" onclick="ciyfn.select_all(table)">全选</a>
<a class="lang btn def" onclick="ciyfn.select_diff(table)">反选</a>
|
<a class="lang btn dag" onclick="ciyfn.select_callfunc(table, this,'del','已选{n}条,是否批量删除?',{},function(json){table.delline(json)})">批量删除</a>
<a class="lang btn" onclick="multiread()">批量审阅</a>
</div>
<div class="page"></div>
</div>
</div>
</div>
<script type="text/javascript" src="/jscss/ciy.js"></script>
<script type="text/javascript" src="/jscss/ciycmp.js"></script>
<script type="text/javascript" src="/jscss/ciytable.js"></script>
<script type="text/javascript" src="../common.js"></script>
<script type="text/javascript">
'use strict';
var table;
var Glob = {};
ciyfn.pageload(function () {
table = new ciyclass.table({
dom: '.table'
, url: 'init'
, pagecount: 10
, fn_beforedata: function (json) {
ciyfn.fillsearch({
searchdom: '.search'
, data: json
, liall: '全部'
, lidata: [{ id: 1, name: '未审阅' }, { id: 2, name: '已审阅' }]
, liclick: function (dom) {
table.search(dom, 'li');
}
});
return json;
}
, fn_tdcontent: function (key, datashow, field, data) {
if (key == 'logs') {
if (datashow.indexOf('{') > -1 && datashow.indexOf('}') > -1) {
var ind = datashow.indexOf('{');
return datashow.substring(0, ind) + '<code onclick="showjson(' + data.id + ', ' + ind + ')">JSON</code>';
}
if (datashow.indexOf('_|@|_') > -1) {
datashow = datashow.substring(0, datashow.indexOf('_|@|_'));
var sps = ciyfn.getstrparam(datashow);
for (var s in sps) {
if (s == 'Del')
return '<kbd onclick="showdb(' + data.id + ')" style="background:var(--dag6)">删除操作</kbd>';
if (s == 'Ins')
return '<kbd onclick="showdb(' + data.id + ')" style="background:var(--warn6)">新增操作</kbd>';
if (s == 'Upd')
return '<kbd onclick="showdb(' + data.id + ')" style="background:var(--succ6)">更新操作</kbd>';
}
}
}
}
});
table.callpage(1);
});
function showjson(id, firstind) {
var json = ciyfn.tojson(table.data[id].logs.substring(firstind));
ciyfn.alert('<span style="white-space: pre-wrap;">' + ciyfn.jsontostr(json, 4) + '</span>');
}
function showdb(id) {
var sps = ciyfn.getstrparam(table.data[id].logs, '_|@|_');
var vl = '';
for (var s in sps) {
if (s == 'Del' || s == 'Ins' || s == 'Upd')
vl += '<kbd>id</kbd> ' + sps[s] + '<br/>';
else
vl += '<kbd>' + s + '</kbd>' + sps[s].replace('→', '<code></code>') + '<br/>';
}
ciyfn.alert(vl);
}
function multiread() {
ciyfn.select_callfunc(table, this, 'multiread', '', {}, function (json) {
if (table.json.where.liid == 1)
table.delline(json);
else
table.updateline(json);
});
}
</script>
</body>
</html>

163
web/admin/ap/logdb.php Normal file
View File

@ -0,0 +1,163 @@
<?php
namespace web\admin\ap;
class logdb {
static function setwhere($db, $post) {
$query = $post->get('query');
$csql = new \ciy\sql('ap_log');
$liid = objint($query, 'liid');
if ($liid == 1)
$csql->where('readuser=0');
if ($liid == 2)
$csql->where('readuser>0');
$val = objstr($query, 'loguser');
if (!empty($val)) {
$csqlt = new \ciy\sql('ap_user');
$csqlt->where('name like', $val);
$trow = $db->getone($csqlt);
if (is_array($trow)) {
$csql->where('loguser', $trow['id']);
$query['loguser'] = $trow['name'];
} else {
$csql->where('loguser=0');
}
}
$csql->where('readuser', objstr($query, 'readuser'));
$csql->where('types', objstr($query, 'types'));
$csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
$csql->where('logs like', objstr($query, 'logs'));
$order = objstr($query, 'order', 'id desc');
$csql->order($order);
$query['order'] = $order;
return [$query, $csql];
}
public static function json_init() {
global $db;
$rsuser = verifyfast();
$post = new \ciy\post();
list($where, $csql) = self::setwhere($db, $post);
$pageno = $post->getint('pageno', 1);
$pagecount = $post->getint('pagecount', 10);
$csql->limit($pageno, $pagecount);
$mainrowcount = $post->getint('count');
$rows = $db->get($csql, $mainrowcount);
$ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
if ($post->getbool('field')) {
$field = array();
$fshow = $db->getfield($field, 'ap_log');
$ret['field'] = $field;
$ret['fshow'] = $fshow;
}
if ($post->getbool('once')) {
$ret['once'] = array();
$input = array();
$input[] = array(
'type' => 'input',
'form' => 'loguser',
'name' => '操作人',
'prop' => ' style="width:6em;"',
);
$input[] = array(
'type' => 'select',
'form' => 'readuser',
'name' => '审阅人',
'prop' => ' style="min-width:6em;"',
'select' => 'adminuser',
'all' => '全部'
);
$input[] = array(
'type' => 'input',
'form' => 'types',
'name' => 'LOG分类',
'prop' => ' style="width:8em;"'
);
$input[] = array(
'type' => 'daterange',
'form' => 'addtimes',
'name' => '发生日期'
);
$input[] = array(
'type' => 'input',
'form' => 'logs',
'name' => '详情',
'prop' => ' style="width:8em;"'
);
$ret['once']['input'] = $input;
}
$ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'loguser');
return succjson($ret);
}
public static function json_del() {
global $db;
$rsuser = verifyfast();
if (nopower($db, $rsuser['id'], 'p10260d'))
return errjson('您未被授权操作');
$post = new \ciy\post();
$ids = $post->get('ids');
if (empty($ids))
return errjson('请选择至少一条');
$csql = new \ciy\sql('ap_log');
$csql->where('id in', $ids);
$rows = $db->get($csql);
$vids = array();
try {
$db->begin();
foreach ($rows as $row) {
$delid = $row['id'];
delme($db, $delid, 'ap_log');
$vids[] = $delid;
}
$db->commit();
} catch (\Exception $ex) {
$db->rollback();
savelogfile('err_db', $ex->getMessage());
return errjson($ex->getMessage());
}
$ret['ids'] = $vids;
return succjson($ret);
}
public static function json_multiread() {
global $db;
$rsuser = verifyfast();
if (nopower($db, $rsuser['id'], 'p10260s'))
return errjson('您未被授权操作');
$post = new \ciy\post();
$ids = $post->get('ids');
if (empty($ids))
return errjson('请选择至少一条');
$csql = new \ciy\sql('ap_log');
$csql->where('id in', $ids);
$rows = $db->get($csql);
$vids = array();
try {
$db->begin();
foreach ($rows as $row) {
$rowid = $row['id'];
$updata = array();
$updata['readuser'] = $rsuser['id'];
$csql = new \ciy\sql('ap_log');
$csql->where('id', $rowid);
if ($db->update($csql, $updata) === false)
throw new \Exception('更新失败:' . $db->error);
$vids[] = $rowid;
}
$db->commit();
} catch (\Exception $ex) {
$db->rollback();
savelogfile('err_db', $ex->getMessage());
return errjson($ex->getMessage());
}
$ret['ids'] = $vids;
$ret['data'] = $updata;
return succjson($ret);
}
}

71
web/admin/ap/luser.html Normal file
View File

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<link href="/jscss/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="/jscss/theme.js"></script>
</head>
<body>
<div class="container">
<form class="search" onsubmit="table.search(this,'btn');return false;">
<ul></ul>
<div>
<div class="sinps"></div>
<div class="sbtns">
<button class="lang btn" type="submit">查询</button>
</div>
</div>
</form>
<div class="table">
<div class="loading col-24">Loading...</div>
<div class="list"></div>
<div>
<div class="btmbtn">
<a class="lang btn def" onclick="ciyfn.select_all(table)">全选</a>
<a class="lang btn def" onclick="ciyfn.select_diff(table)">反选</a>
|
<a class="lang btn dag" onclick="ciyfn.select_callfunc(table, this,'del','已选{n}条,是否批量删除?',{},function(json){table.delline(json)})">批量删除</a>
</div>
<div class="page"></div>
</div>
</div>
</div>
<script type="text/javascript" src="/jscss/ciy.js"></script>
<script type="text/javascript" src="/jscss/ciycmp.js"></script>
<script type="text/javascript" src="/jscss/ciytable.js"></script>
<script type="text/javascript" src="../common.js"></script>
<script type="text/javascript">
'use strict';
var table;
var Glob = {};
ciyfn.pageload(function () {
table = new ciyclass.table({
dom: '.table'
, url: 'init'
, pagecount: 10
, fn_beforedata: function (json) {
ciyfn.fillsearch({
searchdom: '.search'
, data: json
, liall: '全部'
, lidata: [{ id: 1, name: '登入' }, { id: 2, name: '登出' }]
, liclick: function (dom) {
table.search(dom, 'li');
}
});
return json;
}
, fn_tdcontent: function (key, datashow, field, data) {
}
});
table.callpage(1);
});
</script>
</body>
</html>

105
web/admin/ap/luser.php Normal file
View File

@ -0,0 +1,105 @@
<?php
namespace web\admin\ap;
class luser {
static function setwhere($db, $post) {
$query = $post->get('query');
$csql = new \ciy\sql('ap_luser');
$liid = objint($query, 'liid');
if ($liid > 0)
$csql->where('isinout', $liid);
$val = objstr($query, 'loguser');
if (!empty($val)) {
$csqlt = new \ciy\sql('ap_user');
$csqlt->where('name like', $val);
$trow = $db->getone($csqlt);
if (is_array($trow)) {
$csql->where('loguser', $trow['id']);
$query['loguser'] = $trow['name'];
} else {
$csql->where('loguser=0');
}
}
$csql->where('model like', objstr($query, 'model'));
$csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
$order = objstr($query, 'order', 'id desc');
$csql->order($order);
$query['order'] = $order;
return [$query, $csql];
}
public static function json_init() {
global $db;
$rsuser = verifyfast();
$post = new \ciy\post();
list($where, $csql) = self::setwhere($db, $post);
$pageno = $post->getint('pageno', 1);
$pagecount = $post->getint('pagecount', 10);
$csql->limit($pageno, $pagecount);
$mainrowcount = $post->getint('count');
$rows = $db->get($csql, $mainrowcount);
$ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
if ($post->getbool('field')) {
$field = array();
$fshow = $db->getfield($field, 'ap_luser');
$ret['field'] = $field;
$ret['fshow'] = $fshow;
}
if ($post->getbool('once')) {
$ret['once'] = array();
$input = array();
$input[] = array(
'type' => 'input',
'form' => 'loguser',
'name' => '操作人',
'prop' => ' style="width:6em;"',
);
$input[] = array(
'type' => 'daterange',
'form' => 'addtimes',
'name' => '发生日期'
);
$input[] = array(
'type' => 'input',
'form' => 'model',
'name' => '设备指纹',
);
$ret['once']['input'] = $input;
}
$ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'loguser');
return succjson($ret);
}
public static function json_del() {
global $db;
$rsuser = verifyfast();
if (nopower($db, $rsuser['id'], 'p10261d'))
return errjson('您未被授权操作');
$post = new \ciy\post();
$ids = $post->get('ids');
if (empty($ids))
return errjson('请选择至少一条');
$csql = new \ciy\sql('ap_luser');
$csql->where('id in', $ids);
$rows = $db->get($csql);
$vids = array();
try {
$db->begin();
foreach ($rows as $row) {
$delid = $row['id'];
delme($db, $delid, 'ap_luser');
$vids[] = $delid;
}
$db->commit();
} catch (\Exception $ex) {
$db->rollback();
savelogfile('err_db', $ex->getMessage());
return errjson($ex->getMessage());
}
$ret['ids'] = $vids;
return succjson($ret);
}
}

View File

@ -40,7 +40,7 @@
<div class="ciy-form col-24 col-sm-8">
<label class="lang">头像</label>
<div>
<ciy-upload com="icon" num="1" type="jpg,png" />
<ciy-upload com="icon" num="1" type="jpg,png,webp" />
</div>
</div>
<div class="ciy-form col-24 col-sm-8">

View File

@ -212,7 +212,8 @@ class user {
$fields[] = array('style' => 'l', 'width' => 150, 'field' => 'mobile', 'name' => '手机号');
$fields[] = array('style' => 'c', 'width' => 100, 'field' => 'stpstatus', 'name' => '账号状态');
$fields[] = array('style' => 'r', 'width' => 100, 'field' => 'myinvmoney', 'name' => '待开票金额');
$fields[] = array('style' => 'r', 'width' => 100, 'field' => 'mycashmoney', 'name' => '可提现金额');
$fields[] = array('style' => 'r', 'width' => 100, 'field' => 'mycashmoney', 'name' => '用户余额');
$fields[] = array('style' => 'r', 'width' => 100, 'field' => 'mybondmoney', 'name' => '保证金');
$fields[] = array('style' => 'r', 'width' => 100, 'field' => 'mypnt', 'name' => '金币');
$fields[] = array('style' => 'l', 'width' => 150, 'field' => 'certs', 'name' => '认证范围');
$fields[] = array('style' => 'l', 'width' => 100, 'field' => 'logintimes', 'name' => '登录时间');
@ -245,6 +246,8 @@ class user {
$val = number_format($val / 100, 2);
if ($field == 'mycashmoney')
$val = number_format($val / 100, 2);
if ($field == 'mybondmoney')
$val = number_format($val / 100, 2);
if ($field == 'certs')
$val = implode(',', scode($code_certs, $val));
if ($field == 'logintimes')

View File

@ -77,7 +77,7 @@
<div class="ciy-form col-24 col-sm-24">
<label class="lang imp">发票</label>
<div>
<ciy-upload com="invfile" num="3" type="jpg,png,pdf,zip,rar,docx,xlsx,pptx" />
<ciy-upload com="invfile" num="3" type="jpg,png,webp,pdf,zip,rar,docx,xlsx,pptx" />
</div>
</div>
</div>

View File

@ -1,222 +0,0 @@
<?php
function base_dayclean($systemrow) {
global $db;
$msg = '';
$msg .= _base_deldb($db, (new \ciy\sql('zc_autotsk_run'))->where('addtimes<', time() - 86400 * 90));
$msg .= _base_deldb($db, (new \ciy\sql('zc_autotsk_log'))->where('addtimes<', time() - 86400 * 90));
$msg .= _base_deldb($db, (new \ciy\sql('zc_funcslow'))->where('addtimes<', time() - 86400 * 60));
$msg .= _base_deldb($db, (new \ciy\sql('zc_stats'))->where('addtimes<', time() - 86400 * 60));
$msg .= _base_deldb($db, (new \ciy\sql('zc_log'))->where('addtimes<', time() - 86400 * 100));
$msg .= _base_deldb($db, (new \ciy\sql('zc_online'))->where('exptimes<', time() - 86400 * 7));
$cnt = 0;$msg .= _base_delfile(PATH_WEB . 'ud/tmp', 86400 * 3, $cnt);
$cnt = 0;$msg .= _base_delfile(PATH_WEB . 'ud/rep', 86400 * 1, $cnt);
return $msg;
}
function _base_deldb($db, $csql) {
$execute = $db->delete($csql);
if ($execute === false)
return 'clean ' . $csql->table . ': ' . $db->error . '<br/>';
else if ($execute > 0)
return 'clean ' . $csql->table . ': ' . $execute . '<br/>';
return '';
}
function _base_delfile($pathfile, $timespan, &$cnt, $deep = 0) {
if (!is_dir($pathfile)) {
$mtime = filemtime($pathfile);
if ($mtime !== false) {
if (tostamp() - $mtime > $timespan) {
$cnt++;
filedel($pathfile);
}
}
return;
}
$files = scandir($pathfile);
foreach ($files as $file) {
if ($file == '.' || $file == '..')
continue;
_base_delfile($pathfile . '/' . $file, $timespan, $cnt, 1);
}
if ($deep == 0 && $cnt > 0)
return 'clean file: ' . $cnt . ' ' . substr($pathfile, strlen(PATH_WEB)) . '<br/>';
return '';
}
function base_srvstats($systemrow) {
global $db;
$func_succ = 0;
$func_fail = 0;
$func_commit = 0;
$func_rollback = 0;
$func_runms = 0;
$csql = new \ciy\sql('zc_zmem_var');
$memrows = $db->get($csql);
foreach ($memrows as $memrow) {
if ($memrow['types'] == 'func_succ')
$func_succ = toint($memrow['params']);
else if ($memrow['types'] == 'func_fail')
$func_fail = toint($memrow['params']);
else if ($memrow['types'] == 'func_commit')
$func_commit = toint($memrow['params']);
else if ($memrow['types'] == 'func_rollback')
$func_rollback = toint($memrow['params']);
else if ($memrow['types'] == 'func_runms') {
$func_runms = toint($memrow['params']);
} else
continue;
$updata = array();
$updata['params'] = 0;
$csql = new \ciy\sql('zc_zmem_var');
$csql->where('id', $memrow['id']);
$db->update($csql, $updata);
}
$func_runms = 0;
if ($func_succ + $func_fail > 0)
$func_runms = $func_runms / ($func_succ + $func_fail);
$disk_sysfree = disk_free_space("/");
$disk_datafree = disk_free_space("/data");
// $disk_sysfree = disk_free_space("D:/");
// $disk_datafree = disk_free_space("E:/");
$starttime = timems();
$fcontent = str_repeat("0", 1024 * 1024); //写入1MB
$fpath = PATH_WEB . "/ud/_" . tostamp() . ".bin";
file_put_contents($fpath, $fcontent);
$rcontent = file_get_contents($fpath);
unlink($fpath);
$disk_ioms = timems() - $starttime;
if ($rcontent !== $fcontent) {
savelog($db, 0, 'STAT', '写入临时文件校验失败');
}
$output = array();
exec("ps aux -A", $output);
// $output = array();
// $output[] = "USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND";
// $output[] = "root 1 0.0 0.0 190928 3396 ? Ss Apr10 9:54 /usr/lib/systemd/systemd --switched-root --system --deserialize 22";
// $output[] = "root 2 0.0 0.0 0 0 ? S Apr10 0:00 [kthreadd]";
// $output[] = "root 1322 0.0 0.0 102900 2320 ? Ss Apr10 0:00 /sbin/dhclient -q -lf /var/lib/dhclient/dhclient--eth0.lease -pf /var/run/dhclient-eth0.pid -H VM_0_5_centos eth0";
// $output[] = "mysql 2219 0.2 9.3 1654448 362344 ? Sl Apr10 76:53 /usr/libexec/mysqld --basedir=/usr --datadir=/data/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock";
// $output[] = "root 2934 0.0 0.2 494920 10360 ? S Apr10 0:02 WorkerMan: worker process proxy tcp://0.0.0.0:6981";
$cmddb = ['mysql', 'mysqld'];
$cmdweb = ['nginx', 'php', 'WorkerMan', 'mosquitto', 'gitea', '/zgo'];
$cpu = array('db' => 0, 'web' => 0, 'oth' => 0);
$mem = array('db' => 0, 'web' => 0, 'oth' => 0);
foreach ($output as $line) {
if (strpos($line, "COMMAND") !== false)
continue;
_base_nextspace($line);
_base_nextspace($line);
$cpup = (float)_base_nextspace($line);
$memp = (float)_base_nextspace($line);
_base_nextspace($line); //虚拟内存
_base_nextspace($line); //物理内存 包括共享内存
_base_nextspace($line);
_base_nextspace($line);
_base_nextspace($line);
_base_nextspace($line);
if (_base_arrin($line, $cmddb)) {
$cpu['db'] += $cpup;
$mem['db'] += $memp;
} else if (_base_arrin($line, $cmdweb)) {
$cpu['web'] += $cpup;
$mem['web'] += $memp;
} else {
$cpu['oth'] += $cpup;
$mem['oth'] += $memp;
}
}
$output = array();
exec("free -m", $output);
// $output = array();
// $output[] = " total used free shared buff/cache available";
// $output[] = "Mem: 3789 860 201 18 2727 2629";
preg_match('/Mem:\s+(\d+)/', $output[1], $totalmem);
$mem_free = $totalmem[1] * (100 - $cpu['db'] - $cpu['web'] - $cpu['oth']) * 1024 * 1024 / 100;
$output = array();
exec("netstat -an | awk '/^tcp/ {++S[\$NF]} END {for(a in S) print a, S[a]}'", $output);
// $output = array();
// $output[] = "LISTEN 13";
// $output[] = "SYN_RECV 3";
// $output[] = "ESTABLISHED 15";
// $output[] = "TIME_WAIT 36";
$net_tcp = 0;
foreach ($output as $line) {
$ls = explode(" ", $line);
if ($ls[0] == 'LISTEN')
continue;
$net_tcp += toint($ls[1]);
}
$starttime = timems();
$http = new ciy\http();
$http->request('https://www.baidu.com');
$http->get_data();
$net_ioms = timems() - $starttime;
$dbrows = $db->getraw('show global status');
$dbstat = array();
for ($i = 0; $i < count($dbrows); $i++) {
$name = $dbrows[$i]['Variable_name'];
$val = $dbrows[$i]['Value'];
$dbstat[$name] = $val;
}
$db_keyhit = toint($dbstat['Handler_read_key']) / (toint($dbstat['Com_select']) + 1) * 100;
$db_dbhit = toint($dbstat['Innodb_buffer_pool_reads']) / (toint($dbstat['Innodb_buffer_pool_read_requests']) + 1) * 100;
$db_tmptable = toint($dbstat['Created_tmp_disk_tables']) / (toint($dbstat['Created_tmp_tables']) + 1) * 100;
$updata = array();
$updata['func_succ'] = $func_succ;
$updata['func_fail'] = $func_fail;
$updata['func_commit'] = $func_commit;
$updata['func_rollback'] = $func_rollback;
$updata['func_runms'] = $func_runms;
$updata['disk_sysfree'] = $disk_sysfree;
$updata['disk_datafree'] = $disk_datafree;
$updata['disk_ioms'] = $disk_ioms;
$updata['cpu_free'] = 100 - $cpu['db'] - $cpu['web'] - $cpu['oth'];
$updata['cpu_db'] = $cpu['db'];
$updata['cpu_web'] = $cpu['web'];
$updata['cpu_oth'] = $cpu['oth'];
$updata['mem_free'] = $mem_free;
$updata['mem_db'] = $mem['db'];
$updata['mem_web'] = $mem['web'];
$updata['mem_oth'] = $mem['oth'];
$updata['net_tcp'] = $net_tcp;
$updata['net_ioms'] = $net_ioms;
$updata['db_query'] = $dbstat['Questions'];
$updata['db_commit'] = $dbstat['Com_commit'];
$updata['db_rollback'] = $dbstat['Com_rollback'];
$updata['db_keyhit'] = $db_keyhit;
$updata['db_dbhit'] = $db_dbhit;
$updata['db_tmptable'] = $db_tmptable;
$updata['db_lock'] = $dbstat['Innodb_row_lock_current_waits'];
$updata['addtimes'] = tostamp();
$csql = new \ciy\sql('zc_stats');
$db->insert($csql, $updata);
if ($func_succ == 0 && $func_fail == 0 && $func_rollback == 0)
return '';
return 'succ: ' . $func_succ . ($func_rollback > 0 ? ', rollback: ' . $func_rollback : '');
}
function _base_nextspace(&$line) {
$ind = strpos($line, " ");
if ($ind === false) {
$line = '';
return $line;
}
$va = substr($line, 0, $ind);
$line = ltrim(substr($line, $ind));
return $va;
}
function _base_arrin($cmd, $arr) {
foreach ($arr as $v) {
if (strpos($cmd, $v) !== false)
return true;
}
return false;
}

View File

@ -13,8 +13,8 @@ import (
func funcindex() map[string]func(map[string]any) string {
return map[string]func(map[string]any) string{
"dayclean": dayclean,
"srvstats": srvstats,
"web\\admin\\autotask\\base::dayclean": dayclean,
"web\\admin\\autotask\\base::srvstats": srvstats,
}
}
func srvstats(systemrow map[string]any) string {

231
web/admin/autotask/base.php Normal file
View File

@ -0,0 +1,231 @@
<?php
namespace web\admin\autotask;
class base {
public static function dayclean($systemrow) {
global $db;
$msg = '';
$msg .= self::_base_deldb($db, (new \ciy\sql('zc_autotsk_run'))->where('addtimes<', time() - 86400 * 90));
$msg .= self::_base_deldb($db, (new \ciy\sql('zc_autotsk_log'))->where('addtimes<', time() - 86400 * 90));
$msg .= self::_base_deldb($db, (new \ciy\sql('zc_funcslow'))->where('addtimes<', time() - 86400 * 60));
$msg .= self::_base_deldb($db, (new \ciy\sql('zc_stats'))->where('addtimes<', time() - 86400 * 60));
$msg .= self::_base_deldb($db, (new \ciy\sql('zc_log'))->where('addtimes<', time() - 86400 * 100));
$msg .= self::_base_deldb($db, (new \ciy\sql('zc_online'))->where('exptimes<', time() - 86400 * 7));
$cnt = 0;
$msg .= self::_base_delfile(PATH_WEB . 'ud/tmp', 86400 * 3, $cnt);
$cnt = 0;
$msg .= self::_base_delfile(PATH_WEB . 'ud/rep', 86400 * 1, $cnt);
return $msg;
}
static function _base_deldb($db, $csql) {
$execute = $db->delete($csql);
if ($execute === false)
return 'clean ' . $csql->table . ': ' . $db->error . '<br/>';
else if ($execute > 0)
return 'clean ' . $csql->table . ': ' . $execute . '<br/>';
return '';
}
static function _base_delfile($pathfile, $timespan, &$cnt, $deep = 0) {
if (!is_dir($pathfile)) {
if (file_exists($pathfile)) {
$mtime = filemtime($pathfile);
if ($mtime !== false) {
if (tostamp() - $mtime > $timespan) {
$cnt++;
filedel($pathfile);
}
}
}
return;
}
$files = scandir($pathfile);
foreach ($files as $file) {
if ($file == '.' || $file == '..')
continue;
self::_base_delfile($pathfile . '/' . $file, $timespan, $cnt, 1);
}
if ($deep == 0 && $cnt > 0)
return 'clean file: ' . $cnt . ' ' . substr($pathfile, strlen(PATH_WEB)) . '<br/>';
return '';
}
public static function srvstats($systemrow) {
global $db;
$func_succ = 0;
$func_fail = 0;
$func_commit = 0;
$func_rollback = 0;
$func_runms = 0;
$csql = new \ciy\sql('zc_zmem_var');
$memrows = $db->get($csql);
foreach ($memrows as $memrow) {
if ($memrow['types'] == 'func_succ')
$func_succ = toint($memrow['params']);
else if ($memrow['types'] == 'func_fail')
$func_fail = toint($memrow['params']);
else if ($memrow['types'] == 'func_commit')
$func_commit = toint($memrow['params']);
else if ($memrow['types'] == 'func_rollback')
$func_rollback = toint($memrow['params']);
else if ($memrow['types'] == 'func_runms') {
$func_runms = toint($memrow['params']);
} else
continue;
$updata = array();
$updata['params'] = 0;
$csql = new \ciy\sql('zc_zmem_var');
$csql->where('id', $memrow['id']);
$db->update($csql, $updata);
}
$func_runms = 0;
if ($func_succ + $func_fail > 0)
$func_runms = $func_runms / ($func_succ + $func_fail);
$disk_sysfree = disk_free_space("/");
$disk_datafree = disk_free_space("/data");
// $disk_sysfree = disk_free_space("D:/");
// $disk_datafree = disk_free_space("E:/");
$starttime = timems();
$fcontent = str_repeat("0", 1024 * 1024); //写入1MB
$fpath = PATH_WEB . "/ud/_" . tostamp() . ".bin";
file_put_contents($fpath, $fcontent);
$rcontent = file_get_contents($fpath);
unlink($fpath);
$disk_ioms = timems() - $starttime;
if ($rcontent !== $fcontent) {
savelog($db, 0, 'STAT', '写入临时文件校验失败');
}
$output = array();
exec("ps aux -A", $output);
// $output = array();
// $output[] = "USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND";
// $output[] = "root 1 0.0 0.0 190928 3396 ? Ss Apr10 9:54 /usr/lib/systemd/systemd --switched-root --system --deserialize 22";
// $output[] = "root 2 0.0 0.0 0 0 ? S Apr10 0:00 [kthreadd]";
// $output[] = "root 1322 0.0 0.0 102900 2320 ? Ss Apr10 0:00 /sbin/dhclient -q -lf /var/lib/dhclient/dhclient--eth0.lease -pf /var/run/dhclient-eth0.pid -H VM_0_5_centos eth0";
// $output[] = "mysql 2219 0.2 9.3 1654448 362344 ? Sl Apr10 76:53 /usr/libexec/mysqld --basedir=/usr --datadir=/data/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock";
// $output[] = "root 2934 0.0 0.2 494920 10360 ? S Apr10 0:02 WorkerMan: worker process proxy tcp://0.0.0.0:6981";
$cmddb = ['mysql', 'mysqld'];
$cmdweb = ['nginx', 'php', 'WorkerMan', 'mosquitto', 'gitea', '/zgo'];
$cpu = array('db' => 0, 'web' => 0, 'oth' => 0);
$mem = array('db' => 0, 'web' => 0, 'oth' => 0);
foreach ($output as $line) {
if (strpos($line, "COMMAND") !== false)
continue;
self::_base_nextspace($line);
self::_base_nextspace($line);
$cpup = (float)self::_base_nextspace($line);
$memp = (float)self::_base_nextspace($line);
self::_base_nextspace($line); //虚拟内存
self::_base_nextspace($line); //物理内存 包括共享内存
self::_base_nextspace($line);
self::_base_nextspace($line);
self::_base_nextspace($line);
self::_base_nextspace($line);
if (self::_base_arrin($line, $cmddb)) {
$cpu['db'] += $cpup;
$mem['db'] += $memp;
} else if (self::_base_arrin($line, $cmdweb)) {
$cpu['web'] += $cpup;
$mem['web'] += $memp;
} else {
$cpu['oth'] += $cpup;
$mem['oth'] += $memp;
}
}
$output = array();
exec("free -m", $output);
// $output = array();
// $output[] = " total used free shared buff/cache available";
// $output[] = "Mem: 3789 860 201 18 2727 2629";
preg_match('/Mem:\s+(\d+)/', $output[1], $totalmem);
$mem_free = $totalmem[1] * (100 - $cpu['db'] - $cpu['web'] - $cpu['oth']) * 1024 * 1024 / 100;
$output = array();
exec("netstat -an | awk '/^tcp/ {++S[\$NF]} END {for(a in S) print a, S[a]}'", $output);
// $output = array();
// $output[] = "LISTEN 13";
// $output[] = "SYN_RECV 3";
// $output[] = "ESTABLISHED 15";
// $output[] = "TIME_WAIT 36";
$net_tcp = 0;
foreach ($output as $line) {
$ls = explode(" ", $line);
if ($ls[0] == 'LISTEN')
continue;
$net_tcp += toint($ls[1]);
}
$starttime = timems();
$http = new \ciy\http();
$http->request('https://www.baidu.com');
$http->get_data();
$net_ioms = timems() - $starttime;
$dbrows = $db->getraw('show global status');
$dbstat = array();
for ($i = 0; $i < count($dbrows); $i++) {
$name = $dbrows[$i]['Variable_name'];
$val = $dbrows[$i]['Value'];
$dbstat[$name] = $val;
}
$db_keyhit = toint($dbstat['Handler_read_key']) / (toint($dbstat['Com_select']) + 1) * 100;
$db_dbhit = 100 - toint($dbstat['Innodb_buffer_pool_reads']) / (toint($dbstat['Innodb_buffer_pool_read_requests']) + 1) * 100;
$db_tmptable = toint($dbstat['Created_tmp_disk_tables']) / (toint($dbstat['Created_tmp_tables']) + 1) * 100;
$updata = array();
$updata['func_succ'] = $func_succ;
$updata['func_fail'] = $func_fail;
$updata['func_commit'] = $func_commit;
$updata['func_rollback'] = $func_rollback;
$updata['func_runms'] = $func_runms;
$updata['disk_sysfree'] = $disk_sysfree;
$updata['disk_datafree'] = $disk_datafree;
$updata['disk_ioms'] = $disk_ioms;
$updata['cpu_free'] = 100 - $cpu['db'] - $cpu['web'] - $cpu['oth'];
$updata['cpu_db'] = $cpu['db'];
$updata['cpu_web'] = $cpu['web'];
$updata['cpu_oth'] = $cpu['oth'];
$updata['mem_free'] = $mem_free;
$updata['mem_db'] = $mem['db'];
$updata['mem_web'] = $mem['web'];
$updata['mem_oth'] = $mem['oth'];
$updata['net_tcp'] = $net_tcp;
$updata['net_ioms'] = $net_ioms;
$updata['db_query'] = $dbstat['Questions'];
$updata['db_commit'] = $dbstat['Com_commit'];
$updata['db_rollback'] = $dbstat['Com_rollback'];
$updata['db_keyhit'] = $db_keyhit;
$updata['db_dbhit'] = $db_dbhit;
$updata['db_tmptable'] = $db_tmptable;
$updata['db_lock'] = $dbstat['Innodb_row_lock_current_waits'];
$updata['addtimes'] = tostamp();
$csql = new \ciy\sql('zc_stats');
$db->insert($csql, $updata);
if ($func_succ == 0 && $func_fail == 0 && $func_rollback == 0)
return '';
return 'succ: ' . $func_succ . ($func_rollback > 0 ? ', rollback: ' . $func_rollback : '');
}
static function _base_nextspace(&$line) {
$ind = strpos($line, " ");
if ($ind === false) {
$line = '';
return $line;
}
$va = substr($line, 0, $ind);
$line = ltrim(substr($line, $ind));
return $va;
}
static function _base_arrin($cmd, $arr) {
foreach ($arr as $v) {
if (strpos($cmd, $v) !== false)
return true;
}
return false;
}
}

View File

@ -1,7 +1,6 @@
package autotask
import (
"ciyon/web/admin"
c "ciyon/zciyon"
"fmt"
"net/http"
@ -38,15 +37,15 @@ func Main() bool {
}
func Task_main(w http.ResponseWriter, r *http.Request) bool {
post := c.NewCiyPost(w, r)
rsuser, err := admin.Verifyuser(r, c.CiyDB, post)
if err != nil {
w.Write([]byte("您未登录"))
return false
}
if admin.Nopower(c.CiyDB, c.Toint(rsuser["id"]), "p602r") {
w.Write([]byte("您未被授权操作"))
return false
}
// rsuser, err := admin.Verifyuser(r, c.CiyDB, post)
// if err != nil {
// w.Write([]byte("您未登录"))
// return false
// }
// if admin.Nopower(c.CiyDB, c.Toint(rsuser["id"]), "p602r") {
// w.Write([]byte("您未被授权操作"))
// return false
// }
runid := post.Getint("runid")
csql := c.NewCiySQL("zc_autotask")
csql.Where("id", runid)

View File

@ -4,7 +4,7 @@ namespace web\admin\autotask;
class task {
//http://xx.local.ciy.cn/ajax/admin/autotask/task.run
//php D:/Dreams/ciy/ciyon/web/admin/autotask/index.php
//php D:/Dreams/ciy/c5_dao/web/admin/autotask/run.php
public static function json_run() {
self::main();
echo '全部执行完成';
@ -12,10 +12,6 @@ class task {
}
public static function main() {
global $db;
$files = glob(PATH_ROOT . 'web/admin/autotask/at_*.php');
foreach ($files as $file) {
require $file;
}
while (true) {
$csql = new \ciy\sql('zc_autotask');
$csql->where('autotaskstatus<', 90)->where('nexttimes<=', tostamp());
@ -27,13 +23,6 @@ class task {
}
public static function json_main() {
global $db;
//获取本地文件夹内所有.php文件
$files = glob(PATH_ROOT . 'web/admin/autotask/at_*.php');
//遍历所有文件
foreach ($files as $file) {
require $file;
clog('已加载: ' . $file);
}
set_time_limit(0);
if (isset($_SERVER['HTTP_HOST']))
ob_end_clean();
@ -57,11 +46,12 @@ class task {
$taskrow = $db->getone($csql);
if (!is_array($taskrow))
return clog('任务ID不存在:' . $runid);
$taskrow['autotaskstatus'] = 20;
$runtaskid = self::run($db, $taskrow);
$csql = new \ciy\sql('zc_autotsk_run');
$csql->where('id', $runtaskid);
$tskrunrow = $db->getone($csql);
if(!is_array($tskrunrow))
if (!is_array($tskrunrow))
return clog('任务运行记录不存在:' . $runtaskid);
$csql = new \ciy\sql('zc_autotsk_log');
$csql->where('runtaskid', $runtaskid);
@ -148,7 +138,7 @@ class task {
$db->update($csql, array('runtimes' => $taskrow['runtimes']));
};
$taskrow['log'] = function ($msg) use ($db, &$taskrow) {
if(empty($msg))
if (empty($msg))
return;
$updata = array();
$updata['autotaskid'] = $taskrow['id'];
@ -161,14 +151,15 @@ class task {
$msg = '';
try {
clog($taskrow['name'] . ' 开始执行...');
if (!function_exists($taskrow['runfunc']))
$msg .= '缺少函数' . $taskrow['runfunc'];
else
$msg = call_user_func($taskrow['runfunc'], $taskrow);
$funcs = explode('::', $taskrow['runfunc']);
if (!class_exists($funcs[0]))
throw new \Exception('无效类:' . $funcs[0]);
if (!method_exists($funcs[0], $funcs[1]))
throw new \Exception('无效函数:' . $funcs[0] . '::' . $funcs[1]);
$msg = call_user_func($taskrow['runfunc'], $taskrow);
clog($taskrow['name'] . ' 执行完成。<br/>' . $msg);
} catch (\Exception $ex) {
$msg = 'try:' . print_r($ex, true);
$msg = $ex->getMessage();
}
$runsec = tostamp() - $runlogstart;
$updata = array();

View File

@ -56,7 +56,7 @@
<div class="ciy-form col-24 col-sm-24">
<label class="lang imp">图片</label>
<div>
<ciy-upload com="url" num="1" type="jpg,png" />
<ciy-upload com="url" num="1" type="jpg,png,webp" />
</div>
</div>
<div class="ciy-form col-24 col-sm-24">

View File

@ -96,6 +96,8 @@
var Glob = {};
var ciy_vars = {};
var ce = new ciyearth();
if(ciyfn.inmobile())
$5('.cecontrolpanel').hide();
Glob.dom_controltip = $5('.cecontrolpanel .tip');
function fly_to(dom) {
@ -144,7 +146,6 @@
var mapset = ciyfn.tojson(json.cemap.mapjson);
console.log('mapset', mapset);
mapset.domid = 'ceContainer';
mapset.personheight = 1.8;
ce.init(mapset);
if (!isarray(mapset.flys))
return;

View File

@ -1,150 +0,0 @@
<?php
namespace web\admin\datasse;
class expo {
static function sse_pavi($senddata, $sendevent) {
global $db;
$rsuser = verifyfast();
if (nopower($db, $rsuser['id'], 'p610r'))
return errjson('您未被授权操作');
$param = get('param');
if(empty($param))
$senddata('param 可填入 newexpo 建立展会biaoji 标记展会expoday 展会天数调整');
else
$senddata('param: ' . $param);
if (true) {
$csql = new \ciy\sql('c_fair_juzhan_pavi');
$csql->where('diqu like', '中国-');
$csql->where('conferenceid=0');
$cpavirows = $db->get($csql);
foreach ($cpavirows as $cpavirow) {
$csql = new \ciy\sql('c_fair_juzhan_expo');
$csql->where('paviid', $cpavirow['rawid']);
$cnt = $db->get1($csql);
if ($cnt > 0)
$senddata('展馆中有展会,但展馆未收录: ' . $cpavirow['name'] . ',' . $cpavirow['rawid']);
}
}
if (true) {
$csql = new \ciy\sql('c_fair_juzhan_pavi');
$csql->where('diqu like', '中国-');
$csql->where('conferenceid>0');
$cpavirows = $db->get($csql);
foreach ($cpavirows as $cpavirow) {
$csql = new \ciy\sql('c_fair_juzhan_expo');
$csql->where('paviid', $cpavirow['rawid']);
$crows = $db->get($csql);
// $csql = new \ciy\sql('ep_exposition');
// $csql->where('conferenceid', $cpavirow['conferenceid']);
// $csql->order('name');
// $erows = $db->get($csql);
// if(count($crows) == count($erows))
// continue;
//$senddata('C'.count($crows) .'=E'. count($erows).'|'.$cpavirow['name'] . ',' . $cpavirow['rawid']);
//检查C有但E没有的展会有哪些
foreach ($crows as $crow) {
if ($crow['expoid'] == 0) {
$csql = new \ciy\sql('ep_exposition');
$csql->where('conferenceid', $cpavirow['conferenceid']);
$csql->where('name', $crow['name']);
$chkrow = $db->getone($csql);
if (is_array($chkrow)) {
if ($param != 'biaoji') {
$senddata('[biaoji] 展会存在但juzhan未标记: ' . $cpavirow['conferenceid'] . ',' . $crow['name']);
continue;
}
$updata = array();
$updata['status'] = 10;
$updata['expoid'] = $chkrow['id'];
$csql = new \ciy\sql('c_fair_juzhan_expo');
$csql->where('id', $crow['id']);
$execute = $db->data($updata)->set($csql, 'update');
if ($execute === false)
$senddata('ERR ' . $cpavirow['conferenceid'] . ',' . $crow['name'] . $db->error);
else
$senddata('展会存在已补juahznid: ' . $cpavirow['conferenceid'] . ',' . $crow['name']);
} else {
if ($param != 'newexpo') {
$senddata('[newexpo] 展会不存在需建立: ' . $cpavirow['conferenceid'] . ',' . $crow['name']);
continue;
}
$updata = array();
$updata['conferenceid'] = $cpavirow['conferenceid'];
$updata['name'] = $crow['name'];
$updata['opentimes'] = $crow['opentimes'];
$updata['daycnt'] = \web\amb\expo::convday($crow);
$updata['content'] = '[MD]';
$csql = new \ciy\sql('ep_exposition');
$execute = $db->data($updata)->set($csql, 'insert');
if ($execute !== false) {
$exponewid = $db->insert_id();
$updata = array();
$updata['status'] = 10;
$updata['expoid'] = $exponewid;
$csql = new \ciy\sql('c_fair_juzhan_expo');
$csql->where('id', $crow['id']);
$execute = $db->data($updata)->set($csql, 'update');
if ($execute === false)
$senddata('ERR ' . $cpavirow['conferenceid'] . ',' . $crow['name'] . $db->error);
else
$senddata('已新建展会: ' . $cpavirow['conferenceid'] . ',' . $crow['name']);
} else {
$senddata('ERR ' . $cpavirow['conferenceid'] . ',' . $crow['name'] . $db->error);
}
}
}
}
}
}
if (true) {
$csql = new \ciy\sql('ep_exposition');
$csql->where('daycnt>30');
$exporows = $db->get($csql);
$csql = new \ciy\sql('zc_ai_key');
$csql->where('id', 1);
$aikeyrow = $db->getone($csql);
if(!is_array($aikeyrow))
return errjson('AI Key不存在');
foreach ($exporows as $exporow) {
if ($param != 'expoday') {
$senddata('[expoday] 展会持续: ' . $exporow['daycnt'] . '天,' . $exporow['name']);
continue;
}
$csql = new \ciy\sql('c_fair_juzhan_expo');
$csql->where('expoid', $exporow['id']);
$crow = $db->getone($csql);
if (is_array($crow)) {
$n = \web\amb\expo::convday($crow);
if ($n != $exporow['daycnt'])
$senddata('展会天数调整到[' . $n . ']: ' . $exporow['daycnt'] . ',' . $exporow['name'] . $crow['lunchdate']);
} else {
$param = array();
$param['id'] = 6;
$param['name'] = $exporow['name'];
$retai = \web\amb\ai::json_aidecision($param);
if (@$retai['code'] != 1){
$senddata('AI识别失败: ' . $exporow['name'] . ',' . $retai['errmsg']);
continue;
}
if (!isset($retai['ai']['day'])) {
$senddata('AI识别错误: ' . $exporow['name'] . ',day不存在');
continue;
}
$updata = array();
$updata['daycnt'] = $retai['ai']['day'];
$csql = new \ciy\sql('ep_exposition');
$csql->where('id', $exporow['id']);
$execute = $db->data($updata)->set($csql, 'update');
if ($execute === false)
$senddata('ERR ' . $retai['ai']['day'] . '==' . $exporow['daycnt'] . ',' . $exporow['name'] . $db->error);
else
$senddata('展会天数调整到[' . $retai['ai']['day'] . ']: ' . $exporow['daycnt'] . ',' . $exporow['name']);
}
}
}
$sendevent('ok');
}
}

View File

@ -57,7 +57,7 @@ class index {
public static function json_bank_r2() {
$ret['videos'] = array();
for ($i = 1; $i < 50; $i++) {
$ret['videos'][] = array('id' => $i, 'name' => '监控视频' . $i, 'capture' => 'https://cf4.xinquanyou.cn/vcap/c' . rand(7816, 7846) . '.jpg');
$ret['videos'][] = array('id' => $i, 'name' => '监控视频' . $i, 'capture' => 'https://cf4.nyyzsoft.cn/vcap/c' . rand(7816, 7846) . '.jpg');
}
return succjson($ret);
}
@ -118,7 +118,7 @@ class index {
public static function json_farm_r3() {
$ret['videos'] = array();
for ($i = 1; $i < 50; $i++) {
$ret['videos'][] = array('id' => $i, 'name' => '监控视频' . $i, 'capture' => 'https://cf4.xinquanyou.cn/vcap/c' . rand(7816, 7846) . '.jpg');
$ret['videos'][] = array('id' => $i, 'name' => '监控视频' . $i, 'capture' => 'https://cf4.nyyzsoft.cn/vcap/c' . rand(7816, 7846) . '.jpg');
}
return succjson($ret);
}

View File

@ -20,7 +20,7 @@
</div>
<div class="ciy-form col-24 col-sm-24">
<label>测试b</label>
<div><ciy-inputcyc initevent hasmore com="b" value="86400" enableunit="day,month" /></div>
<div><ciy-inputcyc initevent hasmore com="b" value="6" enableunit="day,hour,min" /></div>
</div>
<div class="ciy-form col-24 col-sm-24">
<label>测试c</label>

View File

@ -22,7 +22,7 @@
</div>
<div class="ciy-form col-24 col-sm-24">
<label>测试b</label>
<div><ciy-timepoint hasmore initevent type="second" com="b" value="17268" /></div>
<div><ciy-timepoint hasmore initevent type="sec" com="b" value="17268" /></div>
</div>
<div class="ciy-form col-24 col-sm-24">
<label>测试c</label>

View File

@ -51,75 +51,40 @@
<div><input type="text" name="_bcod_titname" style="width:20em;" />
</div>
</div>
<!-- <div class="ciy-form">
<label>主库</label>
<div><input type="text" name="_bcod_maindb" style="width:20em;" />
</div>
</div> -->
<div class="ciy-form">
<label>认证函数</label>
<div><input type="text" name="_bcod_verifyfunc" style="width:20em;" />
</div>
</div>
<div class="ciy-form">
<label>ud路径</label>
<div><input type="text" name="_bcod_uploadpat" style="width:20em;" />
</div>
</div>
<div class="ciy-form">
<label>列表选项卡</label>
<label>列表选项卡
<span class="help" help="填写字典名,第一个默认全部。\n填写,分隔的选项至少2个"></span></label>
<div><input type="text" name="_bcod_liiddict" style="width:27em;" />
</div>
</div>
<div class="ciy-form">
<label>更新选项卡</label>
<label>更新选项卡
<span class="help" help="填写,分隔的选项卡名称"></span></label>
<div><input type="text" name="_bcod_uptabcard" style="width:27em;" />
</div>
</div>
<div class="ciy-form">
<label>查看选项卡</label>
<div><input type="text" name="_bcod_viewtabcard" style="width:27em;" />
</div>
</div>
<div class="ciy-form">
<label>字典表</label>
<div><input type="text" name="_bcod_tabdict" style="width:20em;" />
</div>
</div>
<div class="ciy-form">
<label>SaaS代码</label>
<div><input type="text" name="_bcod_saascode" style="width:20em;" />
</div>
</div>
<!-- <div class="ciy-form">
<label>查重字段</label>
<div><input type="text" name="_bcod_uniquedata" style="width:20em;" />
</div>
</div> -->
<!-- <div class="ciy-form">
<label>功能开关</label>
<div>
<ciy-checkbox com="_bcod_chk" />
</div>
</div> -->
<div class="ciy-form">
<label>下拉排序</label>
<label>下拉排序
<span class="help" help="order排序:排序名称,,,\n例: addtimes desc:日期倒序,id:ID\n多种排序用逗号分隔\n排序慎用需考虑查询性能"></span></label>
<div><input type="text" name="_bcod_select_order" style="width:100%;" />
</div>
</div>
<div class="ciy-form">
<label>列表上按钮</label>
<label>列表上按钮
<span class="help" help="多个按钮用,逗号分隔。例:XXX,YYY,ZZZ\n支持下拉按钮后面用|分隔。例:ZZZ|xx|-|yy|zz\n固定功能文字:添加、导入、导出、帮助"></span></label>
<div><input type="text" name="_bcod_btntop_newline" style="width:100%;" />
</div>
</div>
<div class="ciy-form">
<label>批量改按钮</label>
<div><input type="text" name="_bcod_btntop_multibtn" style="width:100%;" />
<label>列表内按钮
<span class="help" help="多个按钮用逗号,分隔。例:XXX,YYY,ZZZ\n支持下拉按钮后面用|分隔。例:ZZZ|xx|-|yy|zz\n单个按钮用.分隔定义key点后面是按钮标识key。例如: $详情.info\n文字前加&,调用自定义函数\n文字前加$,打开新选项卡\n仅文字callfastfunc请求后端\n固定功能文字:查看、修改、删除、审核"></span></label>
<div><input type="text" name="_bcod_btnlist_line" style="width:100%;" />
</div>
</div>
<div class="ciy-form">
<label>列表内按钮</label>
<div><input type="text" name="_bcod_btnlist_line" style="width:100%;" />
<label>列表下按钮
<span class="help" help="多个按钮用,逗号分隔。例:XXX,YYY,ZZZ\n文字前加&,用户窗口交互后,请求后端\n仅文字select_callfunc请求后端\n固定功能文字:批量删除、审核通过、驳回"></span></label>
<div><input type="text" name="_bcod_btntop_multibtn" style="width:100%;" />
</div>
</div>
<div class="ciy-form">
@ -145,6 +110,12 @@
<ciy-radio com="_bcod_pctemplate"></ciy-radio>
</div>
</div>
<div class="ciy-form">
<label>PC选项</label>
<div>
<ciy-checkbox com="_bcod_pcparam"></ciy-checkbox>
</div>
</div>
<div class="ciy-form">
<label>MB模版</label>
<div>
@ -196,18 +167,11 @@
var cc = json.code_create || {};
cc.bcod = cc.bcod || {};
document.title = '☯' + cc.bcod.titname + ' 【低代码生成】';
if (!cc.bcod.verifyfunc)
cc.bcod.verifyfunc = ciyfn.getstorage('_ccode_verifyfunc', 'verifyfast');
if (!cc.bcod.tabdict)
cc.bcod.tabdict = ciyfn.getstorage('_ccode_tabdict', 'zc_cata');
if (!cc.bcod.htmllang)
cc.bcod.htmllang = ciyfn.getstorage('_ccode_htmllang', 'js');
if (!cc.bcod.proglang)
cc.bcod.proglang = ciyfn.getstorage('_ccode_proglang', 'php');
if (!cc.bcod.saascode)
cc.bcod.saascode = ciyfn.getstorage('_ccode_saascode', '');
$5('[name=_bcod_verifyfunc]').val(cc.bcod.verifyfunc);
$5('[name=_bcod_titname]').val(cc.bcod.titname);
$5('[name=_bcod_select_order]').val(cc.bcod.selectorder);
$5('[name=_bcod_btntop_newline]').val(cc.bcod.newline);
@ -216,8 +180,6 @@
$5('[name=_bcod_liiddict]').val(cc.bcod.liiddict);
$5('[name=_bcod_uptabcard]').val(cc.bcod.uptabcard);
$5('[name=_bcod_viewtabcard]').val(cc.bcod.viewtabcard);
$5('[name=_bcod_tabdict]').val(cc.bcod.tabdict);
$5('[name=_bcod_saascode]').val(cc.bcod.saascode);
// ciycmp({
// dom: '[com=_bcod_chk]', value: cc.bcod.bcod_chk, range: [
@ -234,6 +196,7 @@
ciycmp({ dom: '[com=_bcod_htmllang]', value: cc.bcod.htmllang, range: [{ id: 'js', name: '原生JS' }, { id: 'vue3', name: 'Vue3' }, { id: 'react18', name: 'ReactV18' }] });
ciycmp({ dom: '[com=_bcod_proglang]', value: cc.bcod.proglang, range: [{ id: 'php', name: 'PHP' }, { id: 'golang', name: 'Golang' }, { id: 'python', name: 'Python' }] });
ciycmp({ dom: '[com=_bcod_pctemplate]', value: cc.bcod.pctemplate, range: [{ id: 'sigpage', name: '单页版' }, { id: 'threepage', name: '独立三页' }, { id: 'treepage', name: '多级树形' }, { id: 'editpage', name: '列表编辑' }] });
ciycmp({ dom: '[com=_bcod_pcparam]', value: cc.bcod.pcparam, range: [{ id: 'listchk', name: '列表复选' }, { id: 'editsave', name: '编辑暂存' }, { id: 'topbtnnewline', name: '列表上按钮起新行' }] });
ciycmp({ dom: '[com=_bcod_mbtemplate]', value: cc.bcod.mbtemplate, range: [{ id: 'sigpage', name: '单页版' }, { id: 'threepage', name: '独立三页' }] });
//计算所有的set给到subset
@ -323,6 +286,7 @@
colrange = [];
colrange.push({ id: '', name: '下拉' });
colrange.push({ id: 'window', name: '窗选' });
colrange.push({ id: 'text', name: '文本框' });
ciycmp({
dom: '[com=subset_dbedit_' + ss + ']', range: colrange, minwidth: '4em', onchange: function (e) {
if (e.from == 'init')
@ -333,6 +297,7 @@
colrange = [];
colrange.push({ id: '', name: '一次性' });
colrange.push({ id: 'rel', name: '增量' });
colrange.push({ id: 'no', name: '不加载' });
ciycmp({
dom: '[com=subset_listload_' + ss + ']', range: colrange, minwidth: '4em', onchange: function (e) {
if (e.from == 'init')
@ -403,7 +368,6 @@
if (!isview)
$5('[name=bviw_' + ss + ']').attr('checked', 'true');
}
console.log(isview);
}
, fn_lihtml: function (data, i) {
var html = '';
@ -421,7 +385,7 @@
|| data.COLUMN_NAME == 'lat') {
chkvalue = ',bout';
}
else if (data.COLUMN_NAME.substring(0, 4) == 'saas' && data.COLUMN_NAME.substring(5) == 'id') {
else if (data.COLUMN_NAME == table.json.dbsaas.saasfield && data.COLUMN_NAME.substring(5) == 'id') {
chkvalue = '';
}
else if (data.COLUMN_NAME == 'ip'
@ -462,8 +426,8 @@
|| data.COLUMN_NAME == 'ip') {
spset.noup = 'no';
}
var saascode = ciyfn.getstorage('_ccode_saascode', '').split('=');
if (data.COLUMN_NAME == saascode[0]) {
if (data.COLUMN_NAME == table.json.dbsaas.saasfield) {
spset.noup = 'saas';
}
if (data.COLUMN_NAME == 'lat') {
@ -479,13 +443,25 @@
spset.msk = '****##';
if (colcomment.cate == 'DOWN')
spset.ftype = 'jpg,png,pdf,zip,rar,docx,xlsx,pptx';
spset.ftype = 'jpg,png,webp,pdf,zip,rar,docx,xlsx,pptx';
if (colcomment.cate == 'AV')
spset.ftype = 'mp3,mp4,wav,ogg';
if (colcomment.cate == 'IMG' || colcomment.cate == 'IMG1')
spset.ftype = 'jpg,png';
if (colcomment.cate == 'DOWN' || colcomment.cate == 'AV' || colcomment.cate == 'IMG')
spset.num = 3;
spset.ftype = 'jpg,png,webp';
if (colcomment.cate == 'DOWN' || colcomment.cate == 'AV' || colcomment.cate == 'IMG') {
spset.num = toint(data.CHARACTER_MAXIMUM_LENGTH / 50);
}
if (colcomment.cate == 'MD' || colcomment.cate == 'DOWN' || colcomment.cate == 'AV' || colcomment.cate == 'IMG' || colcomment.cate == 'IMG1') {
spset.savepath = data.COLUMN_NAME;
if (spset.savepath.substring(spset.savepath.length - 4) == 'imgs')
spset.savepath = spset.savepath.substring(0, spset.savepath.length - 4);
if (spset.savepath.substring(spset.savepath.length - 5) == 'files')
spset.savepath = spset.savepath.substring(0, spset.savepath.length - 5);
if (spset.savepath.substring(spset.savepath.length - 3) == 'img')
spset.savepath = spset.savepath.substring(0, spset.savepath.length - 3);
if (spset.savepath.substring(spset.savepath.length - 4) == 'file')
spset.savepath = spset.savepath.substring(0, spset.savepath.length - 4);
}
if (colcomment.dicttype == 'dictdb' && (colcomment.cate == 'DB' || colcomment.cate == 'CATU'))
spset.listload = 'rel';
}
@ -545,8 +521,8 @@
html += '<div title="上传图片的最大宽度,填纯数字。像素">图片宽 <input oninput="chgset(this)" name="subset_fimgw_' + i + '" type="text" style="width:6em;" /></div>';
html += '<div title="上传图片的最大高度,填纯数字。像素">图片高 <input oninput="chgset(this)" name="subset_fimgh_' + i + '" type="text" style="width:6em;" /></div>';
html += '<div title="上传图片jpg压缩质量0-1">jpg压缩 <input oninput="chgset(this)" name="subset_fzip_' + i + '" type="text" style="width:6em;" /></div>';
html += '<div title="哪些类型图片可被压缩默认jpg,png">压缩范围 <input oninput="chgset(this)" name="subset_fzext_' + i + '" type="text" style="width:6em;" /></div>';
//html += '<div title="设置本地保存路径">savepath <input oninput="chgset(this)" name="subset_savepath_' + i + '" type="text" style="width:10em;" /></div>';
html += '<div title="哪些类型图片可被压缩默认jpg,png,webp">压缩范围 <input oninput="chgset(this)" name="subset_fzext_' + i + '" type="text" style="width:6em;" /></div>';
html += '<div title="设置本地保存路径">savepath <input oninput="chgset(this)" name="subset_savepath_' + i + '" type="text" style="width:10em;" /></div>';
}
if (colcomment.cate == 'BR' || colcomment.cate == 'MD') {
html += '<div title="列表是否加载">列加载 <ciy-select com="subset_nocmn_' + i + '"></ciy-select></div>';
@ -669,11 +645,8 @@
if (typeof (postparam) == 'string')
return ciyfn.alert(postparam);
ciyfn.callfunc('save', postparam, function (json) {
ciyfn.setstorage('_ccode_verifyfunc', postparam._bcod_verifyfunc);
ciyfn.setstorage('_ccode_tabdict', postparam._bcod_tabdict);
ciyfn.setstorage('_ccode_htmllang', postparam._bcod_htmllang);
ciyfn.setstorage('_ccode_proglang', postparam._bcod_proglang);
ciyfn.setstorage('_ccode_saascode', postparam._bcod_saascode);
ciyfn.setstorage('_ccode_savepc', postparam._bcod_savepc.substring(0, postparam._bcod_savepc.lastIndexOf('\\') + 1)); //记忆一部分,默认一部分+表名
ciyfn.toast('保存成功');
});
@ -748,6 +721,10 @@
postparam.schema = table.json.dbsaas.schem;
postparam.table = table.json.table;
postparam.subpath = table.json.dbsaas.subpath;
postparam.verifyfunc = table.json.dbsaas.verifyfunc;
postparam.codetable = table.json.dbsaas.codetable;
postparam.saasfield = table.json.dbsaas.saasfield;
postparam.saasusr = table.json.dbsaas.saasusr;
if (!postparam._bcod_proglang)
return '请选择后端语言';
for (var i = 0; i < postparam.total; i++) {

View File

@ -52,14 +52,19 @@ class code_create {
$ret['code_create']['bcod']['tabname'] = $tabname;
$ret['code_create']['bcod']['titname'] = str_replace('表', '', $tabrow['TABLE_COMMENT']);
$maintab = substr($tabname, strpos($tabname, '_') + 1);
$ret['code_create']['bcod']['uploadpat'] = $maintab;
$subend = substr($dbsaasrow['subpath'], strrpos($dbsaasrow['subpath'], '\\') + 1);
if (substr($maintab, 0, strlen($subend)) == $subend)
$maintab = substr($maintab, strlen($subend));
$ret['code_create']['bcod']['savepc'] = 'web\\' . $dbsaasrow['subpath'] . '\\' . $maintab;
$ret['code_create']['bcod']['pctemplate'] = 'sigpage';
$ret['code_create']['bcod']['pcparam'] = ',listchk,';
if ($chk_audit) {
$ret['code_create']['bcod']['newline'] = '导出';
$ret['code_create']['bcod']['newline'] = '导出,帮助';
$ret['code_create']['bcod']['multibtn'] = '批量删除,审核通过,驳回';
$ret['code_create']['bcod']['btnlist_line'] = '审核';
} else {
$ret['code_create']['bcod']['newline'] = '添加,导入,导出';
$ret['code_create']['bcod']['newline'] = '添加,导入,导出,帮助';
$ret['code_create']['bcod']['multibtn'] = '批量删除';
$ret['code_create']['bcod']['btnlist_line'] = '查看,修改';
}
@ -88,11 +93,6 @@ class code_create {
$json['bcod']['uploadpat'] = $post->get('_bcod_uploadpat', '', 'all');
$json['bcod']['liiddict'] = str_replace('', ',', $post->get('_bcod_liiddict', '', 'all'));
$json['bcod']['uptabcard'] = str_replace('', ',', $post->get('_bcod_uptabcard', '', 'all'));
$json['bcod']['viewtabcard'] = str_replace('', ',', $post->get('_bcod_viewtabcard', '', 'all'));
$json['bcod']['tabdict'] = $post->get('_bcod_tabdict', '', 'all');
$json['bcod']['saascode'] = $post->get('_bcod_saascode', '', 'all');
//$json['bcod']['uniquedata'] = $post->get('_bcod_uniquedata', '', 'all');
//$json['bcod']['bcod_chk'] = $post->get('bcod_chk');
$json['bcod']['selectorder'] = $post->get('_bcod_select_order', '', 'all');
$json['bcod']['newline'] = $post->get('_bcod_btntop_newline', '', 'all');
$json['bcod']['multibtn'] = $post->get('_bcod_btntop_multibtn', '', 'all');
@ -101,6 +101,7 @@ class code_create {
$json['bcod']['htmllang'] = $post->get('_bcod_htmllang', '', 'all');
$json['bcod']['proglang'] = $post->get('_bcod_proglang', '', 'all');
$json['bcod']['pctemplate'] = $post->get('_bcod_pctemplate', '', 'all');
$json['bcod']['pcparam'] = $post->get('_bcod_pcparam', '', 'all');
$json['bcod']['mbtemplate'] = $post->get('_bcod_mbtemplate', '', 'all');
$total = $post->getint('total');
@ -184,7 +185,6 @@ class code_create {
$savepc = $post->get('_bcod_savepc', '', 'all');
if (empty($savepc))
return errjson('请填写PC保存路径');
if (strpos($savepc, ':') === false)
$savepc = PATH_ROOT . $savepc;
$tpath = dirname($savepc);
@ -193,6 +193,12 @@ class code_create {
$ret = self::save($post);
if (is_string($ret))
return errjson($ret);
$fname = substr($savepc, strrpos($savepc, '\\') + 1);
if (empty($fname))
return errjson('必须指定文件名');
if ($fname[0] == '_')
return errjson('文件名不能以_开头');
$codex = code_pc_html($post);
$ret = file_put_contents($savepc . '.html', $codex);
if ($ret === false)

View File

@ -57,9 +57,9 @@
if (key == '_btn') {
var html = '';
if (Glob.tabls[data.TABLE_NAME])
html += '<a class="lang btn imp" onclick="menubtn(this, \'create\')">生成</a>';
html += '<a class="lang btn imp" onclick="menubtn(this, \'create\')" onmousedown="event.stopPropagation()">生成</a>';
else
html += '<a class="lang btn" onclick="menubtn(this, \'create\')">生成</a>';
html += '<a class="lang btn" onclick="menubtn(this, \'create\')" onmousedown="event.stopPropagation()">生成</a>';
return html;
}
}

View File

@ -1,38 +1,25 @@
<?php
function code_pc_html($post) {
$schema = $post->get('schema', '', 'all');
$tabname = $post->get('table', '', 'all');
$subpath = $post->get('subpath', '', 'all');
$maindb = $post->get('_bcod_maindb', '', 'all');
$verifyfunc = $post->get('_bcod_verifyfunc', '', 'all');
$saasfield = $post->get('saasfield', '', 'all');
$saasusr = $post->get('saasusr', '', 'all');
$titname = $post->get('_bcod_titname', '', 'all');
$saascode = $post->get('_bcod_saascode', '', 'all');
if ($saascode) {
$saascode = explode('=', $saascode);
if (count($saascode) == 1)
$saascode[1] = $saascode[0];
}
$uploadpat = $post->get('_bcod_uploadpat', '', 'all');
$liiddict = str_replace('',',', $post->get('_bcod_liiddict', '', 'all'));
$uptabcard = str_replace('',',', $post->get('_bcod_uptabcard', '', 'all'));
$uptabcards = array();
if (!empty($uptabcard))
$uptabcards = explode(',', $uptabcard);
$viewtabcard = str_replace('',',', $post->get('_bcod_viewtabcard', '', 'all'));
$viewtabcards = array();
if (!empty($viewtabcard))
$viewtabcards = explode(',', $viewtabcard);
$tabdict = $post->get('_bcod_tabdict', '', 'all');
$btntop_newline = $post->get('_bcod_btntop_newline', '', 'all');
$btnlist_line = $post->get('_bcod_btnlist_line', '', 'all');
$btntop_multibtn = $post->get('_bcod_btntop_multibtn', '', 'all');
$savepc = $post->get('_bcod_savepc', '', 'all');
$pcparam = $post->get('_bcod_pcparam');
$hasview = strpos($btnlist_line, '查看') !== false;
$flds = calfld($post);
$querycount = 0;
$chk_audit = false;
$chk_matter = false;
$chk_getupdate = false;
@ -45,8 +32,6 @@ function code_pc_html($post) {
$len = gb_strlen($fld['name']);
if ($len > $maxnamelen)
$maxnamelen = $len;
if ($fld['bqry'])
$querycount++;
if ($fld['col'] == 'auditstatus')
$chk_audit = true; //auditstatus/audituser/audittimes/auditmsg: 加审核按钮
if ($fld['col'] == 'matterstatus')
@ -89,6 +74,7 @@ function code_pc_html($post) {
$hasaudit = false;
$hasexcelin = false;
$hasexcelout = false;
$hashelp = false;
$topbtns = [];
$strs = explode(',', $btntop_newline); //添加,导入,导出,其他,操作|成果|方法|-修改|删除
foreach ($strs as $str) {
@ -107,23 +93,22 @@ function code_pc_html($post) {
$hasexcelout = true;
$topbtns[] = '<a class="lang btn" onclick="exportxls()">导出</a>';
} else if ($str == '帮助') {
$hasexcelout = true;
$hashelp = true;
$topbtns[] = '<a class="lang btn def" onclick="pagehelp()">帮助</a>';
} else
$topbtns[] = '<a class="lang btn" onclick="">' . $str . '</a>';
} else {
$subs = explode('|', $str); //操作|成果|方法|-修改|删除
$subs = explode('|', $str); //操作|成果|方法|-|修改|删除
$btnhtml = "<a class=\"btn btn-menu\" direction=\"lr\"><span class=\"lang\">{$subs[0]}</span>\n";
$btnhtml .= " <span class=\"caret\"></span>\n";
$btnhtml .= " <ul class=\"ciy-popmenu\">\n";
for ($j = 1; $j < count($subs); $j++) {
$ext = '';
$name = $subs[$j];
if ($name[0] == '-') {
$name = substr($name, 1);
$ext = ' class="upline"';
if ($name == '-') {
$btnhtml .= " <li class=\"line\"></li>\n";
} else {
$btnhtml .= " <li onclick=\"\">{$name}</li>\n";
}
$btnhtml .= " <li{$ext} onclick=\"\">{$name}</li>\n";
}
$btnhtml .= " </ul>\n";
$btnhtml .= " </a>";
@ -153,7 +138,7 @@ function code_pc_html($post) {
data;
if (($querycount < 5 && count($topbtns) < 4) || count($topbtns) < 3) {
if (strpos($pcparam, ',topbtnnewline,') === false) {
foreach ($topbtns as $topbtn) {
$codex .= ' ' . $topbtn . "\n";
}
@ -165,14 +150,14 @@ data;
data;
if (!(($querycount < 5 && count($topbtns) < 4) || count($topbtns) < 3)) {
if (strpos($pcparam, ',topbtnnewline,') !== false) {
$codex .= " <div class=\"topbtn\">\n";
foreach ($topbtns as $topbtn) {
$codex .= ' ' . $topbtn . "\n";
}
$codex .= " </div>\n";
}
$chk_multistatus = false;
$chk_multis = [];
$multibtn = '';
if ($btntop_multibtn) {
$btns = explode(',', $btntop_multibtn);
@ -191,12 +176,21 @@ data;
}
}
$multibtn .= "\n <a class=\"lang btn warn\" onclick=\"ciyfn.select_callfunc(table, this, 'audit','已选{n}条,是否批量驳回?{$auditmsg}', {auditstatus:90},function(json){table.updateline(json)})\">{$btn}</a>";
} else if ($btn[0] == 'A') {
$btn = substr($btn, 1);
$multibtn .= "\n <a class=\"lang btn\" onclick=\"ciyfn.select_callfunc(table, this, 'status','已选{n}条,是否{$btn}?', {status:1},function(json){table.updateline(json)})\">{$btn}</a>";
} else {
$chk_multistatus = true;
$multibtn .= "\n <a class=\"lang btn\" onclick=\"multistatus()\">{$btn}</a>";
$btnstrs = explode('.', $btn);
$str = $btnstrs[0];
$extkey = '';
if(count($btnstrs) > 1)
$extkey = $btnstrs[1];
if($str[0] == '&'){
$str = substr($str, 1);
if(empty($extkey))
$extkey = $str;
$chk_multis[$extkey] = $str;
$multibtn .= "\n <a class=\"lang btn\" onclick=\"multi_{$extkey}()\">{$str}</a>";
}else{
$multibtn .= "\n <a class=\"lang btn\" onclick=\"ciyfn.select_callfunc(table, this, '{$extkey}','已选{n}条,是否{$btn}?', {xxx:1},function(json){table.updateline(json)})\">{$str}</a>";
}
}
}
}
@ -216,6 +210,24 @@ data;
</div>
</div>
data;
if ($hashelp)
$codex .= <<<data
<div id="alert_pagehelp" style="display:none;">
<b>标题</b>
<div style="margin:0 0 1em 1em">
第一行
<br />第二行
</div>
<b>标题</b>
<ol style="margin:0 0 1em -1em">
<li>第一行</li>
<li>第二行</li>
<li>第三行</li>
</ol>
</div>
data;
if ($hasexcelin)
$codex .= <<<data
@ -251,7 +263,7 @@ if($hasedit){
}
foreach ($flds as $fld) {
$col = $fld['col'];
// if ($col == 'id' || $col == 'ip' || $col == 'uptimes' || $col == 'lat' || $col == 'addtimes' || $col == $saascode)
// if ($col == 'id' || $col == 'ip' || $col == 'uptimes' || $col == 'lat' || $col == 'addtimes' || $col == $saasfield)
// continue;
// if ($col == 'auditstatus' || $col == 'audittimes' || $col == 'audituser' || $col == 'auditmsg')
// continue;
@ -288,6 +300,8 @@ if($hasedit){
if (strpos($fld['data'], ':s') !== false)
$ext = ' type="second"';
$codex .= "\n{$pspec} <ciy-timepoint com=\"{$col}\"{$ext} />";
} else if ($cate == 'MCNY') {
$codex .= "\n{$pspec} <ciy-inputbet com=\"{$col}\" unit=\"\" bet=\"10000\" />";
} else if ($cate == 'WCNY') {
$codex .= "\n{$pspec} <ciy-inputbet com=\"{$col}\" unit=\"万元\" bet=\"1000000\" />";
} else if ($cate == 'MD' || $cate == 'DOWN' || $cate == 'AV' || $cate == 'IMG' || $cate == 'IMG1') {
@ -342,7 +356,9 @@ if($hasedit){
} else if ($cate == 'DB' || $cate == 'CATU') {
if (isset($fld['set']['dbedit']) && $fld['set']['dbedit'] == 'window') //暂无实现窗选/组织
$codex .= "\n{$pspec} <ciy-select com=\"{$col}\"{$ext} />";
else {
else if (isset($fld['set']['dbedit']) && $fld['set']['dbedit'] == 'text') {
$codex .= "\n{$pspec} <input type=\"text\" name=\"{$col}\" style=\"width:10em;\" />";
} else {
if (!$fld['bimp'])
$ext .= ' all="无"';
$codex .= "\n{$pspec} <ciy-select com=\"{$col}\"{$ext} />";
@ -373,7 +389,7 @@ if($hasedit){
else
$align = 'center';
}
$codex .= "\n{$pspec} {$strstart}<input type=\"text\" name=\"{$col}\" style=\"width:5em;text-align:{$align};\" /> {$strend}";
$codex .= "\n{$pspec} {$strstart}<input type=\"text\" name=\"{$col}\" style=\"width:6em;text-align:{$align};\" /> {$strend}";
} else if ($cate == 'TON') {
$codex .= "\n{$pspec} <ciy-inputbet com=\"{$col}\" unit=\"\" bet=\"1000000\" />";
} else if ($cate == 'BET') {
@ -444,13 +460,19 @@ if($hasedit){
$codex .= "\n </div>";
}
if ($chk_multistatus) {
$codex .= "\n <div id=\"alert_multistatus\" style=\"display:none;\">";
foreach($chk_multis as $key=>$name){
$codex .= "\n <div id=\"alert_multi_{$key}\" style=\"display:none;\">";
$codex .= "\n <div class=\"char4 row\">";
$codex .= "\n <div class=\"ciy-form col-24 col-sm-24\">";
$codex .= "\n <label class=\"lang\">状态</label>";
$codex .= "\n <label class=\"lang\">录入</label>";
$codex .= "\n <div>";
$codex .= "\n <select name=\"status\"></select>";
$codex .= "\n <input name=\"inptext\" type=\"text\" style=\"width:100%;\"></input>";
$codex .= "\n </div>";
$codex .= "\n </div>";
$codex .= "\n <div class=\"ciy-form col-24 col-sm-24\">";
$codex .= "\n <label class=\"lang\">组件</label>";
$codex .= "\n <div>";
$codex .= "\n <ciy-datetime com=\"comxxx\"></ciy-datetime>";
$codex .= "\n </div>";
$codex .= "\n </div>";
$codex .= "\n </div>";
@ -501,7 +523,11 @@ if($hasedit){
$editbtn = '';
$menubtn = '';
$bmenubtn = false;
$strs = explode(',', $btnlist_line); //添加,导入,导出,其他,操作|成果|方法|-修改|删除
$subpathn = '';
$ind = strpos($subpath, '\\');
if($ind > 0)
$subpathn = str_replace('\\','/', substr($subpath, $ind+1)) . '/';
$strs = explode(',', $btnlist_line); //添加,导入,导出,其他,操作|成果|方法|-修改|删除,&填报,$跳转选项卡
$subgomenus = array();
foreach ($strs as $str) {
$ind = strpos($str, '|');
@ -539,36 +565,84 @@ if($hasedit){
else {
$btnstrs = explode('.', $str);
$str = $btnstrs[0];
$extcls = '';
$extkey = '';
if(count($btnstrs) > 1){
$subgomenus[] = $btnstrs;
if(count($btnstrs) > 1)
$extkey = $btnstrs[1];
if($str[0] == '&'){
$str = substr($str, 1);
if(empty($extkey))
$extkey = $str;
$menubtn .= "\n if (btn == '{$extkey}') {";
$menubtn .= "\n edit_{$extkey}(id);";
$menubtn .= "\n }";
}else if($str[0] == '$'){
$str = substr($str, 1);
if(empty($extkey))
$extkey = $str;
$xid = 'xxxid';
if(isset($btnstrs[2]))
$xid = $btnstrs[2];
$menubtn .= "\n if (btn == '{$extkey}') {";
$menubtn .= "\n ciyfn.sendsignal(window.top, 'manage_ifropen', {";
$menubtn .= "\n url: '{$subpathn}{$extkey}.html?_{$xid}=' + id";
$menubtn .= "\n , name: '{$str}<code>' + table.data[id].name + '</code>'";
$menubtn .= "\n });";
$menubtn .= "\n }";
}else{
if(empty($extkey))
$extkey = $str;
$menubtn .= "\n if (btn == '{$extkey}') {";
$menubtn .= "\n ciyfn.callfastfunc(dom, '是否{$str}?', '{$extkey}', { ids: id }, function (json) { table.updateline(json) });";
$menubtn .= "\n }";
}
$menubtn .= "\n if (btn == '{$extkey}') {";
$menubtn .= "\n ciyfn.callfastfunc(dom, '是否{$str}?', 'status', { ids: id }, function (json) { table.updateline(json) });";
$menubtn .= "\n }";
$extcls = '';
}
$editbtn .= "\n html += `<a class=\"lang btn{$extcls}\" onclick=\"menubtn(this, '{$extkey}')\">{$str}</a>`;";
$editbtn .= "\n html += `<a class=\"lang btn{$extcls}\" onclick=\"menubtn(this, '{$extkey}')\" onmousedown=\"event.stopPropagation()\">{$str}</a>`;";
} else {
$bmenubtn = true;
$subs = explode('|', $str); //操作|成果|方法|-修改|删除
$subs = explode('|', $str); //操作|成果|方法|-|修改|删除
$editbtn .= "\n html += `<a class=\"btn btn-menu\" direction=\"lr\"><span class=\"lang\">{$subs[0]}</span>";
$editbtn .= "\n <span class=\"caret\"></span>";
$editbtn .= "\n <ul class=\"ciy-popmenu\">";
for ($j = 1; $j < count($subs); $j++) {
$ext = '';
$name = $subs[$j];
if ($name[0] == '-') {
$name = substr($name, 1);
$ext = ' class="upline"';
$str = $subs[$j];
if ($str == '-') {
$editbtn .= "\n <li class=\"line\"></li>";
} else {
$btnstrs = explode('.', $str);
$str = $btnstrs[0];
$extkey = '';
if(count($btnstrs) > 1)
$extkey = $btnstrs[1];
if($str[0] == '&'){
$str = substr($str, 1);
if(empty($extkey))
$extkey = $str;
$menubtn .= "\n if (btn == '{$extkey}') {";
$menubtn .= "\n {$extkey}(id);";
$menubtn .= "\n }";
}else if($str[0] == '$'){
$str = substr($str, 1);
if(empty($extkey))
$extkey = $str;
$xid = 'xxxid';
if(isset($btnstrs[2]))
$xid = $btnstrs[2];
$menubtn .= "\n if (btn == '{$extkey}') {";
$menubtn .= "\n ciyfn.sendsignal(window.top, 'manage_ifropen', {";
$menubtn .= "\n url: '{$subpathn}{$extkey}.html?_{$xid}=' + id";
$menubtn .= "\n , name: '{$str}<code>' + table.data[id].name + '</code>'";
$menubtn .= "\n });";
$menubtn .= "\n }";
}else{
if(empty($extkey))
$extkey = $str;
$menubtn .= "\n if (btn == '{$extkey}') {";
$menubtn .= "\n ciyfn.callfastfunc(dom, '是否{$str}?', '{$extkey}', { ids: id }, function (json) { table.updateline(json) });";
$menubtn .= "\n }";
}
$editbtn .= "\n <li{$ext} onclick=\"menubtn(this, '{$extkey}')\" onmousedown=\"event.stopPropagation()\">{$str}</li>";
}
$btnstrs = explode('.', $name);
if(!isset($btnstrs[1]))
$btnstrs[1] = '';
else
$subgomenus[] = $btnstrs;
$editbtn .= "\n <li{$ext} onclick=\"menubtn(this, '{$btnstrs[1]}')\">{$btnstrs[0]}</li>";
}
$editbtn .= "\n </ul></a>`;";
}
@ -586,6 +660,8 @@ if($hasedit){
$codex .= "\n dom: '.table'";
$codex .= "\n , url: 'list'";
$codex .= "\n , pagecount: 10";
if (strpos($pcparam, ',listchk,') !== false)
$codex .= "\n , chkbox: true";
$codex .= "\n , fn_beforedata: function (json) {";
$codex .= "\n ciyfn.fillsearch({";
$codex .= "\n searchdom: '.search'";
@ -611,42 +687,21 @@ if($hasedit){
$codex .= "\n });";
$codex .= "\n function menubtn(dom, btn) {";
$codex .= "\n var id = $5(dom).parent('tr').attr('data-id');{$menubtn}";
$subpathn = '';
$ind = strpos($subpath, '\\');
if($ind > 0)
$subpathn = str_replace('\\','/', substr($subpath, $ind+1)) . '/';
foreach ($subgomenus as $subgomenu) {
$xid = 'xxxid';
if(isset($subgomenu[2]))
$xid = $subgomenu[2];
$codex .= "\n if (btn == '{$subgomenu[1]}') {";
$codex .= "\n ciyfn.sendsignal(window.top, 'manage_ifropen', {";
$codex .= "\n url: '{$subpathn}{$subgomenu[1]}.html?_{$xid}=' + id";
$codex .= "\n , name: '{$subgomenu[0]}<code>' + table.data[id].name + '</code>'";
$codex .= "\n });";
$codex .= "\n }";
}
if (count($subgomenus) == 0) {
$codex .= "\n if (btn == 'sub') {";
$codex .= "\n ciyfn.sendsignal(window.top, 'manage_ifropen', {";
$codex .= "\n url: 'xxx.html?_xxxid=' + id";
$codex .= "\n , name: '{$titname}<code>' + table.data[id].name + '</code>'";
$codex .= "\n });";
$codex .= "\n }";
}
$codex .= "\n }";
$codex .= "\n";
$codex .= "\n function getdata(id, act, cb) {";
if ($chk_getupdate) {
$codex .= "\n ciyfn.callfunc('getdata', { id: id, act: act }, function (json) {";
$codex .= "\n cb(json);";
$codex .= "\n });";
$codex .= "\n // cb({ data: id == 0 ? {} : table.data[id] });";
}else{
$codex .= "\n cb({ data: id == 0 ? {} : table.data[id] });";
if ($hasedit || $hasview || $hasreview) {
$codex .= "\n function getdata(id, act, cb) {";
if ($chk_getupdate) {
$codex .= "\n ciyfn.callfunc('getdata', { id: id, act: act }, function (json) {";
$codex .= "\n cb(json);";
$codex .= "\n });";
$codex .= "\n // cb({ data: id == 0 ? {} : table.data[id] });";
}else{
$codex .= "\n cb({ data: id == 0 ? {} : table.data[id] });";
}
$codex .= "\n }";
$codex .= "\n";
}
$codex .= "\n }";
$codex .= "\n";
if ($hasedit) {
$codex .= "\n function edit(id) {";
$codex .= "\n getdata(id, 'edit', function (jsndat) {";
@ -665,8 +720,6 @@ if($hasedit){
$codex .= "\n });";
}
$codex .= "\n var dat = jsndat.data;";
$codex .= "\n var path = ciyfn.makeuploadpath('{$uploadpat}', ciyfn.getstorage(ciy_vars.tokenfield));";
foreach ($flds as $fld) {
$cate = $fld['cate'];
$col = $fld['col'];
@ -678,10 +731,12 @@ if($hasedit){
} else if (
$cate == 'FSIZE' || $cate == 'METRE' || $cate == 'DATE' || $cate == 'TIME' || $cate == 'BOOL'
|| $cate == 'WCNY' || $cate == 'UNIT' || $cate == 'CYC' || $cate == 'SEC' || $cate == 'TON'
|| $cate == 'PCT' || $cate == 'CNY' || $cate == 'KG' || $cate == 'TC' || $cate == 'BR'
|| $cate == 'PCT' || $cate == 'MCNY' || $cate == 'CNY' || $cate == 'KG' || $cate == 'TC'
|| $cate == 'BET' || $cate == 'LNY' || $cate == 'SNY' || $cate == 'WGT' || $cate == 'LGH'
) {
$codex .= "\n ciycmp({ dom: $5('[com={$col}]', dom), value: dat.{$col} });";
} else if ($cate == 'BR') {
$codex .= "\n ciycmp({ dom: $5('[com={$col}]', dom), value: dat.{$col}, autoheight: true });";
} else if ($cate == 'CATA' || $cate == 'CATU' || $cate == 'CATM' || $cate == 'CATS' || $cate == 'TINT' || $cate == 'DB') {
list($dicttype, $dictname) = splitdict($fld['data']);
if ($dicttype == 'dictciy')
@ -693,9 +748,12 @@ if($hasedit){
$range = 'table.once.' . $dictname;
} else
$range = "'{$dictname}'";
$codex .= "\n ciycmp({ dom: $5('[com={$col}]', dom), value: dat.{$col}, range: {$range} });";
if (isset($fld['set']['dbedit']) && $fld['set']['dbedit'] == 'text')
$codex .= "\n $5('[name={$col}]', dom).val(dat.{$col});";
else
$codex .= "\n ciycmp({ dom: $5('[com={$col}]', dom), value: dat.{$col}, range: {$range} });";
} else if ($cate == 'MD' || $cate == 'DOWN' || $cate == 'AV' || $cate == 'IMG' || $cate == 'IMG1') {
$codex .= "\n ciycmp({ dom: $5('[com={$col}]', dom), value: dat.{$col}, path: path });";
$codex .= "\n ciycmp({ dom: $5('[com={$col}]', dom), value: dat.{$col}, path: ciyfn.makeuploadpath('{$fld['set']['savepath']}', ciyfn.getstorage(ciy_vars.tokenfield)) });";
} else if ($cate == 'TBIN') {
$codex .= "\n var values = [];";
$codex .= "\n var ibin = parseInt(dat.{$col});";
@ -737,14 +795,19 @@ if($hasedit){
}
}
$codex .= "\n ciyfn.callfunc('update', opn.inputs, function (json) {";
$codex .= "\n if (opn.btn == '保存(Ctrl+S)')";
$codex .= "\n return;";
if (strpos($pcparam, ',editsave,') !== false) {
$codex .= "\n if (opn.btn == '保存(Ctrl+S)')";
$codex .= "\n return;";
}
$codex .= "\n table.updateline(json);";
$codex .= "\n opn.close();";
$codex .= "\n ciyfn.toast('提交成功');";
$codex .= "\n });";
$codex .= "\n },";
$codex .= "\n btns: id == 0 ? [\"新建\", \"*关闭\"] : [\"#保存(Ctrl+S)\", \"提交\", \"*关闭\"],";
if (strpos($pcparam, ',editsave,') !== false)
$codex .= "\n btns: id == 0 ? [\"新建\", \"*关闭\"] : [\"#保存(Ctrl+S)\", \"提交\", \"*关闭\"],";
else
$codex .= "\n btns: id == 0 ? [\"新建\", \"*关闭\"] : [\"提交\", \"*关闭\"],";
$codex .= "\n });";
$codex .= "\n });";
$codex .= "\n }";
@ -759,7 +822,7 @@ if($hasedit){
$cate = $fld['cate'];
if (empty($fld['name']))
continue;
// if (empty($fld['name']) || $col == 'id' || $col == 'lat' || $col == $saascode)
// if (empty($fld['name']) || $col == 'id' || $col == 'lat' || $col == $saasfield)
// continue;
if (!$fld['bviw'])
continue;
@ -770,7 +833,7 @@ if($hasedit){
$codex .= "\n html += '<div class=\"ciy-form col-24 col-sm-{$sgcol}{$clstop}\">';";
$codex .= "\n html += '<label>{$fld['name']}</label><div>';";
$codex .= "\n html += ciyfn.tdshow(dat.{$col}, table.field.{$col}.ext, dat, table.once, table.json, true);";
$codex .= "\n html += '</div></div>';";
$codex .= "\n html += '&nbsp;</div></div>';";
$codex .= "\n";
}
$codex .= "\n html += '</div>';";
@ -795,9 +858,9 @@ if($hasedit){
continue;
if (!$fld['bviw'])
continue;
if ($col == 'auditstatus' || $col == 'audittimes' || $col == 'audituser' || $col == 'auditmsg')
if ($col == 'auditstatus' || $col == 'auditmsg')
continue;
if ($saascode && $saascode[0] == $fld['col'])
if ($saasfield == $fld['col'])
continue;
$sgcol = (isset($fld['set']['colview']) ? $fld['set']['colview'] : '24');
$codex .= "\n html += '<div class=\"ciy-form col-24 col-sm-{$sgcol}\">';";
@ -865,35 +928,49 @@ data;
data;
}
if ($chk_multistatus) {
if ($hashelp) {
$codex .= <<<data
function multistatus() {
function pagehelp() {
ciyfn.alert({
title: '页面帮助'
, width: 'pc'
, content: document.getElementById("alert_pagehelp").innerHTML
});
}
data;
}
foreach($chk_multis as $key=>$name){
$codex .= <<<data
function multi_{$key}() {
var ids = [];
$5('[data-id]', '.table').each(function () {
if ($5(this).hasClass("selected"))
ids.push($5(this).attr("data-id"));
$5('[data-id]', '.table').each(function (dom) {
if ($5(dom).hasClass("selected"))
ids.push($5(dom).attr("data-id"));
});
if (ids.length == 0)
return ciy_toast("请至少选择一条信息");
return ciyfn.toast("请至少选择一条信息");
ciyfn.alert({
title: '批量已读'
title: '批量{$name}'
, width: 'pc'
, content: document.getElementById("alert_multistatus").innerHTML
, content: document.getElementById("alert_multi_{$key}").innerHTML
, nomaskclose: true
//, noparent:true
, fn_showed: function (doc, dom) {
ciycmp({ dom: $5('[com=comxxx]', dom), value: tostamp() });
}
, cb: function (opn) {
if (opn.btn == "关闭")
return opn.close();
opn.inputs.ids = ids.join(",");
if (ciyfn.throttle(opn.dombtn)) return;
ciyfn.callfunc('multistatus', opn.inputs, function (json) {
ciyfn.callfunc('multi_{$key}', opn.inputs, function (json) {
table.updateline(json);
opn.close();
ciyfn.toast('提交成功');

View File

@ -1,20 +1,13 @@
<?php
function code_pc_php($post) {
$schema = $post->get('schema', '', 'all');
$tabname = $post->get('table', '', 'all');
$subpath = $post->get('subpath', '', 'all');
$maindb = $post->get('_bcod_maindb', '', 'all');
$verifyfunc = $post->get('_bcod_verifyfunc', '', 'all');
$verifyfunc = $post->get('verifyfunc', '', 'all');
$codetable = $post->get('codetable', '', 'all');
$saasfield = $post->get('saasfield', '', 'all');
$saasusr = $post->get('saasusr', '', 'all');
$titname = $post->get('_bcod_titname', '', 'all');
$saascode = $post->get('_bcod_saascode', '', 'all');
if ($saascode) {
$saascode = explode('=', $saascode);
if (count($saascode) == 1)
$saascode[1] = '';
}
$uploadpat = $post->get('_bcod_uploadpat', '', 'all');
$liiddict = str_replace('',',', $post->get('_bcod_liiddict', '', 'all'));
$tabdict = $post->get('_bcod_tabdict', '', 'all');
$liiddict = str_replace('', ',', $post->get('_bcod_liiddict', '', 'all'));
$selectorder = $post->get('_bcod_select_order', '', 'all');
$btntop_newline = $post->get('_bcod_btntop_newline', '', 'all');
$btnlist_line = $post->get('_bcod_btnlist_line', '', 'all');
@ -22,6 +15,7 @@ function code_pc_php($post) {
$savepc = $post->get('_bcod_savepc', '', 'all');
$flds = calfld($post);
$hasview = strpos($btnlist_line, '查看') !== false;
$hasadd = strpos($btntop_newline, '添加') !== false; //有添加能力
$hasexcelin = strpos($btntop_newline, '导入') !== false;
$hasexcelout = strpos($btntop_newline, '导出') !== false;
@ -42,9 +36,10 @@ function code_pc_php($post) {
if ($btntop_multibtn) {
$btns = explode(',', $btntop_multibtn);
foreach ($btns as $btn) {
if ($btn != '批量删除' && $btn != '审核通过' && $btn != '驳回' && $btn[0] != 'A') {
if ($btn != '批量删除' && $btn != '审核通过' && $btn != '驳回')
$chk_multistatus = true;
if ($btn[0] == 'A')
$chk_multistatus = true;
}
}
}
$nocolumn = array();
@ -117,8 +112,8 @@ function code_pc_php($post) {
$codex .= "\n if (!empty(\$val)) {";
list($dicttype, $dictname) = splitdict($fld['data']);
if ($dicttype == 'dictcata') {
$codex .= "\n \$csqlt = new \ciy\sql('{$tabdict}');";
$codex .= "\n \$csqlt->where('cbid in (select id from {$tabdict} where cbid=0 and codeid=\'{$col}\')');";
$codex .= "\n \$csqlt = new \ciy\sql('{$codetable}');";
$codex .= "\n \$csqlt->where('cbid in (select id from {$codetable} where cbid=0 and codeid=\'{$col}\')');";
$codex .= "\n \$csqlt->where('name like', \$val);";
$codex .= "\n \$trow = \$db->getone(\$csqlt);";
$codex .= "\n if (is_array(\$trow)) {";
@ -147,7 +142,7 @@ function code_pc_php($post) {
$codex .= "\n \$csql->where('{$col}&' . \$val . '=' . \$val);";
$codex .= "\n }";
} else if (
$cate == 'METRE' || $cate == 'FSIZE' || $cate == 'WCNY' || $cate == 'SEC' || $cate == 'TON' || $cate == 'BET'
$cate == 'METRE' || $cate == 'FSIZE' || $cate == 'WCNY' || $cate == 'MCNY' || $cate == 'SEC' || $cate == 'TON' || $cate == 'BET'
|| $cate == 'PCT' || $cate == 'CNY' || $cate == 'NUM' || $cate == 'KG' || $cate == 'TC' || $cate == 'INT'
|| $cate == 'LNY' || $cate == 'SNY' || $cate == 'WGT' || $cate == 'LGH'
) {
@ -156,6 +151,8 @@ function code_pc_php($post) {
$bet = 1024;
else if ($cate == 'WCNY' || $cate == 'TON')
$bet = 1000000;
else if ($cate == 'MCNY')
$bet = 10000;
else if ($cate == 'SEC' || $cate == 'NUM' || $cate == 'INT')
$bet = 1;
else if ($cate == 'PCT' || $cate == 'CNY' || $cate == 'LNY' || $cate == 'SNY')
@ -189,9 +186,9 @@ function code_pc_php($post) {
$codex .= "\n \$rsuser = {$verifyfunc}();";
$codex .= "\n \$post = new \ciy\post();";
$codex .= "\n list(\$where, \$csql) = self::setwhere(\$db, \$post, \$rsuser);";
if ($saascode){
if(!empty($saascode[1]))
$codex .= "\n \$csql->where('{$saascode[0]}', \$rsuser['{$saascode[1]}']);";
if ($saasfield) {
if (!empty($saasusr))
$codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
}
if (count($nocolumn) > 0) {
$codex .= "\n \$csql->column('!" . implode(',', $nocolumn) . "', \$db->getraw('show full fields from {$tabname}'));";
@ -210,8 +207,8 @@ function code_pc_php($post) {
$codex .= "\n foreach (\$field as \$fr => \$v) {";
$codex .= "\n if (get('_' . \$fr))";
$codex .= "\n \$field[\$fr]['c'] = ',' . \$field[\$fr]['c'];";
if ($saascode) {
$codex .= "\n if (\$fr == '{$saascode[0]}')";
if ($saasfield) {
$codex .= "\n if (\$fr == '{$saasfield}')";
$codex .= "\n \$field[\$fr]['c'] = ',' . \$field[\$fr]['c'];";
}
$codex .= "\n }";
@ -275,7 +272,7 @@ function code_pc_php($post) {
else
$codex .= "\n \$input[] = array('type' => 'daterange', 'form' => '{$col}', 'name' => '{$fld['name']}');";
} else if (
$cate == 'METRE' || $cate == 'FSIZE' || $cate == 'WCNY' || $cate == 'SEC' || $cate == 'TON'
$cate == 'METRE' || $cate == 'FSIZE' || $cate == 'WCNY' || $cate == 'MCNY' || $cate == 'SEC' || $cate == 'TON'
|| $cate == 'PCT' || $cate == 'CNY' || $cate == 'NUM' || $cate == 'KG' || $cate == 'TC' || $cate == 'INT'
|| $cate == 'BET' || $cate == 'LNY' || $cate == 'SNY' || $cate == 'WGT' || $cate == 'LGH'
) {
@ -299,7 +296,7 @@ function code_pc_php($post) {
foreach ($flds as $fld) {
$cate = $fld['cate'];
if ($cate == 'DB' || $cate == 'CATS' || $cate == 'CATM') {
if ($cate == 'DB' || $cate == 'CATU' || $cate == 'CATS' || $cate == 'CATM') {
if (empty($fld['set']['listload'])) {
list($dicttype, $dictname) = splitdict($fld['data']);
if ($dicttype == 'dictdb') {
@ -313,25 +310,33 @@ function code_pc_php($post) {
}
}
$codex .= "\n }";
$rels = array();
foreach ($flds as $fld) {
if (!$fld['show'])
continue;
if ($saascode && $saascode[0] == $fld['col'])
if ($saasfield == $fld['col'])
continue;
$cate = $fld['cate'];
if ($cate == 'DB' || $cate == 'CATU' || $cate == 'CATS' || $cate == 'CATM') {
if (isset($fld['set']['listload']) && $fld['set']['listload'] == 'rel') {
list($dicttype, $dictname) = splitdict($fld['data']);
if ($dicttype == 'dictdb') {
$codex .= "\n \$ret['{$dictname}'] = getrelation(\$db, \$rows, '{$dictname}', '{$fld['col']}');";
if (isset($rels[$dictname]))
$rels[$dictname][] = $fld['col'];
else
$rels[$dictname] = array($fld['col']);
}
}
}
}
foreach ($rels as $dictname => $cols) {
$colsn = implode(',', $cols);
$codex .= "\n \$ret['{$dictname}'] = getrelation(\$db, \$rows, '{$dictname}', '{$colsn}');";
}
$codex .= "\n return succjson(\$ret);";
$codex .= "\n }";
if ($chk_getupdate) {
if ($chk_getupdate && ($hasedit || $hasview || $hasreview)) {
$codex .= "\n";
$codex .= "\n public static function json_getdata() {";
$codex .= "\n global \$db;";
@ -342,9 +347,9 @@ function code_pc_php($post) {
$codex .= "\n \$act = \$post->get('act');";
$codex .= "\n if (\$id > 0) {";
$codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
if ($saascode){
if(!empty($saascode[1]))
$codex .= "\n \$csql->where('{$saascode[0]}', \$rsuser['{$saascode[1]}']);";
if ($saasfield) {
if (!empty($saasusr))
$codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
}
$codex .= "\n \$csql->where('id', \$id);";
$codex .= "\n \$row = \$db->getone(\$csql);";
@ -353,8 +358,8 @@ function code_pc_php($post) {
$codex .= "\n if (\$act == 'view' || \$act == 'review') {";
foreach ($flds as $fld) {
$cate = $fld['cate'];
if ($cate == 'DB' || $cate == 'CATS' || $cate == 'CATM') {
if (isset($fld['set']['listload']) && $fld['set']['listload'] == 'rel') {
if ($cate == 'DB' || $cate == 'CATU' || $cate == 'CATS' || $cate == 'CATM') {
if (!$fld['show'] && empty($fld['set']['noup']) && isset($fld['set']['listload']) && $fld['set']['listload'] == 'rel') {
list($dicttype, $dictname) = splitdict($fld['data']);
if ($dicttype == 'dictdb') {
$codex .= "\n \$csql = (new \ciy\sql('{$dictname}'))->column('id,name');";
@ -372,8 +377,8 @@ function code_pc_php($post) {
$codex .= "\n if (\$act == 'edit') {";
foreach ($flds as $fld) {
$cate = $fld['cate'];
if ($cate == 'DB' || $cate == 'CATS' || $cate == 'CATM') {
if (isset($fld['set']['listload']) && $fld['set']['listload'] == 'rel') {
if ($cate == 'DB' || $cate == 'CATU' || $cate == 'CATS' || $cate == 'CATM') {
if (empty($fld['set']['noup']) && @$fld['set']['dbedit'] != 'text' && @$fld['set']['listload'] == 'rel') {
list($dicttype, $dictname) = splitdict($fld['data']);
if ($dicttype == 'dictdb') {
$codex .= "\n \$csql = (new \ciy\sql('{$dictname}'))->column('id,name');";
@ -398,7 +403,7 @@ function code_pc_php($post) {
$codex .= "\n \$post = new \ciy\post();";
foreach ($flds as $fld) {
$col = $fld['col'];
// if($col == $saascode || $col == 'addtimes' || $col == 'ip' || $col == 'uptimes')
// if($col == $saasfield || $col == 'addtimes' || $col == 'ip' || $col == 'uptimes')
// continue;
// if($col == 'auditstatus' || $col == 'audittimes' || $col == 'audituser' || $col == 'auditmsg')
// continue;
@ -436,9 +441,9 @@ function code_pc_php($post) {
$codex .= "\n \$datarow = null;";
$codex .= "\n if (\$id > 0) {";
$codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
if ($saascode) {
if(!empty($saascode[1]))
$codex .= "\n \$csql->where('{$saascode[0]}', \$rsuser['{$saascode[1]}']);";
if ($saasfield) {
if (!empty($saasusr))
$codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
}
$codex .= "\n \$csql->where('id', \$id);";
$codex .= "\n \$datarow = \$db->getone(\$csql);";
@ -447,9 +452,9 @@ function code_pc_php($post) {
$codex .= "\n }";
} else {
$codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
if ($saascode) {
if(!empty($saascode[1]))
$codex .= "\n \$csql->where('{$saascode[0]}', \$rsuser['{$saascode[1]}']);";
if ($saasfield) {
if (!empty($saasusr))
$codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
}
$codex .= "\n \$csql->where('id', \$id);";
$codex .= "\n \$datarow = \$db->getone(\$csql);";
@ -466,9 +471,9 @@ function code_pc_php($post) {
}
if (count($dups) > 0) {
$codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
if ($saascode){
if(!empty($saascode[1]))
$codex .= "\n \$csql->where('{$saascode[0]}', \$rsuser['{$saascode[1]}']);";
if ($saasfield) {
if (!empty($saasusr))
$codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
}
foreach ($dups as $dup) {
$codex .= "\n \$csql->where('{$dup}', \${$dup});";
@ -481,7 +486,7 @@ function code_pc_php($post) {
$codex .= "\n \$updata = array();";
foreach ($flds as $fld) {
$col = $fld['col'];
if($col == 'id' || $col == 'addtimes')
if ($col == 'id' || $col == 'addtimes')
continue;
// if($col == 'auditstatus' || $col == 'audittimes' || $col == 'audituser' || $col == 'auditmsg')
// continue;
@ -503,7 +508,7 @@ function code_pc_php($post) {
} else
$codex .= "\n \$updata['{$col}'] = \${$col};";
}
$codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
$codex .= "\n \$csql = new \ciy\sql('{$tabname}'); //auto";
if ($hasadd) {
$codex .= "\n if (\$id > 0) {";
$codex .= "\n \$csql->where('id', \$id);";
@ -512,18 +517,16 @@ function code_pc_php($post) {
$codex .= "\n } else {";
foreach ($flds as $fld) {
$col = $fld['col'];
if ($col == 'id'){
}else if ($fld['set']['noup'] == 'no') {
if($fld['type'] == 'int' || $fld['type'] == 'bigint')
if ($col == 'id') {
} else if ($fld['set']['noup'] == 'no') {
if ($fld['type'] == 'int' || $fld['type'] == 'bigint')
$codex .= "\n \$updata['{$col}'] = 0;";
else
$codex .= "\n \$updata['{$col}'] = '';";
} else if ($saascode && $col == $saascode[0]){
if(!empty($saascode[1]))
$codex .= "\n \$updata['{$col}'] = \$rsuser['{$saascode[1]}'];";
}
else if ($col == 'addtimes')
} else if ($saasfield) {
if (!empty($saasusr))
$codex .= "\n \$updata['{$col}'] = \$rsuser['{$saasusr}'];";
} else if ($col == 'addtimes')
$codex .= "\n \$updata['{$col}'] = tostamp();";
else if ($col == 'auditstatus')
$codex .= "\n \$updata['{$col}'] = 20;";
@ -549,19 +552,27 @@ function code_pc_php($post) {
$codex .= "\n return errjson(\$ex->getMessage());";
$codex .= "\n }";
$codex .= "\n \$ret['data'] = \$updata;";
$rels = array();
foreach ($flds as $fld) {
if ($saascode && $saascode[0] == $fld['col'])
if ($saasfield == $fld['col'])
continue;
$cate = $fld['cate'];
if ($cate == 'DB' || $cate == 'CATU' || $cate == 'CATS' || $cate == 'CATM') {
if (isset($fld['set']['listload']) && $fld['set']['listload'] == 'rel') {
list($dicttype, $dictname) = splitdict($fld['data']);
if ($dicttype == 'dictdb') {
$codex .= "\n \$ret['{$dictname}'] = getrelation(\$db, [\$updata], '{$dictname}', '{$fld['col']}');";
if (isset($rels[$dictname]))
$rels[$dictname][] = $fld['col'];
else
$rels[$dictname] = array($fld['col']);
}
}
}
}
foreach ($rels as $dictname => $cols) {
$colsn = implode(',', $cols);
$codex .= "\n \$ret['{$dictname}'] = getrelation(\$db, [\$updata], '{$dictname}', '{$colsn}');";
}
$codex .= "\n return succjson(\$ret);";
// $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
// $codex .= "\n \$csql->where('id', \$id);";
@ -584,9 +595,9 @@ function code_pc_php($post) {
$codex .= "\n if (empty(\$ids))";
$codex .= "\n return errjson('请选择至少一条');";
$codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
if ($saascode){
if(!empty($saascode[1]))
$codex .= "\n \$csql->where('{$saascode[0]}', \$rsuser['{$saascode[1]}']);";
if ($saasfield) {
if (!empty($saasusr))
$codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
}
$codex .= "\n \$csql->where('id in', \$ids);";
$codex .= "\n \$rows = \$db->get(\$csql);";
@ -639,9 +650,9 @@ function code_pc_php($post) {
}
}
$codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
if ($saascode){
if(!empty($saascode[1]))
$codex .= "\n \$csql->where('{$saascode[0]}', \$rsuser['{$saascode[1]}']);";
if ($saasfield) {
if (!empty($saasusr))
$codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
}
$codex .= "\n \$csql->where('id in', \$ids);";
$codex .= "\n \$rows = \$db->get(\$csql);";
@ -649,8 +660,8 @@ function code_pc_php($post) {
$codex .= "\n try {";
$codex .= "\n \$db->begin();";
$codex .= "\n foreach (\$rows as \$row) {";
$codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
$codex .= "\n \$csql->where('id', \$row['id']);";
$codex .= "\n if (\$auditstatus == 100) {";
$codex .= "\n }";
$codex .= "\n \$updata = array();";
foreach ($flds as $fld) {
$col = $fld['col'];
@ -668,8 +679,6 @@ function code_pc_php($post) {
$codex .= "\n if (\$db->update(\$csql, \$updata) === false)";
$codex .= "\n throw new \Exception('审核失败:' . \$db->error);";
$codex .= "\n \$ids[] = \$row['id'];";
$codex .= "\n if (\$auditstatus == 100) {";
$codex .= "\n }";
$codex .= "\n }";
$codex .= "\n \$db->commit();";
$codex .= "\n } catch (\Exception \$ex) {";
@ -685,7 +694,7 @@ function code_pc_php($post) {
if ($chk_multistatus) {
$codex .= "\n";
$codex .= "\n public static function json_multistatus() {";
$codex .= "\n public static function json_multi_status() {";
$codex .= "\n global \$db;";
if ($verifyfunc) {
$codex .= "\n \$rsuser = {$verifyfunc}();";
@ -698,9 +707,9 @@ function code_pc_php($post) {
$codex .= "\n if (empty(\$ids))";
$codex .= "\n return errjson('请选择至少一条');";
$codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
if ($saascode){
if(!empty($saascode[1]))
$codex .= "\n \$csql->where('{$saascode[0]}', \$rsuser['{$saascode[1]}']);";
if ($saasfield) {
if (!empty($saasusr))
$codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
}
$codex .= "\n \$csql->where('id in', \$ids);";
$codex .= "\n \$rows = \$db->get(\$csql);";
@ -708,8 +717,6 @@ function code_pc_php($post) {
$codex .= "\n try {";
$codex .= "\n \$db->begin();";
$codex .= "\n foreach (\$rows as \$row) {";
$codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
$codex .= "\n \$csql->where('id', \$row['id']);";
$codex .= "\n \$updata = array();";
$codex .= "\n \$updata['status'] = \$status;";
$codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
@ -747,7 +754,7 @@ function code_pc_php($post) {
foreach ($flds as $fld) {
if (!$fld['bout'])
continue;
if ($saascode && $saascode[0] == $fld['col'])
if ($saasfield == $fld['col'])
continue;
$col = $fld['col'];
$name = $fld['name'];
@ -767,7 +774,7 @@ function code_pc_php($post) {
foreach ($flds as $fld) {
if (!$fld['bout'])
continue;
if ($saascode && $saascode[0] == $fld['col'])
if ($saasfield == $fld['col'])
continue;
$col = $fld['col'];
$cate = $fld['cate'];
@ -802,7 +809,7 @@ function code_pc_php($post) {
foreach ($flds as $fld) {
if ($fld['col'] != 'id' && !$fld['bout'])
continue;
if ($saascode && $saascode[0] == $fld['col'])
if ($saasfield == $fld['col'])
continue;
$col = $fld['col'];
$cate = $fld['cate'];
@ -830,6 +837,9 @@ function code_pc_php($post) {
} else if ($cate == 'WCNY') {
$codex .= "\n if (\$field == '{$col}')";
$codex .= "\n \$val = number_format(\$val / 1000000, 3) . '万元';";
} else if ($cate == 'MCNY') {
$codex .= "\n if (\$field == '{$col}')";
$codex .= "\n \$val = number_format(\$val / 10000, 4) . '元';";
} else if ($cate == 'BOOL') {
$codex .= "\n if (\$field == '{$col}')";
$codex .= "\n \$val = (\$val == 1 ? \$code_{$col}[0]['name'] : @\$code_{$col}[1]['name']);";
@ -1276,9 +1286,9 @@ function code_pc_php($post) {
}
if (count($dups) > 0) {
$codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
if ($saascode){
if(!empty($saascode[1]))
$codex .= "\n \$csql->where('{$saascode[0]}', \$rsuser['{$saascode[1]}']);";
if ($saasfield) {
if (!empty($saasusr))
$codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
}
foreach ($dups as $dup) {
$codex .= "\n \$csql->where('{$dup}', \${$dup});";
@ -1301,9 +1311,9 @@ function code_pc_php($post) {
$codex .= "\n if (\$id == 0) {";
foreach ($flds as $fld) {
$col = $fld['col'];
if ($saascode && $col == $saascode[0]){
if(!empty($saascode[1]))
$codex .= "\n \$updata['{$col}'] = \$rsuser['{$saascode[1]}'];";
if ($col == $saasfield) {
if (!empty($saasusr))
$codex .= "\n \$updata['{$col}'] = \$rsuser['{$saasusr}'];";
}
if ($col == 'addtimes')
$codex .= "\n \$updata['{$col}'] = tostamp();";

View File

@ -54,6 +54,35 @@
<input type="text" name="subpath" style="width:100%;" />
</div>
</div>
<div class="ciy-form col-24 col-sm-24">
<label class="lang">认证函数</label>
<div>
<input type="text" name="verifyfunc" style="width:100%;" />
</div>
</div>
<div class="ciy-form col-24 col-sm-24">
<label class="lang">字典表</label>
<div>
<input type="text" name="codetable" style="width:100%;" />
</div>
</div>
<div class="ciy-form col-24 col-sm-24">
<label class="lang">SaaS字段</label>
<div>
<input type="text" name="saasfield" style="width:100%;" />
</div>
</div>
<div class="ciy-form col-24 col-sm-24">
<label class="lang">SaaS用户标识</label>
<div>
<input type="text" name="saasusr" style="width:100%;" />
</div>
</div>
<div class="ciy-tip">
多SaaS模式下字段相同但用户SaaS标识不同
<br/>简单SaaS系统用户SaaS标识一般与字段名称相同
<br/>例如: SaaS字段:orgid、用户标识:saas_a
</div>
</div>
</div>
<script type="text/javascript" src="/jscss/ciy.js"></script>
@ -70,6 +99,7 @@
dom: '.table'
, url: 'list'
, pagecount: 10
, chkbox: true
, fn_beforedata: function (json) {
ciyfn.fillsearch({
searchdom: '.search'
@ -80,8 +110,8 @@
, fn_tdcontent: function (key, datashow, field, data) {
if (key == '_btn') {
var html = '';
html += `<a class="lang btn" onclick="menubtn(this, 'edit')">修改</a>`;
html += `<a class="lang btn succ" onclick="menubtn(this, 'table')">数据表</a>`;
html += `<a class="lang btn" onclick="menubtn(this, 'edit')" onmousedown="event.stopPropagation()">修改</a>`;
html += `<a class="lang btn succ" onclick="menubtn(this, 'table')" onmousedown="event.stopPropagation()">数据表</a>`;
return html;
}
}
@ -121,6 +151,10 @@
$5('[name=name]', dom).val(dat.name);
ciycmp({ dom: $5('[com=schem]', dom), value: dat.schem, range: jsndat.schema });
$5('[name=subpath]', dom).val(dat.subpath);
$5('[name=verifyfunc]', dom).val(dat.verifyfunc);
$5('[name=codetable]', dom).val(dat.codetable);
$5('[name=saasfield]', dom).val(dat.saasfield);
$5('[name=saasusr]', dom).val(dat.saasusr);
}
, cb: function (opn) {
if (opn.btn == "关闭")

View File

@ -22,7 +22,7 @@ class code_saas {
$csql->limit($pageno, $pagecount);
$mainrowcount = $post->getint('count');
$rows = $db->get($csql, $mainrowcount);
if($rows === false)
if ($rows === false)
return errjson($db->error);
$ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
if ($post->getbool('field')) {
@ -77,6 +77,14 @@ class code_saas {
$name = $post->get('name');
$schem = $post->get('schem');
$subpath = $post->get('subpath');
$verifyfunc = $post->get('verifyfunc');
$codetable = $post->get('codetable');
$saasfield = $post->get('saasfield');
$saasusr = $post->get('saasusr');
if (strpos($subpath, '\\') === false)
return errjson('相对路径需反斜杠\\');
if (dirmake(PATH_WEB . $subpath) === false)
return errjson('创建目录失败');
$datarow = null;
if ($id > 0) {
$csql = new \ciy\sql('zc_dev_dbsaas');
@ -85,12 +93,17 @@ class code_saas {
if (!is_array($datarow))
return errjson('数据不存在');
}
try {
$db->begin();
$updata = array();
$updata['name'] = $name;
$updata['schem'] = $schem;
$updata['subpath'] = $subpath;
$updata['verifyfunc'] = $verifyfunc;
$updata['codetable'] = $codetable;
$updata['saasfield'] = $saasfield;
$updata['saasusr'] = $saasusr;
$csql = new \ciy\sql('zc_dev_dbsaas');
if ($id > 0) {
$csql->where('id', $id);

View File

@ -7,6 +7,7 @@ class login {
global $db;
global $_token;
$post = new \ciy\post();
$model = $post->get('model');
$user = $post->get('user');
if (empty($user))
return errjson('请填写用户名');
@ -66,7 +67,7 @@ class login {
if ($db->update($csql, $updata) === false)
return errjson('user数据库更新失败:' . $db->error);
savelog($db, $rsuser['id'], 'LOGIN', '登录成功');
self::saveluser($db, 1, $rsuser['id'], $model);
return self::getsync($rsuser, $oid, $sid);
}
public static function json_restorage() {
@ -129,8 +130,19 @@ class login {
$csql = new \ciy\sql('zc_online');
$csql->where('id', $rsuser['_o']);
$db->delete($csql);
self::saveluser($db, 2, $rsuser['id']);
}
savelog($db, toint(@$rsuser['id']), 'LOGIN', '退出登录');
return succjson();
}
private static function saveluser($db, $isinout, $userid, $model = '') {
$updata = array();
$updata['isinout'] = $isinout;
$updata['loguser'] = $userid;
$updata['addtimes'] = tostamp();
$updata['ip'] = getip();
$updata['model'] = $model;
$csql = new \ciy\sql('zc_luser');
$db->insert($csql, $updata);
return false;
}
}

View File

@ -87,7 +87,7 @@
<div class="char4 row">
<div class="ciy-form col-24 col-sm-8">
<div>
<ciy-upload path="{Y}/{m}{d}/avar" showwh="13em" com="icon" num="1" type="jpg,png" zipjpg="0.7" imgwidth="400" imgheight="400" zipext="jpg" style="justify-content: center;" />
<ciy-upload path="{Y}/{m}{d}/avar" showwh="13em" com="icon" num="1" type="jpg,png,webp" zipjpg="0.7" imgwidth="400" imgheight="400" zipext="jpg" style="justify-content: center;" />
</div>
</div>
<div class="ciy-form col-24 col-sm-8">

View File

@ -129,7 +129,7 @@
return '<input style="width:100%;" onkeydown="btnset(this)" type="text" name="' + key + '" value="' + datashow + '"/>';
}
if (key == 'isuse') {
return '<ciy-switch com="' + key + '" value="' + data[key] + '" y="启用" n="停用" />';
return '<ciy-switch com="' + key + '" value="' + data[key] + '" y="可选" n="显示" />';
}
if (key == '_btn') {
var html = '';

View File

@ -46,7 +46,7 @@ class cata {
$fshow = fieldadd($fshow, $field, -1, 'codeid', '代码|');
if (!empty($ext))
$fshow = fieldadd($fshow, $field, -1, 'extdata', $ext);
$fshow = fieldadd($fshow, $field, -1, 'isuse', '启用');
$fshow = fieldadd($fshow, $field, -1, 'isuse', '行为');
$fshow = fieldadd($fshow, $field, -1, 'csort', '排序|');
$fshow = fieldadd($fshow, $field, -1, 'clas', '样式');
$fshow = fieldadd($fshow, $field, -1, '_btn', '操作');
@ -226,9 +226,9 @@ class cata {
$cnt = 0;
try {
$db->begin();
if (count($codes) == 1 && strpos($code, ',') !== false && strpos($code, '.') !== false) {
//订单状态,TINT,1:创建订单.10:支付成功.20:评价
$codes = explode('.', $code);
if (count($codes) == 1 && strpos($code, ',') !== false && strpos($code, ':') !== false) {
//订单状态,TINT,1:创建订单,10:支付成功,20:评价
$codes = explode(',', $code);
foreach ($codes as $c) {
$cs = explode(':', $c);
if (count($cs) < 2)

View File

@ -85,7 +85,7 @@ func Funcslow_del(w http.ResponseWriter, r *http.Request) bool {
if userid == 0 {
return false
}
if admin.Nopower(c.CiyDB, userid, "p555d") {
if admin.Nopower(c.CiyDB, userid, "p556d") {
return c.ErrJSON(w, "您未被授权操作")
}
ids := post.Get("ids")
@ -122,7 +122,7 @@ func Funcslow_exportxls(w http.ResponseWriter, r *http.Request) bool {
if userid == 0 {
return false
}
if admin.Nopower(c.CiyDB, userid, "p555e") {
if admin.Nopower(c.CiyDB, userid, "p556e") {
return c.ErrJSON(w, "您未被授权操作")
}
_, csql := funcslow_setwhere(post)

View File

@ -59,7 +59,7 @@ class funcslow {
global $db;
$rsuser = verifyfast();
if (nopower($db, $rsuser['id'], 'p555d'))
if (nopower($db, $rsuser['id'], 'p556d'))
return errjson('您未被授权操作');
$post = new \ciy\post();
@ -94,7 +94,7 @@ class funcslow {
global $db;
$rsuser = verifyfast();
if (nopower($db, $rsuser['id'], 'p555e'))
if (nopower($db, $rsuser['id'], 'p556e'))
return errjson('您未被授权操作');
$post = new \ciy\post();
list($where, $csql) = self::setwhere($db, $post);

View File

@ -20,7 +20,7 @@ class logfile {
global $db;
global $logpath;
$rsuser = verifyfast();
if (nopower($db, $rsuser['id'], 'p554d'))
if (nopower($db, $rsuser['id'], 'p555d'))
return errjson('您未被授权操作');
$post = new \ciy\post();
$param = $post->get('param');

110
web/admin/rigger/luser.go Normal file
View File

@ -0,0 +1,110 @@
package rigger
import (
"net/http"
"ciyon/web/admin"
c "ciyon/zciyon"
)
func luser_setwhere(post *c.CiyPost) (map[string]any, *c.CiySQL) {
query := post.Getobj("query")
csql := c.NewCiySQL("zc_luser")
liid := c.Getint(query, "liid")
if liid > 0 {
csql.Where("isinout", liid)
}
csql.Where("loguser", c.Getstr(query, "loguser"))
csql.Where_daterange("addtimes", c.Getstr(query, "addtimes"))
csql.Where("model like", c.Getstr(query, "model"))
order := c.Getstr(query, "order", "id desc")
csql.Order(order)
query["order"] = order
return query, csql
}
func Luser_init(w http.ResponseWriter, r *http.Request) bool {
post := c.NewCiyPost(w, r)
_, userid := admin.Verifyfast(r, c.CiyDB, post)
if userid == 0 {
return false
}
where, csql := luser_setwhere(post)
pageno := post.Getint("pageno", 1)
pagecount := post.Getint("pagecount", 10)
csql.Limit(pageno, pagecount)
rows, mainrowcount, err := c.CiyDB.Get(csql, post.Getint("count"))
if err != nil {
return c.ErrJSON(w, "读取错误", err)
}
ret := map[string]any{}
ret["where"] = where
ret["pageno"] = pageno
ret["pagecount"] = pagecount
ret["count"] = mainrowcount
ret["list"] = rows
if post.Getbool("field") {
field, fshow := c.CiyDB.GetField(csql)
ret["fshow"] = fshow
ret["field"] = field
}
if post.Getbool("once") {
once := map[string]any{}
input := make([]map[string]any, 0)
input = append(input, map[string]any{
"form": "loguser",
"type": "select",
"name": "操作人",
"prop": ` style="min-width:6em;"`,
"select": "adminuser",
"all": "全部",
})
input = append(input, map[string]any{
"form": "addtimes",
"type": "daterange",
"name": "发生日期",
})
input = append(input, map[string]any{
"form": "model",
"type": "input",
"name": "设备指纹",
})
once["input"] = input
ret["once"] = once
}
return c.SuccJSON(w, r, ret)
}
func Luser_del(w http.ResponseWriter, r *http.Request) bool {
post := c.NewCiyPost(w, r)
_, userid := admin.Verifyfast(r, c.CiyDB, post)
if userid == 0 {
return false
}
if admin.Nopower(c.CiyDB, userid, "p554d") {
return c.ErrJSON(w, "您未被授权操作")
}
ids := post.Get("ids")
if ids == "" {
return c.ErrJSON(w, "请选择至少一条")
}
csql := c.NewCiySQL("zc_luser")
csql.Where("id in", ids)
rows, _, err := c.CiyDB.Get(csql)
if err != nil {
return c.ErrJSON(w, "读取数据错误", err)
}
vids := make([]int, 0)
err = c.CiyDB.Tran(func() error {
for _, row := range rows {
delid := c.Toint(row["id"])
c.Delme(c.CiyDB, delid, "zc_luser")
vids = append(vids, delid)
}
return nil
})
if err != nil {
return c.ErrJSON(w, "事务"+err.Error())
}
ret := map[string]any{}
ret["ids"] = vids
return c.SuccJSON(w, r, ret)
}

View File

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<link href="/jscss/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="/jscss/theme.js"></script>
</head>
<body>
<div class="container">
<form class="search" onsubmit="table.search(this,'btn');return false;">
<ul></ul>
<div>
<div class="sinps"></div>
<div class="sbtns">
<button class="lang btn" type="submit">查询</button>
</div>
</div>
</form>
<div class="table">
<div class="loading col-24">Loading...</div>
<div class="list"></div>
<div>
<div class="btmbtn">
<a class="lang btn def" onclick="ciyfn.select_all(table)">全选</a>
<a class="lang btn def" onclick="ciyfn.select_diff(table)">反选</a>
|
<a class="lang btn dag" onclick="ciyfn.select_callfunc(table, this,'del','已选{n}条,是否批量删除?',{},function(json){table.delline(json)})">批量删除</a>
</div>
<div class="page"></div>
</div>
</div>
</div>
<script type="text/javascript" src="/jscss/ciy.js"></script>
<script type="text/javascript" src="/jscss/ciycmp.js"></script>
<script type="text/javascript" src="/jscss/ciytable.js"></script>
<script type="text/javascript" src="../common.js"></script>
<script type="text/javascript">
'use strict';
var table;
var Glob = {};
ciyfn.pageload(function () {
table = new ciyclass.table({
dom: '.table'
, url: 'init'
, pagecount: 10
, fn_beforedata: function (json) {
ciyfn.fillsearch({
searchdom: '.search'
, data: json
, liall: '全部'
, lidata: [{ id: 1, name: '登入' }, { id: 2, name: '登出' }]
, liclick: function (dom) {
table.search(dom, 'li');
}
});
return json;
}
, fn_tdcontent: function (key, datashow, field, data) {
}
});
table.callpage(1);
});
</script>
</body>
</html>

View File

@ -0,0 +1,95 @@
<?php
namespace web\admin\rigger;
class luser {
static function setwhere($db, $post) {
$query = $post->get('query');
$csql = new \ciy\sql('zc_luser');
$liid = objint($query, 'liid');
if ($liid > 0)
$csql->where('isinout', $liid);
$csql->where('loguser', objstr($query, 'loguser'));
$csql->where('model like', objstr($query, 'model'));
$csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
$order = objstr($query, 'order', 'id desc');
$csql->order($order);
$query['order'] = $order;
return [$query, $csql];
}
public static function json_init() {
global $db;
$rsuser = verifyfast();
$post = new \ciy\post();
list($where, $csql) = self::setwhere($db, $post);
$pageno = $post->getint('pageno', 1);
$pagecount = $post->getint('pagecount', 10);
$csql->limit($pageno, $pagecount);
$mainrowcount = $post->getint('count');
$rows = $db->get($csql, $mainrowcount);
$ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
if ($post->getbool('field')) {
$field = array();
$fshow = $db->getfield($field, 'zc_luser');
$ret['field'] = $field;
$ret['fshow'] = $fshow;
}
if ($post->getbool('once')) {
$ret['once'] = array();
$input = array();
$input[] = array(
'type' => 'select',
'form' => 'loguser',
'name' => '操作人',
'prop' => ' style="min-width:6em;"',
'select' => 'adminuser',
'all' => '全部'
);
$input[] = array(
'type' => 'daterange',
'form' => 'addtimes',
'name' => '发生日期'
);
$input[] = array(
'type' => 'input',
'form' => 'model',
'name' => '设备指纹',
);
$ret['once']['input'] = $input;
}
return succjson($ret);
}
public static function json_del() {
global $db;
$rsuser = verifyfast();
if (nopower($db, $rsuser['id'], 'p554d'))
return errjson('您未被授权操作');
$post = new \ciy\post();
$ids = $post->get('ids');
if (empty($ids))
return errjson('请选择至少一条');
$csql = new \ciy\sql('zc_luser');
$csql->where('id in', $ids);
$rows = $db->get($csql);
$vids = array();
try {
$db->begin();
foreach ($rows as $row) {
$delid = $row['id'];
delme($db, $delid, 'zc_luser');
$vids[] = $delid;
}
$db->commit();
} catch (\Exception $ex) {
$db->rollback();
savelogfile('err_db', $ex->getMessage());
return errjson($ex->getMessage());
}
$ret['ids'] = $vids;
return succjson($ret);
}
}

288
web/ambap/ai.php Normal file
View File

@ -0,0 +1,288 @@
<?php
namespace web\ambap;
class ai {
public static function json_rawai($param = null, $debug = false) {
global $db;
$post = new \ciy\post($param);
$aikey = $post->getint('aikey');
$aikeyrow = null;
if ($aikey > 0) {
$csql = new \ciy\sql('zc_ai_key');
$csql->where('id', $aikey);
$aikeyrow = $db->getone($csql);
if (!is_array($aikeyrow))
return errjson('AI Key不存在');
}
if (!is_array($aikeyrow)) {
$csql = new \ciy\sql('zc_ai_key');
$csql->where('id', 1);
$aikeyrow = $db->getone($csql);
if (!is_array($aikeyrow))
return errjson('AI Key未设置');
}
$system = $post->get('system');
$chat = $post->get('chat');
if (empty($chat))
return errjson('请输入聊天内容');
$openai = new \ciy\openai($aikeyrow);
$openai->debug($debug);
$openai->setparam($post->get('aiprange'));
$openai->newsystem($system);
$retai = $openai->completion($chat, strpos($chat . $system, 'JSON') !== false);
if (is_string($retai))
return errjson($retai);
$ret['ai'] = $retai;
return succjson($ret);
}
public static function json_aidecision($param = null, $debug = false) {
global $db;
set_time_limit(0);
$timespan = time();
$post = new \ciy\post($param);
$id = $post->getint('id');
$csql = new \ciy\sql('zc_ai_decision');
$csql->where('id', $id);
$decisionrow = $db->getone($csql);
if (!is_array($decisionrow))
return errjson('AI决策单元不存在');
$csql = new \ciy\sql('zc_ai_key');
$csql->where('id', $decisionrow['aikey']);
$aikeyrow = $db->getone($csql);
if (!is_array($aikeyrow))
return errjson('AI Key未设置');
$funcdatarows = null;
if (!empty($decisionrow['funcids'])) {
$csql = new \ciy\sql('zc_ai_funcdata');
$csql->where('id in', trim($decisionrow['funcids'], ','));
$funcdatarows = $db->get($csql);
}
if (strpos($decisionrow['sysprompt'] . $decisionrow['roleprompt'], '{{know.') === false) {
$csql = new \ciy\sql('zc_ai_knowcata');
$knowcatarows = $db->get($csql);
if (count($knowcatarows) > 0) {
if ($funcdatarows == null)
$funcdatarows = array();
$descs = '';
foreach ($knowcatarows as $knowcatarow) {
$descs .= "\n{知识库ID:" . $knowcatarow['id'] . ", " . $knowcatarow['name'] . ',' . $knowcatarow['aiguide'] . '}';
}
$funcdatarows[] = array(
'id' => 0,
'name' => 'know',
'funcname' => 'know',
'descs' => '如果需要补充学习专业知识库信息,调用该函数。知识库列表有,' . $descs,
'paramjson' => '*ID=准确的知识库ID',
'funcparam' => ''
);
}
}
$csql = new \ciy\sql('zc_ai_key');
$csql->where('id', $decisionrow['aikey']);
$aikeyrow = $db->getone($csql);
if (!is_array($aikeyrow))
return errjson('AI Key不存在');
$system = preg_replace_callback('/\{\{([^}]+)\}\}/', function ($matches) use ($db, $post) {
$key = $matches[1];
if (substr($key, 0, 5) == 'know.') {
$knowcataname = substr($key, 5);
$csql = new \ciy\sql('zc_ai_knowcata');
$csql->where('name', $knowcataname);
$knowcatarow = $db->getone($csql);
if (!is_array($knowcatarow))
return '';
$csql = new \ciy\sql('zc_ai_knowledge');
$csql->where('cataid', $knowcatarow['id']);
$knowrows = $db->get($csql);
$knowstr = '';
foreach ($knowrows as $knowrow) {
$knowstr .= $knowrow['content'] . "\n";
}
return $knowstr;
}
$val = $post->get($key);
if (is_array($val))
$val = json_encode($val, JSON_UNESCAPED_UNICODE);
return $val . '';
}, $decisionrow['sysprompt']);
$roleprompt = preg_replace_callback('/\{\{([^}]+)\}\}/', function ($matches) use ($db, $post) {
$key = $matches[1];
if (substr($key, 0, 5) == 'know.') {
$knowcataname = substr($key, 5);
$csql = new \ciy\sql('zc_ai_knowcata');
$csql->where('name', $knowcataname);
$knowcatarow = $db->getone($csql);
if (!is_array($knowcatarow))
return '';
$csql = new \ciy\sql('zc_ai_knowledge');
$csql->where('cataid', $knowcatarow['id']);
$knowrows = $db->get($csql);
$knowstr = '';
foreach ($knowrows as $knowrow) {
$knowstr .= $knowrow['content'] . "\n";
}
return $knowstr;
}
$val = $post->get($key);
if (is_array($val))
$val = json_encode($val, JSON_UNESCAPED_UNICODE);
return $val . '';
}, $decisionrow['roleprompt']);
$openai = new \ciy\openai($aikeyrow);
$openai->debug($debug);
$openai->setparam($decisionrow['aiprange']);
$openai->newsystem($system);
$retai = $openai->completion($roleprompt, strpos($roleprompt . $system, 'JSON') !== false, $funcdatarows, function ($funcarray) use ($funcdatarows) {
$funcdatarow = ccode($funcdatarows, substr($funcarray['name'], 1), 'id', null);
if (!is_array($funcdatarow))
return 'ERR未定义函数:' . $funcarray['name'];
$funcname = $funcdatarow['funcname'];
if ($funcname[0] != '\\')
$funcname = '\\web\\admin\\aifunc\\' . $funcname;
if (!class_exists($funcname))
return 'ERR无效类:' . $funcname;
if (!method_exists($funcname, 'main'))
return 'ERR无效函数:' . $funcname . '::main';
$funcname .= '::main';
$arguments = json_decode($funcarray['arguments'], true);
$funcparams = getstrparam($funcdatarow['funcparam'], "\n");
foreach ($funcparams as $key => $val) {
$arguments[$key] = $val;
}
return call_user_func($funcname, $arguments);
});
if (is_string($retai)) {
$ret = array();
$ret['sec'] = time() - $timespan + 1; //用时
$ret['ci'] = 0; //置信度
$ret['version'] = $decisionrow['version'];
if ($post->get('_more') == 'ok') {
$ret['messages'] = $openai->messages; //交互过程
$ret['roleprompt'] = $roleprompt; //提示词
$ret['system'] = $system; //角色描述
}
return errjson('AI执行失败: ' . $retai, 10, $ret);
}
$decci = 0;
$aichat = json_encode($openai->messages, JSON_UNESCAPED_UNICODE);
$resulttxt = json_encode($retai, JSON_UNESCAPED_UNICODE);
if ($decisionrow['aicalkey'] > 0 && !empty($decisionrow['calprompt'])) {
$post->post['result.ai'] = $aichat;
$post->post['result.data'] = $resulttxt;
$csql = new \ciy\sql('zc_ai_key');
$csql->where('id', $decisionrow['aicalkey']);
$aikeyrow = $db->getone($csql);
if (!is_array($aikeyrow))
return errjson('置信度 AI Key不存在');
$calprompt = preg_replace_callback('/\{\{([^}]+)\}\}/', function ($matches) use ($db, $post) {
$key = $matches[1];
if (substr($key, 0, 5) == 'know.') {
$knowcataname = substr($key, 5);
$csql = new \ciy\sql('zc_ai_knowcata');
$csql->where('name', $knowcataname);
$knowcatarow = $db->getone($csql);
if (!is_array($knowcatarow))
return '';
$csql = new \ciy\sql('zc_ai_knowledge');
$csql->where('cataid', $knowcatarow['id']);
$knowrows = $db->get($csql);
$knowstr = '';
foreach ($knowrows as $knowrow) {
$knowstr .= $knowrow['content'] . "\n";
}
return $knowstr;
}
$val = $post->get($key);
if (is_array($val))
$val = json_encode($val, JSON_UNESCAPED_UNICODE);
return $val . '';
}, $decisionrow['calprompt']);
$openai = new \ciy\openai($aikeyrow);
$openai->debug($debug);
$openai->setparam($decisionrow['aicalprange']);
$openai->newsystem();
$retcalai = $openai->completion($calprompt, true);
$decci = (int)$retcalai['confidence'];
} else if ($decisionrow['aicalkey'] == 0 && !empty($decisionrow['aicalfunc'])) {
$funcname = $decisionrow['aicalfunc'];
if ($funcname[0] != '\\')
$funcname = '\\web\\admin\\aifunc\\' . $funcname;
if (!class_exists($funcname))
return errjson('置信度 无效类:' . $funcname);
if (!method_exists($funcname, 'main'))
return errjson('置信度 无效函数:' . $funcname . '::main');
$funcname .= '::main';
$decci = call_user_func($funcname, $retai, $decisionrow['calprompt']);
}
$ret['sec'] = time() - $timespan + 1; //用时
$ret['ci'] = $decci; //置信度
$ret['ai'] = $retai; //结果
$ret['version'] = $decisionrow['version'];
if ($post->get('_more') == 'ok') {
$ret['messages'] = $openai->messages; //交互过程
$ret['roleprompt'] = $roleprompt; //提示词
$ret['system'] = $system; //角色描述
}
return succjson($ret);
}
public static function multiparam($input, $sep) {
$len = strlen($input);
$ips = array();
$i = 0;
$inMultiline = false;
$currentParam = '';
$currentValue = '';
while ($i < $len) {
if (!$inMultiline) {
$paramStart = $i;
while ($i < $len && $input[$i] !== $sep) {
if ($input[$i] === "\n")
return '参数格式不合法';
$i++;
}
if ($i == $len)
return '参数格式不合法,应用' . $sep . '号分隔';
$currentParam = trim(substr($input, $paramStart, $i - $paramStart));
if (empty($currentParam))
return '参数没有参数名';
$i++;
if ($i < $len && $input[$i] === '`') {
$inMultiline = true;
$i++;
$currentValue = '';
} else {
$valueStart = $i;
while ($i < $len && $input[$i] !== "\n")
$i++;
$currentValue = trim(substr($input, $valueStart, $i - $valueStart));
$ips[] = $currentParam . $sep . $currentValue;
$i++;
}
} else {
$valueStart = $i;
while ($i < $len && $input[$i] !== '`')
$i++;
$currentValue .= trim(substr($input, $valueStart, $i - $valueStart));
if ($i < $len && $input[$i] === '`') {
$ips[] = $currentParam . $sep . $currentValue;
$inMultiline = false;
$i++;
if ($i < $len && $input[$i] === "\n") {
$i++;
}
} else {
$ips[] = $currentParam . $sep . $currentValue;
break;
}
}
}
if (count($ips) == 0)
return '参数都不符合条件';
return $ips;
}
}

View File

@ -103,6 +103,7 @@ class login {
$rsuser['password'] = $pass;
$rsuser['myinvmoney'] = 0;
$rsuser['mycashmoney'] = 0;
$rsuser['mybondmoney'] = 0;
$rsuser['mypnt'] = 0;
$rsuser['trytime'] = 0;
$rsuser['logintimes'] = tostamp();
@ -176,6 +177,7 @@ class login {
$rsuser['userlevel'] = 10;
$rsuser['myinvmoney'] = 0;
$rsuser['mycashmoney'] = 0;
$rsuser['mybondmoney'] = 0;
$rsuser['mypnt'] = $newpnt;
$rsuser['logintimes'] = time();
$rsuser['wxminakey'] = $sskey;
@ -356,6 +358,7 @@ class login {
$ret['me']['userlevel'] = $userrow['userlevel'];
$ret['me']['myinvmoney'] = $userrow['myinvmoney'];
$ret['me']['mycashmoney'] = $userrow['mycashmoney'];
$ret['me']['mybondmoney'] = $userrow['mybondmoney'];
$ret['me']['mypnt'] = $userrow['mypnt'];
$ret['me']['certs'] = $userrow['certs'];
$ret['me']['needpass'] = empty($userrow['password']);

View File

@ -523,6 +523,10 @@ class me {
$cash = $post->getint('cash') * 100;
if ($rsuser['mycashmoney'] < $cash)
return errjson('余额不足');
if ($rsuser['mybondmoney'] > 0) {
if ($rsuser['mycashmoney'] - $rsuser['mybondmoney'] < $cash)
return errjson('余额不足,保证金不能直接提现,请先退保证金');
}
$cashtype = 1;
$csql = new \ciy\sql('ap_usr_ext');
$csql->where('id', $rsuser['id']);
@ -767,7 +771,7 @@ class me {
$rsuser = verifyfast();
$csql = new \ciy\sql('ap_user');
$csql->where('id', $rsuser['id']);
$csql->column('myinvmoney,mycashmoney,mypnt');
$csql->column('myinvmoney,mycashmoney,mybondmoney,mypnt');
$ret['user'] = $db->getone($csql);
return succjson($ret);
}
@ -776,7 +780,7 @@ class me {
$rsuser = verifyfast();
$csql = new \ciy\sql('ap_user');
$csql->where('id', $rsuser['id']);
$csql->column('myinvmoney,mycashmoney,mypnt');
$csql->column('myinvmoney,mycashmoney,mybondmoney,mypnt');
$ret['user'] = $db->getone($csql);
$csql = new \ciy\sql('ap_cash_out');
$csql->where('vuser', $rsuser['id']);
@ -857,9 +861,9 @@ class me {
$csql->where('vuser', $rsuser['id']);
$liid = objint($query, 'liid');
if ($liid == 1)
$csql->where('cashietype<100');
$csql->where('iemoney>0');
if ($liid == 2)
$csql->where('cashietype>=100');
$csql->where('iemoney<0');
$csql->order(objstr($query, 'order', 'id desc'));
$pageno = $post->getint('pageno', 1);
$pagecount = $post->getint('pagecount', 10);

288
web/api/ai.php Normal file
View File

@ -0,0 +1,288 @@
<?php
namespace web\api;
class ai {
public static function json_rawai($param = null, $debug = false) {
global $db;
$post = new \ciy\post($param);
$aikey = $post->getint('aikey');
$aikeyrow = null;
if ($aikey > 0) {
$csql = new \ciy\sql('zc_ai_key');
$csql->where('id', $aikey);
$aikeyrow = $db->getone($csql);
if (!is_array($aikeyrow))
return errjson('AI Key不存在');
}
if (!is_array($aikeyrow)) {
$csql = new \ciy\sql('zc_ai_key');
$csql->where('id', 1);
$aikeyrow = $db->getone($csql);
if (!is_array($aikeyrow))
return errjson('AI Key未设置');
}
$system = $post->get('system');
$chat = $post->get('chat');
if (empty($chat))
return errjson('请输入聊天内容');
$openai = new \ciy\openai($aikeyrow);
$openai->debug($debug);
$openai->setparam($post->get('aiprange'));
$openai->newsystem($system);
$retai = $openai->completion($chat, strpos($chat . $system, 'JSON') !== false);
if (is_string($retai))
return errjson($retai);
$ret['ai'] = $retai;
return succjson($ret);
}
public static function json_aidecision($param = null, $debug = false) {
global $db;
set_time_limit(0);
$timespan = time();
$post = new \ciy\post($param);
$id = $post->getint('id');
$csql = new \ciy\sql('zc_ai_decision');
$csql->where('id', $id);
$decisionrow = $db->getone($csql);
if (!is_array($decisionrow))
return errjson('AI决策单元不存在');
$csql = new \ciy\sql('zc_ai_key');
$csql->where('id', $decisionrow['aikey']);
$aikeyrow = $db->getone($csql);
if (!is_array($aikeyrow))
return errjson('AI Key未设置');
$funcdatarows = null;
if (!empty($decisionrow['funcids'])) {
$csql = new \ciy\sql('zc_ai_funcdata');
$csql->where('id in', trim($decisionrow['funcids'], ','));
$funcdatarows = $db->get($csql);
}
if (strpos($decisionrow['sysprompt'] . $decisionrow['roleprompt'], '{{know.') === false) {
$csql = new \ciy\sql('zc_ai_knowcata');
$knowcatarows = $db->get($csql);
if (count($knowcatarows) > 0) {
if ($funcdatarows == null)
$funcdatarows = array();
$descs = '';
foreach ($knowcatarows as $knowcatarow) {
$descs .= "\n{知识库ID:" . $knowcatarow['id'] . ", " . $knowcatarow['name'] . ',' . $knowcatarow['aiguide'] . '}';
}
$funcdatarows[] = array(
'id' => 0,
'name' => 'know',
'funcname' => 'know',
'descs' => '如果需要补充学习专业知识库信息,调用该函数。知识库列表有,' . $descs,
'paramjson' => '*ID=准确的知识库ID',
'funcparam' => ''
);
}
}
$csql = new \ciy\sql('zc_ai_key');
$csql->where('id', $decisionrow['aikey']);
$aikeyrow = $db->getone($csql);
if (!is_array($aikeyrow))
return errjson('AI Key不存在');
$system = preg_replace_callback('/\{\{([^}]+)\}\}/', function ($matches) use ($db, $post) {
$key = $matches[1];
if (substr($key, 0, 5) == 'know.') {
$knowcataname = substr($key, 5);
$csql = new \ciy\sql('zc_ai_knowcata');
$csql->where('name', $knowcataname);
$knowcatarow = $db->getone($csql);
if (!is_array($knowcatarow))
return '';
$csql = new \ciy\sql('zc_ai_knowledge');
$csql->where('cataid', $knowcatarow['id']);
$knowrows = $db->get($csql);
$knowstr = '';
foreach ($knowrows as $knowrow) {
$knowstr .= $knowrow['content'] . "\n";
}
return $knowstr;
}
$val = $post->get($key);
if (is_array($val))
$val = json_encode($val, JSON_UNESCAPED_UNICODE);
return $val . '';
}, $decisionrow['sysprompt']);
$roleprompt = preg_replace_callback('/\{\{([^}]+)\}\}/', function ($matches) use ($db, $post) {
$key = $matches[1];
if (substr($key, 0, 5) == 'know.') {
$knowcataname = substr($key, 5);
$csql = new \ciy\sql('zc_ai_knowcata');
$csql->where('name', $knowcataname);
$knowcatarow = $db->getone($csql);
if (!is_array($knowcatarow))
return '';
$csql = new \ciy\sql('zc_ai_knowledge');
$csql->where('cataid', $knowcatarow['id']);
$knowrows = $db->get($csql);
$knowstr = '';
foreach ($knowrows as $knowrow) {
$knowstr .= $knowrow['content'] . "\n";
}
return $knowstr;
}
$val = $post->get($key);
if (is_array($val))
$val = json_encode($val, JSON_UNESCAPED_UNICODE);
return $val . '';
}, $decisionrow['roleprompt']);
$openai = new \ciy\openai($aikeyrow);
$openai->debug($debug);
$openai->setparam($decisionrow['aiprange']);
$openai->newsystem($system);
$retai = $openai->completion($roleprompt, strpos($roleprompt . $system, 'JSON') !== false, $funcdatarows, function ($funcarray) use ($funcdatarows) {
$funcdatarow = ccode($funcdatarows, substr($funcarray['name'], 1), 'id', null);
if (!is_array($funcdatarow))
return 'ERR未定义函数:' . $funcarray['name'];
$funcname = $funcdatarow['funcname'];
if ($funcname[0] != '\\')
$funcname = '\\web\\admin\\aifunc\\' . $funcname;
if (!class_exists($funcname))
return 'ERR无效类:' . $funcname;
if (!method_exists($funcname, 'main'))
return 'ERR无效函数:' . $funcname . '::main';
$funcname .= '::main';
$arguments = json_decode($funcarray['arguments'], true);
$funcparams = getstrparam($funcdatarow['funcparam'], "\n");
foreach ($funcparams as $key => $val) {
$arguments[$key] = $val;
}
return call_user_func($funcname, $arguments);
});
if (is_string($retai)) {
$ret = array();
$ret['sec'] = time() - $timespan + 1; //用时
$ret['ci'] = 0; //置信度
$ret['version'] = $decisionrow['version'];
if ($post->get('_more') == 'ok') {
$ret['messages'] = $openai->messages; //交互过程
$ret['roleprompt'] = $roleprompt; //提示词
$ret['system'] = $system; //角色描述
}
return errjson('AI执行失败: ' . $retai, 10, $ret);
}
$decci = 0;
$aichat = json_encode($openai->messages, JSON_UNESCAPED_UNICODE);
$resulttxt = json_encode($retai, JSON_UNESCAPED_UNICODE);
if ($decisionrow['aicalkey'] > 0 && !empty($decisionrow['calprompt'])) {
$post->post['result.ai'] = $aichat;
$post->post['result.data'] = $resulttxt;
$csql = new \ciy\sql('zc_ai_key');
$csql->where('id', $decisionrow['aicalkey']);
$aikeyrow = $db->getone($csql);
if (!is_array($aikeyrow))
return errjson('置信度 AI Key不存在');
$calprompt = preg_replace_callback('/\{\{([^}]+)\}\}/', function ($matches) use ($db, $post) {
$key = $matches[1];
if (substr($key, 0, 5) == 'know.') {
$knowcataname = substr($key, 5);
$csql = new \ciy\sql('zc_ai_knowcata');
$csql->where('name', $knowcataname);
$knowcatarow = $db->getone($csql);
if (!is_array($knowcatarow))
return '';
$csql = new \ciy\sql('zc_ai_knowledge');
$csql->where('cataid', $knowcatarow['id']);
$knowrows = $db->get($csql);
$knowstr = '';
foreach ($knowrows as $knowrow) {
$knowstr .= $knowrow['content'] . "\n";
}
return $knowstr;
}
$val = $post->get($key);
if (is_array($val))
$val = json_encode($val, JSON_UNESCAPED_UNICODE);
return $val . '';
}, $decisionrow['calprompt']);
$openai = new \ciy\openai($aikeyrow);
$openai->debug($debug);
$openai->setparam($decisionrow['aicalprange']);
$openai->newsystem();
$retcalai = $openai->completion($calprompt, true);
$decci = (int)$retcalai['confidence'];
} else if ($decisionrow['aicalkey'] == 0 && !empty($decisionrow['aicalfunc'])) {
$funcname = $decisionrow['aicalfunc'];
if ($funcname[0] != '\\')
$funcname = '\\web\\admin\\aifunc\\' . $funcname;
if (!class_exists($funcname))
return errjson('置信度 无效类:' . $funcname);
if (!method_exists($funcname, 'main'))
return errjson('置信度 无效函数:' . $funcname . '::main');
$funcname .= '::main';
$decci = call_user_func($funcname, $retai, $decisionrow['calprompt']);
}
$ret['sec'] = time() - $timespan + 1; //用时
$ret['ci'] = $decci; //置信度
$ret['ai'] = $retai; //结果
$ret['version'] = $decisionrow['version'];
if ($post->get('_more') == 'ok') {
$ret['messages'] = $openai->messages; //交互过程
$ret['roleprompt'] = $roleprompt; //提示词
$ret['system'] = $system; //角色描述
}
return succjson($ret);
}
public static function multiparam($input, $sep) {
$len = strlen($input);
$ips = array();
$i = 0;
$inMultiline = false;
$currentParam = '';
$currentValue = '';
while ($i < $len) {
if (!$inMultiline) {
$paramStart = $i;
while ($i < $len && $input[$i] !== $sep) {
if ($input[$i] === "\n")
return '参数格式不合法';
$i++;
}
if ($i == $len)
return '参数格式不合法,应用' . $sep . '号分隔';
$currentParam = trim(substr($input, $paramStart, $i - $paramStart));
if (empty($currentParam))
return '参数没有参数名';
$i++;
if ($i < $len && $input[$i] === '`') {
$inMultiline = true;
$i++;
$currentValue = '';
} else {
$valueStart = $i;
while ($i < $len && $input[$i] !== "\n")
$i++;
$currentValue = trim(substr($input, $valueStart, $i - $valueStart));
$ips[] = $currentParam . $sep . $currentValue;
$i++;
}
} else {
$valueStart = $i;
while ($i < $len && $input[$i] !== '`')
$i++;
$currentValue .= trim(substr($input, $valueStart, $i - $valueStart));
if ($i < $len && $input[$i] === '`') {
$ips[] = $currentParam . $sep . $currentValue;
$inMultiline = false;
$i++;
if ($i < $len && $input[$i] === "\n") {
$i++;
}
} else {
$ips[] = $currentParam . $sep . $currentValue;
break;
}
}
}
if (count($ips) == 0)
return '参数都不符合条件';
return $ips;
}
}

59
web/api/message.php Normal file
View File

@ -0,0 +1,59 @@
<?php
namespace web\api;
class message {
static function sendmail($db, $chan, $uid, $mail, $sendtimes, $mailname, $mailcontent) {
if (empty($mail)) {
$csql = new \ciy\sql('ap_usr_ext');
$csql->where('id', $uid);
$uextrow = $db->getone($csql);
if (!is_array($uextrow))
return false;
$mail = $uextrow['email'];
}
if (empty($mail))
return false;
//在sendtimes到时间且donetimes<10发送。
//发送成功donetimes=time
//发送失败donetimes++sendtimes=time+600
//发送完成donetimes+=100
//通知失败donetimes-=99sendtimes=time+600
$updata = array();
$updata['vuser'] = $uid;
$updata['email'] = $mail;
$updata['chan'] = $chan;
$updata['addtimes'] = tostamp();
$updata['sendtimes'] = $sendtimes;
$updata['donetimes'] = 0;
$updata['name'] = $mailname;
$updata['content'] = $mailcontent;
$csql = new \ciy\sql('ap_usr_sendmail');
if ($db->insert($csql, $updata) === false)
throw new \Exception('新建邮件失败:' . $db->error);
}
static function sendsms($db, $chan, $uid, $mobile, $sendtimes, $jsoncontent) {
if (empty($mobile)) {
$csql = new \ciy\sql('ap_user');
$csql->where('id', $uid);
$uextrow = $db->getone($csql);
if (!is_array($uextrow))
return false;
$mobile = $uextrow['mobile'];
}
if (empty($mobile))
return false;
$updata = array();
$updata['vuser'] = $uid;
$updata['mobile'] = $mobile;
$updata['chan'] = $chan;
$updata['addtimes'] = tostamp();
$updata['sendtimes'] = $sendtimes;
$updata['donetimes'] = 0;
$updata['content'] = $jsoncontent;
$csql = new \ciy\sql('ap_usr_sendsms');
if ($db->insert($csql, $updata) === false)
throw new \Exception('新建短信失败:' . $db->error);
}
}

27
web/api/thirdapi.php Normal file
View File

@ -0,0 +1,27 @@
<?php
namespace web\api;
class thirdapi {
static function checkbadword($wordstr, $strict = 1) {
$http = new \ciy\http();
$post = array();
$post['ColaKey'] = 'V0txKKBrP8xzyN1761587699258qq6ro7N0sC'; //2025-12-27 1:54:59 https://luckycola.com.cn/public/dist/#/userCenter
$post['wordStr'] = $wordstr;
$post['isStrict'] = $strict;
$http->request('https://luckycola.com.cn/tools/sensiWords', json_encode($post));
$result = $http->get_data();
$json = json_decode($result, true);
if ($json === null)
return '内容分析请求失败';
if ($json['code'] != 0)
return $json['msg'];
if($json['isPass'] == true)
return true;
savelogfile('bakword', $result);
return '有违禁词,不能发布';
//{"code":-99,"msg":"colaKey无效","data":{}}
//{"code":0,"msg":"检测成功","isPass":true,"data":{"words":[],"text":"asdfsadf"}}
//{"code":0,"msg":"检测成功","isPass":false,"data":{"words":["法轮","法轮大法"],"text":"法轮大法好啊啊阿萨德"}}
}
}

View File

@ -25,7 +25,7 @@ class v1 {
$updata['notifyurl'] = $notifyurl;
$updata['retimes'] = 0;
$updata['uptimes'] = 0;
$updata['nexttimes'] = 9999999999999;
$updata['nexttimes'] = MAXTIMES;
$updata['addtimes'] = time();
$updata['signature'] = '';
$updata['orderstatus'] = 10;

View File

@ -836,9 +836,9 @@ ciyfn.getdictdata = function (datakey, once, reldata) {
return reldata[datakey];
if (isarray(window[datakey]))
return window[datakey];
if (datakey.indexOf('.') == -1 && datakey.indexOf(':') == -1)
if (datakey.indexOf(',') == -1 && datakey.indexOf(':') == -1)
return new Array();
var svs = ciyfn.split(datakey, '.');
var svs = ciyfn.split(datakey, ',');
datas = new Array();
for (var i = 0; i < svs.length; i++) {
var ind = svs[i].indexOf(':');
@ -1713,7 +1713,7 @@ ciyfn.alert = function (content, cb, opn) {
}
htmldom.find('.content').css('height', (ctheight + 2) + 'px');
var dialogcss = {};
var w = toint(htmldom.css().width);
var w = toint(htmldom.find('.content').css().width) + 5;
if (!opn.width && opn.frame) {
if ('ontouchstart' in window)
w = window.innerWidth - 10;
@ -1727,7 +1727,8 @@ ciyfn.alert = function (content, cb, opn) {
w = window.innerWidth - 30;
if (w < 300)
w = 300;
dialogcss.width = w + 'px';
if (Math.abs(w - toint(htmldom.css().width)) > 6)
dialogcss.width = w + 'px';
dialogcss.height = 'auto';
var h = toint(htmldom.css().height);
if (opn.height == 'max') {
@ -2076,7 +2077,7 @@ ciyfn.savedict = function (arr) {
if (arr[code][d].clas)
cs.clas = arr[code][d].clas;
if (arr[code][d].isuse != 1)
cs.no = true;
cs.isuse = 2;
if (arr[code][d].upid > 0) {
for (var i in arr[code]) {
if (arr[code][d].upid == arr[code][i].id) {
@ -2758,4 +2759,8 @@ document.addEventListener('DOMContentLoaded', function () {
}
}
});
$5(document).on('click', '.help', itm => {
var help = $5(itm.currentTarget).attr('help');
ciyfn.alert(help.replace(/\\n/g, '<br>'));
});
});

View File

@ -711,6 +711,7 @@ ciycmpfunc.ciyradio = function (opn) {
opn.initevent = opn.initevent || opn.dom.hasattr('initevent');
opn.hasmore = opn.hasmore || opn.dom.hasattr('hasmore');
opn.hasline = opn.hasline || opn.dom.hasattr('hasline');
opn.chkuse = opn.chkuse || opn.dom.hasattr('chkuse');
opn.all = opn.all || opn.dom.attr('all') || '';
opn.minwidth = opn.minwidth || opn.dom.attr('minwidth') || 'auto';
if (typeof (opn.fn_item) !== 'function')
@ -736,7 +737,7 @@ ciycmpfunc.ciyradio = function (opn) {
var selname = '';
for (var i in this.range) {
var range = this.range[i];
if (range.isuse == 2)
if (opn.chkuse && range.isuse == 2)
continue;
if (opn.filter && range[opn.filter.field] != opn.filter.value)
continue;
@ -780,6 +781,7 @@ ciycmpfunc.ciycheckbox = function (opn) {
opn.initevent = opn.initevent || opn.dom.hasattr('initevent');
opn.hasmore = opn.hasmore || opn.dom.hasattr('hasmore');
opn.hasline = opn.hasline || opn.dom.hasattr('hasline');
opn.chkuse = opn.chkuse || opn.dom.hasattr('chkuse');
opn.range = opn.range || opn.dom.attr('range');
opn.minwidth = opn.minwidth || opn.dom.attr('minwidth') || '';
if (opn.dom.attr('text')) {
@ -821,7 +823,7 @@ ciycmpfunc.ciycheckbox = function (opn) {
var selnames = [];
for (var i in this.range) {
var range = this.range[i];
if (range.isuse == 2)
if (opn.chkuse && range.isuse == 2)
continue;
if (opn.filter && range[opn.filter.field] != opn.filter.value)
continue;
@ -904,6 +906,7 @@ ciycmpfunc.ciyselect = function (opn) {
this.onchange = opn.onchange;
opn.initevent = opn.initevent || opn.dom.hasattr('initevent');
opn.hasmore = opn.hasmore || opn.dom.hasattr('hasmore');
opn.chkuse = opn.chkuse || opn.dom.hasattr('chkuse');
opn.minsearch = toint(opn.minsearch || opn.dom.attr('minsearch') || 0);
opn.all = opn.all || opn.dom.attr('all') || '';
opn.range = opn.range || opn.dom.attr('range');
@ -979,7 +982,7 @@ ciycmpfunc.ciyselect = function (opn) {
if (!badd)
this.range = [];
for (var i in ranges) {
if (ranges[i].isuse == 2)
if (opn.chkuse && ranges[i].isuse == 2)
continue;
if (!ranges[i]._nofilter && opn.filter && ranges[i][opn.filter.field] != opn.filter.value)
continue;
@ -1136,7 +1139,7 @@ ciycmpfunc.ciyinputbet = function (opn) {
opn.units[i] = opn.units[i].substring(1);
}
}
opn.width = opn.width || opn.dom.attr('width') || '5em';
opn.width = opn.width || opn.dom.attr('width') || '6em';
opn.align = opn.align || opn.dom.attr('align') || 'right';
var html = '';
html += '<input type="hidden" name="' + opn.name + '"/>';
@ -1217,7 +1220,7 @@ ciycmpfunc.ciyupload = function (opn) { // v2
opn.imgheight = toint(opn.imgheight || opn.dom.attr('imgheight'));
opn.maxsize = toint(opn.maxsize || opn.dom.attr('maxsize'));
opn.zipjpg = tofloat(opn.zipjpg || opn.dom.attr('zipjpg'));
opn.zipext = opn.zipext || opn.dom.attr('zipext') || 'jpg,png';
opn.zipext = opn.zipext || opn.dom.attr('zipext') || 'jpg,png,webp';
if (opn.zipext)
opn.zipext = opn.zipext.toUpperCase().split(',');
opn.waterfont = opn.waterfont || opn.dom.attr('waterfont') || '28px Arial';

View File

@ -5,15 +5,13 @@
'use strict';
ciyfn.markdown = function (markdown) {
// #,!,`,@lcr,|表格
if (markdown.substring(0, 4) != '[MD]')
return markdown;
markdown = markdown.substring(4).trim();
if (markdown.substring(0, 4) == '[MD]')
markdown = markdown.substring(4).trim();
var mds = markdown.split('\n');
var html = '';
var titnum2 = 0;
var titnum3 = 0;
var titnum4 = 0;
var ispvs = 0; //0文本1html2表格
var isol = false;
var titnum = [0, 0, 0, 0, 0];
var tabalign = {};
for (var m in mds) {
if (mds[m].length == 0) {
@ -24,6 +22,10 @@ ciyfn.markdown = function (markdown) {
if (mds[m].length > 0 && mds[m].trim() == '') {
if (ispvs == 2)
html += '</table>';
if (isol) {
isol = false;
html += '</ol>';
}
ispvs = 0;
html += '<br/>';
continue;
@ -32,27 +34,39 @@ ciyfn.markdown = function (markdown) {
if (ispvs == 2)
html += '</table>';
ispvs = 0;
if (isol) {
isol = false;
html += '</ol>';
}
var cr = mds[m].substring(1, 2).toLowerCase();
if (mds[m].substring(0, 4) == '####') {
titnum4++;
html += '<h3 class="md-h4">' + titnum2 + '.' + titnum3 + '.' + titnum4 + '、' + convertcode(mds[m].substring(4)) + '</h3>';
if (mds[m].substring(0, 5) == '#####') {
if (mds[m].substring(5, 6) == '1')
html += '<h5 class="md-h5">' + olnum(4, titnum, '、') + convertcode(mds[m].substring(6)) + '</h5>';
else
html += '<h5 class="md-h5">' + convertcode(mds[m].substring(5)) + '</h5>';
} else if (mds[m].substring(0, 4) == '####') {
if (mds[m].substring(4, 5) == '1')
html += '<h4 class="md-h4">' + olnum(3, titnum, '、') + convertcode(mds[m].substring(5)) + '</h4>';
else
html += '<h4 class="md-h4">' + convertcode(mds[m].substring(4)) + '</h4>';
} else if (mds[m].substring(0, 3) == '###') {
titnum3++;
titnum4 = 0;
html += '<h3 class="md-h3">' + titnum2 + '.' + titnum3 + '、' + convertcode(mds[m].substring(3)) + '</h3>';
}
else if (mds[m].substring(0, 2) == '##') {
titnum2++;
titnum3 = 0;
html += '<h2 class="md-h2">' + titnum2 + '、' + convertcode(mds[m].substring(2)) + '</h2>';
}
else if (cr == 'c')
if (mds[m].substring(3, 4) == '1')
html += '<h3 class="md-h3">' + olnum(2, titnum, '、') + convertcode(mds[m].substring(4)) + '</h3>';
else
html += '<h3 class="md-h3">' + convertcode(mds[m].substring(3)) + '</h3>';
} else if (mds[m].substring(0, 2) == '##') {
if (mds[m].substring(2, 3) == '1')
html += '<h2 class="md-h2">' + olnum(1, titnum, '、') + convertcode(mds[m].substring(3)) + '</h2>';
else
html += '<h2 class="md-h2">' + convertcode(mds[m].substring(2)) + '</h2>';
} else if (cr == 'c')
html += '<h1 class="md-h1" style="text-align:center;">' + convertcode(mds[m].substring(2)) + '</h1>';
else if (cr == 'r')
html += '<h1 class="md-h1" style="text-align:right;">' + convertcode(mds[m].substring(2)) + '</h1>';
else if (cr == '1')
html += '<h1 class="md-h1">' + olnum(0, titnum, '、') + convertcode(mds[m].substring(2)) + '</h1>';
else
html += '<h1 class="md-h1">' + convertcode(mds[m].substring(1)) + '</h1>';
html += '<h1 class="md-h1">' + convertcode(mds[m].substr(1)) + '</h1>';
} else if (mds[m][0] == '@') {//c居中r靠右
if (ispvs == 2)
html += '</table>';
@ -62,7 +76,13 @@ ciyfn.markdown = function (markdown) {
html += '<div class="md-content" style="text-align:center;">' + convertcode(mds[m].substring(2)) + '</div>';
else if (cr == 'r')
html += '<div class="md-content" style="text-align:right;margin-right:1em;">' + convertcode(mds[m].substring(2)) + '</div>';
else
else if (cr == '1') {
if (!isol) {
isol = true;
html += '<ol>';
}
html += '<li>' + convertcode(mds[m].substr(2)) + '</li>';
} else
html += mds[m].substring(1);
} else if (mds[m][0] == '!') {//图片
@ -121,12 +141,35 @@ ciyfn.markdown = function (markdown) {
if (ispvs == 2)
html += '</table>';
ispvs = 0;
if (isol) {
isol = false;
html += '</ol>';
}
html += '<div class="md-content">' + convertcode(mds[m]) + '</div>';
}
}
if (ispvs == 2)
html += '</table>';
if (isol) {
isol = false;
html += '</ol>';
}
return html;
function olnum(idx, olnum, end) {
console.log(idx, olnum, end);
olnum[idx]++;
for (var i = idx + 1; i < olnum.length; i++)
olnum[i] = 0;
for (var i = 0; i <= idx; i++) {
if (olnum[i] == 0)
continue;
var ols = [];
for (var j = i; j <= idx; j++) {
ols.push(olnum[j]);
}
return ols.join('.') + end;
}
}
function convertcode(md) {
var bcode = false;
md = md.replace(/ /g, ' ');
@ -171,7 +214,7 @@ ciyfn.markdown = function (markdown) {
let mis = md.substring(ind + 1, ind2).split('](');
if (mis.length != 2)
break;
let url = mis[1];
let url = ciyfn.file_stor(mis[1]);
let text = mis[0];
if (text == '')
text = url;
@ -194,6 +237,7 @@ ciycmpfunc.ciyselcas = function (opn) {
this.onchange = opn.onchange;
opn.initevent = opn.initevent || opn.dom.hasattr('initevent');
opn.hasmore = opn.hasmore || opn.dom.hasattr('hasmore');
opn.chkuse = opn.chkuse || opn.dom.hasattr('chkuse');
opn.minsearch = toint(opn.minsearch || opn.dom.attr('minsearch') || 0);
opn.all = opn.all || opn.dom.attr('all') || '';
opn.placeholder = ciyfn.lang(opn.placeholder || opn.dom.attr('placeholder') || '请选择');
@ -237,7 +281,7 @@ ciycmpfunc.ciyselcas = function (opn) {
return console.error('ciy_selcas range null', opn.name);
this.range = [];
for (var i in opn.range) {
if (opn.range[i].isuse == 2)
if (opn.chkuse && opn.range[i].isuse == 2)
continue;
if (!opn.range[i].upid)
opn.range[i].upid = 0;
@ -311,6 +355,7 @@ ciycmpfunc.ciyselmulti = function (opn) {
this.onchange = opn.onchange;
opn.initevent = opn.initevent || opn.dom.hasattr('initevent');
opn.hasmore = opn.hasmore || opn.dom.hasattr('hasmore');
opn.chkuse = opn.chkuse || opn.dom.hasattr('chkuse');
opn.minsearch = toint(opn.minsearch || opn.dom.attr('minsearch') || 0);
opn.minwidth = opn.minwidth || opn.dom.attr('minwidth') || '';
opn.placeholder = opn.placeholder || opn.dom.attr('placeholder') || '请选择';
@ -381,7 +426,7 @@ ciycmpfunc.ciyselmulti = function (opn) {
var ranges = [];
for (var i in this.range) {
var range = this.range[i];
if (range.isuse == 2)
if (opn.chkuse && range.isuse == 2)
continue;
if (opn.filter && range[opn.filter.field] != opn.filter.value)
continue;
@ -403,7 +448,7 @@ ciycmpfunc.ciyselmulti = function (opn) {
return console.error('ciy_select range null', opn.name);
this.range = [];
for (var i in ranges) {
if (ranges[i].isuse == 2)
if (opn.chkuse && ranges[i].isuse == 2)
continue;
if (!ranges[i]._nofilter && opn.filter && ranges[i][opn.filter.field] != opn.filter.value)
continue;
@ -552,18 +597,20 @@ ciycmpfunc.ciyinputcyc = function (opn) {
var eus = opn.enableunit.split(',');
opn.enableunit = [];
for (var i in eus) {
var eu = eus[i].trim().toUpperCase();
if (eu == 'MONTH' || eu == 'DAY' || eu == 'SEC')
var eu = eus[i].trim().toLowerCase();
if (eu == 'month' || eu == 'day' || eu == 'hour' || eu == 'min' || eu == 'sec')
opn.enableunit.push(eu);
}
if (opn.enableunit.length == 0)
opn.enableunit = ['MONTH', 'DAY', 'SEC'];
opn.enableunit = ['month', 'day', 'hour', 'min', 'sec'];
var html = '<input type="hidden" name="' + opn.name + '"/>';
html += '<input style="width:4em;text-align:right;margin-right:0.2em;border-radius: 4px 0 0 4px;" type="text"' + (opn.hasmore ? ' name="' + opn.name + '_num"' : '') + '/>';
html += '<select' + (opn.hasmore ? ' name="' + opn.name + '_unit"' : '') + ' style="border-radius: 0 0.5em 0.5em 0!important;margin-left: -4px;">';
if (opn.enableunit.indexOf('MONTH') >= 0) html += '<option value="month">月</option>';
if (opn.enableunit.indexOf('DAY') >= 0) html += '<option value="day">天</option>';
if (opn.enableunit.indexOf('SEC') >= 0) html += '<option value="sec">秒</option>';
if (opn.enableunit.indexOf('month') >= 0) html += '<option value="month">月</option>';
if (opn.enableunit.indexOf('day') >= 0) html += '<option value="day">天</option>';
if (opn.enableunit.indexOf('hour') >= 0) html += '<option value="hour">小时</option>';
if (opn.enableunit.indexOf('min') >= 0) html += '<option value="min">分钟</option>';
if (opn.enableunit.indexOf('sec') >= 0) html += '<option value="sec">秒</option>';
html += '</select>';
opn.dom.html(html).css({ display: 'inline-flex' });
var valuedom = opn.dom.children(0);
@ -575,23 +622,65 @@ ciycmpfunc.ciyinputcyc = function (opn) {
if (newvalue !== undefined) {
var dat = toint(newvalue);
if (dat < 0) {
data.num = -dat;
data.unit = 'month';
data.num = -dat;
} else if (dat % 86400 == 0) {
data.unit = 'day';
data.num = toint(dat / 86400);
} else if (dat % 3600 == 0) {
data.unit = 'hour';
data.num = toint(dat / 3600);
} else if (dat % 60 == 0) {
data.unit = 'min';
data.num = toint(dat / 60);
} else {
if (dat % 86400 > 0) {
data.num = dat;
data.unit = 'sec';
} else {
data.num = toint(dat / 86400);
data.unit = 'day';
}
data.unit = 'sec';
data.num = toint(dat);
}
this.value = dat;
if (data.unit == 'month' && opn.enableunit.indexOf('month') == -1) {
data.num *= 30;
data.unit = 'day';
}
if (data.unit == 'day' && opn.enableunit.indexOf('day') == -1) {
data.num *= 24;
data.unit = 'hour';
}
if (data.unit == 'hour' && opn.enableunit.indexOf('hour') == -1) {
data.num *= 60;
data.unit = 'min';
}
if (data.unit == 'min' && opn.enableunit.indexOf('min') == -1) {
data.num *= 60;
data.unit = 'sec';
}
if (data.unit == 'sec' && opn.enableunit.indexOf('sec') == -1) {
if (opn.enableunit.indexOf('min') > -1) {
data.num = Math.ceil(data.num / 60);
data.unit = 'min';
}
else if (opn.enableunit.indexOf('hour') > -1) {
data.num = Math.ceil(data.num / 3600);
data.unit = 'hour';
}
else if (opn.enableunit.indexOf('day') > -1) {
data.num = Math.ceil(data.num / 86400);
data.unit = 'day';
}
else if (opn.enableunit.indexOf('month') > -1) {
data.num = -Math.floor(data.num / 86400 / 30);
data.unit = 'month';
}
}
showinpdom.val(data.num);
showseldom.val(data.unit);
} else {
var dat = data.num;
if (data.unit == 'day')
if (data.unit == 'min')
dat = dat * 60;
else if (data.unit == 'hour')
dat = dat * 3600;
else if (data.unit == 'day')
dat = dat * 86400;
else if (data.unit == 'month')
dat = -dat;
@ -719,9 +808,9 @@ ciycmpfunc.ciytimepoint = function (opn) {
opn.initevent = opn.initevent || opn.dom.hasattr('initevent');
opn.hasmore = opn.hasmore || opn.dom.hasattr('hasmore');
opn.placeholder = ciyfn.lang(opn.placeholder || opn.dom.attr('placeholder') || '请选择');
opn.type = opn.type || opn.dom.attr('type') || 'minute'; //minute,second
opn.type = opn.type || opn.dom.attr('type') || 'min'; //min,sec
opn.inpwidth = '4em';
if (opn.type == 'second')
if (opn.type == 'sec')
opn.inpwidth = '5.5em';
var csstxt = '';
csstxt += 'ciy-timepoint>._pulldt{user-select: none;position: fixed;top: 0;left: 0;right: 0;bottom: 0;display:none;z-index:100000;}';
@ -790,7 +879,7 @@ ciycmpfunc.ciytimepoint = function (opn) {
if (newvalue !== undefined) {
this.value = str_timepoint(newvalue);
}
var dat = ciyfn.totimepoint(this.value, opn.type == 'second');
var dat = ciyfn.totimepoint(this.value, opn.type == 'sec');
valuedom.val(this.value);
valnamedom.val(dat);
if (this.value != 0) {
@ -866,7 +955,7 @@ ciycmpfunc.ciytimepoint = function (opn) {
var html = '';
html += '<div class="_time _timehour"><div><span>' + dtimevalue[0] + '</span></div><span>' + ciyfn.lang('选择小时') + '</span></div>'
html += '<div class="_time _time60" data-idx="1"><div><span>' + dtimevalue[1] + '</span></div><span>' + ciyfn.lang('选择分钟') + '</span></div>'
if (opn.type == 'second')
if (opn.type == 'sec')
html += '<div class="_time _time60" data-idx="2"><div><span>' + dtimevalue[2] + '</span></div><span>' + ciyfn.lang('选择秒钟') + '</span></div>'
html += '<div class="_timerit"><div><a class="btn sm done">' + ciyfn.lang('完成') + '</a></div><div><a class="btn sm def clear">' + ciyfn.lang('清空') + '</a></div></div>'
timebtndom.html(html);
@ -956,6 +1045,7 @@ ciycmpfunc.ciymarkdown = function (opn) {
opn.zipext = tofloat(opn.zipext || opn.dom.attr('zipext'));
opn.waterfont = opn.waterfont || opn.dom.attr('waterfont') || '28px Arial';
opn.watertext = opn.watertext || opn.dom.attr('watertext') || '';
opn.fileext = (opn.fileext || opn.dom.attr('fileext') || '.pdf,.zip,.docx,.doc,.pptx,.ppt,.xlsx,.xls,.txt,.rar,.7z,.tar,.glb').toLowerCase().split(',');
opn.action = opn.action || opn.dom.attr('action');
if (!opn.action) {
opn.action = "/z/?func=" + ciy_vars.uploadurl;
@ -982,8 +1072,9 @@ ciycmpfunc.ciymarkdown = function (opn) {
</div>
<div style="padding-left: 0.5em;">
<ciy-switch y="自动换行" n="不换行" style="font-size:0.6em;"></ciy-switch>
<a class="lang btn sm btn_upimg">上传图片</a>
<a class="lang btn sm btn_upav">上传视频</a>
<a class="lang btn sm btn_upimg">图片</a>
<a class="lang btn sm btn_upav">视频</a>
<a class="lang btn sm btn_upfile">附件</a>
<label class="btn sm">
<span class="lang">更多</span>
<input type="checkbox">
@ -1059,12 +1150,25 @@ ciycmpfunc.ciymarkdown = function (opn) {
var blob = e.clipboardData.items[i].getAsFile();
bb.push(blob);
}
if (e.clipboardData.items[i].type.indexOf("video/mp4") !== -1) {
else if (e.clipboardData.items[i].type.indexOf("video/mp4") !== -1) {
var blob = e.clipboardData.items[i].getAsFile();
bb.push(blob);
}
else {
var blob = e.clipboardData.items[i].getAsFile();
if (blob) {
var ind = blob.name.lastIndexOf('.');
var ext = blob.name.substring(ind).toLowerCase();
if (opn.fileext.indexOf(ext) > -1)
bb.push(blob);
else
ciyfn.toast(ciyfn.lang('不支持的附件类型') + ': ' + ext);
}
}
}
opn.type = ['JPG', 'PNG', 'MP4'];
for (var i = 0; i < opn.fileext.length; i++)
opn.type.push(opn.fileext[i].substring(1).toUpperCase());
mdedit_uploadfile(bb);
});
opn.dom.on('click', '.btn_help', function (e) {
@ -1082,8 +1186,9 @@ ciycmpfunc.ciymarkdown = function (opn) {
html += '<code>**加粗**</code> 双星号包裹,<b>加粗</b> 效果<br/>';
html += '<code>[链接文字](网址)</code>,如:[众产](https://ciy.cn/)。<br/>';
html += '<code>[!imgurl](https://ciy.cn/)</code>,图片链接。<br/>';
html += '<code>[链接文字](附件链接)</code> 附件下载<br/>';
html += '可在录入区直接 Ctrl+V 粘贴剪贴板中的图片和视频。<br/>';
ciyfn.alert({content:html, width:'30em'});
ciyfn.alert({ content: html, width: '30em' });
});
opn.dom.on('click', '.btn_kh', function (e) {
var content = textareadom.val();
@ -1106,6 +1211,12 @@ ciycmpfunc.ciymarkdown = function (opn) {
opn.type = ['JPG', 'PNG'];
mdedit_selectfile(".jpg,.png");
});
opn.dom.on('click', '.btn_upfile', function (e) {
opn.type = [];
for (var i = 0; i < opn.fileext.length; i++)
opn.type.push(opn.fileext[i].substring(1).toUpperCase());
mdedit_selectfile(opn.fileext);
});
filedom.on("change", function (e) {
mdedit_uploadfile(e.target.files);
});
@ -1125,6 +1236,10 @@ ciycmpfunc.ciymarkdown = function (opn) {
return;
var text = textareadom.val();
var imgurl = '!' + url;
var ind = url.lastIndexOf('.');
var ext = url.substring(ind).toLowerCase();
if (opn.fileext.indexOf(ext) > -1)
imgurl = '[' + ciyfn.lang('附件') + ': ' + file.name + '](' + url + ')';
if (startPos > 0 && text[startPos - 1] != '\n')
imgurl = '\n' + imgurl;
if (text[startPos] != '\n')

View File

@ -281,6 +281,8 @@ ciyclass.table = function (opn) {
}
}
html = '<table><tr data-field>';
if (opn.chkbox)
html += '<th> </th>';
for (var ki in thos.sortfield) {
var key = thos.sortfield[ki];
if (!thos.field[key].c)
@ -420,6 +422,9 @@ ciyclass.table = function (opn) {
$5('[data-id]', this._tabdom).remove();
$5('[data-none]', this._tabdom).remove();
html = '';
var colspan = thos.sortfield.length;
if (opn.chkbox)
colspan++;
if (json.list) {
for (var i = 0; i < json.list.length; i++) {
var ldat = json.list[i];
@ -428,9 +433,9 @@ ciyclass.table = function (opn) {
html += this.tabletr_html(ldat);
}
if (json.list.length == 0 && json.pageno == 1)
html += '<tr data-none><td colspan="' + thos.sortfield.length + '" style="text-align:center;padding:0.5em;">' + ciyfn.lang(opn.nodatatext) + '</td></tr>';
html += '<tr data-none><td colspan="' + colspan + '" style="text-align:center;padding:0.5em;">' + ciyfn.lang(opn.nodatatext) + '</td></tr>';
} else {
html += '<tr data-none><td colspan="' + thos.sortfield.length + '" style="text-align:center;padding:0.5em;font-size:0.8em;color:var(--txt1);">' + ciyfn.lang("等待操作") + '</td></tr>';
html += '<tr data-none><td colspan="' + colspan + '" style="text-align:center;padding:0.5em;font-size:0.8em;color:var(--txt1);">' + ciyfn.lang("等待操作") + '</td></tr>';
}
ciyfn._table_fillpage(_pagedom, json, opn.btncolumnset == 1);
$5('th>i.sort', this.dom).removeClass('js').removeClass('db');
@ -467,6 +472,8 @@ ciyclass.table = function (opn) {
if (typeof (opn.fn_trprop) == 'function')
html += opn.fn_trprop(ldat, this.json);
html += '>';
if (opn.chkbox)
html += '<td class="chkbox"></td>';
for (var ki in this.sortfield) {
var key = this.sortfield[ki];
var ftf = this.field[key];
@ -618,7 +625,7 @@ ciyclass.table = function (opn) {
tddoms[i].style.display = null;
else
tddoms[i].style.display = "none";
if(tddoms[i].getAttribute('field') == '_btn')
if (tddoms[i].getAttribute('field') == '_btn')
continue;
var txt = tddoms[i].textContent;
if (txt && txt.length * 14 > tddoms[i].getBoundingClientRect().width)
@ -774,7 +781,7 @@ ciyfn.fillsearch = function (opn) {
if (w == 'liid') {
$5('li[data-liid]', '.search').removeClass('active');
$5('li[data-liid="' + opn.data.where[w] + '"]', '.search').addClass('active');
} else if(w)
} else if (w)
$5('[sechr=' + w + ']', '.search').val(opn.data.where[w]);
}
}
@ -996,6 +1003,8 @@ ciyfn._table_eventpage = function (_pagedom, thos) {
var values = [];
for (var i = 0; i < thdoms.length; i++) {
var key = thdoms[i].getAttribute('data-field');
if(key === null)
continue;
range.push({ id: key, name: thdoms[i].textContent });
if (isarray(localset.thhide)) {
if (localset.thhide.indexOf(key) == -1)
@ -1319,7 +1328,7 @@ ciyfn.tdshow = function (dataori, ext, linedata, once, json, isview) {
if (preext == 'MCNY') {
if (dataori == 0)
return '--';
var pstr = ext.substring(4) || '3';
var pstr = ext.substring(4) || '4';
return numunit(dataori, 10000, pstr, '|1000000|万');
}
if (preext == 'WCNY') {

View File

@ -121,6 +121,15 @@ ciy-textarea {
width: 100%;
}
ol {
padding: revert;
}
ol li {
list-style: auto;
line-height: 1.5em;
padding: 0.5em 0;
}
img {
display: inline-block;
@ -837,6 +846,7 @@ pre {
margin: 0 0.3em;
vertical-align: text-top;
display: inline-block;
cursor: pointer;
background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTUxMiAxMDI0YTUxMiA1MTIgMCAxIDEgNTEyLTUxMiA1MTMuMTUzOTc0IDUxMy4xNTM5NzQgMCAwIDEtNTEyIDUxMnogbS01Ny41MTY0ODktMTcyLjYxMDIwMkg1NjYuNjYxOTIydi0xMTIuMTc4NDFINDU0LjQ4MzUxMXpNNTM3Ljg3MzMxIDE3Mi41NDk0NjZjLTEyOS40MjcyODQgMC0yNTMuMTQ1NDMzIDYzLjI4NjM1OC0yNTMuMTQ1NDMzIDIyNy4yMTEzODhIMzk3LjIwOTk2NGExMDkuMzIzODQzIDEwOS4zMjM4NDMgMCAwIDEgMTEyLjE3ODQxMS0xMTUuMDMyOTc3YzQ2LjAzNzQ4NSAwIDExMi4xNzg0MSAxNy4yNDg4NzMgMTEyLjE3ODQxIDg2LjMwNTEgMCA2My4yODYzNTgtMjAuMTY0MTc2IDc0Ljc2NTM2Mi04MC41MzUyMzEgMTIwLjgwMjg0N2ExNzEuODgxMzc2IDE3MS44ODEzNzYgMCAwIDAtODYuMzA1MTAxIDE1Ny45MTIyMTl2MzQuNDk3NzQ2aDExNS4wMzI5NzhjMC0xMDMuMjUwMjk3IDcxLjkxMDc5NS0xMTUuMDMyOTc3IDEyOS40MjcyODMtMTk4LjQ4MzUxMWEyMjYuNDgyNTYyIDIyNi40ODI1NjIgMCAwIDAgNDAuMjY3NjE2LTEzNS4xOTcxNTMgMTkwLjgzMDg0MiAxOTAuODMwODQyIDAgMCAwLTIwMS41ODEwMi0xNzcuOTU0OTIzeiIgZmlsbD0iIzFEODVFRCI+PC9wYXRoPjwvc3ZnPg==");
}
@ -1149,6 +1159,15 @@ textarea[disabled], select[disabled], input[disabled], input[disabled]+i, .btn.d
background: var(--e-tabselect);
}
.table tr.selected .chkbox::before {
content: '✅';
}
.table tr .chkbox::before {
content: '⬜';
text-align: center;
display: block;
}
.table>.loading {
text-align: center;
@ -2157,34 +2176,28 @@ textarea.tran:focus, select.tran:focus, input.tran:focus {
.md-h1 {
font-weight: bold;
font-size: 1.2em;
padding: 0.5em;
margin: 0 0.3em;
margin-left: 0.3em;
line-height: 1.5em;
text-align: left;
padding: 0.5em 0.2em 0.5em 0.5em;
}
.md-h2 {
font-weight: bold;
font-size: 1.1em;
padding: 0.5em;
margin: 0 0.4em;
margin-left: 0.4em;
line-height: 1.8em;
padding: 0.5em 0.2em 0.5em 0.5em;
}
.md-h3 {
.md-h3,
.md-h4,
.md-h5 {
font-weight: bold;
font-size: 1em;
padding: 0.5em;
margin: 0 1.5em;
line-height: 1.5em;
}
.md-h4 {
font-weight: bold;
font-size: 1em;
padding: 0.5em;
margin: 0 2em;
margin-left: 0.5em;
line-height: 1.5em;
padding: 0.5em 0.2em 0.5em 0.5em;
}
.md-content {

View File

@ -4,9 +4,10 @@ function ciy_chgtheme(val) {
else
document.documentElement.classList.add('dark-theme');
}
if (localStorage && localStorage.getItem('theme') == 'dark') {
var theme = '';
if (localStorage)
theme = localStorage.getItem('theme');
if (theme == 'dark')
ciy_chgtheme(false);
} else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
ciy_chgtheme(false);
}
else if (theme != 'light' && window.matchMedia('(prefers-color-scheme: dark)').matches)
ciy_chgtheme(false);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

5
web/ud/svgicon/me.txt Normal file
View File

@ -0,0 +1,5 @@
ciy:<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M987.136 384.512C919.552 131.584 668.16-22.528 415.232 27.136c219.648-41.984 434.176 79.36 488.96 283.136 57.344 214.016-82.944 437.76-313.344 499.2-49.664 13.312-78.848 64-65.536 113.152 13.312 49.664 64 78.848 113.152 65.536 263.168-70.144 418.816-340.48 348.672-603.648zM116.224 713.216C58.88 499.2 199.68 275.456 430.08 214.016c49.664-13.312 78.848-64 65.536-113.152C482.816 51.2 432.128 21.504 382.464 34.816c-263.68 70.656-419.84 340.992-349.184 604.16 67.584 252.928 319.488 407.04 571.392 356.864-219.648 42.496-433.664-78.848-488.448-282.624z m93.184-203.776L291.84 449.536c44.544-32.256 90.112-32.256 133.12-0.512l83.456 60.928-149.504-230.4-149.504 229.888z m516.096-60.416L808.96 509.952l-149.504-229.888-149.504 229.376 82.432-59.904c44.544-32.256 90.112-32.256 133.12-0.512z m-366.08 291.84L441.856 680.96c44.544-32.256 90.112-32.256 133.12-0.512l83.456 60.928-149.504-230.4-149.504 229.888z" fill="#56a4ef"></path></svg>
v1:<svg viewBox="0 0 1024 1024" version="1" xmlns="http://www.w3.org/2000/svg"><path d="M136 183m68 0l621 0q68 0 68 68l0 64q0 68-68 68l-621 0q-68 0-68-68l0-64q0-68 68-68Z" fill="#00650b"></path><path d="M805 835A35 35 0 0 1 755 866l-78-41a35 35 0 0 0-32-0L545 869a76 76 0 0 1-61-0l-99-43a35 35 0 0 0-32 0l-80 41a35 35 0 0 1-50-31V313a46 46 0 0 1 46-46h491a46 46 0 0 1 46 46z" fill="#09a21a"></path><path d="M580 561a20 20 0 0 0 0-40h-31l31-31a20 20 0 1 0-28-28l-38 38-38-38a20 20 0 1 0-28 28l31 31h-31a20 20 0 1 0 0 40h46v25h-46a20 20 0 1 0 0 40h46v37a20 20 0 0 0 40 0v-37h46a20 20 0 0 0 0-40h-46v-25z" fill="#FFFFFF"></path><path d="M514 363c-111 0-201 90-201 202 0 54 21 103 60 139 37 35 88 54 142 54s105-19 142-54c38-36 60-85 60-139-0-111-90-202-202-202z m115 311c-30 28-71 43-115 43s-85-15-115-43c-30-28-47-67-47-109 0-89 72-162 161-162s162 72 162 162c0 42-17 81-47 109z" fill="#FFFFFF"></path></svg>
v2:<svg viewBox="0 0 1024 1024" version="1" xmlns="http://www.w3.org/2000/svg"><path d="M722 733A203 203 0 1 1 781 336v-70a91 91 0 0 0-91-91H241A91 91 0 0 0 151 266v554c0 29 30 47 56 34l85-44a38 38 0 0 1 35 0l107 47a83 83 0 0 0 66 0l108-47a38 38 0 0 1 35 0l83 43c25 13 56-5 56-34v-95a202 202 0 0 1-59 9z" fill="#09a21a"></path><path d="M724 532m-163 0a163 163 0 1 0 326 0 163 163 0 1 0-326 0Z" fill="#00650b"></path><path d="M506 336H285a28 28 0 1 1 0-55h221a28 28 0 0 1 0 55zM431 458H285a28 28 0 1 1 0-55h147a28 28 0 0 1 0 55zM417 580H285a28 28 0 1 1 0-55H417a28 28 0 0 1 0 55zM790 554H744V524h46a20 20 0 0 0 0-40H762l17-17a20 20 0 1 0-28-28L724 465l-27-27a20 20 0 1 0-28 28L686 484h-28a20 20 0 0 0 0 40H704v30h-46a20 20 0 0 0 0 40H704v25a20 20 0 0 0 40 0V594h46a20 20 0 1 0 0-40z" fill="#FFFFFF"></path></svg>
v3:<svg viewBox="0 0 1024 1024" version="1" xmlns="http://www.w3.org/2000/svg"><path d="M239 164m85 0l442 0q85 0 85 85l0 516q0 85-85 85l-442 0q-85 0-85-85l0-516q0-85 85-85Z" fill="#09a21a"></path><path d="M684 363H405a28 28 0 0 1 0-55h279a28 28 0 0 1 0 55zM684 533H405a28 28 0 0 1 0-55h279a28 28 0 0 1 0 55zM684 702H405a28 28 0 1 1 0-55h279a28 28 0 0 1 0 55z" fill="#FFFFFF"></path><path d="M162 293m43 0l67 0q43 0 43 43l0 0q0 43-43 43l-67 0q-43 0-43-43l0 0q0-43 43-43Z" fill="#00650b"></path><path d="M162 632m43 0l67 0q43 0 43 43l0 0q0 43-43 43l-67 0q-43 0-43-43l0 0q0-43 43-43Z" fill="#00650b"></path></svg>
v4:<svg viewBox="0 0 1024 1024" version="1" xmlns="http://www.w3.org/2000/svg"><path d="M725 461h-428a73 73 0 0 0-73 73V773a73 73 0 0 0 73 73h428A73 73 0 0 0 798 773V534a73 73 0 0 0-73-73z m-214 303a72 72 0 0 1-34-136v-50a34 34 0 0 1 69 0v50a72 72 0 0 1-34 136z" fill="#09a21a"></path><path d="M680 424a35 35 0 0 1-35-35v-25c0-73-59-133-133-133S380 291 380 364V389a35 35 0 0 1-70 0v-25c0-112 91-203 203-203S715 252 715 364V389a35 35 0 0 1-35 35z" fill="#00650b"></path></svg>

BIN
web/ud/xcxqrcode/1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

View File

@ -68,6 +68,7 @@ if (!isset($path))
defined('PATH_ROOT') || define('PATH_ROOT', substr($path, 0, strrpos($path, '/') + 1)); //web根目录。
defined('PATH_WEB') || define('PATH_WEB', PATH_ROOT . 'web/'); //web根目录。
defined('NAME_SELF') || define('NAME_SELF', substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], '/') + 1, -4));
defined('MAXTIMES') || define('MAXTIMES', 9999999999999);
$logpath = PATH_ROOT . 'log/';
spl_autoload_register(function ($class) {
@ -135,6 +136,8 @@ function tostr($str = '') {
function toint($str = 0) {
if (!$str)
return 0;
if(!is_numeric($str))
return 0;
return intval(round($str));
}
function todate($time, $format = 'i') {
@ -609,11 +612,14 @@ function fieldadd($fshow, &$field, $pos, $key, $val) {
array_splice($fshows, $pos, 0, $key);
return implode(',', $fshows);
}
function getrelation($cdb, $rows, $table, $field, $column = 'id,name', $queryid = 'id') {
function getrelation($cdb, $rows, $table, $fieldstr, $column = 'id,name', $queryid = 'id') {
$ids = array();
foreach ($rows as $row) {
if (isset($row[$field]) && !in_array($row[$field], $ids))
$ids[] = $row[$field];
$fields = explode(',', $fieldstr);
foreach ($fields as $field) {
foreach ($rows as $row) {
if (isset($row[$field]) && !in_array($row[$field], $ids))
$ids[] = $row[$field];
}
}
if (count($ids) == 0)
return array();

View File

@ -374,7 +374,7 @@ class http {
$key = strtolower(trim(substr($key, 0, $ind)));
}
if ($key == 'expires') {
$cook['expires'] = time($val);
$cook['expires'] = strtotime($val);
if ($cook['expires'] < time())
$cook['value'] = 'deleted';
} else if ($key == 'path')

View File

@ -1,5 +1,7 @@
<?php
namespace ciy;
class sql {
public $tsmt;
public $table;
@ -7,10 +9,7 @@ class sql {
public $limit;
public $where;
public $order;
public $group;
public $having;
public $join;
public $on;
public $selecttail;
public $err;
public $wrapup;
@ -21,10 +20,7 @@ class sql {
$this->limit = '';
$this->where = '';
$this->order = '';
$this->group = '';
$this->having = '';
$this->join = '';
$this->on = '';
$this->selecttail = '';
$this->err = '';
$this->wrapup = true;
}
@ -53,15 +49,6 @@ class sql {
$this->limit = " limit {$pageid},{$pagecount}";
return $this;
}
//eg. $csql->join('tab2','left')->on('tab1.id=tab2.id');
function join($table, $join = 'left') { //left right inner outer
$this->join = " {$join} join {$table}";
return $this;
}
function on($query, $data = null) {
$this->on .= $this->_query($query, $data);
return $this;
}
function order($order) {
$chks = explode(',', $order);
foreach ($chks as $chk) {
@ -73,13 +60,8 @@ class sql {
$this->order = $order;
return $this;
}
function group($group) {
//检查group是否字母数字_-
$this->group = $group;
return $this;
}
function having($query, $data = null) {
$this->having .= $this->_query($query, $data);
function selecttail($selecttail) {
$this->selecttail = $selecttail;
return $this;
}
function where($query, $data = null) {
@ -248,6 +230,8 @@ class sql {
$data = "%{$data}%";
$query = " and {$query} ?";
} else if (substr($query, -3) == ' in') {
if (is_array($data))
$data = implode(',', $data);
if ($data === '')
return '';
return " and {$query} ({$data})";
@ -264,27 +248,14 @@ class sql {
return $query;
}
function buildsql() {
//where group having order
if (empty($this->table))
return null;
$sql = "select {$this->column} from {$this->table}";
//force index()
if (!empty($this->join) && !empty($this->on)) {
$sql .= $this->join;
if (strpos($this->on, ' and ') === 0)
$this->on = substr($this->on, 5);
$sql .= ' on ' . $this->on;
}
$sql .= $this->buildwhere();
if (!empty($this->group))
$sql .= ' group by ' . $this->group;
if (!empty($this->having)) {
if (strpos($this->having, ' and ') === 0)
$this->having = substr($this->having, 5);
$sql .= ' having ' . $this->having;
}
if (!empty($this->order))
$sql .= ' order by ' . $this->order;
if (!empty($this->selecttail))
$sql .= ' ' . $this->selecttail;
return $sql;
}
function buildwhere() {
@ -294,4 +265,4 @@ class sql {
$this->where = substr($this->where, 5);
return ' where ' . $this->where;
}
}
}