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
3e0b4cc7
Commit
3e0b4cc7
authored
Apr 24, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shop status update
parent
ea753f02
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
206 additions
and
0 deletions
+206
-0
GHouses.php
application/model/GHouses.php
+99
-0
route.php
application/route.php
+4
-0
updateShopStatusTask.php
application/task/controller/updateShopStatusTask.php
+103
-0
No files found.
application/model/GHouses.php
View file @
3e0b4cc7
...
@@ -585,6 +585,11 @@ class GHouses extends BaseModel
...
@@ -585,6 +585,11 @@ class GHouses extends BaseModel
->
select
();
->
select
();
}
}
/**
* 获取新增楼盘数量
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getAddHouseNum
(
$params
)
public
function
getAddHouseNum
(
$params
)
{
{
$field
=
"count(1) as num"
;
$field
=
"count(1) as num"
;
...
@@ -644,6 +649,100 @@ class GHouses extends BaseModel
...
@@ -644,6 +649,100 @@ class GHouses extends BaseModel
}
}
}
}
/**
* 批量修改
* @param $params
* @return int
*/
public
function
updateHouse
(
$params
)
{
Db
::
startTrans
();
try
{
$this
->
saveAll
(
$params
);
//echo Db::table($this->table)->getLastSql();
Db
::
commit
();
return
1
;
}
catch
(
\Exception
$e
)
{
echo
3333
;
Db
::
rollback
();
return
0
;
}
}
/**
* 根据时间获取楼盘信息
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getShopListByTime
(
$field
,
$params
){
$where_
=
[];
if
(
isset
(
$params
[
"status"
]))
{
$where_
[
"a.status"
]
=
$params
[
"status"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"a.create_time"
]
=
$params
[
"create_time"
];
}
if
(
isset
(
$params
[
"is_execute"
]))
{
$where_
[
"a.is_execute"
]
=
$params
[
"is_execute"
];
}
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.id = b.house_id"
,
"left"
)
->
where
(
$where_
)
->
group
(
"a.id "
)
->
select
();
//echo Db::table($this->table)->getLastSql();
return
$result
;
}
/**
* 根据获取上架状态的楼盘数量为0 的数据
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getShopListByNum
(
$field
,
$params
){
$where_
=
[];
if
(
isset
(
$params
[
"status"
]))
{
$where_
[
"status"
]
=
$params
[
"status"
];
}
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
$where_
)
->
select
();
//echo Db::table($this->table)->getLastSql();
return
$result
;
}
/**
* 根据独家合同时间获取楼盘信息
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getShopListByPact
(
$field
,
$params
){
$where_
=
[];
if
(
isset
(
$params
[
"status"
]))
{
$where_
[
"a.status"
]
=
$params
[
"status"
];
}
if
(
isset
(
$params
[
"agent_end_time"
]))
{
$where_
[
"b.agent_end_time"
]
=
$params
[
"agent_end_time"
];
}
if
(
isset
(
$params
[
"is_exclusive_type"
]))
{
$where_
[
"a.is_exclusive_type"
]
=
$params
[
"is_exclusive_type"
];
}
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"g_houses_ext b"
,
"a.id = b.house_id"
,
"left"
)
->
where
(
$where_
)
->
group
(
"a.id "
)
->
select
();
//echo Db::table($this->table)->getLastSql();
return
$result
;
}
/******zw end ************/
/******zw end ************/
...
...
application/route.php
View file @
3e0b4cc7
...
@@ -312,6 +312,10 @@ Route::group('task',[
...
@@ -312,6 +312,10 @@ Route::group('task',[
'releaseNumber'
=>
[
'task/PrivacyNumber/releaseNumber'
,
[
'method'
=>
'get'
]],
//释放号码
'releaseNumber'
=>
[
'task/PrivacyNumber/releaseNumber'
,
[
'method'
=>
'get'
]],
//释放号码
'updateStatusByTime'
=>
[
'task/updateShopStatusTask/updateStatusByTime'
,
[
'method'
=>
'get'
]],
//修改上下架
'updateStatusByNum'
=>
[
'task/updateShopStatusTask/updateStatusByNum'
,
[
'method'
=>
'get'
]],
//修改下架根据数量
'totalAgentResults'
=>
[
'task/ResultsSummaryTask/totalAgentResults'
,
[
'method'
=>
'get'
]],
//释放号码
'totalAgentResults'
=>
[
'task/ResultsSummaryTask/totalAgentResults'
,
[
'method'
=>
'get'
]],
//释放号码
...
...
application/task/controller/updateShopStatusTask.php
0 → 100644
View file @
3e0b4cc7
<?php
namespace
app\task\controller
;
use
app\model\GHouses
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/4/23
* Time : 下午5:13
* Intro: 修改商铺状态
*/
class
updateShopStatusTask
{
private
$shopModel
;
function
__construct
()
{
$this
->
shopModel
=
new
GHouses
();
}
/**
* 每天2点跑一次
* 根据创建时间和系统设置的时间范围内无动态则下架
*/
public
function
updateStatusByTime
()
{
//todo 1.查询所有上架的店铺并且创建时间大于设置的自动下架的时间,并且动态无动态标签, 2.查询这些楼盘是否有动态
//todo 3.有动态的打上标签 4.过了时间并且没有动态的下架
$day
=
11
;
$field
=
"a.id,b.id as order_id"
;
$params
=
[];
$time_
=
date
(
'Y-m-d'
,
strtotime
(
"-
$day
day"
));
$params
[
"status"
]
=
1
;
$params
[
"create_time"
]
=
array
(
'gt'
,
$time_
);
$params
[
"is_execute"
]
=
0
;
$result
=
$this
->
shopModel
->
getShopListByTime
(
$field
,
$params
);
$update_arr
=
[];
foreach
(
$result
as
$key
=>
$item
)
{
if
(
$item
[
"order_id"
])
{
$update_arr
[
$key
][
"id"
]
=
$item
[
"id"
];
$update_arr
[
$key
][
"is_execute"
]
=
1
;
}
else
{
$update_arr
[
$key
][
"id"
]
=
$item
[
"id"
];
$update_arr
[
$key
][
"status"
]
=
2
;
}
}
if
(
count
(
$update_arr
)
>
0
)
{
$this
->
shopModel
->
updateHouse
(
$update_arr
);
}
$this
->
updateStatusByPact
();
}
/**
* 每5分钟跑一次 根据商铺数量修改下架 高频
*/
public
function
updateStatusByNum
()
{
$field
=
"id,residue_num"
;
$params
=
[];
$params
[
"status"
]
=
1
;
$result
=
$this
->
shopModel
->
getShopListByNum
(
$field
,
$params
);
$update_arr
=
[];
foreach
(
$result
as
$k
=>
$item
)
{
$update_arr
[
$k
][
"id"
]
=
$item
[
"id"
];
$update_arr
[
$k
][
"status"
]
=
2
;
}
$this
->
shopModel
->
updateHouse
(
$update_arr
);
}
/**
* 根据独家合同修改下架
*/
private
function
updateStatusByPact
()
{
$field
=
"a.id"
;
$params
=
[];
$time_
=
date
(
'Y-m-d'
,
time
());
$params
[
"status"
]
=
1
;
$params
[
"is_exclusive_type"
]
=
1
;
$params
[
"agent_end_time"
]
=
array
(
'lt'
,
$time_
);
$result
=
$this
->
shopModel
->
getShopListByPact
(
$field
,
$params
);
$update_arr
=
[];
foreach
(
$result
as
$key
=>
$item
)
{
$update_arr
[
$key
][
"id"
]
=
$item
[
"id"
];
$update_arr
[
$key
][
"status"
]
=
2
;
}
if
(
count
(
$update_arr
)
>
0
)
{
$this
->
shopModel
->
updateHouse
(
$update_arr
);
}
}
}
\ 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