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
450a210c
Commit
450a210c
authored
Aug 30, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
推送最后转定时间提醒-办公楼
parent
f8c653a6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
155 additions
and
3 deletions
+155
-3
OfficeOPayLogModel.php
application/model/OfficeOPayLogModel.php
+62
-0
route.php
application/route.php
+2
-1
PushMessageTask.php
application/task/controller/PushMessageTask.php
+91
-2
No files found.
application/model/OfficeOPayLogModel.php
View file @
450a210c
...
...
@@ -632,5 +632,66 @@ class OfficeOPayLogModel extends Model
->
find
();
}
/**
* @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
();
}
/**
*
* @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 $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 $data
* @param $where
* @return int|string
* @throws \think\Exception
*/
public
function
updateData
(
$data
,
$where
)
{
return
$this
->
db_
->
where
(
$where
)
->
update
(
$data
);
}
}
\ No newline at end of file
application/route.php
View file @
450a210c
...
...
@@ -760,7 +760,8 @@ Route::group('task', [
'updateShopAgeLimit'
=>
[
'task/JobTask/updateShopAgeLimit'
,
[
'method'
=>
'get'
]],
//默认年限
'push'
=>
[
'task/PushMessageTask/push'
,
[
'method'
=>
'get'
]],
//推送和客户推送
'pushLastTransferTimeMsg'
=>
[
'task/PushMessageTask/pushLastTransferTimeMsg'
,
[
'method'
=>
'get'
]],
//推送最后转定时间提醒
'pushLastTransferTimeMsg'
=>
[
'task/PushMessageTask/pushLastTransferTimeMsg'
,
[
'method'
=>
'get'
]],
//推送最后转定时间提醒-商铺
'pushLastTransferOfficeMsg'
=>
[
'task/PushMessageTask/pushLastTransferOfficeMsg'
,
[
'method'
=>
'get'
]],
//推送最后转定时间提醒-办公楼
'updateLandlordLimit'
=>
[
'task/JobTask/updateLandlordLimit'
,
[
'method'
=>
'get'
]],
//转换房东手机号
...
...
application/task/controller/PushMessageTask.php
View file @
450a210c
...
...
@@ -12,8 +12,8 @@ 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\OfficeOPayLogModel
;
use
app\model\OPayLogModel
;
class
PushMessageTask
...
...
@@ -34,7 +34,7 @@ class PushMessageTask
}
/**
* 推送最后转定时间提醒
* 推送最后转定时间提醒
-商铺
*
* @return null|void
*/
...
...
@@ -125,4 +125,92 @@ class PushMessageTask
return
;
}
/**
* 推送最后转定时间提醒-办公楼
*
* @return null|void
*/
public
function
pushLastTransferOfficeMsg
()
{
set_time_limit
(
0
);
$m_pay
=
new
OfficeOPayLogModel
();
$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
][
'title'
]
=
'意向金转定提醒'
;
$save_data
[
$key
][
'type'
]
=
8
;
$save_data
[
$key
][
'status'
]
=
0
;
$pay_log_id
[]
=
$v
[
'id'
];
if
(
empty
(
$v
[
'reckon_in_store'
]))
{
continue
;
//排除没有门店的收款
}
$agent_data
=
$s_redis
->
getRedisCache
(
2
,
$v
[
'agent_id'
]);
if
(
!
in_array
(
$agent_data
[
'level'
],
[
20
,
40
]))
{
//已是门店店长排除推送信息。
$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'
],
'title'
=>
$save_data
[
$v2
[
'pay_id'
]][
'title'
]
];
}
}
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