使用gitolite搭建git服务器并自定义仓库目录

官网:https://gitolite.com/gitolite/index.html

安装:
su - git
mkdir -p ~/bin
git clone https://github.com/sitaramc/gitolite
gitolite/install -ln ~/bin # please use absolute path here
gitolite setup -pk yourname.pub

其中yourname.pub为管理员git公钥。git 跟 gitolite 服务器通信用的是 git 这个真正的系统用户,而 gitolite 控制仓库权限则是使用自己的虚拟用户。这里的 yourname 就是虚拟用户。

gitolite提供了一个 gitolite-shell。当你使用 ssh 访问 gitolite 时 ssh 服务会启动 gitolite-shell。这个脚本会检查当前用户是否有权限访问对应的仓库。如果用户通过 git push 修改了仓库内容,则会触发 gitolite 预先配置 git hook,这些 hook 会执行创建仓库、添加用户之类的操作。

下载主仓库:
git clone git@yourhost:gitolite-admin.git

通过对主仓库配置及公钥进行管理即可。

Gitolite自定义仓库目录
home/git/.gitolite.rc文件新增以下代码,并重新安装一次即可。

#sensen
GL_REPO_BASE    => "/diskb/git/repositories",


账户余额提现逻辑设计

后端逻辑

1.参数检验:银行卡号(必传)、交易密码(必传)、提现金额(必传)、用户ID(必传),TOKEN值(必传)。注意事项:提现金额禁止科学计数法,并且不能为0、为负。

2.判断提现时间是否在可提现时间段(例如8:00至18:00)。

3.旧版本禁止提现(可以变相强制用户更新)。

4.控制提现金额(最小提现金额和最大提现金额)。

5.获取手续费(最低手续费和最高手续费,可根据设置取值)。

事务处理

6.查找用户余额,判断余额是否满足提现金额。

7.更新用户余额字段,扣除提现金额。

8.增加提现记录表字段(提现日志)。

9.发送系统消息。

10.财务审核通过或拒绝,拒绝则退回金额。

11.手动转账或调用第三方支付。

12.记录转账凭证等。

wamp 配置多端口虚拟主机

应用场景:如局域网内访问wamp下的指定网站

修改httpd.conf新增端口,如:

#新增8080端口
Listen 0.0.0.0:8080
Listen [::0]:8080

配置虚拟主机,httpd-vhost.conf

<VirtualHost *:8080>
    ServerName www.test.com
    DocumentRoot "e:/wamp/www/test/public"
    <Directory  "e:/wamp/www/test/public/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

此时局域网其他电脑即可通过IP:8080获取网站接口数据了

Nginx或Apache通过反向代理配置wss服务

为不影响网站正常业务,使用 xx.com/wss 作为代理入口,即客户端连接地址为:wss://xx.com/wss

nginx配置:

server {
  listen 443;
 
  ssl on;
  ssl_certificate /etc/ssl/server.pem;
  ssl_certificate_key /etc/ssl/server.key;
  ssl_session_timeout 5m;
  ssl_session_cache shared:SSL:50m;
  ssl_protocols SSLv3 SSLv2 TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
 
  location /wss
  {
    proxy_pass http://127.0.0.1:2345;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header X-Real-IP $remote_addr;
  }
  
  # location / {} 站点的其它配置...
}

apache配置:
需开启proxy_wstunnel_module模块
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

#extra/httpd-ssl.conf
DocumentRoot "/网站/目录"
ServerName 域名
 
# Proxy Config
SSLProxyEngine on
 
ProxyRequests Off
ProxyPass /wss ws://127.0.0.1:2345
ProxyPassReverse /wss ws://127.0.0.1:2345
 
# 添加 SSL 协议支持协议,去掉不安全的协议
SSLProtocol all -SSLv2 -SSLv3
# 修改加密套件如下
SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM
SSLHonorCipherOrder on
# 证书公钥配置
SSLCertificateFile /server/httpd/cert/your.pem
# 证书私钥配置
SSLCertificateKeyFile /server/httpd/cert/your.key
# 证书链配置,
SSLCertificateChainFile /server/httpd/cert/chain.pem

trim汉字导致乱码解决

汉字trim时可能导致乱码,如:
trim("张三、李言、", "、");
解决:

/**
 * 中文trim 解决中文trim乱码
 * @param $string
 * @param string $trim_chars
 * @return string|string[]|null
 */
function mb_trim($string, $trim_chars = '\s'){
    return preg_replace('/^['.$trim_chars.']*(?U)(.*)['.$trim_chars.']*$/u', '\\1',$string);
}

layui table指定行变色 改变样式

done: function(res, curr, count){
    //进行表头样式设置
    $('th').css({'font-weight': 'bold', 'font-size': '15','color': 'orange','background':'linear-gradient(#f2f2f2,#cfcfcf)'});
    //遍历各行 处理样式等
    for(var i in res.data){
        //获取当前行数据
        var item = res.data[i];
        //如:ID等于1则复选框禁止选择
        if(item.id==1){
            $('tr[data-index=' + i + '] input[type="checkbox"]').prop('disabled', true); //禁用当前
            $('tr[data-index=' + i + '] input[type="checkbox"]').parent('div').css('display', 'none'); //隐藏这个复选框
            table.render('checkbox'); // 重新渲染一下checkbox
        }
        // 02.如果已结算则整行变灰色
        if(item.ck23=='ok'){
            $("tr[data-index='" + i + "']").attr({"style":"background:#cccccc"});
        }
        // …… 其他功能
    }
}

Excel中将时间格式转化成时间戳格式

时间戳转成正常日期的公式:
C1=(A1+8*3600)/86400+70*365+19
其中A1表示当时的1249488000时间戳数值,C1就是所需的日期格式,C1单元格属性改成日期格式就可以了。

正常日期转为时间戳格式公式:
A1=(C1-70*365-19)*86400-8*3600
其中C1表示正常日期时间格式,A1就是所需的时间戳格式,A1单元格属性日期格式转成常规格式就可以了。