Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zhupu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sugar
zhupu
Commits
748048b0
Commit
748048b0
authored
Nov 24, 2023
by
sugar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://rungit.jxdsy.cn:10000/sugar/zhupu
into dev
parents
fff09015
139037e3
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
658 additions
and
7 deletions
+658
-7
application/admin/controller/user/Agent.php
application/admin/controller/user/Agent.php
+220
-0
application/admin/lang/zh-cn/user/agent.php
application/admin/lang/zh-cn/user/agent.php
+25
-0
application/admin/model/user/Agent.php
application/admin/model/user/Agent.php
+66
-0
application/admin/view/user/agent/add.html
application/admin/view/user/agent/add.html
+91
-0
application/admin/view/user/agent/edit.html
application/admin/view/user/agent/edit.html
+92
-0
application/admin/view/user/agent/index.html
application/admin/view/user/agent/index.html
+60
-0
application/api/controller/Family.php
application/api/controller/Family.php
+3
-5
application/lib/model/FamilyPeopleModel.php
application/lib/model/FamilyPeopleModel.php
+1
-1
application/lib/service/FamilyTreeService.php
application/lib/service/FamilyTreeService.php
+1
-1
public/assets/js/backend/user/agent.js
public/assets/js/backend/user/agent.js
+99
-0
No files found.
application/admin/controller/user/Agent.php
0 → 100644
View file @
748048b0
<?php
namespace
app\admin\controller\user
;
use
app\common\controller\Backend
;
use
think\Db
;
/**
*
*
* @icon fa fa-circle-o
*/
class
Agent
extends
Backend
{
/**
* Agent模型对象
* @var \app\admin\model\user\Agent
*/
protected
$model
=
null
;
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
model
=
new
\app\admin\model\user\Agent
;
$this
->
view
->
assign
(
"typeList"
,
$this
->
model
->
getTypeList
());
$this
->
view
->
assign
(
"statusList"
,
$this
->
model
->
getStatusList
());
}
/**
* 查看
*/
public
function
index
()
{
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
//如果发送的来源是Selectpage,则转发到Selectpage
if
(
$this
->
request
->
request
(
'keyField'
))
{
return
$this
->
selectpage
();
}
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$total
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
with
(
"users,agent,family"
)
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
$list
=
collection
(
$list
)
->
toArray
();
foreach
(
$list
as
$key
=>
$val
)
{
if
(
$val
[
'area_id'
]){
$area
=
Db
::
name
(
'addr'
)
->
where
([
'ID'
=>
$val
[
'area_id'
]])
->
find
();
$list
[
$key
][
'MergerName'
]
=
$area
[
'MergerName'
];
}
else
if
(
$val
[
'city_id'
]){
$city
=
Db
::
name
(
'addr'
)
->
where
([
'ID'
=>
$val
[
'city_id'
]])
->
find
();
$list
[
$key
][
'MergerName'
]
=
$city
[
'MergerName'
];
}
else
if
(
$val
[
'province_id'
]){
$province
=
Db
::
name
(
'addr'
)
->
where
([
'ID'
=>
$val
[
'province_id'
]])
->
find
();
$list
[
$key
][
'MergerName'
]
=
$province
[
'MergerName'
];
}
}
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* 添加
*/
public
function
add
()
{
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
$params
=
$this
->
preExcludeFields
(
$params
);
if
(
$this
->
dataLimit
&&
$this
->
dataLimitFieldAutoFill
)
{
$params
[
$this
->
dataLimitField
]
=
$this
->
auth
->
id
;
}
$result
=
false
;
Db
::
startTrans
();
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
str_replace
(
"
\\
model
\\
"
,
"
\\
validate
\\
"
,
get_class
(
$this
->
model
));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.add'
:
$name
)
:
$this
->
modelValidate
;
$this
->
model
->
validateFailException
(
true
)
->
validate
(
$validate
);
}
if
(
in_array
(
$params
[
"type"
],[
1
,
2
])
){
if
(
empty
(
$params
[
'family_id'
])){
$this
->
error
(
"请选择族谱ID"
);
}
unset
(
$params
[
'province_id'
]);
unset
(
$params
[
'city_id'
]);
unset
(
$params
[
'area_id'
]);
}
else
{
if
(
$params
[
"type"
]
==
3
){
if
(
empty
(
$params
[
'province_id'
])){
$this
->
error
(
"请选择省级"
);
}
unset
(
$params
[
'city_id'
]);
unset
(
$params
[
'area_id'
]);
}
else
if
(
$params
[
"type"
]
==
4
){
if
(
empty
(
$params
[
'city_id'
])){
$this
->
error
(
"请选择市级"
);
}
unset
(
$params
[
'area_id'
]);
}
else
if
(
$params
[
"type"
]
==
5
){
if
(
empty
(
$params
[
'area_id'
])){
$this
->
error
(
"请选择区县级"
);
}
}
unset
(
$params
[
'family_id'
]);
}
$result
=
$this
->
model
->
allowField
(
true
)
->
save
(
$params
);
Db
::
commit
();
}
catch
(
ValidateException
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
catch
(
PDOException
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
catch
(
Exception
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
if
(
$result
!==
false
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were inserted'
));
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
return
$this
->
view
->
fetch
();
}
/**
* 编辑
*/
public
function
edit
(
$ids
=
null
)
{
$row
=
$this
->
model
->
get
(
$ids
);
if
(
!
$row
)
{
$this
->
error
(
__
(
'No Results were found'
));
}
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
if
(
!
in_array
(
$row
[
$this
->
dataLimitField
],
$adminIds
))
{
$this
->
error
(
__
(
'You have no permission'
));
}
}
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
$params
=
$this
->
preExcludeFields
(
$params
);
$result
=
false
;
Db
::
startTrans
();
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
str_replace
(
"
\\
model
\\
"
,
"
\\
validate
\\
"
,
get_class
(
$this
->
model
));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.edit'
:
$name
)
:
$this
->
modelValidate
;
$row
->
validateFailException
(
true
)
->
validate
(
$validate
);
}
if
(
in_array
(
$params
[
"type"
],[
1
,
2
])
){
if
(
empty
(
$params
[
'family_id'
])){
$this
->
error
(
"请选择族谱ID"
);
}
unset
(
$params
[
'province_id'
]);
unset
(
$params
[
'city_id'
]);
unset
(
$params
[
'area_id'
]);
}
else
{
if
(
$params
[
"type"
]
==
3
){
if
(
empty
(
$params
[
'province_id'
])){
$this
->
error
(
"请选择省级"
);
}
unset
(
$params
[
'city_id'
]);
unset
(
$params
[
'area_id'
]);
}
else
if
(
$params
[
"type"
]
==
4
){
if
(
empty
(
$params
[
'city_id'
])){
$this
->
error
(
"请选择市级"
);
}
unset
(
$params
[
'area_id'
]);
}
else
if
(
$params
[
"type"
]
==
5
){
if
(
empty
(
$params
[
'area_id'
])){
$this
->
error
(
"请选择区县级"
);
}
}
unset
(
$params
[
'family_id'
]);
}
$result
=
$row
->
allowField
(
true
)
->
save
(
$params
);
Db
::
commit
();
}
catch
(
ValidateException
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
catch
(
PDOException
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
catch
(
Exception
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
if
(
$result
!==
false
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were updated'
));
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
$this
->
view
->
assign
(
"row"
,
$row
);
return
$this
->
view
->
fetch
();
}
}
application/admin/lang/zh-cn/user/agent.php
0 → 100644
View file @
748048b0
<?php
return
[
'User_id'
=>
'用户id'
,
'Realname'
=>
'真实姓名'
,
'Mobile'
=>
'手机号'
,
'Identity_number'
=>
'身份证号码'
,
'Parent_user_id'
=>
'推荐代理id'
,
'Province_id'
=>
'省级id'
,
'City_id'
=>
'城市id'
,
'Area_id'
=>
'县/区级id'
,
'Createtime'
=>
'创建时间'
,
'Type'
=>
'类型'
,
'Type 1'
=>
'族长'
,
'Type 2'
=>
'传承人'
,
'Type 3'
=>
'县区代理'
,
'Type 4'
=>
'市级代理'
,
'Type 5'
=>
'省级代理'
,
'Rate'
=>
'返佣比例'
,
'Family_id'
=>
'族谱id'
,
'Level'
=>
'传承人代系'
,
'Status'
=>
'状态'
,
'Status 1'
=>
'显示'
,
'Status 2'
=>
'隐藏'
];
application/admin/model/user/Agent.php
0 → 100644
View file @
748048b0
<?php
namespace
app\admin\model\user
;
use
think\Model
;
class
Agent
extends
Model
{
// 表名
protected
$name
=
'agent'
;
// 自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
false
;
protected
$deleteTime
=
false
;
// 追加属性
protected
$append
=
[
'type_text'
,
'status_text'
];
public
function
getTypeList
()
{
return
[
'1'
=>
__
(
'Type 1'
),
'2'
=>
__
(
'Type 2'
),
'3'
=>
__
(
'Type 3'
),
'4'
=>
__
(
'Type 4'
),
'5'
=>
__
(
'Type 5'
)];
}
public
function
getStatusList
()
{
return
[
'1'
=>
__
(
'Status 1'
),
'2'
=>
__
(
'Status 2'
)];
}
public
function
getTypeTextAttr
(
$value
,
$data
)
{
$value
=
$value
?
$value
:
(
isset
(
$data
[
'type'
])
?
$data
[
'type'
]
:
''
);
$list
=
$this
->
getTypeList
();
return
isset
(
$list
[
$value
])
?
$list
[
$value
]
:
''
;
}
public
function
getStatusTextAttr
(
$value
,
$data
)
{
$value
=
$value
?
$value
:
(
isset
(
$data
[
'status'
])
?
$data
[
'status'
]
:
''
);
$list
=
$this
->
getStatusList
();
return
isset
(
$list
[
$value
])
?
$list
[
$value
]
:
''
;
}
public
function
users
(){
return
self
::
hasOne
(
"app\admin\model\User"
,
'id'
,
"user_id"
);
}
public
function
agent
(){
return
self
::
hasOne
(
"app\admin\model\User"
,
'id'
,
"parent_user_id"
);
}
public
function
family
()
{
return
self
::
hasOne
(
"app\admin\model\Family\Family"
,
'id'
,
"family_id"
)
->
bind
(
"family_name"
);
}
}
application/admin/view/user/agent/add.html
0 → 100644
View file @
748048b0
<form
id=
"add-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('User_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-user_id"
data-rule=
"required"
data-source=
"user/user/index"
data-search-field=
"id,nickname,mobile"
data-primary-key=
"id"
data-field=
"id"
data-format-item=
"{id} - {nickname} - {mobile}"
class=
"form-control selectpage"
name=
"row[user_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Realname')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-realname"
data-rule=
"required"
class=
"form-control"
name=
"row[realname]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Mobile')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-mobile"
data-rule=
"required"
class=
"form-control"
name=
"row[mobile]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Identity_number')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-identity_number"
class=
"form-control"
name=
"row[identity_number]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Parent_user_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-parent_user_id"
data-rule=
""
data-multiple=
"true"
data-source=
"user/user/index"
data-search-field=
"id,nickname,mobile"
data-primary-key=
"id"
data-field=
"id"
data-format-item=
"{id} - {nickname} - {mobile}"
class=
"form-control selectpage"
name=
"row[parent_user_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
省市区:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"form-inline col-xs-12"
data-toggle=
"cxselect"
data-selects=
"province,city,area"
>
<select
class=
"province form-control"
data-rule=
""
name=
"row[province_id]"
data-value=
""
data-url=
"ajax/address"
id=
"c-province"
></select>
<select
class=
"city form-control"
data-rule=
""
name=
"row[city_id]"
data-value=
""
data-url=
"ajax/address"
id=
"c-city"
></select>
<select
class=
"area form-control"
data-rule=
""
name=
"row[area_id]"
data-value=
""
data-url=
"ajax/address"
id=
"c-area"
></select>
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="typeList" item="vo"}
<label
for=
"row[type]-{$key}"
><input
id=
"row[type]-{$key}"
name=
"row[type]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"1"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Rate')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-rate"
data-rule=
"required;range(0~1);"
class=
"form-control"
name=
"row[rate]"
type=
"text"
value=
"0"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Family_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-family_id"
data-rule=
""
data-source=
"family/family/index"
class=
"form-control selectpage"
data-search-field=
"id,family_name,realname,address"
data-primary-key=
"id"
data-field=
"id"
data-format-item=
"{id} - {family_name} - {realname} - {address}"
name=
"row[family_id]"
type=
"text"
data-params=
'{"custom[status]":"1"}'
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Level')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-level"
class=
"form-control"
name=
"row[level]"
type=
"number"
value=
"0"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Status')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-status"
class=
"form-control selectpicker"
name=
"row[status]"
>
{foreach name="statusList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"1"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group layer-footer"
>
<label
class=
"control-label col-xs-12 col-sm-2"
></label>
<div
class=
"col-xs-12 col-sm-8"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
application/admin/view/user/agent/edit.html
0 → 100644
View file @
748048b0
<form
id=
"edit-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('User_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-user_id"
data-rule=
"required"
data-source=
"user/user/index"
data-search-field=
"id,nickname,mobile"
data-primary-key=
"id"
data-field=
"id"
data-format-item=
"{id} - {nickname} - {mobile}"
class=
"form-control selectpage"
name=
"row[user_id]"
type=
"text"
value=
"{$row.user_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Realname')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-realname"
data-rule=
"required"
class=
"form-control"
name=
"row[realname]"
type=
"text"
value=
"{$row.realname|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Mobile')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-mobile"
data-rule=
"required"
class=
"form-control"
name=
"row[mobile]"
type=
"text"
value=
"{$row.mobile|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Identity_number')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-identity_number"
class=
"form-control"
name=
"row[identity_number]"
type=
"text"
value=
"{$row.identity_number|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Parent_user_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-parent_user_id"
data-rule=
""
data-multiple=
"true"
data-source=
"user/user/index"
data-search-field=
"id,nickname,mobile"
data-primary-key=
"id"
data-field=
"id"
data-format-item=
"{id} - {nickname} - {mobile}"
class=
"form-control selectpage"
name=
"row[parent_user_id]"
type=
"text"
value=
"{$row.parent_user_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
省市区:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"form-inline col-xs-12"
data-toggle=
"cxselect"
data-selects=
"province,city,area"
>
<select
class=
"province form-control"
data-rule=
""
name=
"row[province_id]"
data-value=
"{$row.province_id|htmlentities}"
data-url=
"ajax/address"
id=
"c-province"
></select>
<select
class=
"city form-control"
data-rule=
""
name=
"row[city_id]"
data-value=
"{$row.city_id|htmlentities}"
data-url=
"ajax/address"
id=
"c-city"
></select>
<select
class=
"area form-control"
data-rule=
""
name=
"row[area_id]"
data-value=
"{$row.area_id|htmlentities}"
data-url=
"ajax/address"
id=
"c-area"
></select>
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="typeList" item="vo"}
<label
for=
"row[type]-{$key}"
><input
id=
"row[type]-{$key}"
name=
"row[type]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"$row.type"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Rate')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-rate"
data-rule=
"required;range(0~1);"
class=
"form-control"
name=
"row[rate]"
type=
"text"
value=
"{$row.rate|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Family_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-family_id"
data-rule=
""
data-source=
"family/family/index"
class=
"form-control selectpage"
data-search-field=
"id,family_name,realname,address"
data-primary-key=
"id"
data-field=
"id"
data-format-item=
"{id} - {family_name} - {realname} - {address}"
name=
"row[family_id]"
type=
"text"
data-params=
'{"custom[status]":"1"}'
value=
"{$row.family_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Level')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-level"
class=
"form-control"
name=
"row[level]"
type=
"number"
value=
"{$row.level|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Status')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-status"
class=
"form-control selectpicker"
name=
"row[status]"
>
{foreach name="statusList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.status"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group layer-footer"
>
<label
class=
"control-label col-xs-12 col-sm-2"
></label>
<div
class=
"col-xs-12 col-sm-8"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
application/admin/view/user/agent/index.html
0 → 100644
View file @
748048b0
<div
class=
"panel panel-default panel-intro"
>
<div
class=
"panel-heading"
>
{:build_heading(null,FALSE)}
<ul
class=
"nav nav-tabs"
data-field=
"status"
>
<li
class=
"active"
><a
href=
"#t-all"
data-value=
""
data-toggle=
"tab"
>
{:__('All')}
</a></li>
{foreach name="statusList" item="vo"}
<li><a
href=
"#t-{$key}"
data-value=
"{$key}"
data-toggle=
"tab"
>
{$vo}
</a></li>
{/foreach}
</ul>
</div>
<div
class=
"panel-body"
>
<div
id=
"myTabContent"
class=
"tab-content"
>
<div
class=
"tab-pane fade active in"
id=
"one"
>
<div
class=
"widget-body no-padding"
>
<div
id=
"toolbar"
class=
"toolbar"
>
<a
href=
"javascript:;"
class=
"btn btn-primary btn-refresh"
title=
"{:__('Refresh')}"
><i
class=
"fa fa-refresh"
></i>
</a>
<a
href=
"javascript:;"
class=
"btn btn-success btn-add {:$auth->check('user/add')?'':'hide'}"
title=
"{:__('Add')}"
><i
class=
"fa fa-plus"
></i>
{:__('Add')}
</a>
<a
href=
"javascript:;"
class=
"btn btn-success btn-edit btn-disabled disabled {:$auth->check('user/edit')?'':'hide'}"
title=
"{:__('Edit')}"
><i
class=
"fa fa-pencil"
></i>
{:__('Edit')}
</a>
<a
href=
"javascript:;"
class=
"btn btn-danger btn-del btn-disabled disabled {:$auth->check('user/del')?'':'hide'}"
title=
"{:__('Delete')}"
><i
class=
"fa fa-trash"
></i>
{:__('Delete')}
</a>
<a
href=
"javascript:;"
class=
"btn btn-danger btn-import {:$auth->check('user/import')?'':'hide'}"
title=
"{:__('Import')}"
id=
"btn-import-file"
data-url=
"ajax/upload"
data-mimetype=
"csv,xls,xlsx"
data-multiple=
"false"
><i
class=
"fa fa-upload"
></i>
{:__('Import')}
</a>
<div
class=
"dropdown btn-group {:$auth->check('user/multi')?'':'hide'}"
>
<a
class=
"btn btn-primary btn-more dropdown-toggle btn-disabled disabled"
data-toggle=
"dropdown"
><i
class=
"fa fa-cog"
></i>
{:__('More')}
</a>
<ul
class=
"dropdown-menu text-left"
role=
"menu"
>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"status=normal"
><i
class=
"fa fa-eye"
></i>
{:__('Set to normal')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"status=hidden"
><i
class=
"fa fa-eye-slash"
></i>
{:__('Set to hidden')}
</a></li>
</ul>
</div>
</div>
<table
id=
"table"
class=
"table table-striped table-bordered table-hover table-nowrap"
data-operate-edit=
"{:$auth->check('user/edit')}"
data-operate-del=
"{:$auth->check('user/del')}"
width=
"100%"
>
</table>
</div>
</div>
</div>
</div>
</div>
<script
id=
"sourcetpl"
type=
"text/html"
>
<
div
class
=
"
row
"
id
=
'
area-select
'
>
<
div
class
=
"
col-xs-12
"
>
<
div
class
=
"
form-inline
"
data
-
toggle
=
"
cxselect
"
data
-
selects
=
"
province,city,area
"
>
<
select
class
=
"
province form-control
"
name
=
"
province_id
"
data
-
url
=
"
ajax/address
"
><
/select
>
<
input
type
=
"
hidden
"
class
=
"
operate
"
data
-
name
=
"
province_id
"
value
=
"
=
"
/>
<
select
class
=
"
city form-control
"
name
=
"
city_id
"
data
-
url
=
"
ajax/city
"
data
-
query
-
name
=
"
province
"
><
/select
>
<
input
type
=
"
hidden
"
class
=
"
operate
"
data
-
name
=
"
city_id
"
value
=
"
=
"
/>
<
select
class
=
"
area form-control
"
name
=
"
area_id
"
data
-
url
=
"
ajax/area
"
data
-
query
-
name
=
"
city_id
"
><
/select
>
<
input
type
=
"
hidden
"
class
=
"
operate
"
data
-
name
=
"
area_id
"
value
=
"
=
"
/>
<
/div
>
<
/div
>
<
/div
>
</script>
\ No newline at end of file
application/api/controller/Family.php
View file @
748048b0
...
...
@@ -44,13 +44,11 @@ class Family extends Api
$parent_name
=
$this
->
request
->
param
(
"parent_name"
);
//父亲名字
$name
=
$this
->
request
->
param
(
"name"
);
//自己名字
$fastim_id
=
$this
->
request
->
param
(
"fastim_id"
);
//IMid
$people_id
=
$this
->
request
->
param
(
"people_id"
);
//选择自己id
$type
=
$this
->
request
->
param
(
"type"
,
2
);
//认领方式(2名片认领,3线上认领)
$activation_code
=
$this
->
request
->
param
(
"activation_code"
);
$people_id
=
$this
->
request
->
param
(
"people_id"
);
//选择自己id
if
(
!
empty
(
$people_id
)){
$people
=
FamilyPeopleModel
::
dataInfo
([
'id'
=>
$people_id
]);
if
(
empty
(
$people
)){
...
...
@@ -59,7 +57,7 @@ class Family extends Api
$this
->
error
(
"该成员已被账户关联"
);
}
if
(
$people
[
'is_pay'
]
==
0
){
$this
->
success
(
"请激活!"
,
$people
);
$this
->
error
(
"请激活!"
,
$people
,
9999
);
}
$res
=
FamilyPeopleModel
::
dataUpdate
([
'id'
=>
$people_id
],[
'user_id'
=>
$this
->
auth
->
id
,
'fastim_id'
=>
$fastim_id
]);
if
(
$type
==
2
){
NameCardModel
::
dataUpdate
([
'activation_code'
=>
$activation_code
,
'user_id'
=>
0
],[
'user_id'
=>
$this
->
auth
->
id
]);}
...
...
application/lib/model/FamilyPeopleModel.php
View file @
748048b0
...
...
@@ -90,7 +90,7 @@ class FamilyPeopleModel extends Model
$data
=
self
::
alias
(
"fp"
)
->
join
(
"family_tree ft"
,
"ft.people_id=fp.id"
,
"LEFT"
)
->
join
(
"family_tree_mate ftm"
,
"ftm.people_id=fp.id"
,
"LEFT"
)
->
field
(
"fp.id,fp.name,fp.photo,fp.sex,fp.activation_code"
)
->
field
(
"fp.id,fp.
user_id,fp.
name,fp.photo,fp.sex,fp.activation_code"
)
->
where
(
$where
)
->
page
(
$page
)
->
limit
(
$pageSize
)
...
...
application/lib/service/FamilyTreeService.php
View file @
748048b0
...
...
@@ -56,7 +56,7 @@ class FamilyTreeService
}
else
{
$family_id
=
isset
(
$param
[
'family_id'
])
?
$param
[
'family_id'
]
:
$family_id
;
if
(
!
empty
(
$family_id
))
FamilyModel
::
where
([
'id'
=>
$family_id
])
->
setInc
(
'join_number'
);
$people
[
"activation_code"
]
=
$people
[
'ext0'
]
==
0
?
create_randomstr
()
:
null
;
$people
[
"activation_code"
]
=
$people
[
'ext0'
]
==
0
?
create_randomstr
(
6
)
:
null
;
return
FamilyPeopleModel
::
dataAdd
(
$people
);
}
}
...
...
public/assets/js/backend/user/agent.js
0 → 100644
View file @
748048b0
define
([
'
jquery
'
,
'
bootstrap
'
,
'
backend
'
,
'
table
'
,
'
form
'
],
function
(
$
,
undefined
,
Backend
,
Table
,
Form
)
{
var
Controller
=
{
index
:
function
()
{
// 初始化表格参数配置
Table
.
api
.
init
({
extend
:
{
index_url
:
'
user/agent/index
'
+
location
.
search
,
add_url
:
'
user/agent/add
'
,
edit_url
:
'
user/agent/edit
'
,
del_url
:
'
user/agent/del
'
,
multi_url
:
'
user/agent/multi
'
,
table
:
'
agent
'
,
}
});
var
table
=
$
(
"
#table
"
);
// 初始化表格
table
.
bootstrapTable
({
url
:
$
.
fn
.
bootstrapTable
.
defaults
.
extend
.
index_url
,
pk
:
'
id
'
,
sortName
:
'
level
'
,
columns
:
[
[
{
checkbox
:
true
},
{
field
:
'
id
'
,
title
:
__
(
'
Id
'
)},
{
field
:
'
user_id
'
,
title
:
__
(
'
User_id
'
),
formatter
:
function
(
value
,
row
,
index
)
{
if
(
row
.
users
){
var
html
=
"
id:
"
+
row
.
user_id
+
"
<br/> 昵称:
"
+
row
.
users
.
nickname
;
html
=
row
.
realname
?
html
+
"
<br/> 姓名:
"
+
row
.
realname
:
html
;
html
=
row
.
users
.
mobile
?
html
+
"
<br/> 电话:
"
+
row
.
users
.
mobile
:
html
;
return
html
;
}
else
{
return
"
id:
"
+
row
.
agent_user_id
;
}
}},
{
field
:
'
realname
'
,
title
:
__
(
'
Realname
'
)},
{
field
:
'
mobile
'
,
title
:
__
(
'
Mobile
'
)},
{
field
:
'
identity_number
'
,
title
:
__
(
'
Identity_number
'
)},
{
field
:
'
parent_user_id
'
,
title
:
__
(
'
Parent_user_id
'
),
formatter
:
function
(
value
,
row
,
index
)
{
if
(
row
.
parent_user_id
>
0
){
var
html
=
"
id:
"
+
row
.
parent_user_id
+
"
<br/> 昵称:
"
+
row
.
agent
.
nickname
;
html
=
row
.
agent
.
mobile
?
html
+
"
<br/> 电话:
"
+
row
.
agent
.
mobile
:
html
;
return
html
;
}
return
"
无
"
;
}
},
{
field
:
'
MergerName
'
,
title
:
__
(
'
省市区街道
'
),
formatter
:
function
(
value
,
row
,
index
)
{
if
(
row
.
province
&&
row
.
city
&&
row
.
area
)
{
return
row
.
province
.
name
+
row
.
city
.
name
+
row
.
area
.
name
+
row
.
town
.
name
;
}
else
{
return
row
.
MergerName
;
}
},
searchList
:
function
(
column
)
{
//重点
return
Template
(
'
sourcetpl
'
,
{});
}
},
{
field
:
'
rate
'
,
title
:
__
(
'
Rate
'
),
operate
:
false
},
{
field
:
'
type
'
,
title
:
__
(
'
Type
'
),
searchList
:
{
"
1
"
:
__
(
'
Type 1
'
),
"
2
"
:
__
(
'
Type 2
'
),
"
3
"
:
__
(
'
Type 3
'
),
"
4
"
:
__
(
'
Type 4
'
),
"
5
"
:
__
(
'
Type 5
'
)},
formatter
:
Table
.
api
.
formatter
.
normal
},
{
field
:
'
family_id
'
,
title
:
__
(
'
Family_id
'
),
formatter
:
function
(
value
,
row
,
index
)
{
if
(
row
.
family_id
){
return
"
id:
"
+
row
.
family_id
+
"
<br/>
"
+
row
.
family_name
+
"
氏谱
"
;
}
}},
{
field
:
'
level
'
,
title
:
__
(
'
Level
'
),
operate
:
false
},
{
field
:
'
createtime
'
,
title
:
__
(
'
Createtime
'
),
operate
:
'
RANGE
'
,
addclass
:
'
datetimerange
'
,
formatter
:
Table
.
api
.
formatter
.
datetime
},
{
field
:
'
status
'
,
title
:
__
(
'
Status
'
),
searchList
:
{
"
1
"
:
__
(
'
Status 1
'
),
"
2
"
:
__
(
'
Status 2
'
)},
formatter
:
Table
.
api
.
formatter
.
status
},
{
field
:
'
operate
'
,
title
:
__
(
'
Operate
'
),
table
:
table
,
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
}
]
]
});
// 为表格绑定事件
Table
.
api
.
bindevent
(
table
);
},
add
:
function
()
{
Controller
.
api
.
bindevent
();
},
edit
:
function
()
{
Controller
.
api
.
bindevent
();
},
api
:
{
bindevent
:
function
()
{
Form
.
api
.
bindevent
(
$
(
"
form[role=form]
"
));
}
}
};
return
Controller
;
});
\ 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