Write the Code. Change the World.

12月 03

校准时间

有些时候,特别是虚拟机,跑着跑着,可能就不准了。校准时间就有必要了。

使用 ntpdate

这里使用 ntpdate 来纠正数据

# centos
yum install ntpdate

# ubuntu
apt-get install ntpdate

# 开始纠正
ntpdate -u ntp.api.bz

如果发现时间和上海时间相差 8 个小时,时区问题请解决,再执行上边的命令。

vim /etc/profile

G

# 调到末尾,加入下边的命令
export TZ='CST-8'

# 使得环境变量生效,再执行上边的命令纠正时区
source /etc/profile

如果经常纠正可以加入定时任务

参考

https://time.is/

https://www.cnblogs.com/luchuangao/p/7795293.html

https://blog.csdn.net/wblinux/article/details/81981328

https://blog.csdn.net/qq_27664167/article/details/80921327

https://www.cnblogs.com/st-jun/p/7737188.html

阅读全文 >>

11月 11

laravel 使用 npm

使用 yarn 来管理

npm config set registry=https://registry.npm.taobao.org

yarn config set registry https://registry.npm.taobao.org

yarn install

npm run watch-poll

假如使用 bootstrap

composer require laravel/ui --dev

php artisan ui bootstrap

阅读全文 >>

9月 25

商户操作:

  1. 安装操作证书 。 使用 mac chrome 安装完成控件后,发现 控件启动不了。这个时候可以这么操作。
  • 浏览器输入 chrome://flags 回车
  • 搜索 Native Client 将状态改成 enable
  • 重启 chrome 即可。
  1. api 安全相关。
# 生成 32 位秘钥
# http://code.php.net.cn 在线编辑

// 创建随机字符串
function createNoncestr($length = 16)
{
    $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    $str = "";
    for($i = 0; $i < $length; $i ++)
    {
        $str .= substr ( $chars, mt_rand ( 0, strlen ( $chars ) - 1 ), 1 );
    }
    return $str;
}

$str = createNoncestr(32);

echo $str;
  1. api 证书

https://kf.qq.com/faq/180824JvUZ3i180824YvMNJj.html

  • 点击更换证书,下载证书只做工具。
  • 设置好路径,下一步生成即可。粘贴进网站上商户输入框。
  • 再网站下一步,生成证书粘贴到工具中。下一步即可。然后打开之前设置的路径。就可以看到 zip文件了。

api 证书不影响支付,对提现等功能才有用。

阅读全文 >>

9月 16

想做

  1. 配置,设置。比如大小,快捷键等。

  2. 主题色,配色。

  3. 支持 sz/rz,上传下载。

做好上边这几个,已经很完美了。不想再弄更多更多。脑袋只有那么大。

参考操作

https://blog.csdn.net/qianghaohao/article/details/79440961

https://www.jianshu.com/p/10ba12d55a49

https://sspai.com/post/53008

https://github.com/xfanwu/oh-my-zsh-custom-xxf

https://www.jianshu.com/p/6ac5ad8ebf98

https://github.com/aikuyun/iterm2-zmodem

阅读全文 >>

9月 12

这里的关键点:
1. redis 异步队列。
2. 多项目。

面对上边这种情况,怎么处理呢。如果不处理又会出现什么现象呢。

因为我们使用 supervisord 进行常驻队列侦听。如果不指定对应的 queue,多项目就会出现串的情况。这个是就可以用 queue 来处理该问题了。

处理

  1. 修改 supervisord 的配置文件。在 command 中指定一个 queue 。如
command=/alidata/service/php/bin/php /alidata/www/www.mlxiu.com/artisan queue:work redis --queue=test --sleep=3 --tries=3
  1. 在项目中,指定 queue。因为使用的是 laravel 框架。 队列继承 ShouldQueue。 可以在构造函数中指定 queue 即可。
public function __construct($id)
{
     $queueName = config('queue.name');
     if ($queueName) {
         $this->onQueue($queueName);
     }
}

queue.name 是自己额外在 queue.config 中添加的变量。

参考

https://www.cnblogs.com/zgxblog/p/10996112.html

阅读全文 >>