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
e32bc6d4
Commit
e32bc6d4
authored
Jul 05, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
个推id绑定
parent
85cf3004
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
33 deletions
+66
-33
Broker.php
application/api_broker/controller/Broker.php
+54
-27
UploadImg.php
application/api_broker/controller/UploadImg.php
+1
-1
OrderLogService.php
application/api_broker/service/OrderLogService.php
+1
-0
PerformanceValidate.php
application/api_broker/validate/PerformanceValidate.php
+3
-1
ABindingDevice.php
application/model/ABindingDevice.php
+7
-4
No files found.
application/api_broker/controller/Broker.php
View file @
e32bc6d4
...
...
@@ -108,6 +108,7 @@ class Broker extends Basic
/*$params = array(
"phone" => "15002102357",
"pwd" => "123456",
"push_id" => "123123",
"device_id" => "qweqweqweqweqw123123",
"model" => "iphone7",//手机型号
);*/
...
...
@@ -179,7 +180,7 @@ class Broker extends Basic
return
$this
->
response
(
"101"
,
$checkResult
);
}
$is_visit
=
$this
->
judgeBand
(
$params
[
"device_id"
],
$params
[
"agent_id"
],
""
,
1
);
$is_visit
=
$this
->
judgeBand
(
$params
[
"device_id"
],
$params
[
"agent_id"
],
""
,
1
,
""
);
if
(
$is_visit
)
{
return
$this
->
response
(
"200"
,
"success"
,
[]);
}
else
{
...
...
@@ -193,33 +194,46 @@ class Broker extends Basic
* @param int $agent_id
* @param string $model
* @param int $type 0提交记录到后台, 1仅仅判断
* @param int $push_id
* @return bool
*/
private
function
judgeBand
(
string
$device_id
,
int
$agent_id
,
string
$model
,
int
$type
)
:
bool
private
function
judgeBand
(
string
$device_id
,
int
$agent_id
,
string
$model
,
int
$type
,
int
$push_id
)
:
bool
{
$params
[
"agent_id"
]
=
$agent_id
;
$result
=
$this
->
aBD
->
getDeviceByAgentId
(
$params
);
if
(
count
(
$result
)
<=
0
)
{
//新增设备绑定关系
//新增设备绑定关系
默认直接登陆
if
(
$type
==
0
)
$this
->
aBD
->
addDevice
([
"device_id"
=>
$device_id
,
"agent_id"
=>
$agent_id
,
"model"
=>
$model
,
"is_forbidden"
=>
0
]);
$this
->
aBD
->
addDevice
([
"device_id"
=>
$device_id
,
"agent_id"
=>
$agent_id
,
"model"
=>
$model
,
"push_id"
=>
$push_id
,
"is_forbidden"
=>
0
]);
return
true
;
}
$is_exits
=
false
;
foreach
(
$result
as
$item
)
{
if
(
$device_id
==
$item
[
"device_id"
]
&&
$item
[
"is_forbidden"
]
==
0
)
{
return
true
;
}
if
(
$device_id
==
$item
[
"device_id"
]
&&
$item
[
"is_forbidden"
]
==
1
)
{
$is_exits
=
true
;
}
if
(
$device_id
==
$item
[
"device_id"
])
{
if
(
$item
[
"is_forbidden"
]
==
0
)
{
return
true
;
}
elseif
(
$item
[
"is_forbidden"
]
==
1
)
{
//已存在申请关系
$is_exits
=
true
;
}
//当个推返回的id改变时则更新记录
if
(
$push_id
&&
$push_id
!=
$item
[
"push_id"
])
$this
->
aBD
->
updateDevice
([
"id"
=>
$item
[
"id"
],
"push_id"
=>
$push_id
]);
}
}
if
(
!
$is_exits
&&
$type
==
0
)
{
//新增申请绑定关系
$this
->
aBD
->
addDevice
([
"device_id"
=>
$device_id
,
"agent_id"
=>
$agent_id
,
"model"
=>
$model
,
"is_forbidden"
=>
1
]);
}
if
(
!
$is_exits
&&
$type
==
0
)
//新增申请绑定关系,需要后台同意登陆
$this
->
aBD
->
addDevice
([
"device_id"
=>
$device_id
,
"agent_id"
=>
$agent_id
,
"model"
=>
$model
,
"push_id"
=>
$push_id
,
"is_forbidden"
=>
1
]);
return
false
;
}
...
...
@@ -228,7 +242,8 @@ class Broker extends Basic
* 绑定或者解绑
* @return \think\Response
*/
public
function
updateDevice
()
public
function
updateDevice
()
{
$params
=
$this
->
params
;
/* $params = array(
...
...
@@ -264,7 +279,8 @@ class Broker extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getBroker
()
public
function
getBroker
()
{
$data
[
'status'
]
=
200
;
$data
[
'data'
]
=
''
;
...
...
@@ -297,7 +313,8 @@ class Broker extends Basic
*
* @return \think\Response
*/
public
function
add_phone_follow_up
()
public
function
add_phone_follow_up
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
...
...
@@ -346,7 +363,8 @@ class Broker extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
user_search
()
public
function
user_search
()
{
$Two_days_ago
=
date
(
"Y-m-d h:i:s"
,
strtotime
(
"-2 day"
));
//dump($Two_days_ago);
...
...
@@ -408,7 +426,8 @@ class Broker extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
useraction_search
()
public
function
useraction_search
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
...
...
@@ -468,7 +487,8 @@ class Broker extends Basic
* 搜索动态
* @return \think\Response
*/
public
function
userStateSearch
()
public
function
userStateSearch
()
{
$params
=
$this
->
params
;
/* $params = array(
...
...
@@ -487,7 +507,8 @@ class Broker extends Basic
/**
* 编辑密码
*/
public
function
editAgent
()
public
function
editAgent
()
{
$data
[
'code'
]
=
200
;
$data
[
'msg'
]
=
""
;
...
...
@@ -515,7 +536,8 @@ class Broker extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
forgetPwd
()
public
function
forgetPwd
()
{
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
""
;
...
...
@@ -565,7 +587,8 @@ class Broker extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
uploadHeadImg
()
public
function
uploadHeadImg
()
{
$data
[
'status'
]
=
101
;
$data
[
'msg'
]
=
''
;
...
...
@@ -608,7 +631,8 @@ class Broker extends Basic
*
* @return \think\Response
*/
public
function
token
()
public
function
token
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$jwt
=
new
JwtUntils
();
...
...
@@ -625,7 +649,8 @@ class Broker extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentsByPhone
()
public
function
getAgentsByPhone
()
{
header
(
'Access-Control-Allow-Origin:*'
);
$agents
=
new
AAgents
();
...
...
@@ -643,7 +668,8 @@ class Broker extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
sendSms
()
public
function
sendSms
()
{
$data
[
'data'
]
=
[];
$data
[
'status'
]
=
101
;
...
...
@@ -705,7 +731,8 @@ class Broker extends Basic
* @throws \Endroid\QrCode\Exception\InvalidPathException
* @throws \Endroid\QrCode\Exception\InvalidWriterException
*/
public
function
qrCode
()
public
function
qrCode
()
{
$parms
=
$this
->
params
;
...
...
application/api_broker/controller/UploadImg.php
View file @
e32bc6d4
...
...
@@ -35,7 +35,7 @@ class UploadImg extends Basic
set_time_limit
(
0
);
$file
=
$_FILES
[
'image'
];
$type
=
request
()
->
param
(
'type'
);
//
Log::record("upload img info :" . json_encode($file) );
Log
::
record
(
"upload img info :"
.
json_encode
(
$file
)
);
$uploadResult
=
$this
->
uFService
->
upload
(
$file
,
$type
);
...
...
application/api_broker/service/OrderLogService.php
View file @
e32bc6d4
...
...
@@ -345,6 +345,7 @@ class OrderLogService
$trees
[
$i
][
"create_time"
]
=
$v
[
0
][
"create_time"
];
}
unset
(
$tree
);
sort
(
$trees
);
return
$trees
;
}
...
...
application/api_broker/validate/PerformanceValidate.php
View file @
e32bc6d4
...
...
@@ -19,6 +19,7 @@ class PerformanceValidate extends Validate
'phone'
=>
'require|number'
,
'pwd'
=>
'require|min:6'
,
'device_id'
=>
'require'
,
'push_id'
=>
'require'
,
'is_forbidden'
=>
'require|in:0,1'
,
'operator_id'
=>
'require|number'
,
];
...
...
@@ -33,6 +34,7 @@ class PerformanceValidate extends Validate
'pwd.require'
=>
'密码不能为空'
,
'pwd.min'
=>
'密码小于6位'
,
'device_id.require'
=>
'设备号获取失败,请联系管理员'
,
'push_id.require'
=>
'个推帐号获取失败,请联系管理员'
,
'is_forbidden.require'
=>
'是否绑定字段必填'
,
'is_forbidden.in'
=>
'是否绑定字段值只能为0或1'
,
'operator_id.require'
=>
'操作人为必填字段'
,
...
...
@@ -42,7 +44,7 @@ class PerformanceValidate extends Validate
protected
$scene
=
[
'verify'
=>
[
'type'
,
'agent_id'
],
'verifyOther'
=>
[
'agent_id'
],
'login'
=>
[
'phone'
,
'pwd'
,
'device_id'
],
'login'
=>
[
'phone'
,
'pwd'
,
'device_id'
,
"push_id"
],
'verifyStatus'
=>
[
'agent_id'
,
'device_id'
],
'verifyIsForbidden'
=>
[
'phone'
,
'device_id'
,
'is_forbidden'
,
'operator_id'
],
];
...
...
application/model/ABindingDevice.php
View file @
e32bc6d4
...
...
@@ -65,16 +65,16 @@ class ABindingDevice extends BaseModel
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getDeviceByAgentId
(
array
$params
,
string
$field
=
"id,agent_id,device_id,is_forbidden"
)
public
function
getDeviceByAgentId
(
array
$params
,
string
$field
=
"id,agent_id,device_id,is_forbidden
,push_id
"
)
{
$where_
=
[];
if
(
isset
(
$params
[
"agent_id"
]))
{
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"device_id"
]))
{
if
(
isset
(
$params
[
"device_id"
]))
{
$where_
[
"device_id"
]
=
$params
[
"device_id"
];
}
if
(
isset
(
$params
[
"is_forbidden"
]))
{
if
(
isset
(
$params
[
"is_forbidden"
]))
{
$where_
[
"is_forbidden"
]
=
$params
[
"is_forbidden"
];
}
return
$this
...
...
@@ -103,6 +103,9 @@ class ABindingDevice extends BaseModel
if
(
isset
(
$params
[
"device_id"
]))
{
$arr
[
"device_id"
]
=
$params
[
"device_id"
];
}
if
(
isset
(
$params
[
"push_id"
]))
{
$arr
[
"push_id"
]
=
$params
[
"push_id"
];
}
if
(
isset
(
$params
[
"model"
]))
{
$arr
[
"model"
]
=
$params
[
"model"
];
}
...
...
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