Commit 5f3f15bd authored by zw's avatar zw

name

parent e231b0cd
......@@ -552,7 +552,11 @@ Route::group('task', [
'updateShopAgeLimit' => ['task/JobTask/updateShopAgeLimit', ['method' => 'get']], //默认年限
'push' => ['task/PushMessageTask/push', ['method' => 'get']], //推送和客户推送
'updateLandlordLimit' => ['task/JobTask/updateLandlordLimit', ['method' => 'get']] //转换房东手机号
'updateLandlordLimit' => ['task/JobTask/updateLandlordLimit', ['method' => 'get']], //转换房东手机号
'test' => ['task/FollowUpTask/test', ['method' => 'get']],
'isExistTable' => ['task/FollowUpTask/isExistTable', ['method' => 'get']],
]);
Route::group('broker', [
......
<?php
namespace app\task\controller;
use app\extra\RedisExt;
use app\model\UPhoneFollowUpTemporary;
/**
* Created by PhpStorm.
* User : zw
* Date : 2019/1/10
* Time : 2:20 PM
* Intro:
*/
class FollowUpTask
{
private $redis_;
private $table = 'u_phone_follow_up_';
private $phoneFollowUpModel;
public function __construct()
{
$this->redis_ = RedisExt::getRedis();
}
public function test()
{
$this->isExistTable("2019-01-10",10006);
}
public function isExistTable($time, $siteId)
{
//todo 1.判断表是否存在,不存在则创建,
$date = date("Y-m-d", time());
//时间是今天
if ($time >= $date && $time <= $date . " 23:59:59") {
$phoneFollowUpModel = new UPhoneFollowUpTemporary($siteId);
$table_name = $this->table . $siteId . "_" . $date;
//存在表
if ($this->redis_->get($table_name) > 0) {
return true;
}
$isTable = $phoneFollowUpModel->query('SHOW TABLES LIKE "' . $table_name . '"');
if ($isTable) {
$this->redis_->set($table_name, 1, 24 * 3600);
return true;//存在表
} else {
//创建表
return $this->createTemp($phoneFollowUpModel,$table_name);
}
}
}
public function createTemp($db,$tableName)
{
if (!$tableName) {
return false;
}
$sql = "CREATE TABLE `" . $tableName . "` (
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT '电话跟进表',
`content` varchar(255) DEFAULT '' COMMENT '跟进内容',
`labels_id` int(10) DEFAULT '0' COMMENT 'u_labels表主键',
`user_id` int(10) unsigned DEFAULT '0' COMMENT 'u_users ID用户表id',
`agent_id` int(10) unsigned DEFAULT '0' COMMENT 'agent表id',
`province` varchar(60) DEFAULT '' COMMENT '省份',
`city` varchar(60) DEFAULT '' COMMENT '城市',
`disc` varchar(60) DEFAULT '' COMMENT '区域',
`type` int(10) unsigned DEFAULT '0' COMMENT '0 电话跟进 1普通跟进 2不知道是什么,3打电话未跟进',
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_status` tinyint(2) DEFAULT '0' COMMENT '客户状态(0:求租;1:已租;-1:无效)',
PRIMARY KEY (`id`),
KEY `idx_agent_id` (`agent_id`),
KEY `idx_user_id` (`user_id`),
KEY `idx_create_time` (`create_time`),
KEY `idx_city` (`city`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8";
if(false !== $db->execute($sql)){
return true;
} else {
return false;
}
}
}
\ No newline at end of file
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