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
1545908b
Commit
1545908b
authored
Aug 28, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11
parent
0194976d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
15 deletions
+67
-15
PushMessageService.php
application/api_broker/service/PushMessageService.php
+26
-0
GHousesToAgents.php
application/model/GHousesToAgents.php
+30
-9
UpdateShopStatusTask.php
application/task/controller/UpdateShopStatusTask.php
+11
-6
No files found.
application/api_broker/service/PushMessageService.php
View file @
1545908b
...
...
@@ -15,6 +15,7 @@ use app\model\ABindingDevice;
use
app\model\AStore
;
use
app\model\GHouses
;
use
app\model\GHousesToAgents
;
use
app\model\MPushMessage
;
use
app\model\OrderModel
;
use
app\model\OReportModel
;
use
app\model\PushFeed
;
...
...
@@ -307,4 +308,28 @@ class PushMessageService
}
return
false
;
}
/**
* 记录需要推送的消息
*
* @param $type
* @param $house_id
* @param $agent_id
* @param $operation_id
* @param $data
* @return bool
*/
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
;
case
1
:
$result
=
$m_push
->
addHouseIdArray
(
$house_id
,
$operation_id
,
$type
,
$data
);
break
;
case
2
:
$result
=
$m_push
->
addAgentIdArray
(
$agent_id
,
$operation_id
,
$type
,
$data
);
break
;
}
return
$result
;
}
}
\ No newline at end of file
application/model/GHousesToAgents.php
View file @
1545908b
...
...
@@ -315,17 +315,23 @@ class GHousesToAgents extends BaseModel
* @param string $field
* @param array $where
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getHouseAgent
(
string
$field
=
''
,
array
$where
=
[])
:
array
public
function
getHouseAgent
(
string
$field
=
''
,
array
$where
=
[])
:
array
{
return
$this
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'a_agents b'
,
'a.agents_id=b.id'
,
'left'
)
->
where
(
$where
)
->
select
();
try
{
$where
[
'a.is_del'
]
=
0
;
$result
[
'data'
]
=
$this
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'a_agents b'
,
'a.agents_id=b.id'
,
'left'
)
->
where
(
$where
)
->
select
();
$result
[
'status'
]
=
'successful'
;
}
catch
(
\Exception
$e
)
{
$result
[
'data'
]
=
[];
$result
[
'status'
]
=
'fail'
;
}
return
$result
;
}
/**
...
...
@@ -355,4 +361,19 @@ class GHousesToAgents extends BaseModel
->
limit
(
1
)
->
select
();
}
/**
* @param $agent_id
* @param int $type
* @return int|string
*/
public
function
getAgentHouseNum
(
$agent_id
,
$type
=
3
)
{
return
$this
->
alias
(
'a'
)
->
field
(
'a.id'
)
->
join
(
'a_agents b'
,
'a.agents_id=b.id'
,
'left'
)
->
where
(
'a.is_del'
,
0
)
->
where
(
'a.type'
,
$type
)
->
where
(
'a.agents_id'
,
$agent_id
)
->
count
();
}
}
application/task/controller/UpdateShopStatusTask.php
View file @
1545908b
...
...
@@ -104,7 +104,7 @@ class UpdateShopStatusTask
$update_arr
[
$k
][
"status"
]
=
2
;
$this
->
house_id
[]
=
$item
[
'id'
];
}
$this
->
shopModel
->
updateHouse
(
$update_arr
);
//
$this->shopModel->updateHouse($update_arr);
}
/**
...
...
@@ -133,11 +133,15 @@ class UpdateShopStatusTask
}
public
function
__destruct
()
{
//处理下架推送消息
/**
* 记录需要推送的消息
*/
public
function
recordPushMessage
()
{
$push_service
=
new
PushMessageService
();
foreach
(
$this
->
house_id
as
$k
=>
$v
)
{
$push_service
->
pushHouseDownMessage
(
$v
);
}
$push_service
->
record
(
1
,
$this
->
house_id
,
0
,
0
);
}
public
function
__destruct
()
{
$this
->
recordPushMessage
();
}
}
\ 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