消息推送
This commit is contained in:
@@ -92,9 +92,11 @@ class FollowController extends BaseController
|
||||
if (Util::isEmpty($type)) {
|
||||
return $this->error('type' . trans('not_null'));
|
||||
}
|
||||
$audio_text = Util::getParam($request, 'audio_text', '');
|
||||
$picture = Util::getParam($request, 'picture');
|
||||
if (Util::isEmpty($picture)) {
|
||||
return $this->error(trans('picture_not_null'));
|
||||
$remark = Util::getParam($request,'remark');
|
||||
if(Util::isEmpty($picture) && Util::isEmpty($audio_text) && Util::isEmpty($remark)){
|
||||
return $this->error(trans('follow_not_null'));
|
||||
}
|
||||
|
||||
$corpInfo = Corp::where('abbr', $request->basic_data['corp_abbr'])->first();
|
||||
@@ -107,7 +109,7 @@ class FollowController extends BaseController
|
||||
'picture' => $picture,
|
||||
'remark' => Util::getParam($request, 'remark', ''),
|
||||
'audio' => Util::getParam($request, 'audio', ''),
|
||||
'audio_text' => Util::getParam($request, 'audio_text', ''),
|
||||
'audio_text' => $audio_text,
|
||||
'lat' => Util::getParam($request, 'lat', 0),
|
||||
'lng' => Util::getParam($request, 'lng', 0),
|
||||
'address' => Util::getParam($request, 'address'),
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace app\process;
|
||||
|
||||
use app\crm\model\Customer;
|
||||
use support\Log;
|
||||
use Workerman\Crontab\Crontab;
|
||||
|
||||
class Task
|
||||
{
|
||||
|
||||
public function onWorkerStart()
|
||||
{
|
||||
// 每半小时执行一次
|
||||
new Crontab('0 */30 * * * *', function(){
|
||||
echo date('Y-m-d H:i:s') . "\n";
|
||||
Log::info('send follow start',[time()]);
|
||||
|
||||
$where = [
|
||||
['follow_next', '<=', time() + 3600],
|
||||
['follow_next', '>', time()],
|
||||
['warn', '<', 1]
|
||||
];
|
||||
$customer = Customer::where($where)->get();
|
||||
foreach ($customer as $item) {
|
||||
$res =[
|
||||
'id'=>$item->id,
|
||||
'category'=>'crm',
|
||||
'scene'=>'crm-person-follow-up',
|
||||
'receive type'=>'person'
|
||||
];
|
||||
\Webman\RedisQueue\Redis::send("feishu-message",$res);
|
||||
}
|
||||
|
||||
Log::info('send follow start',[time()]);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user