Commit 3319d7a8 authored by hujun's avatar hujun

独家时间过期下架商铺修改

parent bb27daac
...@@ -16,22 +16,35 @@ class Exclusive { ...@@ -16,22 +16,35 @@ class Exclusive {
* *
* @return type * @return type
*/ */
/**
* 独家时间过期下架商铺
*
* @return string
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function exclusiveExpirationTime() { public function exclusiveExpirationTime() {
$house = new HouseInfos(); $house = new HouseInfos();
$house_data = $house->field('id,room_num_left,exclusive_end')->where('exclusive_type', 1)->where('is_delete', 0)->select(); $house_data = $house->field('id,room_num_left,exclusive_end')
->where('exclusive_type', 1)
->where('is_delete', 0)
->where('room_num_left','<>', 0)
->select();
$result = array();
if ($house_data) { if ($house_data) {
$insert = array(); $insert = array();
foreach ($house_data as $k => $v) { foreach ($house_data as $k => $v) {
if (strtotime($v['exclusive_end'] . '23:59:59') > time() && $v['exclusive_end'] != NULL) { if ((strtotime($v['exclusive_end'] . '23:59:59') > time()) && ($v['exclusive_end'] != NULL)) {
continue; continue;
} }
$insert[$k]['id'] = $v['id']; $insert[$k]['id'] = $v['id'];
$insert[$k]['room_num_left'] = 0; $insert[$k]['room_num_left'] = 0;
} }
$result = $house->saveAll($insert); $result = $house->saveAll($insert);
} }
return; return json_encode($result);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment