私域操盘手 - 修改检测添加设备成功的规则
This commit is contained in:
@@ -37,10 +37,7 @@ Route::group('v1/', function () {
|
||||
// 获客场景相关
|
||||
Route::group('plan', function () {
|
||||
Route::get('scenes', 'app\cunkebao\controller\plan\GetPlanSceneListV1Controller@index');
|
||||
|
||||
// 添加计划任务
|
||||
Route::post('add', 'app\cunkebao\controller\Plan@index');
|
||||
// 获取计划任务列表
|
||||
Route::post('create', 'app\cunkebao\controller\plan\PostCreateAddFriendPlanV1Controller@index');
|
||||
Route::get('list', 'app\cunkebao\controller\Plan@getList');
|
||||
|
||||
|
||||
|
||||
@@ -73,6 +73,16 @@ class GetAddResultedV1Controller extends BaseController
|
||||
Db::query($sql);
|
||||
}
|
||||
|
||||
protected function getCkbDeviceCount(): int
|
||||
{
|
||||
return DeviceModel::where(
|
||||
[
|
||||
'companyId' => $this->getUserInfo('companyId')
|
||||
]
|
||||
)
|
||||
->count('*');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取添加的关联设备结果。
|
||||
*
|
||||
@@ -85,17 +95,16 @@ class GetAddResultedV1Controller extends BaseController
|
||||
[
|
||||
'accountId' => $accountId,
|
||||
'pageIndex' => 0,
|
||||
'pageSize' => 1
|
||||
'pageSize' => 100
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$result = json_decode($result, true);
|
||||
$result = $result['data']['results'][0] ?? false;
|
||||
$result = $result['data']['results'] ?? false;
|
||||
|
||||
return $result ? (
|
||||
// 125是前端延迟5秒 + 轮询120次 1次/s
|
||||
time() - strtotime($result['lastUpdateTime']) <= 65
|
||||
count($result) > $this->getCkbDeviceCount()
|
||||
) : false;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,13 @@ use think\facade\Request;
|
||||
*/
|
||||
class PostCreateAddFriendPlanV1Controller extends Controller
|
||||
{
|
||||
|
||||
protected function yyyyyyy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加计划任务
|
||||
*
|
||||
@@ -20,17 +27,12 @@ class PostCreateAddFriendPlanV1Controller extends Controller
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
// 获取表单数据
|
||||
$data = [
|
||||
'name' => Request::post('name', ''),
|
||||
'sceneId' => Request::post('sceneId', 0),
|
||||
'status' => Request::post('status', 0),
|
||||
'reqConf' => Request::post('reqConf', ''),
|
||||
'msgConf' => Request::post('msgConf', ''),
|
||||
'tagConf' => Request::post('tagConf', ''),
|
||||
'createTime' => time(),
|
||||
'updateTime' => time()
|
||||
];
|
||||
$params = $this->request->only(['name', 'sceneId', 'status', 'reqConf', 'msgConf', 'tagConf']);
|
||||
|
||||
|
||||
dd($params);
|
||||
|
||||
|
||||
|
||||
// 验证必填字段
|
||||
if (empty($data['name'])) {
|
||||
|
||||
Reference in New Issue
Block a user