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
110182e5
Commit
110182e5
authored
Nov 25, 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
2d29508c
9270d829
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
111 additions
and
15 deletions
+111
-15
application/admin/controller/user/Agent.php
application/admin/controller/user/Agent.php
+6
-2
application/admin/model/family/Family.php
application/admin/model/family/Family.php
+1
-1
application/admin/model/user/Agent.php
application/admin/model/user/Agent.php
+0
-6
application/admin/view/family/family/add.html
application/admin/view/family/family/add.html
+1
-1
application/admin/view/user/agent/add.html
application/admin/view/user/agent/add.html
+1
-1
application/admin/view/user/agent/edit.html
application/admin/view/user/agent/edit.html
+1
-1
application/api/controller/Family.php
application/api/controller/Family.php
+15
-1
application/api/controller/FamilyTree.php
application/api/controller/FamilyTree.php
+1
-1
application/lib/model/AgentModel.php
application/lib/model/AgentModel.php
+71
-0
public/assets/js/backend/family/family.js
public/assets/js/backend/family/family.js
+13
-0
public/assets/js/backend/user/agent.js
public/assets/js/backend/user/agent.js
+1
-1
No files found.
application/admin/controller/user/Agent.php
View file @
110182e5
...
...
@@ -34,7 +34,7 @@ class Agent extends Backend
/**
* 查看
*/
public
function
index
()
public
function
index
(
$family_id
=
''
)
{
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
...
...
@@ -44,12 +44,14 @@ class Agent extends Backend
return
$this
->
selectpage
();
}
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$param
=
[];
if
(
!
empty
(
$family_id
)){
$param
[
'family_id'
]
=
$family_id
;
};
$total
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
with
(
"users,agent
,family
"
)
->
with
(
"users,agent"
)
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
...
...
@@ -66,6 +68,8 @@ class Agent extends Backend
$province
=
Db
::
name
(
'addr'
)
->
where
([
'ID'
=>
$val
[
'province_id'
]])
->
find
();
$list
[
$key
][
'MergerName'
]
=
$province
[
'MergerName'
];
}
$list
[
$key
][
'family'
]
=
Family
::
where
([
'id'
=>
$val
[
'family_id'
]])
->
find
();
}
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
...
...
application/admin/model/family/Family.php
View file @
110182e5
...
...
@@ -40,7 +40,7 @@ class Family extends Model
public
function
getTypeList
()
{
return
[
'1'
=>
__
(
'Type 1'
),
'2'
=>
__
(
'Type 2'
)
,
'3'
=>
__
(
'Type 3'
)];
return
[
'1'
=>
__
(
'Type 1'
),
'2'
=>
__
(
'Type 2'
)
];
//, '3' => __('Type 3')
}
public
function
getTypeTextAttr
(
$value
,
$data
)
...
...
application/admin/model/user/Agent.php
View file @
110182e5
...
...
@@ -57,10 +57,4 @@ class Agent extends Model
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/family/family/add.html
View file @
110182e5
...
...
@@ -61,7 +61,7 @@
<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=
"
3
"
}
checked
{/
in
}
/>
{$vo}
</label>
<label
for=
"row[type]-{$key}"
><input
id=
"row[type]-{$key}"
name=
"row[type]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"
2
"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
...
...
application/admin/view/user/agent/add.html
View file @
110182e5
...
...
@@ -60,7 +60,7 @@
<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=
""
>
<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"
,"custom[type]":"2"
}'
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
...
...
application/admin/view/user/agent/edit.html
View file @
110182e5
...
...
@@ -61,7 +61,7 @@
<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}"
>
<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"
,"custom[type]":"2"
}'
value=
"{$row.family_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
...
...
application/api/controller/Family.php
View file @
110182e5
...
...
@@ -10,6 +10,7 @@ use app\api\model\PaymentLogModel;
use
app\api\model\RechargeModel
;
use
app\api\model\UsersModel
;
use
app\common\controller\Api
;
use
app\lib\model\AgentModel
;
use
app\lib\model\FamilyModel
;
use
app\lib\model\FamilyPeopleModel
;
use
app\lib\model\FamilyTreeMateModel
;
...
...
@@ -139,7 +140,7 @@ class Family extends Api
public
function
addFamily
(){
$params
[
'surname_id'
]
=
$this
->
request
->
param
(
"surname_id"
);
$params
[
'type'
]
=
$this
->
request
->
param
(
"type"
);
//类型:1=家谱,2=族谱,3=宗谱
if
(
$params
[
'type'
]
>
2
){
//只有家谱可以随意创建
if
(
$params
[
'type'
]
!=
1
){
//只有家谱可以随意创建
if
(
$this
->
auth
->
is_shaikh
==
0
){
$this
->
error
(
"您还未申请为族长!"
);
}
...
...
@@ -186,6 +187,19 @@ class Family extends Api
}
$data
=
FamilyModel
::
dataInfo
([
'id'
=>
$id
]);
$data
[
'family_name'
]
=
AgentModel
::
dataValue
([
'family_id'
=>
$id
,
'status'
=>
1
,
'type'
=>
1
]);
$data
[
'inheritor'
]
=
AgentModel
::
dataList
([
'family_id'
=>
$id
,
'status'
=>
1
,
'type'
=>
2
],
"id,realname,level"
);
if
(
$data
[
'village_id'
]){
$addr
=
Db
::
name
(
'addr_village'
)
->
where
([
'village_code'
=>
$data
[
'village_id'
]])
->
find
();
$data
[
'addr'
]
=
$addr
?
$addr
[
'province'
]
.
$addr
[
'city'
]
.
$addr
[
'county'
]
.
$addr
[
'town'
]
.
$addr
[
'village'
]
:
''
;
}
else
if
(
$data
[
'town_id'
]){
$addr
=
Db
::
name
(
'addr_village'
)
->
where
([
'town_code'
=>
$data
[
'town_id'
]])
->
find
();
$data
[
'addr'
]
=
$addr
?
$addr
[
'province'
]
.
$addr
[
'city'
]
.
$addr
[
'county'
]
.
$addr
[
'town'
]
:
''
;
}
else
if
(
$data
[
'area_id'
]){
$addr
=
Db
::
name
(
"addr"
)
->
where
([
'ID'
=>
$data
[
'area_id'
]])
->
field
(
'ID as value,Name as name, ParentId,MergerName'
)
->
find
();
$data
[
'addr'
]
=
$addr
[
'MergerName'
];
}
$this
->
success
(
""
,
$data
);
}
...
...
application/api/controller/FamilyTree.php
View file @
110182e5
...
...
@@ -57,7 +57,7 @@ class FamilyTree extends Api
///查看是否有权限
$myFamily
=
FamilyTreeModel
::
myFamilyTreePeople
([
"ft.family_id"
=>
$family_id
,
'fp.user_id'
=>
$this
->
auth
->
id
]);
if
(
in_array
(
$this
->
auth
->
id
,
explode
(
","
,
$family
[
'rw_user_id'
]))
||
$myFamily
||
$family
[
'type'
]
==
1
||
$family_id
==
7
){
if
(
in_array
(
$this
->
auth
->
id
,
explode
(
","
,
$family
[
'rw_user_id'
]))
||
in_array
(
$this
->
auth
->
id
,
explode
(
","
,
$family
[
'ro_user_id'
]))
||
$myFamily
||
$family
[
'type'
]
==
1
||
$family_id
==
7
){
Log
::
write
(
"用户id:"
.
$this
->
auth
->
id
.
'查看族谱信息是否有权限'
);
}
else
{
$this
->
error
(
"暂未查到您加入族谱信息"
);
...
...
application/lib/model/AgentModel.php
0 → 100644
View file @
110182e5
<?php
namespace
app\lib\model
;
use
think\Db
;
use
think\Model
;
class
AgentModel
extends
Model
{
// 表名
protected
$name
=
'agent'
;
// 追加属性
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
static
function
dataList
(
$where
,
$field
=
"*"
,
$orderby
=
"createtime desc"
){
return
self
::
where
(
$where
)
->
field
(
$field
)
->
order
(
$orderby
)
->
select
();
}
/**
* @功能说明:
*/
public
static
function
dataInfo
(
$where
,
$orderby
=
"createtime desc"
){
return
self
::
where
(
$where
)
->
order
(
$orderby
)
->
find
();
}
/**
* @功能说明:取某个字段
*/
public
static
function
dataValue
(
$where
,
$field
=
'id'
,
$orderby
=
"createtime desc"
){
return
self
::
where
(
$where
)
->
order
(
$orderby
)
->
value
(
$field
);
}
}
\ No newline at end of file
public/assets/js/backend/family/family.js
View file @
110182e5
...
...
@@ -70,6 +70,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return
'
family/family_tree/index?family_id=
'
+
row
.
id
;
},
},
{
name
:
'
agent
'
,
text
:
__
(
'
传承人
'
),
title
:
__
(
'
传承人
'
),
extend
:
'
data-area=["1260px","760px"]
'
,
classname
:
'
btn btn-xs btn-info btn-dialog
'
,
url
:
function
(
row
)
{
return
'
user/agent/index?family_id=
'
+
row
.
id
;
},
visible
:
function
(
row
){
//控制按钮隐藏方法 判断表格数据是否满足要求,然后隐藏或显示
return
row
.
type
==
3
?
true
:
false
;
}
},
],
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
}
]
...
...
public/assets/js/backend/user/agent.js
View file @
110182e5
...
...
@@ -69,7 +69,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{
field
:
'
family_id
'
,
title
:
__
(
'
Family_id
'
),
formatter
:
function
(
value
,
row
,
index
)
{
if
(
row
.
family_id
){
return
"
id:
"
+
row
.
family_id
+
"
<br/>
"
+
row
.
family
_name
+
"
氏谱
"
;
return
"
id:
"
+
row
.
family_id
+
"
<br/>
"
+
row
.
family
.
family_name
+
"
氏谱
"
+
"
<br/>
"
+
row
.
family
.
address
;
}
}},
{
field
:
'
level
'
,
title
:
__
(
'
Level
'
),
operate
:
false
},
...
...
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