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
f6164b46
Commit
f6164b46
authored
Sep 06, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
推送记录
parent
b5aa632f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
155 additions
and
49 deletions
+155
-49
PushMessageService.php
application/api_broker/service/PushMessageService.php
+73
-37
MPushMessage.php
application/model/MPushMessage.php
+55
-11
route.php
application/route.php
+3
-1
PushMessageTask.php
application/task/controller/PushMessageTask.php
+24
-0
No files found.
application/api_broker/service/PushMessageService.php
View file @
f6164b46
...
...
@@ -51,7 +51,6 @@ class PushMessageService
$house_data
=
$house
->
getHouseDetail
(
'internal_title'
,
[
'id'
=>
$house_id
]);
foreach
(
$data
as
$k
=>
$v
)
{
$content
=
"【
{
$agent_name
[
'store_name'
]
}
】店【
{
$agent_name
[
'name'
]
}
】约带看【
{
$house_data
[
'internal_title'
]
}
】商铺"
;
// $this->push->public_push_message_for_one($v['id'], $v['device_id'], '报备', $content);
$this
->
pushAgentAllDeviceId
(
$v
[
'id'
],
'报备'
,
$content
);
}
return
;
...
...
@@ -73,8 +72,7 @@ class PushMessageService
$field
=
'house_title,user_name,report_store_id,report_agent_id'
;
$report_data
=
$report
->
getReportOrder
(
$field
,
[
'a.id'
=>
$report_id
]);
$agent
=
new
AAgents
();
// $agent_data = $agent->getAgentInfo('id', $report_data['report_agent_id']);
$agent
=
new
AAgents
();
if
(
$type
==
1
)
{
$content
=
"客户
{
$report_data
[
'user_name'
]
}
进场【
{
$report_data
[
'house_title'
]
}
】商铺"
;
...
...
@@ -85,12 +83,9 @@ class PushMessageService
}
$where
[
'store_id'
]
=
$report_data
[
'report_store_id'
];
$where
[
'level'
]
=
[
'in'
,
'20,40'
];
$where
[
'level'
]
=
[
'in'
,
'20,40'
];
$agent_store
=
$agent
->
getAgentInfo
(
'id'
,
''
,
$where
);
// $this->push->public_push_message_for_one($report_data['report_agent_id'], $agent_data['device_id'], $title, $content);
// $this->push->public_push_message_for_one($agent_store['id'], $agent_store['device_id'], $title, $content);
$this
->
pushAgentAllDeviceId
(
$report_data
[
'report_agent_id'
],
$title
,
$content
);
$this
->
pushAgentAllDeviceId
(
$agent_store
[
'id'
],
$title
,
$content
);
return
;
...
...
@@ -188,11 +183,6 @@ class PushMessageService
if
(
empty
(
$id
))
{
return
false
;
}
$result
=
[];
// $agent = new AAgents();
// $device_id = $agent->getAgentsById($id, 'device_id');
// $result = $this->push->public_push_message_for_one($id, $device_id, $title, $content, $type, $user_id);
$result
=
$this
->
pushAgentAllDeviceId
(
$id
,
$title
,
$content
,
$type
,
$user_id
);
return
$result
;
...
...
@@ -217,7 +207,6 @@ class PushMessageService
$agent_data
=
$agent
->
getAgentInfo
(
'id,name'
,
$agent_id
);
$content
=
"
{
$submit_agent_name
}
新增成交报告,分佣方:
{
$agent_data
[
'name'
]
}
[
{
$house
[
'internal_title'
]
}
]商铺"
;
// return $this->push->public_push_message_for_one($agent_data['id'], $agent_data['device_id'], '新增分佣', $content);
return
$this
->
pushAgentAllDeviceId
(
$agent_data
[
'id'
],
'新增分佣'
,
$content
);
}
...
...
@@ -231,18 +220,19 @@ class PushMessageService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
pushHouseMessage
(
$house_id
,
$operation_id
,
$agent_id
,
$push_str
)
{
$agent
=
new
AAgents
();
public
function
pushHouseMessage
(
$house_id
,
$operation_id
,
$agent_id
,
$push_str
)
{
$agent
=
new
AAgents
();
$ccr_agent_data
=
$agent
->
getAgentInfo
(
'name,phone'
,
$operation_id
);
$house
=
new
GHouses
();
$house_data
=
$house
->
getHouseInfoById
(
'internal_title'
,
[
'id'
=>
$house_id
]);
$content
=
'你的【'
.
$house_data
[
'internal_title'
]
.
'】商铺,盘方被【'
.
$ccr_agent_data
[
'name'
]
.
'-'
.
$ccr_agent_data
[
'phone'
]
.
'】修改为'
.
$push_str
;
$house
=
new
GHouses
();
$house_data
=
$house
->
getHouseInfoById
(
'internal_title'
,
[
'id'
=>
$house_id
]);
$content
=
'你的【'
.
$house_data
[
'internal_title'
]
.
'】商铺,盘方被【'
.
$ccr_agent_data
[
'name'
]
.
'-'
.
$ccr_agent_data
[
'phone'
]
.
'】修改为'
.
$push_str
;
foreach
(
$agent_id
as
$k
=>
$v
)
{
$this
->
pushAgentAllDeviceId
(
$v
,
'修改盘方'
,
$content
,
'house_info'
,
$house_id
);
foreach
(
$agent_id
as
$k
=>
$v
)
{
$this
->
pushAgentAllDeviceId
(
$v
,
'修改盘方'
,
$content
,
'house_info'
,
$house_id
);
}
return
;
return
;
}
/**
...
...
@@ -251,23 +241,24 @@ class PushMessageService
* @param $house_id
* @return bool|void
*/
public
function
pushHouseDownMessage
(
$house_id
)
{
public
function
pushHouseDownMessage
(
$house_id
)
{
$house
=
new
GHouses
();
try
{
$house_data
=
$house
->
getHouseInfoById
(
'internal_title'
,
[
'id'
=>
$house_id
]);
$content
=
'你的【'
.
$house_data
[
'internal_title'
]
.
'】商铺下架,如需要上架,请编辑提交该商铺'
;
$house_data
=
$house
->
getHouseInfoById
(
'internal_title'
,
[
'id'
=>
$house_id
]);
$content
=
'你的【'
.
$house_data
[
'internal_title'
]
.
'】商铺下架,如需要上架,请编辑提交该商铺'
;
$house_agent
=
new
GHousesToAgents
();
$house_agent
=
new
GHousesToAgents
();
$house_agent_data
=
$house_agent
->
getAgentList
(
$house_id
,
2
,
'a.agents_id'
);
}
catch
(
\Exception
$e
)
{
return
false
;
}
foreach
(
$house_agent_data
as
$k
=>
$v
)
{
$this
->
pushAgentAllDeviceId
(
$v
[
'agents_id'
],
'商铺下架'
,
$content
,
'house_info'
,
$house_id
);
foreach
(
$house_agent_data
as
$k
=>
$v
)
{
$this
->
pushAgentAllDeviceId
(
$v
[
'agents_id'
],
'商铺下架'
,
$content
,
'house_info'
,
$house_id
);
}
return
;
return
;
}
/**
...
...
@@ -285,23 +276,24 @@ class PushMessageService
}
$m_agent_device
=
new
ABindingDevice
();
$device_id_array
=
$m_agent_device
->
getDeviceByAgentId
([
'agent_id'
=>
$id
,
'is_forbidden'
=>
0
],
'id,push_id'
);
$device_id_array
=
$m_agent_device
->
getDeviceByAgentId
([
'agent_id'
=>
$id
,
'is_forbidden'
=>
0
],
'id,push_id'
);
$result
=
[];
if
(
!
empty
(
$device_id_array
))
{
foreach
(
$device_id_array
as
$k
=>
$v
)
{
if
(
!
empty
(
$v
[
'push_id'
]))
{
$this
->
push
->
public_push_message_for_one
(
$id
,
$v
[
'push_id'
],
$title
,
$content
,
$type
,
$user_id
);
$
result
[]
=
$
this
->
push
->
public_push_message_for_one
(
$id
,
$v
[
'push_id'
],
$title
,
$content
,
$type
,
$user_id
);
}
}
}
return
true
;
return
$result
;
}
/**
* @return bool
*/
public
function
pushAllow
()
{
public
function
pushAllow
()
{
$url
=
$this
->
push
->
http_host
();
if
(
$url
==
'http://api.tonglianjituan.com'
||
$url
==
'https://api.tonglianjituan.com'
)
{
return
true
;
...
...
@@ -319,18 +311,61 @@ class PushMessageService
* @param $data
* @return bool
*/
public
function
record
(
$type
,
$house_id
,
$agent_id
,
$operation_id
,
$data
=
[])
{
public
function
record
(
$type
,
$house_id
,
$agent_id
,
$operation_id
,
$data
=
[])
{
$result
=
false
;
$m_push
=
new
MPushMessage
();
switch
(
$type
)
{
case
0
:
$result
=
$m_push
->
addData
(
$data
,
$operation_id
,
$type
);
break
;
$result
=
$m_push
->
addData
(
$data
,
$operation_id
,
$type
);
break
;
case
1
:
$result
=
$m_push
->
addHouseIdArray
(
$house_id
,
0
,
$type
,
$data
);
break
;
$result
=
$m_push
->
addHouseIdArray
(
$house_id
,
$operation_id
,
$type
,
$data
);
break
;
case
2
:
$data
[
'house_id'
]
=
$house_id
;
$result
=
$m_push
->
addAgentIdArray
(
$agent_id
,
$operation_id
,
$type
,
$data
);
break
;
$result
=
$m_push
->
addAgentIdArray
(
$agent_id
,
$operation_id
,
$type
,
$data
);
break
;
}
return
$result
;
}
/**
*
*/
public
function
pushRecord
()
{
$title
=
''
;
$m_push
=
new
MPushMessage
();
$field
=
'id,addressee_id,type,message,house_id'
;
$where
[
'status'
]
=
0
;
$push_data
=
$m_push
->
getDateLimit
(
$field
,
$where
,
100
);
foreach
(
$push_data
[
'data'
]
as
$k
=>
$v
)
{
if
(
$v
[
'type'
]
==
0
)
{
// $this->pushBargainMessage();
}
else
{
switch
(
$v
[
'type'
])
{
case
1
:
$title
=
"商铺下架"
;
break
;
case
2
:
$title
=
"修改客方"
;
break
;
case
3
:
$title
=
'盘方修改'
;
break
;
}
$result
=
$this
->
pushAgentAllDeviceId
(
$v
[
'addressee_id'
],
$title
,
$v
[
'message'
],
'house_info'
,
$v
[
'house_id'
]);
$update_data
[
'status'
]
=
1
;
$update_data
[
'send_time'
]
=
date
(
'Y-m-d H:i:s'
);
$m_push
->
updateData
(
$update_data
,
[
'id'
=>
$v
[
'id'
]
]);
}
}
return
;
}
}
\ No newline at end of file
application/model/MPushMessage.php
View file @
f6164b46
...
...
@@ -27,7 +27,8 @@ class MPushMessage
* @param $type
* @return bool
*/
public
function
addData
(
$data
,
$operation_id
,
$type
)
{
public
function
addData
(
$data
,
$operation_id
,
$type
)
{
if
(
isset
(
$data
[
'agent_id'
]))
{
$insert_data
[
'addressee_id'
]
=
$data
[
'agent_id'
];
}
...
...
@@ -61,6 +62,7 @@ class MPushMessage
return
$result
;
}
/**
* 根据楼盘id批量插入数据
*
...
...
@@ -70,22 +72,22 @@ class MPushMessage
* @param $data
* @return bool
*/
public
function
addHouseIdArray
(
array
$house_id
,
$operation_id
,
int
$type
,
$data
)
public
function
addHouseIdArray
(
array
$house_id
,
$operation_id
,
int
$type
,
$data
)
{
if
(
!
is_array
(
$house_id
))
{
return
false
;
}
$m_house
=
new
GHouses
();
$m_house
=
new
GHouses
();
$insert_data
=
[];
foreach
(
$house_id
as
$k
=>
$v
)
{
$agent_id
=
$this
->
selectAgentHouse
(
$v
);
foreach
(
$agent_id
as
$k2
=>
$v2
)
{
$insert_data
[
$k2
][
'house_id'
]
=
$v
;
$internal_title
=
$m_house
->
where
(
'id'
,
$v
)
->
value
(
'internal_title'
);
$insert_data
[
$k2
][
'message'
]
=
'你的【'
.
$internal_title
.
'】商铺下架,如需要上架,请编辑提交该商铺.'
;
foreach
(
$agent_id
as
$k2
=>
$v2
)
{
$insert_data
[
$k2
][
'house_id'
]
=
$v
;
$internal_title
=
$m_house
->
where
(
'id'
,
$v
)
->
value
(
'internal_title'
);
$insert_data
[
$k2
][
'message'
]
=
'你的【'
.
$internal_title
.
'】商铺下架,如需要上架,请编辑提交该商铺.'
;
$insert_data
[
$k2
][
'addressee_id'
]
=
$v2
;
$insert_data
[
$k2
][
'type'
]
=
$type
;
$insert_data
[
$k2
][
'status'
]
=
0
;
...
...
@@ -153,19 +155,60 @@ class MPushMessage
* @param $house_id
* @return array
*/
public
function
selectAgentHouse
(
$house_id
)
{
$m_house
=
new
GHousesToAgents
();
public
function
selectAgentHouse
(
$house_id
)
{
$m_house
=
new
GHousesToAgents
();
$where
[
'a.houses_id'
]
=
$house_id
;
$where
[
'a.type'
]
=
2
;
$result
=
$m_house
->
getHouseAgent
(
'agents_id'
,
$where
);
$result
=
$m_house
->
getHouseAgent
(
'agents_id'
,
$where
);
$agent_id
=
[];
if
(
$result
[
'status'
]
!=
'fail'
)
{
foreach
(
$result
[
'data'
]
as
$k
=>
$v
)
{
foreach
(
$result
[
'data'
]
as
$k
=>
$v
)
{
$agent_id
[]
=
$v
[
'agents_id'
];
}
}
return
$agent_id
;
}
/**
* 获取指定条数
*
* @param $field
* @param $where
* @param $limit
* @return mixed
*/
public
function
getDateLimit
(
$field
,
$where
,
$limit
)
{
try
{
$result
[
'data'
]
=
$this
->
db_
->
field
(
$field
)
->
where
(
$where
)
->
limit
(
$limit
)
->
select
();
$result
[
'status'
]
=
'successful'
;
}
catch
(
\Exception
$e
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
$e
->
getMessage
();
}
return
$result
;
}
/**
* @param $data
* @param $where
* @return int|string
*/
public
function
updateData
(
$data
,
$where
)
{
try
{
$this
->
db_
->
where
(
$where
)
->
update
(
$data
);
$result
[
'status'
]
=
'successful'
;
}
catch
(
\Exception
$e
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
$e
->
getMessage
();
}
return
$result
;
}
}
\ No newline at end of file
application/route.php
View file @
f6164b46
...
...
@@ -443,7 +443,9 @@ Route::group('task', [
'defaultFollowUp'
=>
[
'task/PrivacyNumber/defaultFollowUp'
,
[
'method'
=>
'post | get'
]
],
//默认跟进
'updateShopTask'
=>
[
'task/JobTask/updateShopTask'
,
[
'method'
=>
'post | get'
]
]
//默认跟进
'updateShopTask'
=>
[
'task/JobTask/updateShopTask'
,
[
'method'
=>
'post | get'
]
],
//默认跟进
'push'
=>
[
'task/PushMessageTask/push'
,
[
'method'
=>
'get'
]
]
//推送
]);
Route
::
group
(
'broker'
,
[
...
...
application/task/controller/PushMessageTask.php
0 → 100644
View file @
f6164b46
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/9/6
* Time: 14:50
*/
namespace
app\task\controller
;
use
app\api_broker\service\PushMessageService
;
class
PushMessageTask
{
/**
* 定时推送
*/
public
function
push
()
{
$push
=
new
PushMessageService
();
$push
->
pushRecord
();
}
}
\ 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