Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
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
bp
goods
Commits
9ee274d4
Commit
9ee274d4
authored
Aug 25, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 团长分销账单详情
parent
0e6c420d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
0 deletions
+66
-0
ColonelDistributorPayInfo.php
...tion/models/marketing/mysql/ColonelDistributorPayInfo.php
+8
-0
Colonel.php
application/modules/Marketing/controllers/Colonel.php
+11
-0
PindanActivityInviteOrderService.php
...n/services/marketing/PindanActivityInviteOrderService.php
+47
-0
No files found.
application/models/marketing/mysql/ColonelDistributorPayInfo.php
View file @
9ee274d4
...
...
@@ -10,6 +10,14 @@ class ColonelDistributorPayInfo extends MysqlBase
const
CONFIG_INDEX
=
'marketing'
;
const
PRIMARY_KEY
=
'colonel_distributor_pay_info_id'
;
const
TYPE_NEW_USER
=
1
;
const
TYPE_FINISH_TARGET
=
2
;
public
static
$typeDesc
=
[
self
::
TYPE_NEW_USER
=>
"邀请新用户"
,
self
::
TYPE_FINISH_TARGET
=>
"完成目标单数"
,
];
public
static
function
getRecord
(
$where
,
$columns
=
[],
$options
=
[])
{
if
(
empty
(
$columns
))
{
...
...
application/modules/Marketing/controllers/Colonel.php
View file @
9ee274d4
...
...
@@ -203,4 +203,15 @@ class ColonelController extends Base
return
$this
->
success
([
"result"
=>
[]]);
}
/**
* 团长分销,账单详情
* @throws Exception
*/
public
function
bill_infoAction
()
{
$params
=
$this
->
params
;
$data
=
PindanActivityInviteOrderService
::
getPayInfoList
(
$params
);
return
$this
->
success
([
"result"
=>
$data
]);
}
}
application/services/marketing/PindanActivityInviteOrderService.php
View file @
9ee274d4
...
...
@@ -164,4 +164,51 @@ class PindanActivityInviteOrderService
}
return
$data
;
}
/**
* 团长分销,账单详情
* @param array $params
* @return array
*/
public
static
function
getPayInfoList
(
$params
=
[])
{
$weekDay
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$userId
=
$params
[
"user_id"
];
if
(
empty
(
$userId
))
{
return
[];
}
$payList
=
ColonelDistributorPayInfo
::
select
(
"*"
,
[
"colonel_user_id"
=>
$userId
,
"date[>=]"
=>
$weekDay
,
"ORDER"
=>
[
"date"
=>
"DESC"
]
],
[]);
$data
=
$res
=
[];
if
(
!
empty
(
$payList
))
{
foreach
(
$payList
as
$item
)
{
$tempItem
=
[];
$tempItem
[
"type"
]
=
$item
[
"type"
];
$tempItem
[
"type_desc"
]
=
ColonelDistributorPayInfo
::
$typeDesc
[
$item
[
"type"
]];
$tempItem
[
"invite_user_id"
]
=
$item
[
"invite_user_id"
];
$tempItem
[
"invite_user_nick"
]
=
$item
[
"invite_user_nick"
];
$tempItem
[
"reward"
]
=
$item
[
"reward"
];
$tempItem
[
"finish_num"
]
=
$item
[
"finish_num"
];
$tempItem
[
"status"
]
=
$item
[
"status"
];
$data
[
$item
[
"date"
]][]
=
$tempItem
;
}
foreach
(
$data
as
$key
=>
$item
)
{
$rewards
=
array_column
(
$item
,
"reward"
);
$total
=
array_sum
(
$rewards
);
$res
[
$key
][
"total"
]
=
$total
/
100
;
$res
[
$key
][
"date"
]
=
$key
;
$res
[
$key
][
"data"
]
=
$item
;
foreach
(
$item
as
$k
=>
$v
)
{
$res
[
$key
][
"data"
][
$k
][
"reward"
]
=
$v
[
"reward"
]
/
100
;
}
}
}
return
array_values
(
$res
);
}
}
\ 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