后端中需要考虑的几点问题
后端中需要考虑的几点问题:
添加过程中
查询
- 关于数据权限的限制功能
1、普通的id转换为复杂,又不容易猜中的md5或sha1值。(没有限制,但是用户不易猜中)
2、将数据权限,整体封装成一个模快,避免其在各个代码中散布。集中,便于管理(但是,目前未找到比较好的解决方法。)
输入限制
- 用户在提交表单或参数时,需要验证输入类型。
- 验证唯一性。(添加、编辑时,或者某一条件下唯一)。
- 用户编辑时,提供已输入的信息。
- 编辑模式下,该id原本所占用的资源依然可选。
删除限制
- 删除模型A,但其依赖另外一个模型B。如何处理?是同时删除模型A、模型B?提示无法删除?还是软删除?或者是建立快照?
不管怎样,删除的依赖验证问题,如何集中处理?或者更优雅的集中管理?
事务问题
某些资源验证不成功,回滚问题?
并发问题
哪些问题需要关注并发问题?如何解决?加锁?
tp5.1学习笔记1
tp5.1学习笔记1
929web终端界面bug调试
928web终端界面
背景颜色
看到panel是有颜色的,使用了渐变色。
.x-panel-body-default {
filter: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#ffffff,endColorStr=#99b9ff);
background: -ms-linear-gradient(top,#ffffff,#99b9ff);
background: -moz-linear-gradient(top,#ffffff,#99b9ff);
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#ffffff), to(#3399ff));
/* border-color:#157fcc; */
color: black;
font-size: 13px;
font-size: normal;
border-width: 1px;
border-style: solid;
}
手动布局
me.SettingPanel.doLayout();有啥作用?
var tree = Ext.create('Ext.tree.Panel',{
title:'网络和位置设置',
renderTo:'SettingPasswordID',
width:300,
//id : 'ShineTreePanel',
height:500,
store: store,
rootVisible: false,
listeners: {
itemclick:function(tree, record, item, index, e, eOpts){
var title = record['data']['text'];
//me.initShineComp();
me.SettingPanel.removeAll();
if(title=='网络状态'){
me.SettingPanel.add(me.formStatus);
}else if (title=='服务器设置'){
me.addShineServerFormPanel();
me.SettingPanel.add(me.formServer);
}else if (title=='有线设置'){
me.addShineOnlineFormPanel();
me.SettingPanel.add(me.formOnline);
}else if (title=='无线设置'){
me.addShineOutlineFormPanel();
me.SettingPanel.add(me.formOutline);
}
me.SettingPanel.doLayout();
}
}
});
me.SettingPanel = Ext.create('Ext.panel.Panel',{
width:700,
height:500,
border:0,
renderTo:'spanId',
items:[me.formServer]
});
页面bug
出现的原因是,panel作为一个容器,在每次点击切换的时候,并没有采取card进行布局,而是利用了removeAll,add的方式来切换。这样做,看起来没有啥大问题。但是如果add的items,有延时事件,在延时的过程中,点切换,直接就因为removeAll,将所有的items移处了,延时时间执行的时候,就再也找不到相关的dom节点了,然后就报错了。针对此bug的代码对比如下:
有bug的代码:
listeners: {
itemclick:function(tree, record, item, index, e, eOpts){
var title = record['data']['text'];
var panel=me.SettingPanel;
panel.removeAll();//暴力移除,再重间
if (title=='服务器设置'){
me.addShineServerFormPanel();//再这个里面会再次重建
panel.add(me.formServer); //然后这个是重建后的item
}
panel.doLayout();
}
}
修改后的代码:
listeners: {
itemclick:function(tree, record, item, index, e, eOpts){
var title = record['data']['text'];
var panel=me.SettingPanel;
var layout = panel.getLayout();
if (title=='服务器设置'){
me.addShineServerFormPanel(); //这个里面加上判断,如果有了,就不要再重建呢。
layout.setActiveItem(1);
}
panel.doLayout();
}
}
//例外,修改布局
me.SettingPanel = Ext.create('Ext.panel.Panel',{
width:700,
height:500,
border:0,
renderTo:'spanId',
layout:'card',//修改成card布局
activeItem:1,//默认显示第二个
items:[me.formStatus,me.formServer,me.formOnline,me.formOutline]
});
js线程问题
js线程问题
今天同事遇到一个问题。点击左侧Dataview做的view,rd.commit虽然执行了,Dataview的store也立马更改了,但是由于itemclick后,使用ShineMessageHub触发了事件,而该事件在多处进行了监听,结果itemclick触发后,很久左侧的dataview的样式才变化。
问题可能描述的不清楚。但是提炼出来,需要关注下面几个问题。
js是单线程的
如下面简单的例子,密集的计算后,才执行setTimeout延时的代码。所以下面的代码,在浏览器终端中,先输出的是999999999,最后才输出第一句的延时代码,输出1。
所以,针对此现象,store变化之后,更改样式是个延时操作。需要在ShineMessageHub触发的事件结束后,线程才有机会执行,重新渲染。
function test (){
setTimeout(function(){
console.log(1);
},0);
var i =0;
tmp=0;
for(;i<1000000000;i++){
tmp=i;
}
console.log(tmp);
}
Ext中的触发事件,其实是立即执行的
Ext中的事件机制,其实是立马执行的。具体实现,别人有例子。(PHP中,php-crud-api中也有注册路由,回调的形式。)
//组件的其他地方,监听了这样的一个方法
ShineMessageHub.on("mytestevent",function(msg){
console.log(2);
});
//某按钮点击事件
handler:function(btn){
setTimeout(function(){
console.log('1');
},0);
ShineMessageHub.fireEvent("mytestevent",1);
}
store更改之后,dataview需要时间渲染(猜测)
猜测dataview中也有个setTimeout之类的延时,在排队。
总结
综上,虽然不清楚具体的原因。但是学习js需要关心这几个知识点。
apache配置
apache配置
禁止访问目录
更改的是httpd.conf及vhost.conf文件。
下面是虚拟主机的配置,更改为Options +ExecCGI,注意+号与后面的单词没有空格,估计的意思是,增加上中个属性的配置。
<VirtualHost *:80>
ServerName zend.scc
DocumentRoot "D:\phpStudy\PHPTutorial\zend"
<Directory "D:\phpStudy\PHPTutorial\zend">
Options +Indexes +FollowSymLinks +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost _default_:80>
DocumentRoot "D:\phpStudy\PHPTutorial\WWW"
<Directory "D:\phpStudy\PHPTutorial\WWW">
# 注意下面的是禁止目录访问,更改前后的对比。
#Options +Indexes +FollowSymLinks +ExecCGI
Options +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
httpd.conf中的配置
DocumentRoot "D:\phpStudy\PHPTutorial\WWW"
<Directory />
#Options +Indexes +FollowSymLinks +ExecCGI
Options +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
备注:另外一种配置形式,缺少+FollowSymLinks,会导致服务直接无法访问。所以,修改要备份,便于快速还原。另外,线上的东西,最好不要随便动。
DocumentRoot "D:/ShineMDS/xampp/htdocs"
<Directory "D:/ShineMDS/xampp/htdocs">
#Options Indexes FollowSymLinks Includes ExecCGI
Options Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
说明:关于禁止目录访问,在两个地方配置,如果其中之一设置了可以目录访问,那么整体就能目录访问,所以,要禁用掉目录访问的功能,需要在这两个地方同时改为禁止访问。
参数:
FollowSymLinks:就是允许你的网页文件夹下的链接文件链接到首页目录以外的文件。举例来说,如果你把首页目录设置为/var/www/html,那么你的网页程序最多只能访问到/var/www/html目录,上层目录是不可见的。但是你可以通过链接把文件链接到/var/www/html目录以外的文件以访问该文件,如果FollowSymLinks被设置的话
apache访问控制
apache访问控制
示例代码
<IfModule alias_module>
Alias /licenses "D:/ShineMDS/xampp/licenses/"
<Directory "D:/ShineMDS/xampp/licenses">
Options +Indexes
<IfModule autoindex_color_module>
DirectoryIndexTextColor "#000000"
DirectoryIndexBGColor "#f8e8a0"
DirectoryIndexLinkColor "#bb3902"
DirectoryIndexVLinkColor "#bb3902"
DirectoryIndexALinkColor "#bb3902"
</IfModule>
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
# 当前的虚拟机,以别名访问。而且不在一个文件夹下面。
# Alias /phpmyadmin "D:/ShineMDS/xampp/phpMyAdmin/"
Alias /phpsql "D:/ShineMDS/xampp/phpMyAdmin/"
<Directory "D:/ShineMDS/xampp/phpMyAdmin">
AllowOverride AuthConfig
#Require all granted
# 下面只允许本地访问。
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
Alias /webalizer "D:/ShineMDS/xampp/webalizer/"
<Directory "D:/ShineMDS/xampp/webalizer">
<IfModule php7_module>
<Files "webalizer.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
</IfModule>
权限详解
Require all granted
允许所有请求访问资源
Require all denied
拒绝所有请求访问资源
Require env env-var [env-var] …
当指定环境变量设置时允许访问
Require method http-method [http-method] …
允许指定的http请求方法访问资源
Require expr expression
当expression返回true时允许访问资源
Require user userid [userid] …
允许指定的用户id访问资源
Require group group-name [group-name] …
允许指定的组内的用户访问资源
Require valid-user
所有有效的用户可访问资源
Require ip 10 172.20 192.168.2
允许指定IP的客户端可访问资源
Require not group select
select组内的用户不可访问资源
Require local
只允许本地访问