Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
0ffe3f44
Commit
0ffe3f44
authored
Dec 19, 2017
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户编辑
parent
ebab6543
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
29 deletions
+47
-29
config.php
application/index/config.php
+1
-0
Member.php
application/index/controller/Member.php
+16
-13
users_list.html
application/index/view/member/users_list.html
+1
-1
Users.php
application/model/Users.php
+12
-9
home.css
public/resource/css/home.css
+4
-0
user.js
public/resource/js/user.js
+12
-5
user_template_tpl.html
public/resource/template/user_template_tpl.html
+1
-1
No files found.
application/index/config.php
View file @
0ffe3f44
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
//配置文件
return
[
'jwt_key'
=>
'tonglian+123'
...
...
application/index/controller/Member.php
View file @
0ffe3f44
...
...
@@ -35,23 +35,22 @@ class Member extends Basic{
$where
[
'status'
]
=
0
;
if
(
isset
(
$params
[
'name'
]))
{
if
(
!
empty
(
$params
[
'name'
]))
{
$where
[
'a.user_nick'
]
=
[
'like'
,
'%'
.
$params
[
'name'
]
.
'%'
];
}
if
(
isset
(
$params
[
'phone'
]))
{
if
(
!
empty
(
$params
[
'phone'
]))
{
$where
[
'a.user_phone'
]
=
[
'like'
,
'%'
.
$params
[
'phone'
]
.
'%'
];
}
if
(
isset
(
$params
[
'invite'
]))
{
if
(
!
empty
(
$params
[
'invite'
]))
{
$where
[
'b.phone'
]
=
[
'like'
,
'%'
.
$params
[
'invite'
]
.
'%'
];
}
if
(
isset
(
$params
[
'id'
]))
{
$where
[
'
a.
id'
]
=
$params
[
'id'
];
if
(
!
empty
(
$params
[
'id'
]))
{
$where
[
'id'
]
=
$params
[
'id'
];
}
$fields
=
'a.id,a.user_nick,a.user_phone,a.user_pic,a.create_time,b.realname,b.phone,a.user_pswd'
;
$fields
=
'id,user_nick,user_phone,user_pic,create_time,user_pswd,referrer_id'
;
$data
[
'list'
]
=
$this
->
user
->
getUserAgent
(
$pageNo
,
$pageSize
,
''
,
$fields
,
$where
);
$data
[
'total'
]
=
$this
->
user
->
getUserAgentTotal
(
$where
);
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
);
...
...
@@ -69,7 +68,11 @@ class Member extends Basic{
$msg
=
''
;
$data
=
''
;
$user_data
=
$this
->
user
->
get
([
'user_phone'
=>
$params
[
'user_phone'
]]);
if
(
empty
(
$params
[
'id'
]))
{
$user_data
=
$this
->
user
->
get
([
'user_phone'
=>
$params
[
'user_phone'
]]);
}
else
{
$user_data
=
$this
->
user
->
get
(
$params
[
'id'
]);
}
$date
=
date
(
'Y-m-d H:i:s'
);
...
...
@@ -94,13 +97,10 @@ class Member extends Basic{
$msg
=
'新增用户失败'
;
}
}
else
{
$msg
=
'该用户已存在'
;
$status
=
101
;
if
(
!
empty
(
$user_data
)
&&
$params
[
'type'
]
==
'edit'
){
$user_data
->
user_nick
=
$params
[
'realname'
]
?
$params
[
'
user_phon
e'
]
:
$user_data
->
user_nick
;
$user_data
->
user_nick
=
$params
[
'realname'
]
?
$params
[
'
realnam
e'
]
:
$user_data
->
user_nick
;
$user_data
->
user_phone
=
$params
[
'user_phone'
]
?
$params
[
'user_phone'
]
:
$user_data
->
user_phone
;
$user_data
->
user_pswd
=
$params
[
'pwd'
]
?
md5
(
md5
(
$params
[
'pwd'
])
.
'+123'
)
:
$user_data
->
user_pswd
;
$user_data
->
user_pswd
=
$params
[
'pwd'
]
!=
$user_data
->
user_pswd
?
md5
(
md5
(
$params
[
'pwd'
])
.
'+123'
)
:
$user_data
->
user_pswd
;
$user_data
->
status
=
$params
[
'status'
]
?
$params
[
'status'
]
:
$user_data
->
status
;
$user_data
->
update_time
=
$date
;
...
...
@@ -113,6 +113,9 @@ class Member extends Basic{
}
else
{
$msg
=
'编辑用户失败'
;
}
}
else
{
$msg
=
'该用户已存在'
;
$status
=
101
;
}
}
...
...
application/index/view/member/users_list.html
View file @
0ffe3f44
...
...
@@ -154,7 +154,7 @@
<div
class=
"form-group"
>
<label
for=
"inputPassword3"
class=
"col-sm-3 control-label"
>
邀请人手机:
</label>
<div
class=
"col-sm-9"
>
<span
class=
"use-span1"
></span>
<span
class=
"use-span1"
id=
"invite_phone"
></span>
</div>
</div>
...
...
application/model/Users.php
View file @
0ffe3f44
...
...
@@ -29,15 +29,22 @@ class Users extends Model
* @return type
*/
public
function
getUserAgent
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'a.id desc'
,
$fields
=
'*'
,
$params
=
''
)
{
$result
=
$this
->
field
(
$fields
)
->
alias
(
'a'
)
->
join
(
'agents b'
,
'a.referrer_id = b.id'
,
'left'
)
$result
=
$this
->
field
(
$fields
)
->
where
(
$params
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
return
$result
;
$agents
=
new
Agents
();
foreach
(
$result
as
$k
=>
$v
)
{
$data
[
$k
]
=
$v
->
getData
();
$data
[
$k
][
'user_pic'
]
=
'/resource/head_portrait/'
.
$data
[
$k
][
'user_pic'
];
$agent_data
=
$agents
->
field
(
'realname,phone'
)
->
where
(
'id'
,
$data
[
$k
][
'referrer_id'
])
->
find
();
$data
[
$k
][
'realname'
]
=
$agent_data
[
'realname'
];
$data
[
$k
][
'phone'
]
=
$agent_data
[
'phone'
];
}
return
$data
;
}
/**
...
...
@@ -47,11 +54,7 @@ class Users extends Model
* @return mixed
*/
public
function
getUserAgentTotal
(
$params
)
{
$result
=
$this
->
alias
(
'a'
)
->
join
(
'agents b'
,
'a.referrer_id = b.id'
,
'left'
)
->
where
(
$params
)
->
count
();
$result
=
$this
->
where
(
$params
)
->
count
();
return
$result
;
}
...
...
public/resource/css/home.css
View file @
0ffe3f44
...
...
@@ -79,4 +79,7 @@ body{
}
.modal
{
padding-right
:
0
!important
;
}
.img_header
{
width
:
55px
;
height
:
47px
;
margin
:
0
auto
;
}
\ No newline at end of file
public/resource/js/user.js
View file @
0ffe3f44
...
...
@@ -49,9 +49,9 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
$
(
"#edit_user"
).
click
(
function
()
{
var
params
=
{};
params
.
id
=
$
(
"#edit_id"
).
val
();
params
.
type
=
'e
id
t'
;
params
.
realnam
e
=
$
(
"#edit_user_form input[name='phone']"
).
val
();
params
.
pwd
=
$
(
"#edit_user_form input[name='password']"
).
val
();
params
.
type
=
'e
di
t'
;
params
.
user_phon
e
=
$
(
"#edit_user_form input[name='phone']"
).
val
();
params
.
pwd
=
$
(
"#edit_user_form input[name='password']"
).
val
();
user
.
edit_user
(
params
);
});
},
...
...
@@ -117,8 +117,8 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
dataType
:
'json'
,
success
:
function
(
data
)
{
if
(
data
.
code
==
200
)
{
alert
(
data
.
msg
);
$
(
"#modal_add_user"
).
modal
(
'hide'
);
alert
(
data
.
msg
);
}
else
{
alert
(
data
.
msg
);
}
...
...
@@ -133,7 +133,14 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
data
:
params
,
dataType
:
'json'
,
success
:
function
(
data
)
{
console
.
log
(
data
);
$
(
"#modal-delete"
).
modal
(
'hide'
);
if
(
data
.
code
==
200
)
{
$
(
"#modal-do"
).
modal
(
'hide'
);
alert
(
data
.
msg
);
}
else
{
alert
(
data
.
msg
);
}
user
.
getList
(
user
.
pageNo
);
}
});
},
...
...
public/resource/template/user_template_tpl.html
View file @
0ffe3f44
...
...
@@ -4,7 +4,7 @@
<
tr
>
<
td
>
[
%=
it
[
item
][
'create_time'
]
%
]
<
/td
>
<
td
>
[
%=
it
[
item
][
"id"
]
%
]
<
/td
>
<
td
>
[
%=
it
[
item
][
"user_nick"
]
%
]
[
%=
it
[
item
][
"user_pic"
]
%
]
<
/td
>
<
td
>
[
%=
it
[
item
][
"user_nick"
]
%
]
<
img
class
=
"img_header img-rounded"
src
=
'[%= it[item]["user_pic"] %]'
/>
<
/td
>
<
td
>
[
%=
it
[
item
][
"user_phone"
]
%
]
<
/td
>
<
td
>
[
%=
it
[
item
][
"realname"
]
%
]
<
/td
>
<
td
>
...
...
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