Commit 0490b55f authored by yinxiaoling's avatar yinxiaoling

初始化添加一个字段

parent 96797e3a
......@@ -46,9 +46,13 @@ class CreatedTaskCommand extends Command
$taskInfo = StrategyTask::where('is_created',0)->get()->toArray(); //获取需要新建任务的数据
$url = "https://test117.ciopaas.com/api/addJsonNoLogin";
//dd($taskInfo);
foreach ($taskInfo as $k=>$v){//批量调用接口新建任务
//处理参数
//处理参数
dump($v['project_sn']);
if (empty($v['project_sn'])){
break;
}
$client_info_json = [
[
'姓名'=>$v['name'],
......@@ -62,21 +66,24 @@ class CreatedTaskCommand extends Command
];
$params = [
'user_sn'=>$userInfo['user_sn'],
'project_sn'=>$v['project_sn'],
'user_sn'=>$v['user_sn'],
'project_sn'=>trim($v['project_sn']),
'source'=>date('YmdHis').$k, //任务名称,年月日时分秒,加上循环键值避免重复任务名
'ai_user_sn'=>$v['user_sn'],
'ai_user_sn'=>$v['user_sn'],//$v['user_sn'],
'is_zidong'=>'off',//是否自动启动,否,任务定时启动
'is_open_remove_duplication'=>'0',
'is_auto_fail_recall'=>'1', //是否自动重呼,是
'total_fail_recall_times'=>'3', //重呼次数
'fail_recall_interval'=>'',//重呼间隔时间
'fail_recall_interval'=>'3',//重呼间隔时间
'mark'=>'值班策略创建任务',
'fail_recall_of_reason'=>'关机,来电提醒,稍后再拨,停机,无法接通,正在通话中,用户正忙,用户拒接,欠费,无人应答,其他,对方示忙',
'ai_distribution_type'=>'0'//0公用ai 1按主账号分配ai(6.2人工外呼分配方式 0平均,1抢拨)
'is_auto_stop'=>2, //0非自动暂停,1自动暂停 2 定时启动任务
'timed_started_at'=>$v['call_date'].' '.$v['call_time'], //定时启动
'yd_display_phone'=>$v['user_sn'].'@vos:'.$v['call_number'] //主叫号码传输格式
//'ai_distribution_type'=>'0'//0公用ai 1按主账号分配ai(6.2人工外呼分配方式 0平均,1抢拨)
];
$params['client_info_json'] = json_encode($client_info_json);
$params['client_info_json'] = json_encode(['data'=>$client_info_json]);
$params['url'] = substr(md5(json_encode($params)),1,8);
......@@ -92,4 +99,38 @@ class CreatedTaskCommand extends Command
}
public function requestPost($url = '', $post_data = array(),$header=array()) {
if (empty($url) || empty($post_data)) {
return false;
}
$o = "";
if(is_array($post_data) && count($post_data)){
foreach ( $post_data as $k => $v )
{
$o.= "$k=" . urlencode( $v ). "&" ;
}
$post_data = substr($o,0,-1);
}
$postUrl = $url;
$curlPost = $post_data;
$ch = curl_init();//初始化curl
if(!empty($header)){
curl_setopt( $ch, CURLOPT_HTTPHEADER, $header);
}
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, '0');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, '0');
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_URL,$postUrl);//抓取指定网页
curl_setopt($ch, CURLOPT_HEADER, 0);//设置header
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
$data = curl_exec($ch);//运行curl
curl_close($ch);
return $data;
}
}
......@@ -245,6 +245,7 @@ class StrategyService
'parent_sn'=>$strategyInfo['parent_sn'],
'call_number'=>$strategyInfo['call_number'],
'project_sn'=>isset($project_sn[0]) ? $project_sn[0] : '',//$strategyInfo['project_sn'],
'user_sn'=>$strategyInfo['user_sn'],
'call_date'=>$i,
'call_time'=>isset($call_time[0]) ? $call_time[0] : '',//$strategyInfo['call_time'],
'created_at'=>$now
......@@ -259,6 +260,7 @@ class StrategyService
'parent_sn'=>$strategyInfo['parent_sn'],
'call_number'=>$strategyInfo['call_number'],
'project_sn'=>isset($project_sn[1]) ? $project_sn[1] : '',
'user_sn'=>$strategyInfo['user_sn'],
'call_date'=>$v['duty_date'],
'call_time'=>isset($call_time[1]) ? $call_time[1] : '',
'created_at'=>$now
......@@ -287,6 +289,7 @@ class StrategyService
'parent_sn'=>$strategyInfo['parent_sn'],
'call_number'=>$strategyInfo['call_number'],
'project_sn'=>isset($project_sn[0]) ? $project_sn[0] : '',
'user_sn'=>$strategyInfo['user_sn'],
'call_date'=>$yesterday,
'call_time'=>isset($call_time[0]) ? $call_time[0] : '',
'created_at'=>$now
......
......@@ -74,6 +74,7 @@ class DatabaseSeeder extends Seeder
$table->date('call_date')->comment('外呼时间(年月日)');
$table->time('call_time')->comment('外呼时间(时分秒)');
$table->char('parent_sn',50)->comment('主账号名');
$table->char('user_sn',50)->comment('账号sn');
$table->char('project_sn',100)->comment('项目sn');
$table->unsignedSmallInteger('is_created')->default(0)->comment('是否新建任务(0未建 1已建)');
......
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