Files
liche/api/controllers/dms/Spider.php
T
xiaoyu 1ee0f11f94 mixed
2023-08-23 11:04:02 +08:00

433 lines
31 KiB
PHP

<?php
defined('BASEPATH') or exit('No direct script access allowed');
ini_set('display_errors','On');
error_reporting(E_ERROR);
require_once(APPPATH . "controllers/dms/CurlAutoLogin.php");
class Spider extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('dms/dms_clues_model','dms_clues_model');
$this->load->model('receiver/receiver_customers_model','receiver_customers_model');
$this->log_dir = 'dms';
$this->file_name = 'clues.txt';
}
public function get_clues()
{
//登录态缓存文件
$loginResultFile = APPPATH . "cache/loginRes.txt";
$autoLogin = new CurlAutoLogin();
//已有登录态,则直接读取登录态,避免多次重复登录
if (!file_exists($loginResultFile)) {
$resArr = $this->doLogin($autoLogin, $loginResultFile);
} else {
debug_log("有登录态,自动登录...\n", $this->file_name, $this->log_dir);
$resArr = json_decode(file_get_contents($loginResultFile), true);
}
if (empty($resArr['username'])) {
debug_log("未登录成功...\n", $this->file_name, $this->log_dir);
exit("未登录成功\n");
}
$token = $resArr['token'];
$pageIndex = 1;
$pageSize = 100;
$dollor = '$';
$createdDateStart = date("Y-m-d H:i:00", strtotime("-15 minute"));
$createdDateEnd = date("Y-m-d H:i:00", strtotime("now"));
echo "开始时间: ".$createdDateStart." ";
echo "截止时间: ".$createdDateEnd." \n";
debug_log("开始时间: ".$createdDateStart." ", $this->file_name, $this->log_dir);
debug_log("截止时间: ".$createdDateEnd." ", $this->file_name, $this->log_dir);
$curl = <<<CURL
curl 'http://dms.dna-nev.com.cn/ly/mp/busicen/csc/graphql.do?v=clueServerQueryFromDlr' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: zh-CN,zh;q=0.9' \
-H 'Authorization: $token' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Cookie: pwRKey=1; token=$token; wadapp.current.curlang=zh-CN; wadapp.current.token=$token; wadapp.current.user{$dollor}dms.dna-nev.com.cn={"username":"FJ0011董凯杰","remember":false,"randomCode":"8333185700157948","token":"$token","usertype":"2","{$dollor}data":{"result":"1","msg":"Success","token":"$token","username":"FJ0011董凯杰","userRealName":null,"userid":"673d16368b50446681537bd955a09d03","usertype":"2","empname":"董凯杰","errnums":null,"timeout":"3600","expires":10,"initstatus":"1","clientid":null,"vcode":null,"wxbind":"1","errorCode":"Success","message":"Success","loginPage":{"type":"None"}}}; orgInfo={"BRAND_CODE":"1","DLR_CODE":"FJ0011","DLR_ID":"86df6b1f8dd44b44a79723afd536b152","DLR_NAME":"福州狸车","DLR_ORG_TYPE":"1","DLR_STATUS":"1","GROUP_CODE":"1","GROUP_ID":"1","OEM_CODE":"1","OEM_ID":"1","ORG_CODE":"01FJ0011","EMP_ID":"d00f13699d514fb09c8029f59b825a2d","ORG_ID":"90436c9dbef845f2a7c0976132831ee6","ORG_NAME":"整车销售部","ORG_TYPE":"1","PARENT_DLR_CODE":"FJ0011","PARENT_DLR_ID":"86df6b1f8dd44b44a79723afd536b152","PARENT_DLR_NAME":"福州狸车","POS_CODE":"COC_XS_CSR_HEADER,COC_XS_CSR,SE-DLR-003,VE0003,SE-004,VE0001","POS_ID":"0011e894a6fd11ea8bfe005056850f88,00173ad3a6fd11ea8bfe005056850f88,003a9a92a6fd11ea8bfe005056850f88,fffbee61a6fc11ea8bfe005056850f88,293af90463a64f7c820472623a222716,ffca8da7a6fc11ea8bfe005056850f88","SOLUTION_ID":"经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位","COMPANY_ID":"9b89df77b07b4258b5d83c8b8f6bbc79","UPDATEPWDTIME":"2022-9-22","empName":"董凯杰","userId":"673d16368b50446681537bd955a09d03","userName":"FJ0011董凯杰","usertype":"2"}' \
-H 'Origin: http://dms.dna-nev.com.cn' \
-H 'Referer: http://dms.dna-nev.com.cn/' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36' \
--data-raw '{"query":"query({$dollor}pageIndex: Int, {$dollor}pageSize: Int, {$dollor}dataInfo: InputClueServer){clueServerQueryFromDlr(dataInfo: {$dollor}dataInfo, pageIndex: {$dollor}pageIndex, pageSize: {$dollor}pageSize){msg pageindex pages records result rows{serverOrder custId custName contactTel carBrandName carSeriesCn clueLevelCode nextDealUserName createdName cantactWayName infoChanMName infoChanDName assignStatusName statusName crruNodeName createdDate remainDataDate inteSeriesCode}}}","variables":{"pageSize":$pageSize,"pageIndex":$pageIndex,"dataInfo":{"custName":"","contactTel":"","inteSeriesId":"","clueLevelCode":"","createdDateStart":"$createdDateStart","createdDateEnd":"$createdDateEnd","orderDateStart":"","orderDateEnd":"","status":"","csr":"","serverOrder":"","cantactWayCode":"CS001","infoChanMCode":"","carBrandCode":"","assignStatus":"","crruNode":"","createdName":"","dlrCode":"","handleCode":"1","assignStatusName":"","statusArray":["10","20","21","30","31","40","50"],"nextDealUserId":"","nextDealUserName":"","infoChanDName":"","isQueryHistory":"0"}}}' \
--compressed \
--insecure
CURL;
$content = $autoLogin->execCurl($curl);
$resArr = json_decode($content, true);
if (!$resArr['result']) {
$this->doLogin($autoLogin, $loginResultFile);
}
//print_r($resArr);
if(!$resArr['data']['clueServerQueryFromDlr']['rows']){
debug_log("无新增数据\n", $this->file_name, $this->log_dir);
exit;
}else{
debug_log("".$resArr['data']['clueServerQueryFromDlr']['records']." 条新增数据\n", $this->file_name, $this->log_dir);
}
foreach ($resArr['data']['clueServerQueryFromDlr']['rows'] as $k => $v) {
//原始数据
$add = array(
'o_id' => $v['serverOrder'],
'c_id' => $v['custId'],
'name' => $v['custName'],
'mobile' => $v['contactTel'],
'cfrom1' => $v['infoChanMName'],
'cfrom2' => $v['infoChanDName'],
'jsondata' => json_encode($v, JSON_UNESCAPED_UNICODE),
'log_date' => date('Y-m-d'),
'c_time' => strtotime($v['createdDate'])
);
//福州狸车
if(strpos($v['serverOrder'], 'FJ0011') && $v['statusName'] == '待分配'){
//插入狸车宝
$this->pushLcb($add);
//抢单
$this->takeOrder($v['serverOrder'], $autoLogin);
//跟进
sleep(1);
$cust = $this->customer($v['serverOrder'], $autoLogin);
if($cust['data']['clueServerQueryFromDlr']['rows']){
$this->follow1($cust['data']['clueServerQueryFromDlr']['rows'][0], $autoLogin);
}
//二次跟进
sleep(1);
$cust = $this->customer($v['serverOrder'], $autoLogin);
if($cust['data']['clueServerQueryFromDlr']['rows']){
$this->follow2($cust['data']['clueServerQueryFromDlr']['rows'][0], $autoLogin);
}
}
//$this->dms_clues_model->add($add);
}
}
private function doLogin($autoLogin, $loginResultFile)
{
echo "无登录态,模拟登录...\n";
debug_log("无登录态,模拟登录...\n", $this->file_name, $this->log_dir);
$curl = <<<CURL
curl 'http://dms.dna-nev.com.cn/mp/login/validlogin.do' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: zh-CN,zh;q=0.9' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
-H 'Cookie: pwRKey=1' \
-H 'Origin: http://dms.dna-nev.com.cn' \
-H 'Referer: http://dms.dna-nev.com.cn/' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36' \
--data-raw 'reuestParas=vrdCxWqmC6nNDXrxEyNCX5sThLElae5I%2FznYqpsieYlTddUJ3hGzCvtSaYuzgDIiFAA3q0F7oHSYjeXfwRppg6lnsHDViByHQ4sJwSXhMWyKZNQ7zrgAZ%2FzR9jd5XQEQYmdcXnNgzjRxZIUaYmOwkAPFBuBOodE58zLpEvWsTFqLQVfQhVUZzE%2FN941hLaRaAHBbSqn21c6TpJyXHprF766eukiB4b5urdLilNsNQimLVcEfW6xQS9dSzAcMQZIR7dWEWQyWGWqPNnfD5yp%2Btw%3D%3D' \
--compressed \
--insecure
CURL;
$content = $autoLogin->execCurl($curl);
$resArr = json_decode($content, true);
file_put_contents($loginResultFile, $content); //存储登录结果
return $resArr;
}
private function takeOrder($serverOrder, $autoLogin)
{
//登录态缓存文件
$loginResultFile = APPPATH . "cache/loginRes.txt";
$resArr = json_decode(file_get_contents($loginResultFile), true);
$token = $resArr['token'];
$dollor = '$';
$curl = <<<CURL
curl 'http://dms.dna-nev.com.cn/ly/mp/busicen/csc/graphql.do?v=clueServerMutationGetBill' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: zh-CN,zh;q=0.9' \
-H 'Authorization: $token' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Cookie: pwRKey=1; token=$token; wadapp.current.curlang=zh-CN; wadapp.current.token=$token; wadapp.current.user{$dollor}dms.dna-nev.com.cn={"username":"FJ0011董凯杰","remember":false,"randomCode":"46494479577814074","token":"$token","usertype":"2","{$dollor}data":{"result":"1","msg":"Success","token":"$token","username":"FJ0011董凯杰","userRealName":null,"userid":"673d16368b50446681537bd955a09d03","usertype":"2","empname":"董凯杰","errnums":null,"timeout":"3600","expires":10,"initstatus":"1","clientid":null,"vcode":null,"wxbind":"1","errorCode":"Success","message":"Success","loginPage":{"type":"None"}}}; orgInfo={"BRAND_CODE":"1","DLR_CODE":"FJ0011","DLR_ID":"86df6b1f8dd44b44a79723afd536b152","DLR_NAME":"福州狸车","DLR_ORG_TYPE":"1","DLR_STATUS":"1","GROUP_CODE":"1","GROUP_ID":"1","OEM_CODE":"1","OEM_ID":"1","ORG_CODE":"01FJ0011","EMP_ID":"d00f13699d514fb09c8029f59b825a2d","ORG_ID":"90436c9dbef845f2a7c0976132831ee6","ORG_NAME":"整车销售部","ORG_TYPE":"1","PARENT_DLR_CODE":"FJ0011","PARENT_DLR_ID":"86df6b1f8dd44b44a79723afd536b152","PARENT_DLR_NAME":"福州狸车","POS_CODE":"COC_XS_CSR_HEADER,COC_XS_CSR,SE-DLR-003,VE0003,SE-004,VE0001","POS_ID":"0011e894a6fd11ea8bfe005056850f88,00173ad3a6fd11ea8bfe005056850f88,003a9a92a6fd11ea8bfe005056850f88,fffbee61a6fc11ea8bfe005056850f88,293af90463a64f7c820472623a222716,ffca8da7a6fc11ea8bfe005056850f88","SOLUTION_ID":"经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位","COMPANY_ID":"9b89df77b07b4258b5d83c8b8f6bbc79","UPDATEPWDTIME":"2022-9-22","empName":"董凯杰","userId":"673d16368b50446681537bd955a09d03","userName":"FJ0011董凯杰","usertype":"2"}' \
-H 'Origin: http://dms.dna-nev.com.cn' \
-H 'Proxy-Connection: keep-alive' \
-H 'Referer: http://dms.dna-nev.com.cn/' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36' \
--data-raw '{"query":"mutation({$dollor}dataInfo: InputClueServer){clueServerMutationGetBill(dataInfo: {$dollor}dataInfo){msg result}}","variables":{"dataInfo":{"serverOrder":"$serverOrder","handleCode":"0"}}}' \
--compressed \
--insecure
CURL;
$content = $autoLogin->execCurl($curl);
$resArr = json_decode($content, true);
print_r($resArr);
}
public function follow1($info, $autoLogin)
{
//登录态缓存文件
$loginResultFile = APPPATH . "cache/loginRes.txt";
$resArr = json_decode(file_get_contents($loginResultFile), true);
$token = $resArr['token'];
$dollor = '$';
$nextCallbackDate = date('Y-m-d 00:00:00', strtotime('+3 days'));
$dataInfo = '{"dataInfo":{"custId":"'.$info['custId'].'","custName":"'.$info['custName'].'","contactTel":"'.$info['contactTel'].'","gender":"0","backupTel":null,"serverOrder":"'.$info['serverOrder'].'","cantactWayCode":"'.$info['cantactWayCode'].'","infoChanMCode":"'.$info['infoChanMCode'].'","infoChanDCode":"'.$info['infoChanDCode'].'","clueLevelCode":"H","crruLevel":null,"intentPriceCode":null,"carBrandCode":"1","inteSeriesId":"cf38e6909c1a41a29871868c79c2eccc","inteSeriesCode":"纳米BOX","inteTypeId":"1d5029d0a5df4be5a063d08256722f47","inteTypeCode":"B420EV0014C001","inteTypeName":"标准型/201km(2022-001)","planReviewDate":"'.$nextCallbackDate.'","color":"","innerColor":"","optionalPackId":"","optionalPackCn":"","remainDataDate":"'.$info['remainDataDate'].'","clueDesc":"继续跟进","remark":null,"touchStatus":"15","buyFocus":null,"custSource":null,"originalCustId":null,"originalCustName":null,"isFirstCallback":"1","recommendPersonRelation":null,"carLicense":null,"introducerRelationship":null,"introducer":null,"introduceTel":null,"introduceGender":null,"compCarBrandCode":null,"compCarBrandName":null,"compCarSeriesCode":null,"compCarSeriesName":null,"reviewCars":[{"seriesCode":"纳米BOX","seriesName":"纳米BOX","modelId":"1d5029d0a5df4be5a063d08256722f47","modelCode":"B420EV0014C001","modelName":"标准型/201km(2022-001)","colorId":"","colorName":null,"inColorId":"","inColorName":null,"optionId":"","optionName":"","isFirstChoice":"1","isCompVehicle":"0"}],"reviewDesc":"继续跟进","nextCallbackDate":"'.$nextCallbackDate.'"}}';
$curl = <<<CURL
curl 'http://dms.dna-nev.com.cn/ly/mp/busicen/csc/graphql.do?v=clueServerMutationReview' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: zh-CN,zh;q=0.9' \
-H 'Authorization: $token' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Cookie: pwRKey=1; token=$token; wadapp.current.curlang=zh-CN; wadapp.current.token=$token; wadapp.current.user{$dollor}dms.dna-nev.com.cn={"username":"FJ0011董凯杰","remember":false,"randomCode":"46494479577814074","token":"$token","usertype":"2","{$dollor}data":{"result":"1","msg":"Success","token":"$token","username":"FJ0011董凯杰","userRealName":null,"userid":"673d16368b50446681537bd955a09d03","usertype":"2","empname":"董凯杰","errnums":null,"timeout":"3600","expires":10,"initstatus":"1","clientid":null,"vcode":null,"wxbind":"1","errorCode":"Success","message":"Success","loginPage":{"type":"None"}}}; orgInfo={"BRAND_CODE":"1","DLR_CODE":"FJ0011","DLR_ID":"86df6b1f8dd44b44a79723afd536b152","DLR_NAME":"福州狸车","DLR_ORG_TYPE":"1","DLR_STATUS":"1","GROUP_CODE":"1","GROUP_ID":"1","OEM_CODE":"1","OEM_ID":"1","ORG_CODE":"01FJ0011","EMP_ID":"d00f13699d514fb09c8029f59b825a2d","ORG_ID":"90436c9dbef845f2a7c0976132831ee6","ORG_NAME":"整车销售部","ORG_TYPE":"1","PARENT_DLR_CODE":"FJ0011","PARENT_DLR_ID":"86df6b1f8dd44b44a79723afd536b152","PARENT_DLR_NAME":"福州狸车","POS_CODE":"COC_XS_CSR_HEADER,COC_XS_CSR,SE-DLR-003,VE0003,SE-004,VE0001","POS_ID":"0011e894a6fd11ea8bfe005056850f88,00173ad3a6fd11ea8bfe005056850f88,003a9a92a6fd11ea8bfe005056850f88,fffbee61a6fc11ea8bfe005056850f88,293af90463a64f7c820472623a222716,ffca8da7a6fc11ea8bfe005056850f88","SOLUTION_ID":"经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位","COMPANY_ID":"9b89df77b07b4258b5d83c8b8f6bbc79","UPDATEPWDTIME":"2022-9-22","empName":"董凯杰","userId":"673d16368b50446681537bd955a09d03","userName":"FJ0011董凯杰","usertype":"2"}' \
-H 'Origin: http://dms.dna-nev.com.cn' \
-H 'Proxy-Connection: keep-alive' \
-H 'Referer: http://dms.dna-nev.com.cn/' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36' \
--data-raw '{"query":"mutation({$dollor}dataInfo: InputClueServer){clueServerMutationReview(dataInfo: {$dollor}dataInfo){msg result}}","variables":$dataInfo}' \
--compressed \
--insecure
CURL;
$content = $autoLogin->execCurl($curl);
$resArr = json_decode($content, true);
echo $curl;
print_r($resArr);
}
public function follow2($info, $autoLogin){
//登录态缓存文件
$loginResultFile = APPPATH . "cache/loginRes.txt";
$resArr = json_decode(file_get_contents($loginResultFile), true);
$token = $resArr['token'];
$dollor = '$';
$nextCallbackDate = date('Y-m-d 00:00:00', strtotime('+15 days'));
$dataInfo = '{"dataInfo": {
"custId": "'.$info['custId'].'",
"custName": "'.$info['custName'].'",
"contactTel": "'.$info['contactTel'].'",
"gender": "0",
"backupTel": null,
"serverOrder": "'.$info['serverOrder'].'",
"cantactWayCode": "'.$info['cantactWayCode'].'",
"infoChanMCode": "'.$info['infoChanMCode'].'",
"infoChanDCode": "'.$info['infoChanDCode'].'",
"clueLevelCode": "B",
"crruLevel": "H",
"intentPriceCode": null,
"carBrandCode": "1",
"inteSeriesId": "cf38e6909c1a41a29871868c79c2eccc",
"inteSeriesCode": "纳米BOX",
"inteTypeId": "1d5029d0a5df4be5a063d08256722f47",
"inteTypeCode": "B420EV0014C001",
"inteTypeName": "标准型/201km(2022-001)",
"planReviewDate": "'.$nextCallbackDate.'",
"color": "",
"innerColor": "",
"optionalPackId": "",
"optionalPackCn": "",
"remainDataDate": "'.date("Y-m-d H:i:00").'",
"clueDesc": "继续跟进",
"remark": null,
"touchStatus": "15",
"buyFocus": null,
"custSource": null,
"originalCustId": null,
"originalCustName": null,
"isFirstCallback": "0",
"recommendPersonRelation": null,
"carLicense": null,
"introducerRelationship": null,
"introducer": null,
"introduceTel": null,
"introduceGender": null,
"compCarBrandCode": null,
"compCarBrandName": null,
"compCarSeriesCode": null,
"compCarSeriesName": null,
"reviewCars": [{
"seriesCode": "纳米BOX",
"seriesName": "纳米BOX",
"modelId": "1d5029d0a5df4be5a063d08256722f47",
"modelCode": "B420EV0014C001",
"modelName": "标准型/201km(2022-001)",
"colorId": "",
"colorName": null,
"inColorId": "",
"inColorName": null,
"optionId": "",
"optionName": "",
"isFirstChoice": "1",
"isCompVehicle": "0"
}],"reviewDesc":"继续跟进","nextCallbackDate":"'.$nextCallbackDate.'"}}';
$curl = <<<CURL
curl 'http://dms.dna-nev.com.cn/ly/mp/busicen/csc/graphql.do?v=clueServerMutationReview' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: zh-CN,zh;q=0.9' \
-H 'Authorization: $token' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Cookie: pwRKey=1; token=$token; wadapp.current.curlang=zh-CN; wadapp.current.token=$token; wadapp.current.user {$dollor}dms.dna-nev.com.cn={"username":"FJ0011董凯杰","remember":false,"randomCode":"10042259079155347","token":"$token","usertype":"2"," {$dollor}data":{"result":"1","msg":"Success","token":"$token","username":"FJ0011董凯杰","userRealName":null,"userid":"673d16368b50446681537bd955a09d03","usertype":"2","empname":"董凯杰","errnums":null,"timeout":"3600","expires":10,"initstatus":"1","clientid":null,"vcode":null,"wxbind":"1","errorCode":"Success","message":"Success","loginPage":{"type":"None"}}}; orgInfo={"BRAND_CODE":"1","DLR_CODE":"FJ0011","DLR_ID":"86df6b1f8dd44b44a79723afd536b152","DLR_NAME":"福州狸车","DLR_ORG_TYPE":"1","DLR_STATUS":"1","GROUP_CODE":"1","GROUP_ID":"1","OEM_CODE":"1","OEM_ID":"1","ORG_CODE":"01FJ0011","EMP_ID":"d00f13699d514fb09c8029f59b825a2d","ORG_ID":"90436c9dbef845f2a7c0976132831ee6","ORG_NAME":"整车销售部","ORG_TYPE":"1","PARENT_DLR_CODE":"FJ0011","PARENT_DLR_ID":"86df6b1f8dd44b44a79723afd536b152","PARENT_DLR_NAME":"福州狸车","POS_CODE":"COC_XS_CSR_HEADER,COC_XS_CSR,SE-DLR-003,VE0003,SE-004,VE0001","POS_ID":"0011e894a6fd11ea8bfe005056850f88,00173ad3a6fd11ea8bfe005056850f88,003a9a92a6fd11ea8bfe005056850f88,fffbee61a6fc11ea8bfe005056850f88,293af90463a64f7c820472623a222716,ffca8da7a6fc11ea8bfe005056850f88","SOLUTION_ID":"经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位","COMPANY_ID":"9b89df77b07b4258b5d83c8b8f6bbc79","UPDATEPWDTIME":"2022-9-22","empName":"董凯杰","userId":"673d16368b50446681537bd955a09d03","userName":"FJ0011董凯杰","usertype":"2"}' \
-H 'Origin: http://dms.dna-nev.com.cn' \
-H 'Referer: http://dms.dna-nev.com.cn/' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36' \
--data-raw '{"query":"mutation( {$dollor}dataInfo: InputClueServer){clueServerMutationReview(dataInfo: {$dollor}dataInfo){msg result}}","variables":$dataInfo}' \
--compressed \
--insecure
CURL;
print_r($curl);
$content = $autoLogin->execCurl($curl);
$resArr = json_decode($content, true);
print_r($resArr);
}
private function customer($serverOrder, $autoLogin){
//登录态缓存文件
$loginResultFile = APPPATH . "cache/loginRes.txt";
$resArr = json_decode(file_get_contents($loginResultFile), true);
$token = $resArr['token'];
$dollor = '$';
$curl = <<<CURL
curl 'http://dms.dna-nev.com.cn/ly/mp/busicen/csc/graphql.do?v=clueServerQueryFromDlr' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: zh-CN,zh;q=0.9' \
-H 'Authorization: $token' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Cookie: pwRKey=1; token=$token; wadapp.current.curlang=zh-CN; wadapp.current.token=$token; wadapp.current.user { {$dollor}dollor}dms.dna-nev.com.cn={"username":"FJ0011董凯杰","remember":false,"randomCode":"6312573416240335","token":"$token","usertype":"2"," {$dollor}data":{"result":"1","msg":"Success","token":"$token","username":"FJ0011董凯杰","userRealName":null,"userid":"673d16368b50446681537bd955a09d03","usertype":"2","empname":"董凯杰","errnums":null,"timeout":"3600","expires":10,"initstatus":"1","clientid":null,"vcode":null,"wxbind":"1","errorCode":"Success","message":"Success","loginPage":{"type":"None"}}}; orgInfo={"BRAND_CODE":"1","DLR_CODE":"FJ0011","DLR_ID":"86df6b1f8dd44b44a79723afd536b152","DLR_NAME":"福州狸车","DLR_ORG_TYPE":"1","DLR_STATUS":"1","GROUP_CODE":"1","GROUP_ID":"1","OEM_CODE":"1","OEM_ID":"1","ORG_CODE":"01FJ0011","EMP_ID":"d00f13699d514fb09c8029f59b825a2d","ORG_ID":"90436c9dbef845f2a7c0976132831ee6","ORG_NAME":"整车销售部","ORG_TYPE":"1","PARENT_DLR_CODE":"FJ0011","PARENT_DLR_ID":"86df6b1f8dd44b44a79723afd536b152","PARENT_DLR_NAME":"福州狸车","POS_CODE":"COC_XS_CSR_HEADER,COC_XS_CSR,SE-DLR-003,VE0003,SE-004,VE0001","POS_ID":"0011e894a6fd11ea8bfe005056850f88,00173ad3a6fd11ea8bfe005056850f88,003a9a92a6fd11ea8bfe005056850f88,fffbee61a6fc11ea8bfe005056850f88,293af90463a64f7c820472623a222716,ffca8da7a6fc11ea8bfe005056850f88","SOLUTION_ID":"经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位","COMPANY_ID":"9b89df77b07b4258b5d83c8b8f6bbc79","UPDATEPWDTIME":"2022-9-22","empName":"董凯杰","userId":"673d16368b50446681537bd955a09d03","userName":"FJ0011董凯杰","usertype":"2"}' \
-H 'Origin: http://dms.dna-nev.com.cn' \
-H 'Referer: http://dms.dna-nev.com.cn/' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36' \
--data-raw '{"query":"query( {$dollor}pageIndex: Int, {$dollor}pageSize: Int, {$dollor}dataInfo: InputClueServer){clueServerQueryFromDlr(dataInfo: {$dollor}dataInfo, pageIndex: {$dollor}pageIndex, pageSize: {$dollor}pageSize){msg pageindex pages records result rows{custName gender contactTel backupTel touchStatus inteTypeCode color colorName isOrder clueDesc remark remainDataDate nextCallbackDate planReviewDate custSource originalCustId originalCustName recommendPersonRelation carLicense introducerRelationship introducer introduceTel introduceGender nextCallbackDate arrivedDate caEmpId buyingFormSite dlrShortName cantactWayCode cantactWayName infoChanDCode infoChanDName infoChanMCode infoChanMName clueLevelCode intentPriceCode clueLabel clueActive carSeriesCn carBrandCode inteSeriesId inteSeriesCode carConfigId inteTypeId inteTypeName carConfigCn isFirstCallback optionalPackId optionalShortName innerColor innerColorName reviewId serverOrder custId buyFocus compCarSeriesCode compCarSeriesName compCarBrandCode compCarBrandName}}}","variables":{"pageSize":10,"pageIndex":1,"dataInfo":{"handleCode":"1","statusArray":["10","20","21","30","31","40","50"],"serverOrder":"$serverOrder"}}}' \
--compressed \
--insecure
CURL;
$content = $autoLogin->execCurl($curl);
$resArr = json_decode($content, true);
print_r($resArr);
return $resArr;
}
private function pushLcb($data){
$add = array(
'name' => $data['name'],
'mobile' => $data['mobile'],
'city_id' => 350100,
'county_id' => 350102,
'of_id' => 7,
'biz_id' => 55,
'cf_title' => '自有资源',
'cf_clues' => '狸车宝',
'c_time' => time(),
);
//来源
switch ($data['cfrom1']){
case '新媒体线索':
if($data['cfrom2'] == '直播团购会'){
$add['of2_id'] = 77;
}else{
$add['of2_id'] = 76;
}
break;
case '传播引流':
$add['of2_id'] = 74;
break;
case '垂媒线索':
if($data['cfrom2'] == '汽车之家'){
$add['of2_id'] = 72;
}elseif ($data['cfrom2'] == '易车'){
$add['of2_id'] = 73;
}else{
$add['of2_id'] = 71;
}
break;
default:
$add['of2_id'] = 70;
break;
}
$rt = $this->receiver_customers_model->add($add);
echo $rt;
debug_log("新增狸车宝线索...\n", $this->file_name, $this->log_dir);
}
public function mytest()
{
//登录态缓存文件
$loginResultFile = APPPATH . "cache/loginRes.txt";
$autoLogin = new CurlAutoLogin();
// //已有登录态,则直接读取登录态,避免多次重复登录
// if (!file_exists($loginResultFile)) {
// $resArr = $this->doLogin($autoLogin, $loginResultFile);
// } else {
// debug_log("有登录态,自动登录...\n", $this->file_name, $this->log_dir);
// $resArr = json_decode(file_get_contents($loginResultFile), true);
// }
//
// if (empty($resArr['username'])) {
// debug_log("未登录成功...\n", $this->file_name, $this->log_dir);
// exit("未登录成功\n");
// }
$resArr = $this->doLogin($autoLogin, $loginResultFile);
$token = $resArr['token'];
$pageIndex = 1;
$pageSize = 100;
$dollor = '$';
$createdDateStart = date("Y-m-d 00:00:00", strtotime("-10 minute"));
$createdDateEnd = date("Y-m-d H:i:s", strtotime("now"));
debug_log("开始时间: ".$createdDateStart." ", $this->file_name, $this->log_dir);
debug_log("截止时间: ".$createdDateEnd." ", $this->file_name, $this->log_dir);
$curl = <<<CURL
curl 'http://dms.dna-nev.com.cn/ly/mp/busicen/csc/graphql.do?v=clueServerMutationReview' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: zh-CN,zh;q=0.9' \
-H 'Authorization: $token' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Cookie: pwRKey=1; token=$token; wadapp.current.curlang=zh-CN; wadapp.current.token=$token; wadapp.current.user\$dms.dna-nev.com.cn={"username":"FJ0011董凯杰","remember":false,"randomCode":"14424255643892003","token":"$token","usertype":"2","\$data":{"result":"1","msg":"Success","token":"$token","username":"FJ0011董凯杰","userRealName":null,"userid":"673d16368b50446681537bd955a09d03","usertype":"2","empname":"董凯杰","errnums":null,"timeout":"3600","expires":10,"initstatus":"1","clientid":null,"vcode":null,"wxbind":"1","errorCode":"Success","message":"Success","loginPage":{"type":"None"}}}; orgInfo={"BRAND_CODE":"1","DLR_CODE":"FJ0011","DLR_ID":"86df6b1f8dd44b44a79723afd536b152","DLR_NAME":"福州狸车","DLR_ORG_TYPE":"1","DLR_STATUS":"1","GROUP_CODE":"1","GROUP_ID":"1","OEM_CODE":"1","OEM_ID":"1","ORG_CODE":"01FJ0011","EMP_ID":"d00f13699d514fb09c8029f59b825a2d","ORG_ID":"90436c9dbef845f2a7c0976132831ee6","ORG_NAME":"整车销售部","ORG_TYPE":"1","PARENT_DLR_CODE":"FJ0011","PARENT_DLR_ID":"86df6b1f8dd44b44a79723afd536b152","PARENT_DLR_NAME":"福州狸车","POS_CODE":"COC_XS_CSR_HEADER,COC_XS_CSR,SE-DLR-003,VE0003,SE-004,VE0001","POS_ID":"0011e894a6fd11ea8bfe005056850f88,00173ad3a6fd11ea8bfe005056850f88,003a9a92a6fd11ea8bfe005056850f88,fffbee61a6fc11ea8bfe005056850f88,293af90463a64f7c820472623a222716,ffca8da7a6fc11ea8bfe005056850f88","SOLUTION_ID":"经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位,经销商通用岗位","COMPANY_ID":"9b89df77b07b4258b5d83c8b8f6bbc79","UPDATEPWDTIME":"2022-9-22","empName":"董凯杰","userId":"673d16368b50446681537bd955a09d03","userName":"FJ0011董凯杰","usertype":"2"}' \
-H 'Origin: http://dms.dna-nev.com.cn' \
-H 'Referer: http://dms.dna-nev.com.cn/' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36' \
--data-raw '{"query":"mutation(\$dataInfo: InputClueServer){clueServerMutationReview(dataInfo: \$dataInfo){msg result}}","variables":{"dataInfo":{"custId":"ca578a170b6648f0b45cc0a5b41b71db","custName":"未命名","contactTel":"18705067353","gender":"0","backupTel":null,"serverOrder":"XSFJ001123082200009","cantactWayCode":"CS001","infoChanMCode":"dqws2TxA","infoChanDCode":"KFs9gUnF","clueLevelCode":"B","crruLevel":"B","intentPriceCode":null,"carBrandCode":"1","inteSeriesId":"cf38e6909c1a41a29871868c79c2eccc","inteSeriesCode":"纳米BOX","inteTypeId":"1d5029d0a5df4be5a063d08256722f47","inteTypeCode":"B420EV0014C001","inteTypeName":"标准型/201km(2022-001)","planReviewDate":"2023-09-06 00:00:00","color":"","innerColor":"","optionalPackId":"","optionalPackCn":"","remainDataDate":"2023-08-22 16:20:31","clueDesc":"继续跟进","remark":null,"touchStatus":"15","buyFocus":null,"custSource":null,"originalCustId":null,"originalCustName":null,"isFirstCallback":"0","recommendPersonRelation":null,"carLicense":null,"introducerRelationship":null,"introducer":null,"introduceTel":null,"introduceGender":null,"compCarBrandCode":null,"compCarBrandName":null,"compCarSeriesCode":null,"compCarSeriesName":null,"reviewCars":[{"seriesCode":"纳米BOX","seriesName":"纳米BOX","modelId":"1d5029d0a5df4be5a063d08256722f47","modelCode":"B420EV0014C001","modelName":"标准型/201km(2022-001)","colorId":"","colorName":null,"inColorId":"","inColorName":null,"optionId":"","optionName":"","isFirstChoice":"1","isCompVehicle":"0"}],"reviewDesc":"继续跟进","nextCallbackDate":"2023-09-06 00:00:00"}}}' \
--compressed \
--insecure
CURL;
$content = $autoLogin->execCurl($curl);
$resArr = json_decode($content, true);
print_r($resArr);
}
}