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
44437b60
Commit
44437b60
authored
Jul 18, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自动下架逻辑更新
parent
6b2e6d12
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
27 deletions
+96
-27
GHouses.php
application/model/GHouses.php
+5
-10
GHousesFollowUp.php
application/model/GHousesFollowUp.php
+22
-1
OrderModel.php
application/model/OrderModel.php
+53
-10
UpdateShopStatusTask.php
application/task/controller/UpdateShopStatusTask.php
+16
-6
No files found.
application/model/GHouses.php
View file @
44437b60
...
@@ -825,25 +825,20 @@ class GHouses extends BaseModel
...
@@ -825,25 +825,20 @@ class GHouses extends BaseModel
{
{
$where_
=
[];
$where_
=
[];
if
(
isset
(
$params
[
"status"
]))
{
if
(
isset
(
$params
[
"status"
]))
{
$where_
[
"
a.
status"
]
=
$params
[
"status"
];
$where_
[
"status"
]
=
$params
[
"status"
];
}
}
if
(
isset
(
$params
[
"update_time"
]))
{
if
(
isset
(
$params
[
"update_time"
]))
{
$where_
[
"a.update_time"
]
=
$params
[
"update_time"
];
$where_
[
"update_time"
]
=
$params
[
"update_time"
];
}
if
(
isset
(
$params
[
"is_execute"
]))
{
$where_
[
"a.is_execute"
]
=
$params
[
"is_execute"
];
}
}
if
(
isset
(
$params
[
"is_exclusive_type"
]))
{
if
(
isset
(
$params
[
"is_exclusive_type"
]))
{
$where_
[
"
a.
is_exclusive_type"
]
=
$params
[
"is_exclusive_type"
];
$where_
[
"is_exclusive_type"
]
=
$params
[
"is_exclusive_type"
];
}
}
$result
=
Db
::
table
(
$this
->
table
)
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.id = b.house_id"
,
"left"
)
->
join
(
"g_houses_follow_up c"
,
"a.id = c.house_id"
,
"left"
)
->
where
(
$where_
)
->
where
(
$where_
)
->
group
(
"a.id "
)
->
select
();
->
select
();
echo
$this
->
getLastSql
();
return
$result
;
return
$result
;
}
}
...
...
application/model/GHousesFollowUp.php
View file @
44437b60
...
@@ -109,13 +109,14 @@ class GHousesFollowUp extends Model
...
@@ -109,13 +109,14 @@ class GHousesFollowUp extends Model
// echo $this->getLastSql();
// echo $this->getLastSql();
return
$data
;
return
$data
;
}
}
/**
/**
* 首页商铺跟进搜索
* 首页商铺跟进搜索
* @param $join
* @param $join
* @param $where
* @param $where
* @return int
* @return int
*/
*/
public
function
getSearchCount
(
$join
,
$where
)
public
function
getSearchCount
(
$join
,
$where
)
{
{
$data
=
$this
$data
=
$this
->
alias
(
'f'
)
->
alias
(
'f'
)
...
@@ -124,4 +125,23 @@ class GHousesFollowUp extends Model
...
@@ -124,4 +125,23 @@ class GHousesFollowUp extends Model
->
count
(
"f.id"
);
->
count
(
"f.id"
);
return
$data
;
return
$data
;
}
}
public
function
getFollowUpByHouseId
(
array
$params
)
:
bool
{
$where_
=
[];
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
}
if
(
isset
(
$params
[
"house_id"
]))
{
$where_
[
"house_id"
]
=
$params
[
"house_id"
];
}
$follow_list
=
$this
->
field
(
"id"
)
->
where
(
$where_
)
->
select
();
if
(
count
(
$follow_list
)
>
0
)
{
return
true
;
}
return
false
;
}
}
}
\ No newline at end of file
application/model/OrderModel.php
View file @
44437b60
...
@@ -101,7 +101,8 @@ class OrderModel extends Model
...
@@ -101,7 +101,8 @@ class OrderModel extends Model
* @param $params
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @return false|\PDOStatement|string|\think\Collection
*/
*/
public
function
searchOrder
(
$field
,
$params
,
$where_
){
public
function
searchOrder
(
$field
,
$params
,
$where_
)
{
/* $result = $this->db_
/* $result = $this->db_
->field($field)
->field($field)
...
@@ -138,7 +139,7 @@ class OrderModel extends Model
...
@@ -138,7 +139,7 @@ class OrderModel extends Model
$result
=
$this
->
db_
->
query
(
$sql
);
$result
=
$this
->
db_
->
query
(
$sql
);
//echo $this->db_->getLastSql();
//echo $this->db_->getLastSql();
return
$result
;
return
$result
;
}
}
...
@@ -150,9 +151,10 @@ class OrderModel extends Model
...
@@ -150,9 +151,10 @@ class OrderModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getOrderById
(
$field
,
$order_id
)
{
public
function
getOrderById
(
$field
,
$order_id
)
{
return
$this
->
field
(
$field
)
return
$this
->
field
(
$field
)
->
where
(
'id'
,
$order_id
)
->
where
(
'id'
,
$order_id
)
->
find
();
->
find
();
}
}
...
@@ -166,10 +168,10 @@ class OrderModel extends Model
...
@@ -166,10 +168,10 @@ class OrderModel extends Model
$signStartTime
=
date
(
"Y-m-d H:i:s"
,
$timeArr
[
0
]);
$signStartTime
=
date
(
"Y-m-d H:i:s"
,
$timeArr
[
0
]);
$signEndTime
=
date
(
"Y-m-d H:i:s"
,
$timeArr
[
1
]);
$signEndTime
=
date
(
"Y-m-d H:i:s"
,
$timeArr
[
1
]);
$where_
[
'a.create_time'
]
=
array
(
"between"
,
array
(
$signStartTime
,
$signEndTime
)
);
$where_
[
'a.create_time'
]
=
array
(
"between"
,
array
(
$signStartTime
,
$signEndTime
)
);
$where_
[
'b.father_id'
]
=
array
(
"eq"
,
0
);
$where_
[
'b.father_id'
]
=
array
(
"eq"
,
0
);
return
$this
->
db_
return
$this
->
db_
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
"o_bargain b"
,
"a.id = b.order_id"
,
"left"
)
->
join
(
"o_bargain b"
,
"a.id = b.order_id"
,
"left"
)
->
where
(
$where_
)
->
where
(
$where_
)
->
count
();
->
count
();
}
}
...
@@ -184,11 +186,12 @@ class OrderModel extends Model
...
@@ -184,11 +186,12 @@ class OrderModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getHouseInfoByOrderId
(
$field
,
$params
){
public
function
getHouseInfoByOrderId
(
$field
,
$params
)
{
return
$this
->
db_
return
$this
->
db_
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
"g_houses b"
,
"a.house_id = b.id"
,
"left"
)
->
join
(
"g_houses b"
,
"a.house_id = b.id"
,
"left"
)
->
where
(
$params
)
->
where
(
$params
)
->
select
();
->
select
();
}
}
...
@@ -203,12 +206,51 @@ class OrderModel extends Model
...
@@ -203,12 +206,51 @@ class OrderModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getHouseInfoByOrderIdOne
(
$field
,
$params
)
{
public
function
getHouseInfoByOrderIdOne
(
$field
,
$params
)
{
return
$this
->
db_
return
$this
->
db_
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
"g_houses b"
,
"a.house_id = b.id"
,
"left"
)
->
join
(
"g_houses b"
,
"a.house_id = b.id"
,
"left"
)
->
where
(
$params
)
->
where
(
$params
)
->
find
();
->
find
();
}
}
public
function
getOrderByHouseId
(
array
$params
)
:
bool
{
$where_
=
$select_
=
[];
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"create_time"
]
=
$params
[
"create_time"
];
$select_
[
"b.create_time"
]
=
$params
[
"create_time"
];
}
if
(
isset
(
$params
[
"house_id"
]))
{
$where_
[
"house_id"
]
=
$params
[
"house_id"
];
$select_
[
"a.house_id"
]
=
$params
[
"house_id"
];
}
//判断此楼盘10天内是否有订单记录
$orderResult
=
$this
->
db_
->
field
(
"id"
)
->
where
(
$where_
)
->
limit
(
1
)
->
select
();
echo
$this
->
getLastSql
();
if
(
count
(
$orderResult
)
>
0
)
{
return
true
;
}
//判断此楼盘10天内是否有跟进记录
$marchIn
=
$this
->
db_
->
field
(
"b.id"
)
->
alias
(
"a"
)
->
join
(
"o_march_in b"
,
"a.id = b.order_id"
,
"left"
)
->
where
(
$select_
)
->
limit
(
1
)
->
select
();
echo
$this
->
getLastSql
();
if
(
count
(
$marchIn
)
>
0
)
{
return
true
;
}
return
false
;
}
}
}
\ No newline at end of file
application/task/controller/UpdateShopStatusTask.php
View file @
44437b60
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
namespace
app\task\controller
;
namespace
app\task\controller
;
use
app\model\GHouses
;
use
app\model\GHouses
;
use
app\model\GHousesFollowUp
;
use
app\model\OrderModel
;
use
app\model\SystemConfig
;
use
app\model\SystemConfig
;
...
@@ -46,22 +48,30 @@ class UpdateShopStatusTask
...
@@ -46,22 +48,30 @@ class UpdateShopStatusTask
}
else
{
}
else
{
return
null
;
return
null
;
}
}
$field
=
"
a.id,b.id as order_
id"
;
$field
=
"id"
;
$params
=
[];
$params
=
[];
$time_
=
date
(
'Y-m-d'
,
strtotime
(
"-
$day
day"
));
$time_
=
date
(
'Y-m-d'
,
strtotime
(
"-
$day
day"
));
$params
[
"status"
]
=
1
;
$params
[
"status"
]
=
1
;
$params
[
"update_time"
]
=
array
(
'lt'
,
$time_
.
" 23:59:59"
);
$params
[
"update_time"
]
=
array
(
'lt'
,
$time_
.
" 23:59:59"
);
$params
[
"is_execute"
]
=
0
;
//过滤掉有动态的商铺
$params
[
"is_exclusive_type"
]
=
0
;
$params
[
"is_exclusive_type"
]
=
0
;
//所有修改时间大于10天的商铺
$result
=
$this
->
shopModel
->
getShopListByTime
(
$field
,
$params
);
$result
=
$this
->
shopModel
->
getShopListByTime
(
$field
,
$params
);
$orderModel
=
new
OrderModel
();
$followMole
=
new
GHousesFollowUp
();
$select_
[
"create_time"
]
=
array
(
"between"
,
array
(
$time_
,
date
(
"Y-m-d H:i:s"
,
time
())
)
);
$update_arr
=
[];
$update_arr
=
[];
foreach
(
$result
as
$key
=>
$item
)
{
foreach
(
$result
as
$key
=>
$item
)
{
if
(
$item
[
"order_id"
])
{
$select_
[
"house_id"
]
=
$item
[
"id"
];
$update_arr
[
$key
][
"id"
]
=
$item
[
"id"
];
$is_ok
=
$orderModel
->
getOrderByHouseId
(
$select_
);
$update_arr
[
$key
][
"is_execute"
]
=
1
;
$is_follow
=
$followMole
->
getFollowUpByHouseId
(
$select_
);
}
else
{
//10天内无动态则下架
if
(
!
$is_ok
&&
!
$is_follow
)
{
$update_arr
[
$key
][
"id"
]
=
$item
[
"id"
];
$update_arr
[
$key
][
"id"
]
=
$item
[
"id"
];
$update_arr
[
$key
][
"status"
]
=
2
;
$update_arr
[
$key
][
"status"
]
=
2
;
}
}
...
...
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