• mynote todo other
  • mynote todo
  • md to html 全部使用 markdown-it,逻辑优化;html to text 优化
  • helper
  • other
  • mynote init
  • mynote todo other

    mynote todo

    文章已经存在
    E:\uninote\mynote-front\static\editor.md\editormd.js
    editormd.js 4188
        // 使用国外的CDN,加载速度有时会很慢,或者自定义URL
        // You can custom KaTeX load url.
        editormd.katexURL  = {
            css : "//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min",
            js  : "//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min"
        };
    docs 注册流程有问题
    --
    修改时间:pure rename 时不改变;sync 时不改变
    user_edit: sync 时不改变,但有可能其实有改变,因此最终需要md5校验
    feat: 70, fix: :文章不存在的处理
    check chdir 后当前路径包含 .git
    test03 数据
    文件夹拖动,路径中含有中文时数据库存储的路径出错
    rename dir 中文
    mynote: 编辑当前页面按钮
    见[快速错误定位](#875EC99012)
    文件夹重命名 删除
    data 中的路径需要同步更新
    --uninote 编辑器
    右侧:同步可选
    展示标题
    esjob: 
    sync es use cache?
    check: use cache? no
    rename 不存在时报错
    log convert
    E:\uninote\mynote\basic\runtime\seaslog_cmd\default\queue-convert.sh
    没有切回 master
    master 分支验证
    ct_log 并发问题
    签名档支持
    lock: 批量时(用于测试)不加锁 & 已经加锁后
    支持 md 、html 两种格式
    CommonMarkConverter
    lv1= lv2= type=

    md to html 全部使用 markdown-it,逻辑优化;html to text 优化

    http://zentao.uninote.com.cn/zentao/task-view-84.html
    还是要区分 md、html 格式,html需要更多的处理
    时间戳是秒?快速两次保存,可能有问题 -- 都存入数据库中?
    有缓存文件,就一定是最新的?
    结合事务考虑
    $artshow_arr = $article_logic->getArticleContent($article_id, false, true);
    md文件时间从 db 中获取
    这里导致修改时间改变,但内容没变
    foreach ($artinfo_arr as $artinfo) {
        $sql = "
        INSERT INTO artinfo
            ( `aid`, `read`, `like`, `comment` )
        VALUES 
            ( :a,:b,:c,:d )
        ON DUPLICATE KEY UPDATE
            `aid` = :a ,
            `read` = :b ,
            `like` = :c ,
            `comment` = :d
        ";
        \Yii::$app->db->createCommand($sql)
            ->bindValue(':a',trim($artinfo['aid']))
            ->bindValue(':b',trim($artinfo['read_cnt']))
            ->bindValue(':c',trim($artinfo['like_cnt']))
            ->bindValue(':d',trim($artinfo['comment_cnt']))
            ->execute();
    }
    \yii\db\Command::batchInsert
    三种方式:
    \Yii::$app->db->createCommand()
        ->delete('artheading', ['aid' => $aid])
        ->execute();
    DbTools::execute("DELETE FROM artheading where aid = $aid");
    DbTools::execute("DELETE FROM artheading where aid = :aid", ["aid" => $aid]);
        /**
    	   * Token#map -> Array
    	   *
    	   * Source map info. Format: `[ line_begin, line_end ]`
    	   **/    this.map = null;
            var md = window.markdownit({
              linkify: true,
              html: true,
            });
    /**
     * markdown 转为 html,并缓存
     * @param $uid
     * @param $path
     * @return mixed|string
     */
    public function convertToHtml($uid, $path, $cache_file) {
    获取文件锁超时 >
     IntegrityException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3000-306346-merge.md' for key 'uid_path'\n The SQL being executed was: INSERT INTO `article` (`article_id`, `thum`, `abstract`, `uid`, `title`, `updata_time`) VALUES ('306346-merge.md', '', 'to merge modify\n1\n2\n3\n4\n5\n', 3000, '306346-merge', '2021-08-07 16:41:17')
    get lock time
    FILE_LOCK_TIMEOUT 也可能不是超时
    es error, re-queue
    get article info failed 丢弃此job
    Elasticsearch\Common\Exceptions\NoNodesAvailableException
    2021-07-29 17:37:05 [127.0.0.1][-][-][error][Elasticsearch\Common\Exceptions\NoNodesAvailableException] Elasticsearch\Common\Exceptions\NoNodesAvailableException: No alive nodes found in your cluster in E:\uninote\mynote\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ConnectionPool\StaticNoPingConnectionPool.php:51
     Stack trace:
    Notice: Undefined offset: 1 in /home/www/additional_item/log_storage/bin/Analysis/mynote_request.php on line 69
    [{"status":true,"api_name":"mynote_log","path":"\/home\/www\/mynote\/basic\/runtime\/seaslog\/default\/20210729.log","handled_lines":442,"insert_lines":441,"$last_end_index":65614},{"status":false,"api_name":"mynote_login","error":"\u65e5\u5fd7 \/home\/www\/mynote\/basic\/runtime\/seaslog\/login\/20210729.log \u4e0d\u5b58\u5728"},{"status":true,"api_name":"mynote_request","path":"\/home\/www\/mynote\/basic\/runtime\/logs\/logs.txt","handled_lines":4939},{"status":true,"api_name":"mynote_log","path":"\/home\/www\/mynote\/basic\/runtime\/logs\/nginx.log","handled_lines":5194},{"status":true,"api_name":"mynote_log","path":"\/home\/www\/mynote\/basic\/runtime\/logs\/nginx-old.log","handled_lines":0}]

    helper

    # 重新初始化
    cd /e/uninote/mynote/basic/web/docs/3000
    git reset --hard 1dbf7; git push origin -f
    curl 'http://a.mynote.my:8686/api/markdown/repo-sync'   -H 'Connection: keep-alive'   -H 'Accept: application/json, text/plain, */*'   -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36'   -H 'Content-Type: application/x-www-form-urlencoded'   -H 'Origin: http://a.mynote.my:8686'   -H 'Referer: http://a.mynote.my:8686/?api=mynote&mi=mynote&select=syncRepo&ui='   -H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8'   -H 'Cookie: Hm_lvt_078d2823b3bbff357751330198f45c58=1626241342; Hm_lpvt_078d2823b3bbff357751330198f45c58=1626660730; PHPSESSID=lfaq7r3eif7ji37dn4on6bgrnd'   --data-raw 'uid=3000&version=&vcode='   --compressed   --insecure
    # 分支清理
    cd /e/uninote/mynote/basic/web/docs/3000/.git/
    rm -f packed-refs
    cd refs/heads
    rm update* -f
    cd ../tags
    rm * -f
    cd ../../..
    git fetch --prune
    # vm21 分支清理
    cd /home/git/gogs-repositories/3000/3000.git
    rm -f packed-refs
    rm update* -f
    cd refs/heads
    rm update* -f

    other

    debug 开关
    if (shell_exe(['git rev-parse --abbrev-ref HEAD']) !== "master") {
    req index,输出
    这里有问题,create时冲突:
    // repo-sync 方式删除的文章
    if ($article->status === 0) {
    这里可以全生命周期加锁
    $redis->hdel($esMapKey, $aid);
    $m->release($esKey);

    mynote init

    gogs_ssh_port 等变量的检查
    输出当前版本,commit date,message等信息
    ### 解压
    cd /root/init
    . pre.sh
    if [ -f .git.zip ]; then
         unzip .git.zip
         rm -f .git.zip
         git reset --hard
    fi
    mkdir mynote
    cd mynote
    git init
    git remote add origin E:\uninote\mynote
    git fetch
    mkdir mynote
    cd mynote
    git init
    #git remote add origin E:\uninote\mynote
    git remote add origin git@git.uninote.com.cn:eson/mynote.git
    git fetch origin --depth=1
    git branch master FETCH_HEAD
    mkdir mynote-front-dist
    cd mynote-front-dist
    git init
    #git remote add origin E:\uninote\mynote-front-dist
    git remote add origin git@git.uninote.com.cn:cyb/mynote-front-dist.git
    git fetch origin master --depth=1
    git branch master FETCH_HEAD
    mkdir addi
    cd addi
    git init
    git remote add origin git@git.uninote.com.cn:eson/additional_item.git
    git fetch origin
    git branch master FETCH_HEAD
    mkdir fa
    cd fa
    git init
    git remote add origin git@git.uninote.com.cn:eson/fastadmin.git
    git fetch origin
    git branch master FETCH_HEAD