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
e37431ea
Commit
e37431ea
authored
Nov 24, 2023
by
wuxiaoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
族谱简介
parent
6a1fa1e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
0 deletions
+85
-0
application/api/controller/Family.php
application/api/controller/Family.php
+14
-0
application/lib/model/AgentModel.php
application/lib/model/AgentModel.php
+71
-0
No files found.
application/api/controller/Family.php
View file @
e37431ea
...
...
@@ -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
;
...
...
@@ -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
]);
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/lib/model/AgentModel.php
0 → 100644
View file @
e37431ea
<?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
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