Uninote
Uninote
用户根目录
每日点滴
 mynote todo misc
mynote todo misc
mynote tnds 

mynote 瘦身;vendor清理

E:\uninote\mynote\basic\vendor\composer\autoload_static.php
class ComposerStaticInit90933ea8c1501994af4c881c90cd1926
{
    public static $files = array (
//        '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
//        '2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
//        '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
//        '2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
//        'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
//        '180092cfc969a12e06f2132a203a3184' => __DIR__ . '/..' . '/codeception/verify/src/Codeception/function.php',
    );

mynote sync 同步

E:\uninote\mynote_res\mynote\edam-sync.pdf
lv1=mynote lv2= type=todo

head 添加

客户端
lv1=mynote lv2= type=todo

id 代替path

comment.article_id 变成了真正的id
中文问题
前端不再需要path
没有完成,有残留
变量命名规范 p
basename test;setlocale 在linux下无效
phpstorm声明$maxlen默认值为null,但传入null却无法读取内容:
file_get_contents($path, null, null, -1);
file_get_contents($path, null, null, null);
function file_get_contents ($filename, $flags = null, $context = null, $offset = null, $maxlen = null) {}
$("#path") 不再需要
checkout_content 不再需要
path_for_aid 不再需要
lv1= lv2= type=

上线前todo

if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
        // uncomment the following to add your IP if you are not connecting from localhost.
        'allowedIPs' => ['127.0.0.1', '::1', '120.78.153.202'],
    ];
actionLike 这个不能取消(uid不需要传,直接用就是了):
        if ($uid != $_SESSION['user_id']) {
            return ResponseTools::return_error(ResponseCode::USER_ID_ERROR);
        }
已经初始化了,不必再判断:
public function init()
{
    CT("app/controllers/api/common/BaseController.init(){}");
    $this->req = \Yii::$app->request;
request 包含get、post?
没有参数为啥要post?
    public function actionCount()
    {
        if (!empty($_POST)) {
@throws \yii\db\Exception
 * @throws \yii\db\StaleObjectException
 */
public function picUpdate($userId, $base64, &$errno = 0)
public function addPv($aid, $uid, $ip, $referer, &$errno = 0)
public function getArtLikeNum($aid)
逐渐脱离框架
对比:
private function _checkout_for_like_repeat($ids)
public function checkoutForLikeRepeat($uid, $aid)
??
use function PHPSTORM_META\type;
use app\lib\ResponseTools;
        if (!$arr) {
            $errno = ResponseCode::NOT_HAVE_USER;
            // TODO: 记录日志,而非返回错误,前端无法(不)处理
        }
//        return ResponseTools::return_error(ResponseCode::NOT_HAVE_USER, null, false);
        return ResponseTools::return_error(0, $arr, true);
轮播图获取失败
保存文件时发现working dir not clean
部分可用如何处理?
需要同时支持curl方式获取,session问题?fe server不维护session,仅做转发功能
如何确保session_start至多只调用一次?
每个请求都要初始化这些,完全没必要
public function init()
{
	CT("app/controllers/common/BaseController.init(){}");
	$this->req = \Yii::$app->request;
	$this->api_url = \Yii::$app->api->api_url;
	$this->curl_model = new Curl();
	$this->com = new Com();
lv1= lv2= type=

上线前todo 2

protected function internalExecute($rawSql)
这是干啥?
if (!$rs_arr['status']) {
    slog("[save sql] - \n{$rs_arr['data']}\n - SQL statement has no influence on rows.\n");
}
传路径要验证,不能超出用户目录范围。
errno直接返回到数组中,status逻辑重复。如md.php
md.php, init时就确定了:
$_SESSION['web']['user_info']['username']
actionRename 这里面的文件是否存在需要放在_git_op_lock中,因为可能需要切换版本,并且要在锁中进行。
_db_save_md 新建、编辑分离,就不要insert ... ON DUPLICATE KEY UPDATE 这种了
错误:
url: api_url + '/markdown/version',
var st = $(this).attr('disabled') || true;
6e641acece98335aa43b3d2c0b5459c1f128cafd
lv1= lv2= type=

2018-10 整理

为啥传入uid?
\app\logic\ArticleLogic::info
yii中,1068799191这个被自动识别为id:
http://localhost:222/book/1068799191
E:\uninote\mynote\basic\controllers\BookController.php
public function actionIndex()
{
    // 接收请求
    if ($this->req) {
        $username = $this->req->get('id',FALSE);// 用户唯一标示
    }
actionArticle_info 通过article_info访问
共享ajax controller?
也封装为logic:
// 获取 user_id
if ($this->is_login_bool) {
    $uid = $_SESSION['web']['user_id'];
} else {
    $uid = NULL;
}
public static function return_error($errno, $data = '', $status = false)
{
    return ['errno' => $errno, 'data' => $data, 'status' => $status];
}
curl_error curl_errno
http status code & response
build query 不调用?
file传递?
超时时间
CURLOPT_HEADER 决定是否返回header,但即使为false,也可以获取http code
CURLOPT_RETURNTRANSFER 一般都为true,返回而非直接print
http://php.net/manual/en/function.curl-setopt.php
curl_setopt_array
public static function proxy_logic($class, $method, $args)
// 从model取数据,再根据status设置errno:
public function getArticleContent($article_id)
{
    if (!$article_id) {
        return ResponseTools::return_error(ResponseCode::NOT_HAVE_ARTICLE_UNIQUE);
    }
    $article_model = new Article();
    // 通过 username path 查询出所有文章内容
    $data = $article_model->show_content($article_id);
    $data['status'] ? $data['errno'] = '' : $data['errno'] = $article_model->errno;
    return $data;
logic的status是内部的,还是外部的?
php reflection
curl error:端口错误 ip错误 超时
errno:api返回的,用于api排查错误的
X:\project\visual studio projects\findhelper\codeviewer\Test\GrammarParserTests_out\idcard.php
CTInsert 前不再 CTRemove
修改删除的逻辑:
old:函数定义开始处,第一个非空的内容如果是CT,则一直查找到";",删除之
new:函数定义开始处,一直找到";",生成字符串,去匹配removePattern_,如果成功,删除之
if(isset(\Yii::$app->api->api_proxy_url)) { return \app\logic\CommonLogic::proxy_logic(__CLASS__, __METHOD__, func_get_args()); }
注意移除\app\logic\CommonLogic::proxy_logic自身的proxy
登录返回:
$user_logic->getuserinfoto 返回,多了num,用户文章数(何时使用??):
限制$_session的滥用
移除,好像没用了:
/* @describe 接口:更新用户session
 * @return 输出请求结果
 * */
public function actionUpdate_user_session()
{
    $user_id = $this->req->post('id', FALSE);
    $this->update_user_session($user_id);
    echo json_encode(['info'=>'更新用户session完毕。']);
}
update..session.. 整理,id是多余的
remove:已登录,更新用户session 
前后端同步登陆session
removed:
    /*
    *   @describe  向后台发送同步登陆session 
    *   @return    NULL
    */    
    private function _synchrodata()
    {
        $msign = $this->com->AES($_SESSION["web"]["user_info"]);
        $param = array('id'=>$_SESSION["web"]["user_id"],'data'=>$msign);
        $url = "/user/synchrodata";
        $this->curl_model->http_post($this->api_url.$url,$param);
    }
    /**
    * @function 
    * @deprecated
    * @param $url String api地址
    * @param $param Array/String 请求的参数
    * 请求api指引方法
    */
    // public function _req_api($url,$param)
    // {
    //     // 请求信息
    //     if (is_array($param) || is_object($param)) {
    //         $param_en = http_build_query($param);
    //     } else {
    //         $param_en = $param;
    //     }    
        
    //     if ($this->curl_model->http_post($this->api_url.$url,$param)) {
    //         $json = $this->curl_model->tmp_info;
    //         $data = json_decode($json,TRUE);
            
    //         /*记录日志*/
    //         $param_str = urldecode($param_en);
    //         $api_info = "httpCode: {$this->curl_model->http_code} \n url: {$this->api_url}{$url} \n param: {$param_str} \n result: \n {$json} ";
    //         \SeasLog::info($api_info,array(),'api');
            
    //         /*定义返回数据*/
    //         $data['json'] = $json;
    //         // 客户端登录数据还在 - 向后台发送同步登陆session
    //         if (!empty($data['errno']) && $data['errno'] == -1100 && !empty($_SESSION["web"]["user_info"])) {
    //             $this->_synchrodata();
    //             return $this->_req_api($url,$param);
    //         }
    //         if (!empty($data['json'])) {
    //             return $data;
    //         }
    //         throw new \Exception("no json data", -2000);
    //     } else {
    //         throw new \Exception("curl error", -2001);
    //     }
    // }
is_mobile_request 耗时?优化:根据session,判断是否是mobile。不必每次都计算。
lv1=mynote lv2= type=todo
session中存储pv信息,避免数据库操作。
public function Addpv($arr)
{
    $rs = \Yii::$app->db->createCommand()->Insert('artpv',$arr)->execute();
这个会导致复杂的运算??耗时??
SELECT
    kcu.constraint_name,
    kcu.column_name,
    kcu.referenced_table_name,
    kcu.referenced_column_name
FROM information_schema.referential_constraints AS rc
JOIN information_schema.key_column_usage AS kcu ON
    (
        kcu.constraint_catalog = rc.constraint_catalog OR
        (kcu.constraint_catalog IS NULL AND rc.constraint_catalog IS NULL)
    ) AND
    kcu.constraint_schema = rc.constraint_schema AND
    kcu.constraint_name = rc.constraint_name
WHERE rc.constraint_schema = database() AND kcu.table_schema = database()
AND rc.table_name = 'artpv' AND kcu.table_name = 'artpv'
SessionTools controller不要直接使用
get_message_bool todo
'user_info' => $this->user_info,
<?= $user_info["username"]; ?>
<?= $user_info['username']; ?>
lv1=mynote lv2= type=todo
评论,username不要记死了
lv1=mynote lv2= type=todo
是否登录不应该以有无session为标记
user_id 未登录下,不再设置为ip
'user_info' => $this->user_info,
$_SESSION['web']['user_info']['username'];   -> $this->user_info['username']
lv1=mynote lv2= type=todo
actionLunbotuadd 还有用没?
lv1=mynote lv2= type=todo
js不用uid,如何判断是否登录?
lv1=mynote lv2= type=todo
前后分离的头像update有问题
lv1=mynote lv2= type=todo
user、book controller取消了模板配置
getArticleNum 需要status=1判断
编辑时不应该调用 _db_for_file
验证码session
$uid = \app\lib\SessionTools::getUid();
$user_id = SessionTools::getUid();
$ctx = $this->context;
$_SESSION['web']['user_id']
->
$ctx->user_id
SessionTools::getUid()
$_SESSION['web']['user_info']['username']
->
$ctx->user_info["username"]
$session = SessionTools::getSession();
$web = &SessionTools::get('web');
unset($web['check_code_time']);
这样可以:
$aaa = null;
unset($aaa["aaab"]);
echo "ok";
lv1=mynote lv2= type=todo
信息放session,如果每次不从数据库中取,可能不是最新的。
getuserinfo 如何调用??

gogs todo

message_text_relation_aid
https://github.com/gogs/go-gogs-client/wiki
https://github.com/gogs/go-gogs-client/wiki/Administration-Users
https://github.com/gogs/go-gogs-client/wiki/Administration-Repositories
新的操作令牌生成成功!您必须立即复制到一个安全的地方,因为该令牌只会显示一次!
collaborators
lv1= lv2= type=

短信

AccessKey详情
AccessKeyID:LTAImnfwWptNEeqz AccessKeySecret:u2ClVsV29RQl4GYFOQvduU0ujV6riY 

前后分离

前端的controller,不应该返回json,api访问直接调用api的controller: -- 但这样会有跨域问题。可以考虑怎样简化代码
public function actionTelregister()
{
    $tel = $this->req->post('tel', FALSE);
    $code = $this->req->post('code', FALSE);
    $password = $this->req->post('password', FALSE);
    
    $user_logic = new UserLogic();
    $result = $user_logic->user_telregister($tel,$code,$password);
    
    return $this->handle_result($result);
}

规范 review

新增代码要review 再合并到master

mynote codetracker/ct error

php codetracker ct 
views/user/login.php
function check() {
E:\uninote\mynote\basic\views
common.php
E:\uninote\mynote\basic\web\tests\log_storage.php
E:\uninote\mynote\basic\models\page.php
lv1= lv2= type=

实习 todo

rtf文档整理;php等文档整理
pdf-》html 整理

mynote todo tnds

lv1=mynote lv2= type=todo
// 获取当前系统时间,返回float格式,单位:秒
function get_time() {
	date_default_timezone_set('Asia/Shanghai');
	list($usec, $sec) = explode(" ", microtime());
	return ((float)$usec + (float)$sec);
}
lv1=mynote lv2= type=todo
自动创建git仓库、管理ssh key
SHA-1: 3ba286f4ff9561807b8ec143465470f00de5be57
* 【更新】- html缓存清理
这种容易解析不到json
[master 0743903] update
 Date: Sat Aug 11 15:57:14 2018 +0800
 1 file changed, 1 insertion(+), 1 deletion(-)
Deleted branch update_1941333651 (was 0743903).
{"status":true}
lv1=mynote lv2= type=todo
异常处理
public function runWithParams($params)
这里如果已经有输出,header 500 还有作用?
public function render_error($code)
{
    CT("app/controllers/api/common/BaseController.render_error(code){}");
    global $request_num;
    $response = /Yii::$app->getResponse();
    $response->format = $response::FORMAT_RAW;
    $response->getHeaders()->set('Status', 500);
    return "error occurs : {$request_num} /n code : {$code}";
}
一般的错误,不要报404
lv1=mynote lv2= type=todo
环境变量控制config
check session_start(); 
这种不应该作为member:
public $curl_model = NULL;// curl 模块
lv1=mynote lv2= type=todo
2>&1 可以放到 $this->_shell_ex($cmds);里面
免得每个都去写
lv1=mynote lv2= type=todo
actionResetpwd_tel actionResetpwd_email 提起公共代码
lv1= lv2= type=todo

markdown 转纯文本有问题

public function get_text($html,$ext='md')
{
    if ($ext == 'md') {
        $parser = new \HyperDown\Parser;
        $html = $parser->makeHtml($html);
        $html = "<html><body>" . $html . "</body></html>";
        $doc = \phpQuery::newDocument($html);
        return $doc->text();
    } else {
        $html = $this->CloseTags($html);
        $doc = \phpQuery::newDocument($html);
        $doc["#outline"]->empty();
        $doc["style"]->empty();
        $doc["script"]->empty();
        return $doc["body"]->text();
    }
}
lv1= lv2= type=

微信公众号 掘金等一键发布 selenium

selenium等待用户完成某个动作。
获取数据post
js脚本?
E:\projects\tweets
E:\projects\tweets\README.md
pip3 install selenium
pip3 install yaml -> PyYAML
pip3 install requests
ERROR:root:'gbk' codec can't decode byte 0x80 in position 395: illegal multibyte sequence
Traceback (most recent call last):
  File "E:\projects\tweets\workspace\baseMethod.py", line 122, in yaml_read
    return yaml.load(f, yaml.FullLoader)["browser"]
pyhon-----安装yaml踩过的坑以及正解
https://www.codetd.com/article/1883431
https://stackoverflow.com/questions/14261614/how-do-i-install-the-yaml-package-for-python
https://stackoverflow.com/questions/14261614/how-do-i-install-the-yaml-package-for-python/23613658
There are three YAML capable packages. Syck (pip install syck) which implements the YAML 1.0 specification from 2002; PyYAML (pip install pyyaml) which follows the YAML 1.1 specification from 2004; and ruamel.yaml which follows the latest (YAML 1.2, from 2009) specification.
https://github.com/yaml/pyyaml
https://w3c.github.io/webdriver
"C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222
自动化测试-20.selenium常用JS代码执行
https://www.cnblogs.com/cmnz/p/9099473.html
单独的管理后台,用mynote的账号密码登录
同步更新:uninote编辑之后,自动同步更新到其他平台。
  能够区分出是编辑还是是新增
  管理同步到哪些平台
评论收集、统一的评论管理
统计阅读量、评论、点赞量,每日数据统计
消息统一管理
uninote 发文章之后,默认同步到其他平台。
aidmynotejuejinsegmentdefaultviewcommentlikepublish?viewcommentlikepublish?viewcommentlikepublish?1132yesnoyes
lv1= lv2= type=

提醒工具 todo list

告诉xx做一件事,1h 检查,我记录在电脑上
1h后,电脑上提醒我,如果我没有关掉,消息推送;还是不行,短信
(换一句话说:桌面 创建时;也可以自定义延迟时间,过了此设定,则手机震动提醒。再超过一定的阈值发送短信)
手机上可以修改。
再次提醒 10 20 分钟 可以自定义;
方便创建
服务器同步,多端可以同时修改。
支持桌面(桌面版支持热键)、手机端(小程序+hbuilder)
lv1= lv2= type=

【干货】Chrome插件(扩展)开发全攻略 大纲生成器 uoutline extension

https://www.cnblogs.com/liuxianan/p/chrome-plugin-develop.html
〖E:\projects\directory_generator_chrome_plugin〗
popup 点击后自动关闭
快捷键
打包
收藏夹 浏览器辅助工具 
page rank
style dump debug 
https://element.eleme.cn 这个有问题,不能定位
-end

mynote_tnds

mynote_todo0304

点赞(0) 阅读(323) 举报
目录
标题