Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冷斌
bds
Commits
57a85420
Commit
57a85420
authored
Mar 04, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
8998dd2c
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
62 additions
and
31 deletions
+62
-31
Application/Admin/Controller/AuthManagerController.class.php
+23
-1
Application/Admin/Controller/GoodsController.class.php
+5
-2
Application/Admin/Controller/OtherController.class.php
+3
-2
Application/Admin/View/AuthManager/index.html
+2
-2
Application/Admin/View/AuthManager/managergroup.html
+4
-2
Application/Admin/View/AuthManager/user.html
+4
-3
Application/Admin/View/goods/add.html
+4
-4
Application/Admin/View/goods/updGoods.html
+4
-4
ThinkPHP/Library/OT/Database.class.php
+13
-11
No files found.
Application/Admin/Controller/AuthManagerController.class.php
View file @
57a85420
...
...
@@ -200,11 +200,15 @@ class AuthManagerController extends AdminController{
$map
=
array
(
'module'
=>
'admin'
,
'type'
=>
AuthRuleModel
::
RULE_URL
,
'status'
=>
1
);
$child_rules
=
M
(
'AuthRule'
)
->
where
(
$map
)
->
getField
(
'name,id'
);
$authGroupAccess
=
M
(
'AuthGroupAccess'
);
$authAccess
=
$authGroupAccess
->
where
(
'uid='
.
$_GET
[
'uid'
]
.
' and group_id='
.
$_GET
[
'group_id'
])
->
find
();
$this
->
assign
(
'main_rules'
,
$main_rules
);
$this
->
assign
(
'auth_rules'
,
$child_rules
);
$this
->
assign
(
'node_list'
,
$node_list
);
$this
->
assign
(
'auth_group'
,
$auth_group
);
$this
->
assign
(
'this_group'
,
$auth_group
[(
int
)
$_GET
[
'group_id'
]]);
// $this->assign('this_group', $auth_group[(int)$_GET['group_id']]);
$this
->
assign
(
'this_group'
,
$authAccess
);
if
(
isset
(
$_GET
[
'city'
])){
$this
->
assign
(
'dre'
,
$_GET
[
'city'
]);
}
elseif
(
isset
(
$_GET
[
'pid'
])){
...
...
@@ -224,6 +228,24 @@ class AuthManagerController extends AdminController{
$this
->
ajaxReturn
(
$list
);
}
public
function
writeAccess
()
{
if
(
isset
(
$_POST
[
'rules'
])){
sort
(
$_POST
[
'rules'
]);
$_POST
[
'rules'
]
=
implode
(
','
,
array_unique
(
$_POST
[
'rules'
]));
}
$authGroupAccess
=
M
(
'AuthGroupAccess'
);
$data
=
$authGroupAccess
->
where
(
'uid='
.
$_POST
[
'uid'
]
.
' and group_id='
.
$_POST
[
'group_id'
])
->
save
([
'rules'
=>
$_POST
[
'rules'
],
]);
if
(
$data
)
{
$this
->
success
(
'更新成功!'
);
}
else
{
$this
->
error
(
'更新失败'
);
}
}
/**
* 管理员用户组数据写入/更新
* @author 朱亚杰 <zhuyajie@topthink.net>
...
...
Application/Admin/Controller/GoodsController.class.php
View file @
57a85420
...
...
@@ -94,6 +94,7 @@ class GoodsController extends AdminController
$data
[
'city_id'
]
=
$v
;
$data
[
'price'
]
=
$_POST
[
'price'
.
$v
];
$data
[
'suggest_price'
]
=
$_POST
[
'suggest_price'
.
$v
];
$data
[
'vip_price'
]
=
$_POST
[
'vip_price'
.
$v
];
$data
[
'favorable'
]
=
$_POST
[
'favorable'
.
$v
];
$data
[
'meet'
]
=
$_POST
[
'meet'
.
$v
];
$data
[
'reduce'
]
=
$_POST
[
'reduce'
.
$v
];
...
...
@@ -160,6 +161,7 @@ class GoodsController extends AdminController
$city_id
[]
=
$v
[
'city_id'
];
$pr
[
$v
[
'city_id'
]]
=
$v
[
'price'
];
$su_pr
[
$v
[
'city_id'
]]
=
$v
[
'suggest_price'
];
$vip_pr
[
$v
[
'city_id'
]]
=
$v
[
'vip_price'
];
$fa
[
$v
[
'city_id'
]]
=
$v
[
'favorable'
];
$me
[
$v
[
'city_id'
]]
=
$v
[
'meet'
];
$re
[
$v
[
'city_id'
]]
=
$v
[
'reduce'
];
...
...
@@ -167,6 +169,7 @@ class GoodsController extends AdminController
}
$this
->
pr
=
$pr
;
$this
->
su_pr
=
$su_pr
;
$this
->
vip_pr
=
$vip_pr
;
$this
->
me
=
$me
;
$this
->
re
=
$re
;
$this
->
ex
=
$ex
;
...
...
@@ -243,6 +246,7 @@ class GoodsController extends AdminController
$data
[
'city_id'
]
=
$v
;
$data
[
'price'
]
=
$_POST
[
'price'
.
$v
];
$data
[
'suggest_price'
]
=
$_POST
[
'suggest_price'
.
$v
];
$data
[
'vip_price'
]
=
$_POST
[
'vip_price'
.
$v
];
$data
[
'favorable'
]
=
$_POST
[
'favorable'
.
$v
];
$data
[
'meet'
]
=
$_POST
[
'meet'
.
$v
];
$data
[
'reduce'
]
=
$_POST
[
'reduce'
.
$v
];
...
...
@@ -286,4 +290,4 @@ class GoodsController extends AdminController
$this
->
success
(
'下架成功'
,
U
(
'goods/index'
,
array
(
'p'
=>
session
(
'ym'
),
'id'
=>
$keywords
)));
}
}
\ No newline at end of file
}
Application/Admin/Controller/OtherController.class.php
View file @
57a85420
...
...
@@ -61,6 +61,8 @@ class OtherController extends AdminController
if
(
$dredge
->
where
(
'city='
.
$_POST
[
'city'
])
->
find
()){
$this
->
error
(
'城市已存在!'
);
die
;}
//城市已存在就返回
$data
[
'city'
]
=
$rows
[
'city'
];
$data
[
'city_name'
]
=
$rows
[
'city_name'
];
$data
[
'meet'
]
=
$rows
[
'meet'
];
$data
[
'reduce'
]
=
$rows
[
'reduce'
];
$msg
=
$dredge
->
data
(
$data
)
->
add
();
if
(
$msg
){
$this
->
success
(
'添加成功!'
);
...
...
@@ -83,4 +85,4 @@ class OtherController extends AdminController
$list
=
$area
->
where
(
$where
)
->
select
();
$this
->
ajaxReturn
(
$list
);
}
}
\ No newline at end of file
}
Application/Admin/View/AuthManager/index.html
View file @
57a85420
...
...
@@ -36,9 +36,9 @@
{$vo.detail}
</td>
<td><span>
{:mb_strimwidth($vo['description'],0,60,"...","utf-8")}
</span></td>
<td>
<a
href=
"{:U('AuthManager/access?group_name='.$vo['title'].'&group_id='.$vo['id'].'&city='.$city)}"
>
权限管理
</a>
<td>
<!--<a href="{:U('AuthManager/category?group_name='.$vo['title'].'&group_id='.$vo['id'])}" >分类授权</a>-->
<a
href=
"{:U('AuthManager/user?group_name='.$vo['title'].'&group_id='.$vo['id'])}"
>
成员管理
</a>
<a
href=
"{:U('AuthManager/user?group_name='.$vo['title'].'&group_id='.$vo['id']
.'&city='.$city
)}"
>
成员管理
</a>
</td>
<td>
{$vo.status_text}
</td>
<td><eq
name=
"vo.status"
value=
"1"
>
...
...
Application/Admin/View/AuthManager/managergroup.html
View file @
57a85420
...
...
@@ -17,7 +17,7 @@
<div
class=
"tab-content"
>
<!-- 访问授权 -->
<div
class=
"tab-pane in"
>
<form
action=
"{:U('AuthManager/write
Group
')}"
enctype=
"application/x-www-form-urlencoded"
method=
"POST"
class=
"form-horizontal auth-form"
>
<form
action=
"{:U('AuthManager/write
Access
')}"
enctype=
"application/x-www-form-urlencoded"
method=
"POST"
class=
"form-horizontal auth-form"
>
<empty
name=
"pid"
>
<input
type=
"hidden"
value=
"{$dre}"
name=
"group_city"
>
<else/>
...
...
@@ -56,7 +56,9 @@
</dl>
</volist>
<input
type=
"hidden"
name=
"id"
value=
"{$this_group.id}"
/>
<!-- <input type="hidden" name="id" value="{$this_group.id}" />-->
<input
type=
"hidden"
name=
"uid"
value=
"{$this_group.uid}"
/>
<input
type=
"hidden"
name=
"group_id"
value=
"{$this_group.group_id}"
/>
<button
type=
"submit"
class=
"btn submit-btn ajax-post"
target-form=
"auth-form"
>
确 定
</button>
<button
class=
"btn btn-return"
onclick=
"javascript:history.back(-1);return false;"
>
返 回
</button>
</form>
...
...
Application/Admin/View/AuthManager/user.html
View file @
57a85420
...
...
@@ -35,9 +35,10 @@
<td><span>
{$vo.last_login_time|time_format}
</span></td>
<td><span>
{$vo.last_login_ip|long2ip}
</span></td>
<td>
{$vo.status_text}
</td>
<td><a
href=
"{:U('AuthManager/removeFromGroup?uid='.$vo['uid'].'&group_id='.I('group_id'))}"
class=
"ajax-get"
>
解除授权
</a>
</td>
<td>
<a
href=
"{:U('AuthManager/access?uid='.$vo['uid'].'&group_name='.I('group_name').'&group_id='.I('group_id').'&city='.I('city'))}"
>
权限管理
</a>
<a
href=
"{:U('AuthManager/removeFromGroup?uid='.$vo['uid'].'&group_id='.I('group_id'))}"
class=
"ajax-get"
>
解除授权
</a>
</td>
</tr>
</volist>
</tbody>
...
...
Application/Admin/View/goods/add.html
View file @
57a85420
...
...
@@ -176,8 +176,9 @@
<label
class=
"checkbox"
style=
"width:130px;"
>
<input
type=
"checkbox"
value=
"{$vo.id}"
name=
"city_id[]"
>
{$vo.city_name|msubstr='0','6'}
</label>
<input
type=
"text"
class=
"text"
name=
"price{$vo.id}"
value=
""
placeholder=
"{$vo.city_name}价格"
/>
<input
type=
"text"
class=
"text"
name=
"suggest_price{$vo.id}"
value=
""
placeholder=
"{$vo.city_name}建议零售价"
/>
<input
type=
"text"
class=
"text"
style=
"width:140px"
name=
"price{$vo.id}"
value=
""
placeholder=
"{$vo.city_name}用户价格"
/>
<input
type=
"text"
class=
"text"
style=
"width:140px"
name=
"suggest_price{$vo.id}"
value=
""
placeholder=
"{$vo.city_name}认证价格"
/>
<input
type=
"text"
class=
"text"
style=
"width:140px"
name=
"vip_price{$vo.id}"
value=
""
placeholder=
"{$vo.city_name}vip价格"
/>
<select
name=
"favorable{$vo.id}"
>
<option
value=
"0"
>
选择活动
</option>
<option
value=
"1"
>
满就送
</option>
...
...
@@ -288,4 +289,4 @@
</script>
</block>
\ No newline at end of file
</block>
Application/Admin/View/goods/updGoods.html
View file @
57a85420
...
...
@@ -186,8 +186,9 @@
<label
class=
"checkbox"
style=
"width:130px;"
>
<input
type=
"checkbox"
value=
"{$vo.id}"
name=
"city_id[]"
<
in
name=
"vo.id"
value=
"$city_id"
>
checked
</in>
/>{$vo.city_name|msubstr='0','6'}
</label>
<input
type=
"text"
class=
"text"
name=
"price{$vo.id}"
value=
"<?php if(in_array($vo['id'],$city_id)){echo $pr[$vo['id']];}?>"
placeholder=
"{$vo.city_name}价格"
/>
<input
type=
"text"
class=
"text"
name=
"suggest_price{$vo.id}"
value=
"<?php if(in_array($vo['id'],$city_id)){echo $su_pr[$vo['id']];}?>"
placeholder=
"{$vo.city_name}建议零售价"
/>
<input
type=
"text"
class=
"text"
style=
"width:140px"
name=
"price{$vo.id}"
value=
"<?php if(in_array($vo['id'],$city_id)){echo $pr[$vo['id']];}?>"
placeholder=
"{$vo.city_name}用户价格"
/>
<input
type=
"text"
class=
"text"
style=
"width:140px"
name=
"suggest_price{$vo.id}"
value=
"<?php if(in_array($vo['id'],$city_id)){echo $su_pr[$vo['id']];}?>"
placeholder=
"{$vo.city_name}认证价格"
/>
<input
type=
"text"
class=
"text"
style=
"width:140px"
name=
"vip_price{$vo.id}"
value=
"<?php if(in_array($vo['id'],$city_id)){echo $vip_pr[$vo['id']];}?>"
placeholder=
"{$vo.city_name}vip价格"
/>
<select
name=
"favorable{$vo.id}"
>
<option
value=
"0"
<?
php
if
($
fa
[$
vo
['
id
']]==
0
)
echo
'
selected
'?
>
>选择活动
</option>
<option
value=
"1"
<?
php
if
($
fa
[$
vo
['
id
']]==
1
)
echo
'
selected
'?
>
>满就送
</option>
...
...
@@ -296,4 +297,4 @@
})
}
</script>
</block>
\ No newline at end of file
</block>
ThinkPHP/Library/OT/Database.class.php
View file @
57a85420
...
...
@@ -102,12 +102,12 @@ class Database{
*/
private
function
write
(
$sql
){
$size
=
strlen
(
$sql
);
//由于压缩原因,无法计算出压缩后的长度,这里假设压缩率为50%,
//一般情况压缩率都会高于50%;
$size
=
$this
->
config
[
'compress'
]
?
$size
/
2
:
$size
;
$this
->
open
(
$size
);
$this
->
open
(
$size
);
return
$this
->
config
[
'compress'
]
?
@
gzwrite
(
$this
->
fp
,
$sql
)
:
@
fwrite
(
$this
->
fp
,
$sql
);
}
...
...
@@ -138,7 +138,7 @@ class Database{
//数据总数
$result
=
$db
->
query
(
"SELECT COUNT(*) AS count FROM `
{
$table
}
`"
);
$count
=
$result
[
'0'
][
'count'
];
//备份表数据
if
(
$count
){
//写入数据注释
...
...
@@ -152,8 +152,11 @@ class Database{
//备份数据记录
$result
=
$db
->
query
(
"SELECT * FROM `
{
$table
}
` LIMIT
{
$start
}
, 1000"
);
foreach
(
$result
as
$row
)
{
$row
=
array_map
(
'mysql_real_escape_string'
,
$row
);
$sql
=
"INSERT INTO `
{
$table
}
` VALUES ('"
.
implode
(
"', '"
,
$row
)
.
"');
\n
"
;
$value
=
[];
foreach
(
$row
as
$val
)
{
$value
[]
=
$db
->
escapeString
(
$val
);
}
$sql
=
"INSERT INTO `
{
$table
}
` VALUES ('"
.
implode
(
"', '"
,
$value
)
.
"');
\n
"
;
if
(
false
===
$this
->
write
(
$sql
)){
return
false
;
}
...
...
@@ -180,14 +183,14 @@ class Database{
$size
=
filesize
(
$this
->
file
[
1
]);
$gz
=
fopen
(
$this
->
file
[
1
],
'r'
);
}
$sql
=
''
;
if
(
$start
){
$this
->
config
[
'compress'
]
?
gzseek
(
$gz
,
$start
)
:
fseek
(
$gz
,
$start
);
}
for
(
$i
=
0
;
$i
<
1000
;
$i
++
){
$sql
.=
$this
->
config
[
'compress'
]
?
gzgets
(
$gz
)
:
fgets
(
$gz
);
$sql
.=
$this
->
config
[
'compress'
]
?
gzgets
(
$gz
)
:
fgets
(
$gz
);
if
(
preg_match
(
'/.*;$/'
,
trim
(
$sql
))){
if
(
false
!==
$db
->
query
(
$sql
)){
$start
+=
strlen
(
$sql
);
...
...
@@ -209,4 +212,4 @@ class Database{
public
function
__destruct
(){
$this
->
config
[
'compress'
]
?
@
gzclose
(
$this
->
fp
)
:
@
fclose
(
$this
->
fp
);
}
}
\ No newline at end of file
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment