diff --git a/web/admin/rigger/cata.html b/web/admin/rigger/cata.html
index ec4a99d..8e4cb57 100644
--- a/web/admin/rigger/cata.html
+++ b/web/admin/rigger/cata.html
@@ -129,7 +129,7 @@
return '
';
}
if (key == 'isuse') {
- return '
';
+ return '
';
}
if (key == '_btn') {
var html = '';
diff --git a/web/admin/rigger/cata.php b/web/admin/rigger/cata.php
index 668c257..e671b93 100644
--- a/web/admin/rigger/cata.php
+++ b/web/admin/rigger/cata.php
@@ -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)
diff --git a/web/admin/rigger/funcslow.go b/web/admin/rigger/funcslow.go
index 5537605..fb62a5e 100644
--- a/web/admin/rigger/funcslow.go
+++ b/web/admin/rigger/funcslow.go
@@ -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)
diff --git a/web/admin/rigger/funcslow.php b/web/admin/rigger/funcslow.php
index 958f444..1622fac 100644
--- a/web/admin/rigger/funcslow.php
+++ b/web/admin/rigger/funcslow.php
@@ -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);
diff --git a/web/admin/rigger/logfile.php b/web/admin/rigger/logfile.php
index 5a92ea5..9d8a3af 100644
--- a/web/admin/rigger/logfile.php
+++ b/web/admin/rigger/logfile.php
@@ -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');
diff --git a/web/admin/rigger/luser.go b/web/admin/rigger/luser.go
new file mode 100644
index 0000000..05ba66f
--- /dev/null
+++ b/web/admin/rigger/luser.go
@@ -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)
+}
diff --git a/web/admin/rigger/luser.html b/web/admin/rigger/luser.html
new file mode 100644
index 0000000..a12ae28
--- /dev/null
+++ b/web/admin/rigger/luser.html
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/rigger/luser.php b/web/admin/rigger/luser.php
new file mode 100644
index 0000000..d742fda
--- /dev/null
+++ b/web/admin/rigger/luser.php
@@ -0,0 +1,95 @@
+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);
+ }
+}
diff --git a/web/ambap/ai.php b/web/ambap/ai.php
new file mode 100644
index 0000000..d9c5ea2
--- /dev/null
+++ b/web/ambap/ai.php
@@ -0,0 +1,288 @@
+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;
+ }
+}
diff --git a/web/ambap/login.php b/web/ambap/login.php
index e7e9896..7575d7b 100644
--- a/web/ambap/login.php
+++ b/web/ambap/login.php
@@ -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']);
diff --git a/web/ambap/me.php b/web/ambap/me.php
index c60a695..c7aeb10 100644
--- a/web/ambap/me.php
+++ b/web/ambap/me.php
@@ -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);
diff --git a/web/api/ai.php b/web/api/ai.php
new file mode 100644
index 0000000..4cfa672
--- /dev/null
+++ b/web/api/ai.php
@@ -0,0 +1,288 @@
+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;
+ }
+}
diff --git a/web/api/message.php b/web/api/message.php
new file mode 100644
index 0000000..510bc8c
--- /dev/null
+++ b/web/api/message.php
@@ -0,0 +1,59 @@
+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-=99,sendtimes=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);
+ }
+}
diff --git a/web/api/thirdapi.php b/web/api/thirdapi.php
new file mode 100644
index 0000000..e9399f0
--- /dev/null
+++ b/web/api/thirdapi.php
@@ -0,0 +1,27 @@
+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":"法轮大法好啊啊阿萨德"}}
+ }
+}
diff --git a/web/api/v1.php b/web/api/v1.php
index dde805a..7314657 100644
--- a/web/api/v1.php
+++ b/web/api/v1.php
@@ -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;
diff --git a/web/jscss/ciy.js b/web/jscss/ciy.js
index b099d56..b20e2e4 100644
--- a/web/jscss/ciy.js
+++ b/web/jscss/ciy.js
@@ -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, '
'));
+ });
});
\ No newline at end of file
diff --git a/web/jscss/ciycmp.js b/web/jscss/ciycmp.js
index 4ad3210..b7ce456 100644
--- a/web/jscss/ciycmp.js
+++ b/web/jscss/ciycmp.js
@@ -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 += '
';
@@ -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';
diff --git a/web/jscss/ciycmp2.js b/web/jscss/ciycmp2.js
index 113e8e3..65afbea 100644
--- a/web/jscss/ciycmp2.js
+++ b/web/jscss/ciycmp2.js
@@ -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文本,1html,2表格
+ 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 += '';
+ if (isol) {
+ isol = false;
+ html += '';
+ }
ispvs = 0;
html += '
';
continue;
@@ -32,27 +34,39 @@ ciyfn.markdown = function (markdown) {
if (ispvs == 2)
html += '';
ispvs = 0;
+ if (isol) {
+ isol = false;
+ html += '';
+ }
var cr = mds[m].substring(1, 2).toLowerCase();
- if (mds[m].substring(0, 4) == '####') {
- titnum4++;
- html += '
' + titnum2 + '.' + titnum3 + '.' + titnum4 + '、' + convertcode(mds[m].substring(4)) + '
';
+ if (mds[m].substring(0, 5) == '#####') {
+ if (mds[m].substring(5, 6) == '1')
+ html += '
' + olnum(4, titnum, '、') + convertcode(mds[m].substring(6)) + '
';
+ else
+ html += '
' + convertcode(mds[m].substring(5)) + '
';
+ } else if (mds[m].substring(0, 4) == '####') {
+ if (mds[m].substring(4, 5) == '1')
+ html += '
' + olnum(3, titnum, '、') + convertcode(mds[m].substring(5)) + '
';
+ else
+ html += '
' + convertcode(mds[m].substring(4)) + '
';
} else if (mds[m].substring(0, 3) == '###') {
- titnum3++;
- titnum4 = 0;
- html += '
' + titnum2 + '.' + titnum3 + '、' + convertcode(mds[m].substring(3)) + '
';
- }
- else if (mds[m].substring(0, 2) == '##') {
- titnum2++;
- titnum3 = 0;
- html += '
' + titnum2 + '、' + convertcode(mds[m].substring(2)) + '
';
- }
- else if (cr == 'c')
+ if (mds[m].substring(3, 4) == '1')
+ html += '
' + olnum(2, titnum, '、') + convertcode(mds[m].substring(4)) + '
';
+ else
+ html += '
' + convertcode(mds[m].substring(3)) + '
';
+ } else if (mds[m].substring(0, 2) == '##') {
+ if (mds[m].substring(2, 3) == '1')
+ html += '
' + olnum(1, titnum, '、') + convertcode(mds[m].substring(3)) + '
';
+ else
+ html += '
' + convertcode(mds[m].substring(2)) + '
';
+ } else if (cr == 'c')
html += '
' + convertcode(mds[m].substring(2)) + '
';
else if (cr == 'r')
html += '
' + convertcode(mds[m].substring(2)) + '
';
+ else if (cr == '1')
+ html += '
' + olnum(0, titnum, '、') + convertcode(mds[m].substring(2)) + '
';
else
- html += '
' + convertcode(mds[m].substring(1)) + '
';
-
+ html += '
' + convertcode(mds[m].substr(1)) + '
';
} else if (mds[m][0] == '@') {//c居中,r靠右
if (ispvs == 2)
html += '';
@@ -62,7 +76,13 @@ ciyfn.markdown = function (markdown) {
html += '
' + convertcode(mds[m].substring(2)) + '
';
else if (cr == 'r')
html += '
' + convertcode(mds[m].substring(2)) + '
';
- else
+ else if (cr == '1') {
+ if (!isol) {
+ isol = true;
+ html += '
';
+ }
+ html += '- ' + convertcode(mds[m].substr(2)) + '
';
+ } else
html += mds[m].substring(1);
} else if (mds[m][0] == '!') {//图片
@@ -121,12 +141,35 @@ ciyfn.markdown = function (markdown) {
if (ispvs == 2)
html += '';
ispvs = 0;
+ if (isol) {
+ isol = false;
+ html += '
';
+ }
html += '
' + convertcode(mds[m]) + '
';
}
}
if (ispvs == 2)
html += '';
+ if (isol) {
+ isol = false;
+ html += '';
+ }
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 = '
';
html += '
';
html += '
';
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 += '
' + dtimevalue[0] + '
' + ciyfn.lang('选择小时') + ''
html += '
' + dtimevalue[1] + '
' + ciyfn.lang('选择分钟') + ''
- if (opn.type == 'second')
+ if (opn.type == 'sec')
html += '
' + dtimevalue[2] + '
' + ciyfn.lang('选择秒钟') + ''
html += '
'
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) {