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
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
42 deletions
+111
-42
GHouses.php
application/model/GHouses.php
+5
-10
GHousesFollowUp.php
application/model/GHousesFollowUp.php
+23
-2
OrderModel.php
application/model/OrderModel.php
+67
-24
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
{
$where_
=
[];
if
(
isset
(
$params
[
"status"
]))
{
$where_
[
"
a.
status"
]
=
$params
[
"status"
];
$where_
[
"status"
]
=
$params
[
"status"
];
}
if
(
isset
(
$params
[
"update_time"
]))
{
$where_
[
"a.update_time"
]
=
$params
[
"update_time"
];
}
if
(
isset
(
$params
[
"is_execute"
]))
{
$where_
[
"a.is_execute"
]
=
$params
[
"is_execute"
];
$where_
[
"update_time"
]
=
$params
[
"update_time"
];
}
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
)
->
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_
)
->
group
(
"a.id "
)
->
select
();
echo
$this
->
getLastSql
();
return
$result
;
}
...
...
application/model/GHousesFollowUp.php
View file @
44437b60
...
...
@@ -106,16 +106,17 @@ class GHousesFollowUp extends Model
->
limit
(
$pageSize
)
->
page
(
$p
)
->
select
();
// echo $this->getLastSql();
// echo $this->getLastSql();
return
$data
;
}
/**
* 首页商铺跟进搜索
* @param $join
* @param $where
* @return int
*/
public
function
getSearchCount
(
$join
,
$where
)
public
function
getSearchCount
(
$join
,
$where
)
{
$data
=
$this
->
alias
(
'f'
)
...
...
@@ -124,4 +125,23 @@ class GHousesFollowUp extends Model
->
count
(
"f.id"
);
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,19 +101,20 @@ class OrderModel extends Model
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
searchOrder
(
$field
,
$params
,
$where_
){
/* $result = $this->db_
->field($field)
->alias("a")
->join("o_report b","a.f_id = b.id","left")
->union('SELECT '.$field.' FROM o_order a left join o_report b on a.f_id = b.id where '.$params)
->where($params)
->select();*/
public
function
searchOrder
(
$field
,
$params
,
$where_
)
{
/* $result = $this->db_
->field($field)
->alias("a")
->join("o_report b","a.f_id = b.id","left")
->union('SELECT '.$field.' FROM o_order a left join o_report b on a.f_id = b.id where '.$params)
->where($params)
->select();*/
/* dump($params);
dump($where_);*/
//$where_ = $where_ ." and " . $params;
$sql
=
"SELECT * FROM
$sql
=
"SELECT * FROM
(
(
SELECT
...
...
@@ -135,10 +136,10 @@ class OrderModel extends Model
$where_
)
) AS aaa"
;
$result
=
$this
->
db_
->
query
(
$sql
);
//echo $this->db_->getLastSql();
$result
=
$this
->
db_
->
query
(
$sql
);
//echo $this->db_->getLastSql();
return
$result
;
return
$result
;
}
...
...
@@ -150,9 +151,10 @@ class OrderModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getOrderById
(
$field
,
$order_id
)
{
public
function
getOrderById
(
$field
,
$order_id
)
{
return
$this
->
field
(
$field
)
->
where
(
'id'
,
$order_id
)
->
where
(
'id'
,
$order_id
)
->
find
();
}
...
...
@@ -162,14 +164,14 @@ class OrderModel extends Model
*/
function
getTurnover
()
{
$timeArr
=
Time
::
lastWeek
();
$signStartTime
=
date
(
"Y-m-d H:i:s"
,
$timeArr
[
0
]);
$signEndTime
=
date
(
"Y-m-d H:i:s"
,
$timeArr
[
1
]);
$timeArr
=
Time
::
lastWeek
();
$signStartTime
=
date
(
"Y-m-d H:i:s"
,
$timeArr
[
0
]);
$signEndTime
=
date
(
"Y-m-d H:i:s"
,
$timeArr
[
1
]);
$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_
->
alias
(
"a"
)
->
join
(
"o_bargain b"
,
"a.id = b.order_id"
,
"left"
)
->
join
(
"o_bargain b"
,
"a.id = b.order_id"
,
"left"
)
->
where
(
$where_
)
->
count
();
}
...
...
@@ -184,11 +186,12 @@ class OrderModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getHouseInfoByOrderId
(
$field
,
$params
){
public
function
getHouseInfoByOrderId
(
$field
,
$params
)
{
return
$this
->
db_
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"g_houses b"
,
"a.house_id = b.id"
,
"left"
)
->
join
(
"g_houses b"
,
"a.house_id = b.id"
,
"left"
)
->
where
(
$params
)
->
select
();
}
...
...
@@ -203,12 +206,51 @@ class OrderModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getHouseInfoByOrderIdOne
(
$field
,
$params
)
{
public
function
getHouseInfoByOrderIdOne
(
$field
,
$params
)
{
return
$this
->
db_
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"g_houses b"
,
"a.house_id = b.id"
,
"left"
)
->
join
(
"g_houses b"
,
"a.house_id = b.id"
,
"left"
)
->
where
(
$params
)
->
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 @@
namespace
app\task\controller
;
use
app\model\GHouses
;
use
app\model\GHousesFollowUp
;
use
app\model\OrderModel
;
use
app\model\SystemConfig
;
...
...
@@ -46,22 +48,30 @@ class UpdateShopStatusTask
}
else
{
return
null
;
}
$field
=
"
a.id,b.id as order_
id"
;
$field
=
"id"
;
$params
=
[];
$time_
=
date
(
'Y-m-d'
,
strtotime
(
"-
$day
day"
));
$params
[
"status"
]
=
1
;
$params
[
"update_time"
]
=
array
(
'lt'
,
$time_
.
" 23:59:59"
);
$params
[
"is_execute"
]
=
0
;
//过滤掉有动态的商铺
$params
[
"is_exclusive_type"
]
=
0
;
//所有修改时间大于10天的商铺
$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
=
[];
foreach
(
$result
as
$key
=>
$item
)
{
if
(
$item
[
"order_id"
])
{
$update_arr
[
$key
][
"id"
]
=
$item
[
"id"
];
$update_arr
[
$key
][
"is_execute"
]
=
1
;
}
else
{
$select_
[
"house_id"
]
=
$item
[
"id"
];
$is_ok
=
$orderModel
->
getOrderByHouseId
(
$select_
);
$is_follow
=
$followMole
->
getFollowUpByHouseId
(
$select_
);
//10天内无动态则下架
if
(
!
$is_ok
&&
!
$is_follow
)
{
$update_arr
[
$key
][
"id"
]
=
$item
[
"id"
];
$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