Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
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
hujun
tl_estate
Commits
974e5efc
Commit
974e5efc
authored
Mar 06, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通话金额计算修改
parent
1b9c3461
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
19 deletions
+33
-19
SecretReport.php
application/model/SecretReport.php
+33
-19
No files found.
application/model/SecretReport.php
View file @
974e5efc
...
...
@@ -158,25 +158,8 @@ class SecretReport extends Model
$result
[
$k
][
'time'
]
=
$v
->
time
;
//主叫收费
if
(
$v
->
call_type
==
0
)
{
if
(
$v
->
time
>
0
)
{
if
(
$v
->
time
<=
60
)
{
$time
=
1
;
//不足一分钟按一分钟
}
else
{
$remainder
=
$v
->
time
%
60
;
$time
=
0
;
if
(
$remainder
!=
0
)
{
$time
+=
1
;
}
$time
+=
floor
(
$v
->
time
/
60
);
}
$result
[
$k
][
'price'
]
=
$time
*
0.06
+
$time
*
0.05
;
//通话 0.06元/分,录音 0.05元/分
}
else
{
$result
[
$k
][
'price'
]
=
0
;
}
if
(
$v
[
'call_type'
]
==
0
)
{
$result
[
$k
][
'price'
]
=
$this
->
getTotalPrice
(
$v
[
'agents_id'
]);
}
else
{
$result
[
$k
][
'price'
]
=
0
;
}
...
...
@@ -198,4 +181,35 @@ class SecretReport extends Model
->
group
(
'agents_id'
)
->
count
();
}
/**
* @param $agents_id
* @return int
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getTotalPrice
(
$agents_id
)
{
$data
=
$this
->
field
(
'id,time'
)
->
where
([
'agents_id'
=>
$agents_id
,
'call_type'
=>
0
,
'time'
=>
[
'<>'
,
0
]
])
->
select
();
$price
=
0
;
foreach
(
$data
as
$k
=>
$v
)
{
if
(
$v
[
'time'
]
<=
60
)
{
$time
=
1
;
//不足一分钟按一分钟
}
else
{
$remainder
=
$v
[
'time'
]
%
60
;
$time
=
0
;
if
(
$remainder
!=
0
)
{
$time
+=
1
;
}
$time
+=
floor
(
$v
->
time
/
60
);
}
$price
+=
$time
*
0.06
+
$time
*
0.05
;
//通话 0.06元/分,录音 0.05元/分
}
return
$price
;
}
}
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