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
ac0557d0
Commit
ac0557d0
authored
Jun 15, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
系统设置和处理房东隐私号码
parent
1ea0a10e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
75 deletions
+94
-75
CellPhone.php
application/api_broker/controller/CellPhone.php
+90
-71
SecretReport.php
application/model/SecretReport.php
+2
-3
setting.js
public/resource/js/setting.js
+1
-0
setting_template_tpl.html
public/resource/template/setting_template_tpl.html
+1
-1
No files found.
application/api_broker/controller/CellPhone.php
View file @
ac0557d0
...
...
@@ -11,11 +11,11 @@ namespace app\api_broker\controller;
use
app\api_broker\extend\Basic
;
use
app\api_broker\untils\PlsDemo
;
use
app\api_broker\untils\RongDemo
;
use
app\extra\RedisExt
;
use
app\model\AAgentsPhone
;
use
app\model\AliYunPhone
;
use
app\model\BindingPhone
;
use
think\Cache
;
use
think\Db
;
use
app\model\SecretReport
;
use
think\Log
;
class
CellPhone
extends
Basic
...
...
@@ -34,7 +34,8 @@ class CellPhone extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
bindAXB
()
{
public
function
bindAXB
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
request
->
param
();
...
...
@@ -48,38 +49,65 @@ class CellPhone extends Basic
$phone_b
=
$this
->
params
[
'phone_b'
];
//客户手机号
$record
=
true
;
//是否录音
$setting
=
Cache
::
get
(
'Setting'
);
//获取配置
$redis
=
RedisExt
::
getRedis
();
$is_privacy
=
$redis
->
get
(
's_is_privacy'
);
//0不使用隐私号码 1阿里云 2容联云
if
(
$setting
[
'is_privacy'
]
!=
0
)
{
if
(
$is_privacy
==
0
)
{
$this
->
data
=
[
'phone'
=>
$phone_b
];
$m_report
=
new
SecretReport
();
$report_data
[
'phone_no'
]
=
$phone_a
;
$report_data
[
'secret_no'
]
=
$phone_b
;
$report_data
[
'peer_no'
]
=
$phone_b
;
$report_data
[
'call_type'
]
=
1
;
$report_data
[
'record_down'
]
=
3
;
$m_report
->
editData
(
$report_data
);
//记录不使用隐号拨打记录
return
$this
->
response
(
$this
->
code
,
$this
->
msg
,
$this
->
data
);
}
$aliYunPhone
=
new
AliYunPhone
();
$bind
=
new
BindingPhone
();
$where
[
'a.status'
]
=
1
;
$where
[
'a.phone_a'
]
=
$phone_a
;
$where
[
'a.phone_b'
]
=
$phone_b
;
$where
[
'a.type'
]
=
$setting
[
'is_privacy'
]
;
$where
[
'a.type'
]
=
$is_privacy
;
$phone_x
=
$bind
->
getPhoneX
(
'b.phone_x'
,
$where
);
//已经绑定的返回隐私号码
if
(
$phone_x
!=
NULL
)
{
if
(
!
empty
(
$phone_x
[
'phone_x'
])
)
{
$this
->
data
=
[
'phone'
=>
$phone_x
[
'phone_x'
]];
}
else
{
$phone_x
=
$aliYunPhone
->
getAliYunPhone
(
$phone_a
,
$phone_b
,
$setting
[
'is_privacy'
]);
return
$this
->
response
(
$this
->
code
,
$this
->
msg
,
$this
->
data
);
//绑定过了,返回隐号
}
$phone_x
=
$aliYunPhone
->
getAliYunPhone
(
$phone_a
,
$phone_b
,
$is_privacy
);
//获取未绑定隐号
//是否还有未绑定的中间号码
if
(
$phone_x
)
{
if
(
empty
(
$setting
[
'day_num'
]))
{
$this
->
code
=
102
;
$this
->
msg
=
'号码使用完,请联系运营人员。'
;
return
$this
->
response
(
$this
->
code
,
$this
->
msg
,
$this
->
data
);
}
$day_num
=
$redis
->
get
(
's_day_num'
);
if
(
empty
(
$day_num
))
{
$time
=
_EXPIRATION
;
}
else
{
$setting
[
'day_num'
]
+=
1
;
$time
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
"+
{
$setting
[
'day_num'
]
}
day"
));
if
(
empty
(
$this
->
params
[
'landlord'
]))
{
$day_num
+=
1
;
}
else
{
$landlord_phone_day
=
$redis
->
get
(
'landlord_phone_day'
);
$day_num
=
$landlord_phone_day
+
1
;
}
$time
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
"+
{
$day_num
}
day"
));
}
if
(
$setting
[
'is_privacy'
]
==
1
)
{
if
(
$is_privacy
==
1
)
{
/*阿里云*/
$result
=
PlsDemo
::
bindAxb
(
$phone_a
,
$phone_b
,
$time
,
$record
,
$phone_x
[
'phone_x'
]);
if
(
$result
->
Message
==
'OK'
)
{
$aliYunPhone
->
editStatus
(
$phone_x
,
$phone_a
,
$phone_b
,
$record
,
$time
,
$result
,
''
,
$setting
[
'is_privacy'
]
);
//记录绑定
$aliYunPhone
->
editStatus
(
$phone_x
,
$phone_a
,
$phone_b
,
$record
,
$time
,
$result
,
''
,
$is_privacy
);
//记录绑定
$this
->
msg
=
'绑定成功。'
;
$this
->
data
=
[
'phone'
=>
$phone_x
[
'phone_x'
]];
}
else
{
...
...
@@ -87,10 +115,10 @@ class CellPhone extends Basic
$phone_x_array
[]
=
$phone_x
[
'phone_x'
];
//尝试5次绑定
for
(
$i
=
1
;
$i
<
5
;
$i
++
)
{
$phone_x
=
$aliYunPhone
->
getAliYunPhone
(
$phone_a
,
$phone_b
,
$setting
[
'is_privacy'
]
,
$phone_x_array
);
$phone_x
=
$aliYunPhone
->
getAliYunPhone
(
$phone_a
,
$phone_b
,
$is_privacy
,
$phone_x_array
);
$result
=
PlsDemo
::
bindAxb
(
$phone_a
,
$phone_b
,
$time
,
$record
,
$phone_x
);
//再尝试一下
if
(
$result
->
Message
==
'OK'
)
{
$aliYunPhone
->
editStatus
(
$phone_x
,
$phone_a
,
$phone_b
,
$record
,
$time
,
$result
,
''
,
$setting
[
'is_privacy'
]
);
//记录绑定
$aliYunPhone
->
editStatus
(
$phone_x
,
$phone_a
,
$phone_b
,
$record
,
$time
,
$result
,
''
,
$is_privacy
);
//记录绑定
$this
->
msg
=
'绑定成功。'
;
$this
->
data
=
[
'phone'
=>
$phone_x
[
'phone_x'
]];
break
;
...
...
@@ -104,47 +132,31 @@ class CellPhone extends Basic
$this
->
msg
=
'拨号失败,10秒再试,再无法拨号请联系请联系运营人员!'
;
}
}
}
else
{
}
else
{
/*容联云*/
$Rong
=
new
RongDemo
();
$record2
=
empty
(
$this
->
params
[
'record'
])
?
'true'
:
'false'
;
/* 是否录音(容联云规定string类型)*/
/*计算有效期*/
if
(
empty
(
$setting
[
'day_num'
]))
{
$yx_time
=
$setting
[
'day_num'
]
*
60
*
60
*
24
;
}
else
{
$yx_time
=
604800
;
if
(
empty
(
$day_num
))
{
$yx_time
=
$day_num
*
60
*
60
*
24
;
}
else
{
$yx_time
=
604800
;
}
$result
=
$Rong
->
setNumber
(
$phone_a
,
$phone_b
,
$phone_x
[
'phone_x'
],
$phone_x
[
'area'
],
$yx_time
,
$record2
);
$result
=
$Rong
->
setNumber
(
$phone_a
,
$phone_b
,
$phone_x
[
'phone_x'
],
$phone_x
[
'area'
],
$yx_time
,
$record2
);
/*绑定成功*/
if
(
$result
[
'statusCode'
]
==
'000000'
)
{
$aliYunPhone
->
editStatus
(
$phone_x
,
$phone_a
,
$phone_b
,
$record
,
$time
,
0
,
$result
[
'data'
][
'mappingId'
],
$setting
[
'is_privacy'
]
);
//记录绑定
if
(
$result
[
'statusCode'
]
==
'000000'
)
{
$aliYunPhone
->
editStatus
(
$phone_x
,
$phone_a
,
$phone_b
,
$record
,
$time
,
0
,
$result
[
'data'
][
'mappingId'
],
$is_privacy
);
//记录绑定
$this
->
msg
=
'Binding Rong success'
;
$this
->
data
=
[
'phone'
=>
$phone_x
[
'phone_x'
]];
}
else
{
}
else
{
$this
->
code
=
101
;
$this
->
msg
=
'操作频繁,请10秒后再操作。'
;
}
}
Log
::
write
(
json_encode
(
$result
),
'AliYunBindAxb'
);
//记录日志
}
else
{
$this
->
code
=
102
;
$this
->
msg
=
'号码使用完,请联系运营人员。'
;
}
}
}
else
{
$this
->
data
=
[
'phone'
=>
$phone_b
];
Db
::
table
(
'aliYun_secret_report'
)
->
insert
([
'phone_no'
=>
$phone_a
,
'secret_no'
=>
$phone_b
,
'peer_no'
=>
$phone_b
,
'call_type'
=>
1
,
'record_down'
=>
3
,
]);
}
Log
::
write
(
json_encode
(
$result
),
'AliYunBindAxb'
);
//记录日志
return
$this
->
response
(
$this
->
code
,
$this
->
msg
,
$this
->
data
);
}
...
...
@@ -153,16 +165,17 @@ class CellPhone extends Basic
*
* @return \think\Response
*/
public
function
updateBindAXB
()
{
public
function
updateBindAXB
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
request
->
param
();
if
(
$params
[
'phone_x'
]
&&
(
$params
[
'phone_a'
]
||
$params
[
'phone_b'
]))
{
$bind
=
new
BindingPhone
();
if
(
$params
[
'phone_a'
])
{
$subId
=
$bind
->
getSubsId
(
$params
[
'phone_x'
],
$params
[
'phone_a'
],
''
,
1
);
//跟换B号码
$subId
=
$bind
->
getSubsId
(
$params
[
'phone_x'
],
$params
[
'phone_a'
],
''
,
1
);
//跟换B号码
}
else
{
$subId
=
$bind
->
getSubsId
(
$params
[
'phone_x'
],
''
,
$params
[
'phone_b'
],
1
);
//更好A号码
$subId
=
$bind
->
getSubsId
(
$params
[
'phone_x'
],
''
,
$params
[
'phone_b'
],
1
);
//更好A号码
}
$resutl
=
PlsDemo
::
updateSubscription
(
$params
[
'type'
],
$subId
,
$this
->
params
[
'phone_x'
],
$this
->
params
[
'phone_a'
],
$this
->
params
[
'phone_b'
],
$params
[
'date'
]);
...
...
@@ -178,7 +191,7 @@ class CellPhone extends Basic
$this
->
code
=
101
;
$this
->
msg
=
'phone is null'
;
}
return
$this
->
response
(
$this
->
code
,
$this
->
msg
,
$this
->
data
);
return
$this
->
response
(
$this
->
code
,
$this
->
msg
,
$this
->
data
);
}
/**
...
...
@@ -187,19 +200,26 @@ class CellPhone extends Basic
* @return \think\Response
* @throws \think\exception\DbException
*/
public
function
agentsUnBind
()
{
public
function
agentsUnBind
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$phone_x
=
$this
->
params
[
'phone_x'
];
$phone_a
=
$this
->
params
[
'phone_a'
];
$phone_b
=
$this
->
params
[
'phone_b'
];
if
(
$phone_x
&&
$phone_a
&&
$phone_b
)
{
$setting
=
Cache
::
get
(
'Setting'
);
//获取配置
if
(
empty
(
$phone_x
)
||
empty
(
$phone_a
)
||
empty
(
$phone_b
))
{
$this
->
code
=
101
;
$this
->
msg
=
'解除关系参数错误,请联系运营人员!'
;
return
$this
->
response
(
$this
->
code
,
$this
->
msg
);
}
$phone
=
new
BindingPhone
();
if
(
$setting
[
'is_privacy'
]
==
1
)
{
$redis
=
RedisExt
::
getRedis
();
$is_privacy
=
$redis
->
get
(
's_is_privacy'
);
if
(
$is_privacy
==
1
)
{
/*阿里云*/
$subsId
=
$phone
->
getSubsId
(
$phone_x
,
$phone_a
,
$phone_b
,
1
,
'subsId'
);
$subsId
=
$phone
->
getSubsId
(
$phone_x
,
$phone_a
,
$phone_b
,
1
,
'subsId'
);
if
(
$subsId
)
{
$result
=
PlsDemo
::
unbindSubscription
(
$subsId
,
$phone_x
);
/*解绑*/
if
(
$result
->
Message
==
'OK'
)
{
...
...
@@ -212,28 +232,25 @@ class CellPhone extends Basic
$this
->
code
=
200
;
$this
->
msg
=
'没有号码绑定关系,请忽略!。'
;
}
}
else
{
}
else
{
/*容联云*/
$mappingId
=
$phone
->
getSubsId
(
$phone_x
,
$phone_a
,
$phone_b
,
1
,
'mappingId'
);
$mappingId
=
$phone
->
getSubsId
(
$phone_x
,
$phone_a
,
$phone_b
,
1
,
'mappingId'
);
$Rong
=
new
RongDemo
();
if
(
$mappingId
)
{
if
(
$mappingId
)
{
$result
=
$Rong
->
releaseNumber
(
$mappingId
);
/*解绑*/
//var_dump($result);/*************测试****************/
if
(
$result
[
'statusCode'
]
==
'000000'
)
{
$phone
->
unBind
(
$phone_x
,
$phone_a
,
$phone_b
);
}
else
{
}
else
{
$this
->
code
=
101
;
$this
->
msg
=
'remove binding error'
;
}
}
else
{
}
else
{
$this
->
code
=
101
;
$this
->
msg
=
'dont\'t have about phone_x info'
;
}
}
}
else
{
$this
->
code
=
101
;
$this
->
msg
=
'解除关系参数错误,请联系运营人员!'
;
}
$this
->
params
[
'phone_x'
];
return
$this
->
response
(
$this
->
code
,
$this
->
msg
);
}
...
...
@@ -247,24 +264,26 @@ class CellPhone extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
agentsPhone
()
{
public
function
agentsPhone
()
{
header
(
'Access-Control-Allow-Origin:*'
);
if
(
$this
->
params
[
'agents_id'
])
{
if
(
empty
(
$this
->
params
[
'agents_id'
]))
{
$this
->
msg
=
'agents_id is null'
;
return
$this
->
response
(
101
,
"agents_id is null"
);
}
$agents_phone
=
new
AAgentsPhone
();
if
(
$this
->
request
->
isGet
())
{
$where
[
'agents_id'
]
=
$this
->
params
[
'agents_id'
];
$where
[
'status'
]
=
0
;
$this
->
data
=
$agents_phone
->
getList
(
1
,
3
,
'id asc'
,
'id,phone'
,
$where
);
$this
->
data
=
$agents_phone
->
getList
(
1
,
3
,
'id asc'
,
'id,phone'
,
$where
);
}
else
{
if
(
$this
->
params
[
'type'
]
==
'delete'
)
{
$this
->
data
=
$agents_phone
->
delPhone
(
$this
->
params
[
'agents_id'
],
$this
->
params
[
'phone'
]);
$this
->
data
=
$agents_phone
->
delPhone
(
$this
->
params
[
'agents_id'
],
$this
->
params
[
'phone'
]);
}
else
{
$this
->
data
=
$agents_phone
->
add
(
$this
->
params
[
'agents_id'
],
$this
->
params
[
'phone'
]);
}
$this
->
data
=
$agents_phone
->
add
(
$this
->
params
[
'agents_id'
],
$this
->
params
[
'phone'
]);
}
}
else
{
$this
->
code
=
101
;
$this
->
msg
=
'agents_id is null'
;
}
return
$this
->
response
(
$this
->
code
,
$this
->
msg
,
$this
->
data
);
...
...
application/model/SecretReport.php
View file @
ac0557d0
...
...
@@ -2,11 +2,10 @@
namespace
app\model
;
use
Symfony\Component\Yaml\Tests\DumperTest
;
use
think\Db
;
use
think\Model
;
class
SecretReport
extends
Model
class
SecretReport
extends
BaseModel
{
// 设置当前模型对应的完整数据表名称
protected
$table
=
'aliYun_secret_report'
;
...
...
public/resource/js/setting.js
View file @
ac0557d0
...
...
@@ -40,6 +40,7 @@ define (['doT', 'text!temp/setting_template_tpl.html', 'css!style/home.css'], fu
param
.
down_time
=
$
(
"input[name='shop_day_num']"
).
val
();
param
.
new_client_hours
=
$
(
"input[name='new_client_hours']"
).
val
();
param
.
agent_shop_num
=
$
(
"input[name='agent_shop_num']"
).
val
();
param
.
landlord_phone_day
=
$
(
"input[name='landlord_phone_day']"
).
val
();
$
.
ajax
({
url
:
'/admin.php/index/getSetting'
,
type
:
'POST'
,
...
...
public/resource/template/setting_template_tpl.html
View file @
ac0557d0
...
...
@@ -26,7 +26,7 @@
<!--
房东隐号绑定有效期
-->
<
label
class
=
"col-sm-3 control-label"
style
=
"text-align: right"
>
房东隐号绑定有效期(天数):
<
/label
>
<
div
class
=
"col-sm-9"
>
<
input
type
=
"number"
class
=
"form-control btn5"
name
=
"
day_num2"
placeholder
=
"隐号绑定天数"
value
=
"[%= it['day_num2
'] %]"
>
<
input
type
=
"number"
class
=
"form-control btn5"
name
=
"
landlord_phone_day"
placeholder
=
"隐号绑定天数"
value
=
"[%= it['landlord_phone_day
'] %]"
>
<
/div
>
<
label
class
=
"col-sm-3 control-label"
style
=
"text-align: right"
>
商铺自动下架天数:
<
/label
>
...
...
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