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
6e886b22
Commit
6e886b22
authored
Aug 29, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
推送最后转定时间提醒
parent
bbc177d0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
172 additions
and
1 deletion
+172
-1
MPushCheckMessage.php
application/model/MPushCheckMessage.php
+10
-0
OPayLogModel.php
application/model/OPayLogModel.php
+62
-0
route.php
application/route.php
+1
-0
AgentLookUserTask.php
application/task/controller/AgentLookUserTask.php
+1
-0
PushMessageTask.php
application/task/controller/PushMessageTask.php
+98
-1
No files found.
application/model/MPushCheckMessage.php
View file @
6e886b22
...
...
@@ -280,4 +280,13 @@ class MPushCheckMessage extends BaseModel
}
return
$result
;
}
/**
* @param $data
* @return int|string
*/
public
function
insertAllData
(
$data
)
{
return
$this
->
db_
->
insertAll
(
$data
);
}
}
\ No newline at end of file
application/model/OPayLogModel.php
View file @
6e886b22
...
...
@@ -675,5 +675,66 @@ class OPayLogModel extends Model
->
select
();
}
/**
* 记录总数
*
* @param $params
* @param string $field
* @return int|string
*/
public
function
getTotalJoinOrder
(
$params
,
$field
=
'a.id'
)
{
return
$this
->
db_
->
alias
(
'a'
)
->
join
(
'o_order b'
,
'a.order_id = b.id'
,
'LEFT'
)
->
where
(
$params
)
->
count
(
$field
);
}
/**
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getListJoinOrder
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'a.id desc'
,
$field
=
''
,
$params
=
''
)
{
return
$this
->
db_
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'o_order b'
,
'a.order_id = b.id'
,
'LEFT'
)
->
where
(
$params
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
}
/**
* @param $data
* @param $where
* @return int|string
* @throws \think\Exception
*/
public
function
updateData
(
$data
,
$where
)
{
return
$this
->
db_
->
where
(
$where
)
->
update
(
$data
);
}
/**
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getListJoinOrderAgent
(
$field
=
''
,
$params
=
''
)
{
return
$this
->
db_
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.reckon_in_store=b.store_id'
,
'LEFT'
)
->
where
(
$params
)
->
select
();
}
}
\ No newline at end of file
application/route.php
View file @
6e886b22
...
...
@@ -758,6 +758,7 @@ Route::group('task', [
'updateShopAgeLimit'
=>
[
'task/JobTask/updateShopAgeLimit'
,
[
'method'
=>
'get'
]],
//默认年限
'push'
=>
[
'task/PushMessageTask/push'
,
[
'method'
=>
'get'
]],
//推送和客户推送
'pushLastTransferTimeMsg'
=>
[
'task/PushMessageTask/pushLastTransferTimeMsg'
,
[
'method'
=>
'get'
]],
//推送最后转定时间提醒
'updateLandlordLimit'
=>
[
'task/JobTask/updateLandlordLimit'
,
[
'method'
=>
'get'
]],
//转换房东手机号
...
...
application/task/controller/AgentLookUserTask.php
View file @
6e886b22
...
...
@@ -18,6 +18,7 @@ class AgentLookUserTask
*/
public
function
delAgentUserLog
()
{
set_time_limit
(
0
);
$m_look
=
new
TLookAgentUserModel
();
$where
[
'create_time'
]
=
[
'<'
,
date
(
'Y-m-d H:i:s'
,
strtotime
(
'-3 month'
))];
//两个月前
$total
=
$m_look
->
getTotal
(
$where
);
...
...
application/task/controller/PushMessageTask.php
View file @
6e886b22
...
...
@@ -11,13 +11,18 @@ namespace app\task\controller;
use
app\api\service\PushClientService
;
use
app\api_broker\service\PushMessageService
;
use
app\api_broker\service\RedisCacheService
;
use
app\model\AAgents
;
use
app\model\MPushCheckMessage
;
use
app\model\OPayLogModel
;
class
PushMessageTask
{
/**
* 定时推送 (5分钟)
*/
public
function
push
()
{
public
function
push
()
{
//经纪人
$push
=
new
PushMessageService
();
$push
->
pushRecord
();
...
...
@@ -27,4 +32,95 @@ class PushMessageTask
$push
=
new
PushClientService
();
$push
->
pushRecord
();
}
/**
* 推送最后转定时间提醒
*
* @return null|void
*/
public
function
pushLastTransferTimeMsg
()
{
set_time_limit
(
0
);
$m_pay
=
new
OPayLogModel
();
$m_push
=
new
MPushCheckMessage
();
$s_redis
=
new
RedisCacheService
();
$where
[
'a.is_del'
]
=
0
;
$where
[
'a.is_transfer_msg'
]
=
0
;
$where
[
'a.source'
]
=
[
'<'
,
2
];
$where
[
'a.type'
]
=
10
;
$where
[
'a.last_transfer_time'
]
=
[
'<'
,
date
(
'Y-m-d H:i:s'
)];
$total
=
$m_pay
->
getTotalJoinOrder
(
$where
);
if
(
empty
(
$total
))
{
return
null
;
}
$page_size
=
200
;
$page_total
=
ceil
(
$total
/
$page_size
);
for
(
$i
=
0
;
$i
<
$page_total
;
$i
++
)
{
$list
=
$m_pay
->
getListJoinOrder
(
$i
,
$page_size
,
'a.id asc'
,
'a.id,a.agent_id,a.order_id,b.house_id,a.reckon_in_store'
,
$where
);
$save_data
=
$pay_log_id
=
$store_id
=
$pay_id
=
$pay_id_store
=
[];
foreach
(
$list
as
$k
=>
$v
)
{
$key
=
$v
[
'id'
];
$save_data
[
$key
][
'order_id'
]
=
$v
[
'order_id'
];
$save_data
[
$key
][
'addressee_id'
]
=
$v
[
'agent_id'
];
$save_data
[
$key
][
'message'
]
=
'[商铺编号:'
.
$v
[
'house_id'
]
.
']的意向金到转定时间了,请抓紧时间转定哦!'
;
$save_data
[
$key
][
'type'
]
=
8
;
$save_data
[
$key
][
'status'
]
=
1
;
$pay_log_id
[]
=
$v
[
'id'
];
if
(
empty
(
$v
[
'reckon_in_store'
]))
{
continue
;
//排除没有门店的收款
}
$agent_data
=
$s_redis
->
getRedisCache
(
2
,
$v
[
'agent_id'
]);
if
(
$agent_data
[
'store_id'
]
==
$v
[
'reckon_in_store'
])
{
if
(
!
in_array
(
$agent_data
[
'level'
],
[
20
,
40
]))
{
//已是本门店店长排除推送信息。
$pay_id_store
[]
=
$v
[
'id'
];
}
}
else
{
//提交非本门店处理
$pay_id_store
[]
=
$v
[
'id'
];
}
unset
(
$agent_data
);
}
//取收款门店店长
if
(
!
empty
(
$pay_id_store
))
{
$agent_where
[
'b.status'
]
=
0
;
$agent_where
[
'b.level'
]
=
[
'in'
,
'20,40'
];
$agent_where
[
'a.id'
]
=
[
'in'
,
$pay_id_store
];
$agent_store
=
$m_pay
->
getListJoinOrderAgent
(
'a.id as pay_id,b.id,b.store_id'
,
$agent_where
);
foreach
(
$agent_store
as
$k2
=>
$v2
)
{
if
(
empty
(
$save_data
[
$v2
[
'pay_id'
]]))
{
continue
;
}
$save_store_data
[]
=
[
'order_id'
=>
$save_data
[
$v2
[
'pay_id'
]][
'order_id'
],
'addressee_id'
=>
$v2
[
'id'
],
'type'
=>
8
,
'status'
=>
0
,
'message'
=>
$save_data
[
$v2
[
'pay_id'
]][
'message'
]
];
}
}
if
(
isset
(
$save_data
))
{
$m_push
->
insertAllData
(
$save_data
);
//与下方不能一起插入表 会报错 分开插入
unset
(
$save_data
);
$m_pay
->
updateData
([
'is_transfer_msg'
=>
1
],
[
'id'
=>
[
'in'
,
$pay_log_id
]]);
}
if
(
isset
(
$save_store_data
))
{
$m_push
->
insertAllData
(
$save_store_data
);
unset
(
$save_store_data
);
}
}
return
;
}
}
\ 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