Commit 770a7e41 authored by hujun's avatar hujun

Merge remote-tracking branch 'origin/test' into test

parents 69944169 03a6f1e2
...@@ -149,8 +149,8 @@ ...@@ -149,8 +149,8 @@
<option value="2"></option> <option value="2"></option>
<option value="1"></option> <option value="1"></option>
</select> </select>
<input class="form-control btn2 margin-top-ld input" data-rule-phoneus="false" data-rule-required="false" name="guest_department" placeholder="客方所属部门" type="text" value=""> <input class="form-control btn2 margin-top-ld input" data-rule-phoneus="false" data-rule-required="false" id="guest_department" placeholder="客方所属部门" type="text" value="">
<input class="form-control btn2 margin-top-ld input" data-rule-phoneus="false" data-rule-required="false" name="guest_stores" placeholder="客方所属门店" type="text" value=""> <input class="form-control btn2 margin-top-ld input" data-rule-phoneus="false" data-rule-required="false" id="guest_stores" placeholder="客方所属门店" type="text" value="">
<select class="form-control btn2 margin-top-ld" name="public_status"> <select class="form-control btn2 margin-top-ld" name="public_status">
<option value="2">客户状态</option> <option value="2">客户状态</option>
<option value="0">未租</option> <option value="0">未租</option>
......
...@@ -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,99 @@ class GHouses extends BaseModel ...@@ -644,6 +649,99 @@ 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) {
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 ************/
......
...@@ -311,6 +311,10 @@ Route::group('task',[ ...@@ -311,6 +311,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' ]], //释放号码
......
<?php
namespace app\task\controller;
use app\model\GHouses;
use app\model\SystemConfig;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/4/23
* Time : 下午5:13
* Intro: 修改商铺状态
*/
class updateShopStatusTask
{
private $shopModel;
function __construct()
{
$this->shopModel = new GHouses();
}
/**
* 每天2点跑一次
* 根据创建时间和系统设置的时间范围内无动态则下架
* @return null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function updateStatusByTime()
{
//todo 1.查询所有上架的店铺并且创建时间大于设置的自动下架的时间,并且动态无动态标签, 2.查询这些楼盘是否有动态
//todo 3.有动态的打上标签 4.过了时间并且没有动态的下架
$this->updateStatusByPact();
$systemConfigModel = new SystemConfig();
$where["config_type"] = 10;
$data = $systemConfigModel->getSetting($where, "rule");
if ($data && $data["down_time"] > 0) {
$day = $data["down_time"];
} else {
return null;
}
$field = "a.id,b.id as order_id";
$params = [];
$time_ = date('Y-m-d', strtotime("-$day day"));
$params["status"] = 1;
$params["create_time"] = array( 'lt', $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);
}
}
/**
* 每5分钟跑一次 根据商铺数量修改下架 高频
*/
public function updateStatusByNum()
{
$field = "id,residue_num";
$params = [];
$params["status"] = 1;
$params["residue_num"] = array( "lt", 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
...@@ -369,6 +369,7 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', ' ...@@ -369,6 +369,7 @@ define (['doT', 'text!temp/user_template_tpl.html','ckfinder','ckfinderStart', '
params.district_name=$("#guest_department").val() params.district_name=$("#guest_department").val()
params.pageNo = user.pageNo; params.pageNo = user.pageNo;
params.pageSize = user.pageSize; params.pageSize = user.pageSize;
console.log($("#guest_stores").val());
$.ajax ({ $.ajax ({
url: '/index/users_list', url: '/index/users_list',
// /index/users_list // /index/users_list
......
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