Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
OA
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
weiyn
OA
Commits
35228b4c
提交
35228b4c
authored
5月 09, 2020
作者:
chengye
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'test' of
ssh://39.155.253.71:33222/PHP/OA
into test
上级
e4ea485c
4d5b2a4b
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
266 行增加
和
489 行删除
+266
-489
README.md
README.md
+2
-0
mode_goodly.js
webmain/flow/input/inputjs/mode_goodly.js
+10
-9
mode_finfybxAction.php
webmain/flow/input/mode_finfybxAction.php
+13
-4
mode_goodlyAction.php
webmain/flow/input/mode_goodlyAction.php
+5
-5
mode_oafkAction.php
webmain/flow/input/mode_oafkAction.php
+14
-2
mode_oayfkAction.php
webmain/flow/input/mode_oayfkAction.php
+35
-9
finfybxModel.php
webmain/model/flow/finfybxModel.php
+58
-1
fund_depositModel.php
webmain/model/flow/fund_depositModel.php
+1
-0
fund_transferModel.php
webmain/model/flow/fund_transferModel.php
+2
-0
oafkModel.php
webmain/model/flow/oafkModel.php
+63
-0
oayfkModel.php
webmain/model/flow/oayfkModel.php
+63
-0
tpl_upload.html
webmain/public/upload/tpl_upload.html
+0
-357
uploadAction.php
webmain/public/upload/uploadAction.php
+0
-102
没有找到文件。
README.md
浏览文件 @
35228b4c
...
@@ -58,3 +58,4 @@
...
@@ -58,3 +58,4 @@
15、iconfont图标库:http://www.iconfont.cn/
15、iconfont图标库:http://www.iconfont.cn/
16、腾讯地图:http://map.qq.com/
16、腾讯地图:http://map.qq.com/
16、nodejs:https://nodejs.org/
16、nodejs:https://nodejs.org/
17
\ No newline at end of file
webmain/flow/input/inputjs/mode_goodly.js
浏览文件 @
35228b4c
...
@@ -22,7 +22,7 @@ function initbodys(){
...
@@ -22,7 +22,7 @@ function initbodys(){
for
(
i
=
0
;
i
<
da
.
length
;
i
++
){
for
(
i
=
0
;
i
<
da
.
length
;
i
++
){
d
=
da
[
i
];
d
=
da
[
i
];
bo
=
false
;
bo
=
false
;
for
(
j
=
0
;
j
<
dao
.
length
;
j
++
)
if
(
dao
[
j
].
aid
==
d
.
value
)
bo
=
true
;
//
for(j=0;j<dao.length;j++)if(dao[j].aid==d.value)bo=true;
oii
++
;
oii
++
;
if
(
!
bo
){
if
(
!
bo
){
if
(
oii
>
0
){
if
(
oii
>
0
){
...
@@ -38,15 +38,16 @@ function initbodys(){
...
@@ -38,15 +38,16 @@ function initbodys(){
aid
:
d
.
value
aid
:
d
.
value
});
});
$
(
form
(
'count'
+
nam
[
2
]
+
''
)).
attr
(
'max'
,
d
.
stock
);
$
(
form
(
'count'
+
nam
[
2
]
+
''
)).
attr
(
'max'
,
d
.
stock
);
}
else
{
oii
--
;
if
(
i
==
0
){
this
.
setrowdata
(
nam
[
0
],
nam
[
1
],{
temp_aid
:
''
,
aid
:
'0'
});
}
}
}
// else{
// oii--;
// if(i==0){
// this.setrowdata(nam[0],nam[1],{
// temp_aid:'',
// aid:'0'
// });
// }
// }
}
}
}
}
}
}
...
...
webmain/flow/input/mode_finfybxAction.php
浏览文件 @
35228b4c
...
@@ -6,14 +6,23 @@
...
@@ -6,14 +6,23 @@
class
mode_finfybxClassAction
extends
inputAction
{
class
mode_finfybxClassAction
extends
inputAction
{
protected
function
savebefore
(
$table
,
$arr
,
$id
,
$addbo
){
// protected function savebefore($table, $arr, $id, $addbo){
// $cbzxid= $arr['cbzxid'];
// $model = 'c_fund_account';
// $sql = " cost_id ='$cbzxid' and status = 1 and is_default=1";
// $data = m($model)->getone($sql,'id,account_balance');
}
// if(!$data){
// return "未检测到该成本中心默认扣款账户";
// }
// // if($data['account_balance'] < $arr['amountOfThisPayment']){
// // return "账户余额不足";
// // }
// }
protected
function
saveafter
(
$table
,
$arr
,
$id
,
$addbo
){
}
public
function
getlastAjax
()
public
function
getlastAjax
()
{
{
...
...
webmain/flow/input/mode_goodlyAction.php
浏览文件 @
35228b4c
...
@@ -10,11 +10,11 @@ class mode_goodlyClassAction extends inputAction{
...
@@ -10,11 +10,11 @@ class mode_goodlyClassAction extends inputAction{
$this
->
sssaid
=
'0'
;
$this
->
sssaid
=
'0'
;
foreach
(
$data
as
$k
=>
$rs
){
foreach
(
$data
as
$k
=>
$rs
){
if
(
$rs
[
'count'
]
==
0
)
return
'行['
.
(
$k
+
1
)
.
']的数量不能为0'
;
if
(
$rs
[
'count'
]
==
0
)
return
'行['
.
(
$k
+
1
)
.
']的数量不能为0'
;
if
(
!
isset
(
$cbarr
[
$rs
[
'aid'
]])){
//
if(!isset($cbarr[$rs['aid']])){
$cbarr
[
$rs
[
'aid'
]]
=
1
;
//
$cbarr[$rs['aid']] = 1;
}
else
{
//
}else{
return
'行['
.
(
$k
+
1
)
.
']的物品已申请了'
;
//
return '行['.($k+1).']的物品已申请了';
}
//
}
$this
->
sssaid
.=
','
.
$rs
[
'aid'
]
.
''
;
$this
->
sssaid
.=
','
.
$rs
[
'aid'
]
.
''
;
}
}
}
}
...
...
webmain/flow/input/mode_oafkAction.php
浏览文件 @
35228b4c
...
@@ -14,6 +14,20 @@ class mode_oafkClassAction extends inputAction{
...
@@ -14,6 +14,20 @@ class mode_oafkClassAction extends inputAction{
*/
*/
protected
function
savebefore
(
$table
,
$arr
,
$id
,
$addbo
){
protected
function
savebefore
(
$table
,
$arr
,
$id
,
$addbo
){
// $cbzxid= $arr['cbzx_code'];
// $model = 'c_fund_account';
// $sql = " cost_id ='$cbzxid' and status = 1 and is_default=1";
// // var_dump($sql);die;
// $data = m($model)->getone($sql,'id,account_balance');
// if(!$data){
// return "未检测到该成本中心默认扣款账户";
// }
// if($data['account_balance'] < $arr['amountOfThisPayment']){
// return "账户余额不足";
// }
}
}
/**
/**
...
@@ -23,9 +37,7 @@ class mode_oafkClassAction extends inputAction{
...
@@ -23,9 +37,7 @@ class mode_oafkClassAction extends inputAction{
* $id Int 对应表上记录Id
* $id Int 对应表上记录Id
* $addbo Boolean 是否添加时
* $addbo Boolean 是否添加时
*/
*/
protected
function
saveafter
(
$table
,
$arr
,
$id
,
$addbo
){
}
public
function
getbankinfoAjax
()
public
function
getbankinfoAjax
()
{
{
...
...
webmain/flow/input/mode_oayfkAction.php
浏览文件 @
35228b4c
...
@@ -14,17 +14,42 @@ class mode_oayfkClassAction extends inputAction{
...
@@ -14,17 +14,42 @@ class mode_oayfkClassAction extends inputAction{
*/
*/
protected
function
savebefore
(
$table
,
$arr
,
$id
,
$addbo
){
protected
function
savebefore
(
$table
,
$arr
,
$id
,
$addbo
){
}
// if($data['account_balance'] < $arr['amountOfThisPayment']){
// return "账户余额不足";
// }
/**
* 重写函数:保存后处理,主要保存其他表数据
* $table String 对应表名
* $arr Array 表单参数
* $id Int 对应表上记录Id
* $addbo Boolean 是否添加时
*/
protected
function
saveafter
(
$table
,
$arr
,
$id
,
$addbo
){
}
}
// protected function savesubbefore($data,$tables){
// if($tables == 'c_fund_details_yfk'){
// if (count($data) > 1) {
// foreach ($data as $key => $value) {
// $cbzxid= $value['cbzx_code'];
// $model = 'c_fund_account';
// $sql = " cost_id ='$cbzxid' and status = 1 and is_default=1";
// $data = m($model)->getone($sql,'id,account_balance');
// if($data===false){
// return "未检测到该成本中心默认扣款账户";
// }
// }
// }else{
// $cbzxid= $data['cbzx_code'];
// $model = 'c_fund_account';
// $sql = " cost_id ='$cbzxid' and status = 1 and is_default=1";
// $data = m($model)->getone($sql,'id,account_balance');
// if($data===false){
// return "未检测到该成本中心默认扣款账户";
// }
// }
// }
// return $data;
// }
}
}
\ No newline at end of file
webmain/model/flow/finfybxModel.php
浏览文件 @
35228b4c
...
@@ -13,14 +13,70 @@ class flow_finfybxClassModel extends flowModel
...
@@ -13,14 +13,70 @@ class flow_finfybxClassModel extends flowModel
{
{
$arr
[
"
$sid
"
]
=
"982"
;
$arr
[
"
$sid
"
]
=
"982"
;
$arr
[
"
$sna
"
]
=
"
ε
"
;
$arr
[
"
$sna
"
]
=
"
εÑàéª
"
;
}
}
return
$arr
;
return
$arr
;
}
}
//流程全部完成后调用
protected
function
flowcheckfinsh
(
$zt
){
// 扣除账户余额 c_fund_account account_balance
$cbzxid
=
$this
->
rs
[
'cbxmid'
];
$model
=
'c_fund_account'
;
$sql
=
" cost_id ='
$cbzxid
' and status = 1 and is_default=1"
;
$data
=
m
(
$model
)
->
getone
(
$sql
,
'id,name,account_balance'
);
$zfarr
=
array
(
'account_balance'
=>
$data
[
'account_balance'
]
-
$this
->
rs
[
'money'
],
);
$id
=
$data
[
'id'
];
m
(
'c_fund_account'
)
->
update
(
$zfarr
,
"`id`='
$id
'"
);
// 成本中心 amount 变更
$cbzx
=
substr
(
$cbzxid
,
0
,
strrpos
(
$cbzxid
,
"("
));
$cbzxsql
=
" code ='
$cbzx
' and status = 1"
;
$cbzxdata
=
m
(
'c_cbzx'
)
->
getone
(
$cbzxsql
,
'id,amount'
);
$cbarr
=
array
(
'amount'
=>
$cbzxdata
[
'amount'
]
+
$this
->
rs
[
'money'
],
);
m
(
'c_cbzx'
)
->
update
(
$cbarr
,
"`code`='
$cbzx
'"
);
//账户明细 c_account_detail
$account_detail
=
array
(
'account'
=>
$data
[
'name'
],
'opt_type'
=>
2
,
'amount'
=>
$this
->
rs
[
'money'
],
'trans_numb'
=>
$this
->
rs
[
'docnum'
],
'account_balance'
=>
$data
[
'account_balance'
]
-
$this
->
rs
[
'money'
],
'create_time'
=>
date
(
"Y-m-d H:i:s"
),
'uid'
=>
$this
->
rs
[
'uid'
],
);
m
(
'c_account_detail'
)
->
insert
(
$account_detail
);
// 业务付款8业务预付款10费用报销11 oa_c_fund_detail
$fund_detail
=
array
(
'trans_numb'
=>
$this
->
rs
[
'docnum'
],
'account'
=>
$data
[
'name'
],
'toaccount'
=>
''
,
'trans_amount'
=>
$this
->
rs
[
'money'
],
'business_type'
=>
11
,
'opt_type'
=>
2
,
'account_balance'
=>
$data
[
'account_balance'
]
-
$this
->
rs
[
'money'
],
'create_time'
=>
date
(
"Y-m-d H:i:s"
),
'uid'
=>
$this
->
rs
[
'uid'
],
);
m
(
'c_fund_detail'
)
->
insert
(
$fund_detail
);
}
}
}
\ No newline at end of file
webmain/model/flow/fund_depositModel.php
浏览文件 @
35228b4c
...
@@ -42,6 +42,7 @@ class flow_fund_depositClassModel extends flowModel
...
@@ -42,6 +42,7 @@ class flow_fund_depositClassModel extends flowModel
'account_balance'
=>
$data
[
'account_balance'
]
+
$this
->
rs
[
'trans_amount'
],
'account_balance'
=>
$data
[
'account_balance'
]
+
$this
->
rs
[
'trans_amount'
],
'trans_numb'
=>
$this
->
rs
[
'trans_numb'
],
'trans_numb'
=>
$this
->
rs
[
'trans_numb'
],
'create_time'
=>
$this
->
rs
[
'create_time'
],
'create_time'
=>
$this
->
rs
[
'create_time'
],
'uid'
=>
$this
->
rs
[
'uid'
],
);
);
m
(
'c_account_detail'
)
->
insert
(
$toacc_detail
);
m
(
'c_account_detail'
)
->
insert
(
$toacc_detail
);
...
...
webmain/model/flow/fund_transferModel.php
浏览文件 @
35228b4c
...
@@ -76,6 +76,7 @@ class flow_fund_transferClassModel extends flowModel
...
@@ -76,6 +76,7 @@ class flow_fund_transferClassModel extends flowModel
'account_balance'
=>
$data
[
'account_balance'
]
-
$this
->
rs
[
'trans_amount'
],
'account_balance'
=>
$data
[
'account_balance'
]
-
$this
->
rs
[
'trans_amount'
],
'trans_numb'
=>
$this
->
rs
[
'trans_numb'
],
'trans_numb'
=>
$this
->
rs
[
'trans_numb'
],
'create_time'
=>
$this
->
rs
[
'create_time'
],
'create_time'
=>
$this
->
rs
[
'create_time'
],
'uid'
=>
$this
->
rs
[
'uid'
],
);
);
m
(
'c_account_detail'
)
->
insert
(
$acc_detail
);
m
(
'c_account_detail'
)
->
insert
(
$acc_detail
);
...
@@ -86,6 +87,7 @@ class flow_fund_transferClassModel extends flowModel
...
@@ -86,6 +87,7 @@ class flow_fund_transferClassModel extends flowModel
'account_balance'
=>
$toaccount_list
[
'account_balance'
]
+
$this
->
rs
[
'trans_amount'
],
'account_balance'
=>
$toaccount_list
[
'account_balance'
]
+
$this
->
rs
[
'trans_amount'
],
'trans_numb'
=>
$this
->
rs
[
'trans_numb'
],
'trans_numb'
=>
$this
->
rs
[
'trans_numb'
],
'create_time'
=>
$this
->
rs
[
'create_time'
],
'create_time'
=>
$this
->
rs
[
'create_time'
],
'uid'
=>
$this
->
rs
[
'uid'
],
);
);
m
(
'c_account_detail'
)
->
insert
(
$toacc_detail
);
m
(
'c_account_detail'
)
->
insert
(
$toacc_detail
);
...
...
webmain/model/flow/oafkModel.php
浏览文件 @
35228b4c
...
@@ -8,4 +8,66 @@ class flow_oafkClassModel extends flowModel
...
@@ -8,4 +8,66 @@ class flow_oafkClassModel extends flowModel
if
(
$rs
[
'contractNumber'
])
$rs
[
'contractNumber'
]
=
$this
->
getContractByTag
(
$rs
[
'contractNumber'
]);
if
(
$rs
[
'contractNumber'
])
$rs
[
'contractNumber'
]
=
$this
->
getContractByTag
(
$rs
[
'contractNumber'
]);
return
$rs
;
return
$rs
;
}
}
//流程全部完成后调用
protected
function
flowcheckfinsh
(
$zt
){
$mid
=
$this
->
rs
[
'id'
];
$datafk
=
m
(
'c_fund_details_fk'
)
->
getall
(
'mid='
.
$mid
);
foreach
(
$datafk
as
$key
=>
$value
)
{
// 扣除账户余额 c_fund_account account_balance
$cbzxid
=
$value
[
'cbzx_code'
];
$model
=
'c_fund_account'
;
$sql
=
" cost_id ='
$cbzxid
' and status = 1 and is_default=1"
;
$data
=
m
(
$model
)
->
getone
(
$sql
,
'id,name,account_balance'
);
$zfarr
=
array
(
'account_balance'
=>
$data
[
'account_balance'
]
-
$value
[
'charge_amount'
],
);
$id
=
$data
[
'id'
];
m
(
'c_fund_account'
)
->
update
(
$zfarr
,
"`id`='
$id
'"
);
// 成本中心 amount 变更
$cbzx
=
substr
(
$cbzxid
,
0
,
strrpos
(
$cbzxid
,
"("
));
$cbzxsql
=
" code ='
$cbzx
' and status = 1"
;
$cbzxdata
=
m
(
'c_cbzx'
)
->
getone
(
$cbzxsql
,
'id,amount'
);
$cbarr
=
array
(
'amount'
=>
$cbzxdata
[
'amount'
]
+
$value
[
'charge_amount'
],
);
m
(
'c_cbzx'
)
->
update
(
$cbarr
,
"`code`='
$cbzx
'"
);
//账户明细 c_account_detail
$account_detail
=
array
(
'account'
=>
$data
[
'name'
],
'opt_type'
=>
2
,
'amount'
=>
$value
[
'charge_amount'
],
'trans_numb'
=>
$this
->
rs
[
'docnum'
],
'account_balance'
=>
$data
[
'account_balance'
]
-
$value
[
'charge_amount'
],
'create_time'
=>
date
(
"Y-m-d H:i:s"
),
'uid'
=>
$this
->
rs
[
'uid'
],
);
m
(
'c_account_detail'
)
->
insert
(
$account_detail
);
// 业务付款8业务预付款10费用报销11 oa_c_fund_detail
$fund_detail
=
array
(
'trans_numb'
=>
$this
->
rs
[
'docnum'
],
'account'
=>
$data
[
'name'
],
'toaccount'
=>
$this
->
rs
[
'payee'
],
'trans_amount'
=>
$value
[
'charge_amount'
],
'business_type'
=>
8
,
'opt_type'
=>
2
,
'account_balance'
=>
$data
[
'account_balance'
]
-
$value
[
'charge_amount'
],
'create_time'
=>
date
(
"Y-m-d H:i:s"
),
'uid'
=>
$this
->
rs
[
'uid'
],
);
m
(
'c_fund_detail'
)
->
insert
(
$fund_detail
);
}
}
}
}
\ No newline at end of file
webmain/model/flow/oayfkModel.php
浏览文件 @
35228b4c
...
@@ -8,4 +8,66 @@ class flow_oayfkClassModel extends flowModel
...
@@ -8,4 +8,66 @@ class flow_oayfkClassModel extends flowModel
if
(
$rs
[
'contractNumber'
])
$rs
[
'contractNumber'
]
=
$this
->
getContractByTag
(
$rs
[
'contractNumber'
]);
if
(
$rs
[
'contractNumber'
])
$rs
[
'contractNumber'
]
=
$this
->
getContractByTag
(
$rs
[
'contractNumber'
]);
return
$rs
;
return
$rs
;
}
}
//流程全部完成后调用
protected
function
flowcheckfinsh
(
$zt
){
$mid
=
$this
->
rs
[
'id'
];
$datafk
=
m
(
'c_fund_details_yfk'
)
->
getall
(
'mid='
.
$mid
);
foreach
(
$datafk
as
$key
=>
$value
)
{
// 扣除账户余额 c_fund_account account_balance
$cbzxid
=
$value
[
'cbzx_code'
];
$model
=
'c_fund_account'
;
$sql
=
" cost_id ='
$cbzxid
' and status = 1 and is_default=1"
;
$data
=
m
(
$model
)
->
getone
(
$sql
,
'id,name,account_balance'
);
$zfarr
=
array
(
'account_balance'
=>
$data
[
'account_balance'
]
-
$value
[
'charge_amount'
],
);
$id
=
$data
[
'id'
];
m
(
'c_fund_account'
)
->
update
(
$zfarr
,
"`id`='
$id
'"
);
// 成本中心 amount 变更
$cbzx
=
substr
(
$cbzxid
,
0
,
strrpos
(
$cbzxid
,
"("
));
$cbzxsql
=
" code ='
$cbzx
' and status = 1"
;
$cbzxdata
=
m
(
'c_cbzx'
)
->
getone
(
$cbzxsql
,
'id,amount'
);
$cbarr
=
array
(
'amount'
=>
$cbzxdata
[
'amount'
]
+
$value
[
'charge_amount'
],
);
m
(
'c_cbzx'
)
->
update
(
$cbarr
,
"`code`='
$cbzx
'"
);
//账户明细 c_account_detail
$account_detail
=
array
(
'account'
=>
$data
[
'name'
],
'opt_type'
=>
2
,
'amount'
=>
$value
[
'charge_amount'
],
'trans_numb'
=>
$this
->
rs
[
'docnum'
],
'account_balance'
=>
$data
[
'account_balance'
]
-
$value
[
'charge_amount'
],
'create_time'
=>
date
(
"Y-m-d H:i:s"
),
'uid'
=>
$this
->
rs
[
'uid'
],
);
m
(
'c_account_detail'
)
->
insert
(
$account_detail
);
// 业务付款8业务预付款10费用报销11 oa_c_fund_detail
$fund_detail
=
array
(
'trans_numb'
=>
$this
->
rs
[
'docnum'
],
'account'
=>
$data
[
'name'
],
'toaccount'
=>
$this
->
rs
[
'payee'
],
'trans_amount'
=>
$value
[
'charge_amount'
],
'business_type'
=>
10
,
'opt_type'
=>
2
,
'account_balance'
=>
$data
[
'account_balance'
]
-
$value
[
'charge_amount'
],
'create_time'
=>
date
(
"Y-m-d H:i:s"
),
'uid'
=>
$this
->
rs
[
'uid'
],
);
m
(
'c_fund_detail'
)
->
insert
(
$fund_detail
);
}
}
}
}
\ No newline at end of file
webmain/public/upload/tpl_upload.html
deleted
100755 → 0
浏览文件 @
e4ea485c
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<script
language=
"javascript"
src=
"js/jquery.js"
></script>
<script
language=
"javascript"
src=
"js/js.js"
></script>
<title>
<?=$da['title']?>
</title>
<script
language=
"javascript"
>
var
callback
=
'<?=$params['
callback
']?>'
,
maxup
=
<
?
=
$params
[
'maxup'
]?
>
,
uptype
=
'<?=str_replace('
,
','
|
',$params['
uptype
'])?>'
,
thumbnail
=
'<?=$params['
thumbnail
']?>'
,
maxwidth
=
'<?=$params['
maxwidth
']?>'
,
showid
=
'<?=$params['
showid
']?>'
,
upkey
=
'<?=$params['
upkey
']?>'
,
urlparams
=
<
?
=
$params
[
'urlparams'
]?
>
,
thumbtype
=
'<?=$params['
thumbtype
']?>'
;
//缩略图类型0可能去掉看不到的默认, 1整图缩略可以看到白
var
up
=
{
filearr
:[],
bool
:
false
,
maxsize
:
<
?
=
$params
[
'maxsize'
]?
>
,
moi
:
0
,
wcarr
:[],
init
:
function
()
{
if
(
typeof
(
FormData
)
==
'undefined'
){
$
(
'body'
).
prepend
(
'<div style="color:red;padding:2px;border:1px #dddddd solid;margin:5px">对不起,您的浏览器不支持上传功能,请使用IE10+,火狐,Opera,谷歌浏览器</div>'
);
}
else
{
this
.
reader
=
true
;
}
var
bol
=
true
;
try
{
if
(
parent
.
js
.
uploadrand
!=
upkey
){
bol
=
false
;}}
catch
(
e
){
bol
=
false
;}
if
(
!
bol
){
try
{
if
(
opener
.
js
.
uploadrand
==
upkey
){
bol
=
true
;}}
catch
(
e
){}
}
if
(
!
bol
){
$
(
'body'
).
prepend
(
'<div style="color:red;padding:2px;border:1px #dddddd solid;margin:5px">不正当访问本页面,不能操作</div>'
);
this
.
reader
=
false
;
}
if
(
!
this
.
reader
){
get
(
'addbtn'
).
disabled
=
true
;
get
(
'clearbtn'
).
disabled
=
true
;
get
(
'startbtn'
).
disabled
=
true
;
}
this
.
obj
=
$
(
'#upfile'
);
var
fmsg
=
''
;
if
(
maxup
!=
0
)
fmsg
=
',最多可添加'
+
maxup
+
'个文件'
;
if
(
uptype
!=
'*'
)
fmsg
+=
',限制'
+
uptype
+
'类型'
;
if
(
fmsg
!=
''
)
fmsg
=
fmsg
.
substr
(
1
);
$
(
'#footmsg'
).
html
(
fmsg
);
},
add
:
function
()
{
if
(
!
this
.
reader
||
this
.
bool
)
return
false
;
if
(
maxup
!=
0
){
if
(
this
.
gsize
()
>=
maxup
){
js
.
msg
(
'msg'
,
'最多可添加'
+
maxup
+
'个文件'
);
return
false
;
}
}
document
.
myform
.
inputfile
.
click
();
return
false
;
},
rand
:
function
()
{
var
rand
=
''
+
js
.
now
(
'd_His'
)
+
''
+
parseInt
(
Math
.
random
()
*
9999
)
+
''
;
return
rand
;
},
change
:
function
(
o
){
this
.
change1
(
0
);
},
change1
:
function
(
oi
)
{
var
obja
=
get
(
'inputfileid'
).
files
;
if
(
maxup
!=
0
){
if
(
this
.
gsize
()
>=
maxup
){
this
.
rexushow
();
return
false
;
}
}
if
(
oi
>=
obja
.
length
){
setTimeout
(
'document.myform.reset()'
,
500
);
this
.
rexushow
();
return
false
;
}
var
file
=
obja
[
oi
];
var
olen
=
this
.
filearr
.
length
;
var
filesize
=
file
.
size
;
var
filesizecn
=
js
.
formatsize
(
filesize
);
var
filename
=
file
.
name
;
var
fileext
=
filename
.
substr
(
filename
.
lastIndexOf
(
'.'
)
+
1
).
toLowerCase
();
var
filetype
=
file
.
type
;
if
(
uptype
!=
'*'
&&
uptype
!=
''
){
var
uobo
=
true
;
if
(
uptype
==
'image'
){
if
(
filetype
.
indexOf
(
'image'
)
<
0
)
uobo
=
false
;
}
else
{
var
auptsype
=
'|'
+
uptype
+
'|'
;
if
(
auptsype
.
indexOf
(
'|'
+
fileext
+
'|'
)
<
0
)
uobo
=
false
;
}
if
(
!
uobo
){
var
tstype
=
uptype
;
if
(
tstype
==
'image'
)
tstype
=
'jpg,png,gif,bmp,jpeg'
;
js
.
msg
(
'msg'
,
'['
+
filename
+
']文件类型不符合,请选择类型为['
+
tstype
+
']的文件'
);
up
.
change1
(
oi
+
1
);
return
false
;
}
}
if
(
filesize
>
this
.
maxsize
*
1024
*
1024
){
js
.
msg
(
'msg'
,
'['
+
filename
+
']文件超过'
+
this
.
maxsize
+
' MB,当前文件大小'
+
filesizecn
+
''
);
up
.
change1
(
oi
+
1
);
return
false
;
}
//回调的验证
<
?
php
if
(
$params
[
'changeback'
]
!=
''
){?
>
try
{
var
tisr
=
parent
.
<
?
=
$params
[
'changeback'
]?
>
(
file
);
if
(
tisr
&&
typeof
(
tisr
)
==
'string'
){
js
.
msg
(
'msg'
,
tisr
);
up
.
change1
(
oi
+
1
);
return
false
;
}
}
catch
(
e
){}
<
?
php
}?
>
this
.
moi
++
;
for
(
var
i
=
0
;
i
<
olen
;
i
++
){
if
(
this
.
filearr
[
i
].
filename
==
filename
&&
this
.
filearr
[
i
].
filesize
==
filesize
){
js
.
msg
(
'msg'
,
'['
+
filename
+
']已添加,请不要选择重复文件!'
);
up
.
change1
(
oi
+
1
);
return
false
;
}
}
var
arr
=
{
filename
:
filename
,
filesize
:
filesize
,
filesizecn
:
filesizecn
,
filetype
:
filetype
,
fileext
:
fileext
,
xu
:
this
.
moi
,
fileobj
:
file
};
var
noi
=
this
.
filearr
.
push
(
arr
);
var
fis
=
'web/images/fileicons/'
+
js
.
filelxext
(
fileext
)
+
'.gif'
;
var
s
=
'<div class="mdiv" upload="true">'
+
'<div class="div01"><span>1. </span><img src="'
+
fis
+
'" width="16" height="16" align="absmiddle"> <font>'
+
filename
+
'</font>,<a onclick="up.editname('
+
(
noi
-
1
)
+
', this)" href="javascript:;">改名</a></div>'
+
'<div class="div02">'
+
filesizecn
+
'</div>'
+
'<div class="div03" id="updeng'
+
this
.
moi
+
'">初始化文件...</div>'
+
'</div>'
;
this
.
obj
.
append
(
s
);
$
(
'#updeng'
+
up
.
moi
+
''
).
html
(
'等待上传...<a href="javascript:" temp="del" onclick="return up.del(this,'
+
olen
+
')">×</a>'
);
setTimeout
(
'up.change1('
+
(
oi
+
1
)
+
');'
,
5
);
},
editname
:
function
(
oi
,
o1
){
var
arr
=
this
.
filearr
[
oi
];
if
(
!
arr
){
$
(
o1
).
remove
();
return
;
}
var
nae
=
arr
.
filename
.
replace
(
'.'
+
arr
.
fileext
+
''
,
''
);
js
.
prompt
(
'改名'
,
'输入新的文件名称'
,
function
(
jg
,
txt
){
if
(
jg
==
'yes'
&&
txt
){
var
nname
=
txt
+
'.'
+
arr
.
fileext
+
''
;
up
.
filearr
[
oi
].
filename
=
nname
;
$
(
o1
).
parent
().
find
(
'font'
).
html
(
nname
);
}
},
nae
);
},
del
:
function
(
o
,
oi
)
{
$
(
o
).
parent
().
parent
().
remove
();
this
.
filearr
[
oi
]
=
false
;
this
.
rexushow
();
return
false
;
},
gsize
:
function
()
{
var
olen
=
this
.
filearr
.
length
;
var
ol
=
0
;
for
(
var
i
=
0
;
i
<
olen
;
i
++
){
if
(
this
.
filearr
[
i
])
ol
++
;
}
return
ol
;
},
upload
:
function
()
{
if
(
this
.
bool
)
return
false
;
var
olen
=
this
.
filearr
.
length
;
this
.
uparr
=
[];
var
ol
=
0
;
for
(
var
i
=
0
;
i
<
olen
;
i
++
){
if
(
this
.
filearr
[
i
]){
this
.
uparr
.
push
(
this
.
filearr
[
i
]);
ol
++
;
}
}
if
(
ol
==
0
){
js
.
msg
(
'msg'
,
'请添加上传文件'
);
return
false
;
}
this
.
filearr
=
[];
get
(
'addbtn'
).
disabled
=
true
;
get
(
'quebtn'
).
disabled
=
true
;
get
(
'clearbtn'
).
disabled
=
true
;
get
(
'startbtn'
).
disabled
=
true
;
this
.
bool
=
true
;
$
(
"a[temp='del']"
).
remove
();
$
(
'#prou'
).
show
();
$
(
'#proushow'
).
html
(
'等待上传('
+
ol
+
'/<font id="nowupspan">0</font>)[<font id="allbili">0%</font>]...'
);
$
(
'#proudiv'
).
css
(
'width'
,
'0%'
);
this
.
start
(
0
);
return
false
;
},
start
:
function
(
oi
)
{
if
(
oi
==
this
.
uparr
.
length
){
$
(
'#proushow'
).
html
(
'<font color=white>上传完成</font>'
);
get
(
'addbtn'
).
disabled
=
false
;
get
(
'clearbtn'
).
disabled
=
false
;
get
(
'startbtn'
).
disabled
=
false
;
get
(
'quebtn'
).
disabled
=
false
;
this
.
bool
=
false
;
return
false
;
}
this
.
suarr
=
this
.
uparr
[
oi
];
this
.
suarr
.
xuoi
=
oi
;
this
.
updengid
=
'updeng'
+
this
.
suarr
.
xu
+
''
;
$
(
'#'
+
this
.
updengid
+
''
).
html
(
'<font color=#ff6600>正在上传(<span id="bilishow">0</span>%)...</font>'
);
$
(
'#nowupspan'
).
html
(
oi
+
1
);
this
.
jdt
(
0
);
var
xhr
=
new
XMLHttpRequest
();
urlparams
.
maxsize
=
up
.
maxsize
;
if
(
uptype
&&
uptype
!=
'*'
)
urlparams
.
uptype
=
uptype
;
if
(
thumbnail
)
urlparams
.
thumbnail
=
thumbnail
;
var
url
=
js
.
getajaxurl
(
'upfile'
,
'upload'
,
'public'
,
urlparams
);
xhr
.
open
(
'POST'
,
url
,
true
);
xhr
.
onreadystatechange
=
function
(){
};
xhr
.
upload
.
addEventListener
(
"progress"
,
function
(
evt
){
var
loaded
=
evt
.
loaded
;
var
tot
=
evt
.
total
;
var
per
=
Math
.
floor
(
100
*
loaded
/
tot
);
up
.
jdt
(
per
);
$
(
'#bilishow'
).
html
(
per
);
},
false
);
xhr
.
addEventListener
(
"load"
,
function
(){
up
.
upsuccess
(
this
.
response
,
this
.
status
);
},
false
);
xhr
.
addEventListener
(
"error"
,
function
(){
$
(
'#'
+
up
.
updengid
+
''
).
html
(
'<font color=red>上传失败0</font>'
);
},
false
);
var
fd
=
new
FormData
();
fd
.
append
(
'file'
,
this
.
suarr
.
fileobj
,
this
.
suarr
.
filename
);
xhr
.
send
(
fd
);
},
upsuccess
:
function
(
bstr
,
code
){
var
arr
=
this
.
suarr
;
var
o1s
=
$
(
'#'
+
up
.
updengid
+
''
);
if
(
code
!=
200
){
o1s
.
html
(
'<font color=red>失败:'
+
code
+
'</font>'
);
js
.
msg
(
'msg'
,
bstr
,
0
);
}
else
{
o1s
.
html
(
'<font color=green>上传成功</font>'
);
var
result
=
js
.
decode
(
bstr
);
if
(
result
.
id
){
up
.
wcarr
.
push
({
id
:
result
.
id
,
filename
:
arr
.
filename
,
filetype
:
arr
.
filetype
,
fileext
:
arr
.
fileext
,
filesize
:
arr
.
filesize
,
filesizecn
:
arr
.
filesizecn
,
filepath
:
result
.
filepath
,
thumbpath
:
result
.
thumbpath
,
width
:
result
.
width
,
height
:
result
.
height
});
}
else
{
o1s
.
html
(
'<font color=red>上传失败1,保存失败</font>'
);
js
.
msg
(
'msg'
,
result
.
msg
,
0
);
}
}
setTimeout
(
'up.start('
+
(
arr
.
xuoi
+
1
)
+
')'
,
5
);
},
jdt
:
function
(
bl
){
$
(
'#allbili'
).
html
(
bl
+
'%'
);
$
(
'#proudiv'
).
css
(
'width'
,
''
+
bl
+
'%'
);
},
unload
:
function
(){
return
false
;
},
clear
:
function
()
{
$
(
'#prou'
).
hide
();
this
.
wcarr
=
[];
this
.
filearr
=
[];
this
.
obj
.
html
(
''
);
},
rexushow
:
function
(){
var
o
=
$
(
'#upfile'
).
find
(
'span'
);
for
(
var
i
=
0
;
i
<
o
.
length
;
i
++
){
o
[
i
].
innerHTML
=
''
+
(
i
+
1
)
+
'. '
;
}
},
getsid
:
function
(
a
){
var
sid
=
''
,
i
;
for
(
i
=
0
;
i
<
a
.
length
;
i
++
){
sid
+=
','
+
a
[
i
].
id
+
''
;
}
if
(
sid
!=
''
)
sid
=
sid
.
substr
(
1
);
return
sid
;
},
okla
:
function
(){
var
sid
=
this
.
getsid
(
this
.
wcarr
);
<
?
php
if
(
$callback
!=
''
){?
>
try
{
parent
.
<
?
=
$callback
?
>
(
this
.
wcarr
,
js
.
request
(
'params1'
),
js
.
request
(
'params2'
),
sid
)}
catch
(
e
){}
<
?
php
}?
>
if
(
showid
!=
''
){
try
{
parent
.
js
.
downupshow
(
this
.
wcarr
,
showid
);}
catch
(
e
){}
try
{
opener
.
js
.
downupshow
(
this
.
wcarr
,
showid
);}
catch
(
e
){}
}
this
.
closeaa
();
},
closeaa
:
function
(){
window
.
close
();
try
{
parent
.
js
.
tanclose
(
'uploadwin'
)}
catch
(
e
){}
}
}
window
.
onbeforeunload
=
function
(){
if
(
up
.
bool
)
return
'文件正在上传,确定要关闭页面吗?'
;
}
</script>
<style
type=
"text/css"
>
.alert
{
padding
:
1px
5px
;
border
:
1px
#996
solid
;
background-color
:
#ffffff
;
color
:
#933
}
*
{
font-size
:
14px
;}
.mdiv
{
border-bottom
:
1px
#cccccc
solid
;
height
:
22px
;
overflow
:
hidden
}
.mdiv
div
{
float
:
left
;
height
:
22px
;
line-height
:
22px
;
overflow
:
hidden
;
padding
:
0px
3px
}
.div01
{
width
:
55%
;
text-align
:
left
;
border-right
:
1px
#cccccc
solid
;}
.div02
{
width
:
15%
;
text-align
:
center
;
border-right
:
1px
#cccccc
solid
;}
.div03
{
width
:
25%
;
text-align
:
left
}
#prou
{
overflow
:
hidden
;
background-color
:
#ffffff
;
margin
:
5px
0px
;
border
:
1px
#666
solid
;
padding
:
0px
;
text-align
:
left
;
font-size
:
12px
;
position
:
relative
;
height
:
18px
;
line-height
:
18px
}
#prou
span
{
left
:
5px
;
position
:
absolute
;
top
:
2px
}
#proudiv
{
position
:
absolute
;
left
:
0px
;
top
:
0px
;
height
:
18px
;
overflow
:
hidden
;
background-color
:
#09F
;
width
:
0%
}
button
{
cursor
:
pointer
}
#footmsg
{
text-align
:
left
;
padding
:
3px
}
.quebntha
{
position
:
fixed
;
right
:
10px
;
bottom
:
10px
;}
.webbtn
{
color
:
#ffffff
;
opacity
:
0.8
;
background-color
:
#1389D3
;
padding
:
5px
8px
;
border
:
none
;
cursor
:
pointer
;
font-size
:
14px
;
outline
:
none
;
border-radius
:
5px
}
.webbtn
:disabled
{
background-color
:
#aaaaaa
;
color
:
#eeeeee
}
.webbtn
:hover
{
box-shadow
:
0px
0px
5px
rgba
(
0
,
0
,
0
,
0.3
);
opacity
:
1
}
</style>
</head>
<body
style=
"padding:1px"
onLoad=
"up.init()"
>
<center>
<form
name=
"myform"
style=
"display:none"
><input
type=
"file"
name=
"inputfile"
id=
"inputfileid"
<?
php
if
($
params
['
maxup
']!=
1
)
echo
'
multiple
';?
>
onChange="up.change(this)">
</form>
<div
align=
"left"
style=
"padding:3px"
></div>
<table
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
<tr>
<td
align=
"left"
><button
type=
"button"
class=
"webbtn"
id=
"addbtn"
onClick=
"up.add()"
>
+添加文件
</button>
<button
type=
"button"
class=
"webbtn"
id=
"clearbtn"
onClick=
"up.clear()"
>
-清除所有文件
</button>
<button
type=
"button"
class=
"webbtn"
onClick=
"up.closeaa()"
>
关闭
</button></td>
<td
align=
"right"
><button
type=
"button"
class=
"webbtn"
id=
"startbtn"
onClick=
"up.upload()"
>
开始上传
</button></td>
</tr>
</table>
<div
style=
"overflow:hidden; height:5px"
></div>
<div
id=
"prou"
style=
"display:none"
><div
id=
"proudiv"
></div><span
id=
"proushow"
>
等待上传...
</span></div>
<div
class=
"mdiv"
style=
"background-color:#eeeeee"
>
<div
class=
"div01"
>
文件名
</div>
<div
class=
"div02"
>
大小
</div>
<div
class=
"div03"
>
状态
</div>
</div>
<div
id=
"upfile"
></div>
<div
id=
"footmsg"
></div>
<div
class=
"quebntha"
><button
type=
"button"
disabled
style=
"padding:5px 15px"
class=
"webbtn"
id=
"quebtn"
onClick=
"up.okla()"
>
确定
</button></div>
</center>
</body>
</html>
\ No newline at end of file
webmain/public/upload/uploadAction.php
deleted
100755 → 0
浏览文件 @
e4ea485c
<?php
class
uploadClassAction
extends
Action
{
/**
* 上传文件页面
*/
public
function
defaultAction
()
{
$callback
=
$this
->
get
(
'callback'
);
$callbacka
=
explode
(
'|'
,
$callback
);
$params
[
'callback'
]
=
$callbacka
[
0
];
$params
[
'changeback'
]
=
arrvalue
(
$callbacka
,
1
);
$params
[
'maxup'
]
=
$this
->
get
(
'maxup'
,
'0'
);
$params
[
'thumbnail'
]
=
$this
->
get
(
'thumbnail'
);
$params
[
'maxwidth'
]
=
$this
->
get
(
'maxwidth'
,
'0'
);
$params
[
'showid'
]
=
$this
->
get
(
'showid'
);
$params
[
'upkey'
]
=
$this
->
get
(
'upkey'
);
$params
[
'uptype'
]
=
$this
->
get
(
'uptype'
,
'*'
);
$params
[
'thumbtype'
]
=
$this
->
get
(
'thumbtype'
,
'0'
);
$params
[
'maxsize'
]
=
(
int
)
$this
->
get
(
'maxsize'
,
c
(
'upfile'
)
->
getmaxzhao
());
$urlparams
=
'{}'
;
$urlcan
=
$this
->
get
(
'urlparams'
);
//格式:a=b,c=d
if
(
!
isempt
(
$urlcan
)){
$cans1
=
explode
(
','
,
$urlcan
);
$urlparams
=
array
();
foreach
(
$cans1
as
$cans2
){
$cans3
=
explode
(
':'
,
$cans2
);
$urlparams
[
$cans3
[
0
]]
=
$cans3
[
1
];
}
$urlparams
=
json_encode
(
$urlparams
);
}
$params
[
'urlparams'
]
=
$urlparams
;
$this
->
title
=
$this
->
get
(
'title'
,
'文件上传'
);
$this
->
assign
(
'params'
,
$params
);
$this
->
assign
(
'callback'
,
$params
[
'callback'
]);
}
public
function
upfileAjax
()
{
if
(
!
$_FILES
)
exit
(
'sorry!'
);
$upimg
=
c
(
'upfile'
);
$maxsize
=
(
int
)
$this
->
get
(
'maxsize'
,
5
);
$uptype
=
$this
->
get
(
'uptype'
,
'*'
);
$thumbnail
=
$this
->
get
(
'thumbnail'
);
$upimg
->
initupfile
(
$uptype
,
''
.
UPDIR
.
'|'
.
date
(
'Y-m'
)
.
''
,
$maxsize
);
$upses
=
$upimg
->
up
(
'file'
);
$arr
=
c
(
'down'
)
->
uploadback
(
$upses
,
$thumbnail
,
false
);
$this
->
returnjson
(
$arr
);
}
/**
* 获取文件
*/
public
function
getfileAjax
()
{
$mtype
=
$this
->
request
(
'mtype'
);
$mid
=
(
int
)
$this
->
request
(
'mid'
);
$rows
=
m
(
'file'
)
->
getfiles
(
$mtype
,
$mid
);
echo
json_encode
(
$rows
);
}
/**
* 删除文件
*/
public
function
delfileAjax
()
{
$id
=
(
int
)
$this
->
request
(
'id'
,
'0'
);
m
(
'file'
)
->
delfile
(
$id
);
}
public
function
showAction
()
{
$id
=
(
int
)
$this
->
get
(
'id'
,
'0'
);
$this
->
display
=
false
;
m
(
'file'
)
->
show
(
$id
);
}
/**
* 编辑器上传文件
*/
public
function
upimgAction
()
{
$this
->
display
=
false
;
$upfile
=
c
(
'upfile'
);
$upfile
->
initupfile
(
'jpg|png|gif|jpeg'
,
''
.
UPDIR
.
'|'
.
date
(
'Y-m'
)
.
''
,
5
);
$upses
=
$upfile
->
up
(
'imgFile'
);
if
(
is_array
(
$upses
)){
$url
=
$upses
[
'allfilename'
];
$url
=
str_replace
(
'../'
,
''
,
$url
);
$arr
=
array
(
'error'
=>
0
,
'url'
=>
$url
);
}
else
{
$arr
=
array
(
'error'
=>
1
,
'message'
=>
$upses
);
}
$this
->
returnjson
(
$arr
);
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论