Commit 9e152386 authored by hujun's avatar hujun

通话话费计算

parent 342da585
......@@ -46,7 +46,7 @@ class Client extends Basic
$data=array();
if ($this->params['user_nick'] || $this->params['user_nick'] || $this->params['id']) {
if ($this->request->isPost()) {
if ($this->params['id']) {
if (!empty($this->params['id'])) {
//编辑
$data['start'] = $this->user->edit($this->params, $this->params['id']);
......
......@@ -168,7 +168,7 @@ class CellPhone extends Basic
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$report = new SecretReport();
$field = 'agents_id,users_id,release_time,start_time,call_type,call_time,time,voice_file';
$field = 'agents_id,users_id,call_type,call_time,time,voice_file';
$where = [];
if ($this->params['start_time']) {
......
......@@ -32,9 +32,11 @@ class AliYunPhone extends BaseModel
$phone_x = Db::table('aliYun_binding_phone')->alias('a')
->join('aliYun_phone b','a.aliYun_phone_id = b.id','left')
->where([
'phone_b' => $phone,
'a.status' => 1
'phone_b' => $phone,
'a.status' => 0,
'b.status' => 0
])->value('phone_x');
if ($phone_x) {
$where['phone_x'] = $phone_x;
}
......
......@@ -76,7 +76,7 @@ class SecretReport extends Model
$result[$k]['time'] = $v->time;
//主叫收费
if ($v->call_type == 0) {
if (strtotime($v->release_time) - strtotime($v->start_time) > 0) {
if ($v->time > 0) {
if ($v->time <= 60) {
$time = 1; //不足一分钟按一分钟
} else {
......@@ -91,6 +91,8 @@ class SecretReport extends Model
} else {
$result[$k]['price'] = 0;
}
} else {
$result[$k]['price'] = 0;
}
}
......@@ -154,9 +156,11 @@ class SecretReport extends Model
}
$result[$k]['time'] = $v->time;
//主叫收费
if ($v->call_type == 0) {
if (strtotime($v->release_time) - strtotime($v->start_time) > 0) {
if ($v->time > 0) {
if ($v->time <= 60) {
$time = 1; //不足一分钟按一分钟
} else {
......@@ -168,10 +172,13 @@ class SecretReport extends Model
$time += floor($v->time/60);
}
$result[$k]['price'] = $time*0.06 + $time*0.05;//通话 0.06元/分,录音 0.05元/分
} else {
$result[$k]['price'] = 0;
}
} else {
$result[$k]['price'] = 0;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment