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
52fcd21b
Commit
52fcd21b
authored
Nov 21, 2023
by
wuxiaoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
认领二维码
parent
5e5b77c6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
2 deletions
+60
-2
application/api/controller/Family.php
application/api/controller/Family.php
+27
-1
application/lib/model/NameCardModel.php
application/lib/model/NameCardModel.php
+32
-0
application/lib/service/FamilyTreeService.php
application/lib/service/FamilyTreeService.php
+1
-1
No files found.
application/api/controller/Family.php
View file @
52fcd21b
...
...
@@ -14,6 +14,7 @@ use app\lib\model\FamilyModel;
use
app\lib\model\FamilyPeopleModel
;
use
app\lib\model\FamilyTreeMateModel
;
use
app\lib\model\FamilyTreeModel
;
use
app\lib\model\NameCardModel
;
use
app\lib\model\SurnameModel
;
use
app\lib\service\AddressService
;
use
function
PHPSTORM_META\elementType
;
...
...
@@ -46,6 +47,10 @@ class Family extends Api
$people_id
=
$this
->
request
->
param
(
"people_id"
);
//选择自己id
$type
=
$this
->
request
->
param
(
"type"
,
2
);
//认领方式(2名片认领,3线上认领)
$activation_code
=
$this
->
request
->
param
(
"activation_code"
);
if
(
!
empty
(
$people_id
)){
$people
=
FamilyPeopleModel
::
dataInfo
([
'id'
=>
$people_id
]);
if
(
empty
(
$people
)){
...
...
@@ -53,11 +58,32 @@ class Family extends Api
}
else
if
(
$people
&&
$people
[
'user_id'
]){
$this
->
error
(
"该成员已被账户关联"
);
}
if
(
$people
[
'is_pay'
]
==
0
){
$this
->
success
(
"请激活!"
,
$people
);
}
$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
]);}
$this
->
success
(
"该用户认领成功"
,
$res
);
}
else
{
$data
=
FamilyTreeModel
::
claimFamilyPeople
([
'ft1.name'
=>
$name
,
'ft2.name'
=>
$parent_name
,
'ft3.name'
=>
$grandpa_name
]);
$this
->
success
(
""
,
$data
);
$list
=
[];
if
(
$type
==
2
){
$family_id
=
NameCardModel
::
where
([
'activation_code'
=>
$activation_code
,
'user_id'
=>
0
])
->
column
(
"family_id"
);
foreach
(
$data
as
$key
=>
$val
){
if
(
$val
[
'family_id'
]
==
$family_id
){
array_push
(
$list
,
$val
);
}
}
}
else
{
foreach
(
$data
as
$key
=>
$val
){
$people
=
FamilyPeopleModel
::
dataInfo
([
'id'
=>
$val
[
'people_id'
],
'activation_code'
=>
$activation_code
]);
if
(
$people
){
array_push
(
$list
,
$val
);
}
}
}
$this
->
success
(
""
,
$list
);
}
}
...
...
application/lib/model/NameCardModel.php
0 → 100644
View file @
52fcd21b
<?php
namespace
app\lib\model
;
use
think\Model
;
class
NameCardModel
extends
Model
{
// 表名
protected
$name
=
'name_card'
;
/**
* @功能说明:
*/
public
static
function
dataInfo
(
$where
){
return
self
::
where
(
$where
)
->
find
();
}
/**
* @功能说明:编辑
*/
public
static
function
dataUpdate
(
$where
,
$data
){
return
self
::
where
(
$where
)
->
update
(
$data
);
}
}
\ No newline at end of file
application/lib/service/FamilyTreeService.php
View file @
52fcd21b
...
...
@@ -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"
]
=
create_randomstr
()
;
$people
[
"activation_code"
]
=
$people
[
'ext0'
]
==
0
?
create_randomstr
()
:
null
;
return
FamilyPeopleModel
::
dataAdd
(
$people
);
}
}
...
...
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