Commit 6b337374 authored by 蒋林's avatar 蒋林

1. 维修单搜索接口修改

2. 安装单搜索接口修改
parent 646142fa
...@@ -113,7 +113,7 @@ class Galanz extends BaseController ...@@ -113,7 +113,7 @@ class Galanz extends BaseController
$this->saveLog('', 'searchWorkOrder', $param); $this->saveLog('', 'searchWorkOrder', $param);
$sourceGalanzObj = $this->sourceGalanzObj($values['account'], $values['pwd']); $sourceGalanzObj = $this->sourceGalanzObj($values['account'], $values['pwd']);
$result = $sourceGalanzObj->SearchWorkOrder($values['name'], $values['custmobile'], $values['producenumber'], $values['approvalstatus'], $values['ischangepart'], $values['returnfactory'], $values['isrelief'], $values['starttime'], $values['endtime']); $result = $sourceGalanzObj->SearchWorkOrder($values['name'], $values['custmobile'], $values['approvalstatus'], $values['ischangepart'], $values['returnfactory'], $values['isrelief'], $values['producenumber'], $values['starttime'], $values['endtime']);
$result = $sourceGalanzObj->HandelSearchOrderFields($result, 'work'); $result = $sourceGalanzObj->HandelSearchOrderFields($result, 'work');
$obj->ReturnMessage(true, '', $result); $obj->ReturnMessage(true, '', $result);
...@@ -128,10 +128,10 @@ class Galanz extends BaseController ...@@ -128,10 +128,10 @@ class Galanz extends BaseController
$obj->SetValues($param); $obj->SetValues($param);
$obj->CheckSearchUserProfieOrderValues(); $obj->CheckSearchUserProfieOrderValues();
$values = $obj->GetValues(); $values = $obj->GetValues();
$this->saveLog($values['mobile'], 'searchUserProfieOrder', $param); $this->saveLog('', 'searchUserProfieOrder', $param);
$sourceGalanzObj = $this->sourceGalanzObj($values['account'], $values['pwd']); $sourceGalanzObj = $this->sourceGalanzObj($values['account'], $values['pwd']);
$result = $sourceGalanzObj->SearchUserProfieOrder($values['mobile']); $result = $sourceGalanzObj->SearchUserProfieOrder($values['custmobile'], $values['status'], $values['investstatus'], $values['havadetail'], $values['isuseful'], $values['jiesuanstatus'], $values['producenumber'], $values['installstarttime'], $values['installendtime'], $values['inputstarttime'], $values['inputendtime']);
$result = $sourceGalanzObj->HandelSearchOrderFields($result, 'userprofile'); $result = $sourceGalanzObj->HandelSearchOrderFields($result, 'userprofile');
$obj->ReturnMessage(true, '', $result); $obj->ReturnMessage(true, '', $result);
......
...@@ -33,9 +33,6 @@ class ReceiveGalanz extends Receive ...@@ -33,9 +33,6 @@ class ReceiveGalanz extends Receive
public function CheckSearchOrderValues() public function CheckSearchOrderValues()
{ {
// $fileds = ['custmobile'];
// $this->CheckValues($fileds);
$dfields = [ $dfields = [
'name', 'name',
'custmobile', 'custmobile',
...@@ -44,69 +41,43 @@ class ReceiveGalanz extends Receive ...@@ -44,69 +41,43 @@ class ReceiveGalanz extends Receive
'callintype', 'callintype',
'starttime', 'starttime',
'endtime', 'endtime',
'isreminder' 'isreminder',
]; ];
$this->SetDefaultValues($dfields); $this->SetDefaultValues($dfields);
if ($this->values['starttime']) {
$this->values['starttime'] = date('Y/m/d', strtotime($this->values['starttime']));
}
if ($this->values['endtime']) {
$this->values['endtime'] = date('Y/m/d', strtotime($this->values['endtime']));
}
} }
public function CheckSearchWorkOrderValues() public function CheckSearchWorkOrderValues()
{ {
// $fileds = ['mobile'];
// $this->CheckValues($fileds);
$dfields = [ $dfields = [
'name', 'name',
'custmobile', 'custmobile',
'producenumber',
'approvalstatus', 'approvalstatus',
'ischangepart', 'ischangepart',
'returnfactory', 'returnfactory',
'isrelief', 'isrelief',
'producenumber',
'starttime', 'starttime',
'endtime' 'endtime'
]; ];
$this->SetDefaultValues($dfields); $this->SetDefaultValues($dfields);
if ($this->values['starttime']) {
$this->values['starttime'] = date('Y/m/d', strtotime($this->values['starttime']));
}
if ($this->values['endtime']) {
$this->values['endtime'] = date('Y/m/d', strtotime($this->values['endtime']));
}
if ($this->values['ischangepart'] && in_array($this->values['ischangepart'], [1,2])) {
$this->values['ischangepart'] += 1;
} else {
$this->values['ischangepart'] = 1;
}
if ($this->values['returnfactory'] && in_array($this->values['returnfactory'], [1,2])) {
$this->values['returnfactory'] += 1;
} else {
$this->values['returnfactory'] = 1;
}
if ($this->values['isrelief'] && in_array($this->values['isrelief'], [1,2])) {
$this->values['isrelief'] += 1;
} else {
$this->values['isrelief'] = 1;
}
} }
public function CheckSearchUserProfieOrderValues() public function CheckSearchUserProfieOrderValues()
{ {
$fileds = ['mobile']; $dfields = [
$this->CheckValues($fileds); 'custmobile',
'status',
'investstatus',
'havadetail',
'isuseful',
'jiesuanstatus',
'producenumber',
'installstarttime',
'installendtime',
'inputstarttime',
'inputendtime',
];
$this->SetDefaultValues($dfields);
} }
/** /**
......
...@@ -194,6 +194,22 @@ class SourceGalanz extends Source ...@@ -194,6 +194,22 @@ class SourceGalanz extends Source
*/ */
public function SearchOrder($name='', $custtel='', $finishStatus='', $isAccept='', $callintype='', $startTime='', $endTime='', $isreminder='') public function SearchOrder($name='', $custtel='', $finishStatus='', $isAccept='', $callintype='', $startTime='', $endTime='', $isreminder='')
{ {
if (!in_array($callintype, [1,2,3,4,5,6])) {
$callintype = '';
}
if (!in_array($finishStatus, [0,1])) {
$finishStatus = '';
}
if (!in_array($isAccept, [1,2,3])) {
$isAccept = '';
}
if (!in_array($isreminder, [0,1])) {
$isreminder = '';
}
$post = [ $post = [
'__EVENTTARGET' => 'ctl00$ContentQuery$btnQuery', '__EVENTTARGET' => 'ctl00$ContentQuery$btnQuery',
'__EVENTARGUMENT' => '', '__EVENTARGUMENT' => '',
...@@ -206,39 +222,53 @@ class SourceGalanz extends Source ...@@ -206,39 +222,53 @@ class SourceGalanz extends Source
'ctl00$ContentQuery$new_name' => $name, 'ctl00$ContentQuery$new_name' => $name,
'ctl00$ContentQuery$new_custname' => '', 'ctl00$ContentQuery$new_custname' => '',
'ctl00$ContentQuery$ddlfinishstatus' => $finishStatus, 'ctl00$ContentQuery$ddlfinishstatus' => $finishStatus,
'ctl00$ContentQuery$startTime' => $startTime, 'ctl00$ContentQuery$startTime' => $this->HandelSearcheOrderTimeParam($startTime),
'ctl00$ContentQuery$endTime' => $endTime, 'ctl00$ContentQuery$endTime' => $this->HandelSearcheOrderTimeParam($endTime),
'ctl00$ContentQuery$ddlIsAccept' => $isAccept, 'ctl00$ContentQuery$ddlIsAccept' => $isAccept,
'ctl00$ContentQuery$new_custtel' => $custtel, 'ctl00$ContentQuery$new_custtel' => $custtel,
'ctl00$ContentQuery$new_address' => '', 'ctl00$ContentQuery$new_address' => '',
'ctl00$ContentQuery$ddlcallintype' => $callintype, 'ctl00$ContentQuery$ddlcallintype' => $callintype,
'ctl00$ContentQuery$new_isReminder' => $isreminder, 'ctl00$ContentQuery$new_isReminder' => $isreminder,
'ctl00$ContentQuery$new_ServicePersonnel' => '', 'ctl00$ContentQuery$new_ServicePersonnel' => '',
'ctl00$ContentData$PagerToolBar1$ctl00' => 50, 'ctl00$ContentData$PagerToolBar1$ctl00' => '25',
'ctl00$ContentData$PagerToolBar1$ctl05' => 1 'ctl00$ContentData$PagerToolBar1$ctl05' => '1',
]; ];
$url = self::$host . '/Complaint/new_srv_callinMP.aspx'; $url = self::$host . '/Complaint/new_srv_callinMP.aspx';
$orders = $this->HandelSearchOrder($url, $post); return $this->HandelSearchOrder($url, $post);
return $orders;
} }
/** /**
* 维修单搜索 * 维修单搜索
* @param string $name 维修单号 * @param string $name 维修单号
* @param string $custmobile 顾客手机 * @param string $custmobile 顾客手机
* @param string $producenumber 产品条码
* @param string $approvalstatus 单据状态: '':默认; 1:待发送; 2:已发送; 3:驳回; 4:合格; 5:复议; 6:虚假单 * @param string $approvalstatus 单据状态: '':默认; 1:待发送; 2:已发送; 3:驳回; 4:合格; 5:复议; 6:虚假单
* @param string $ischangepart 是否换件: 1:默认; 2:是; 3:否 * @param string $ischangepart 是否换件: 1:默认; 2:是; 3:否
* @param string $returnfactory 售前机: 1:默认; 2:是; 3:否 * @param string $returnfactory 售前机: 1:默认; 2:是; 3:否
* @param string $isrelief 减免: 1:默认; 2:是; 3:否 * @param string $isrelief 减免: 1:默认; 2:是; 3:否
* @param string $producenumber 产品条码
* @param string $stime 开始时间,格式:2016/08/05 * @param string $stime 开始时间,格式:2016/08/05
* @param string $etime 结束时间,格式:同上 * @param string $etime 结束时间,格式:同上
* @return array * @return array
*/ */
public function SearchWorkOrder($name='', $custmobile='', $producenumber='', $approvalstatus='', $ischangepart='', $returnfactory='', $isrelief='', $stime='', $etime='') public function SearchWorkOrder($name='', $custmobile='', $approvalstatus='', $ischangepart='', $returnfactory='', $isrelief='', $producenumber='', $stime='', $etime='')
{ {
if (!in_array($approvalstatus, [1,2,3,4,5,6])) {
$approvalstatus = '';
}
if (!in_array($ischangepart, [2,3])) {
$ischangepart = '1';
}
if (!in_array($returnfactory, [2,3])) {
$returnfactory = '1';
}
if (!in_array($isrelief, [2,3])) {
$isrelief = '1';
}
$post = [ $post = [
'__EVENTTARGET' => 'ctl00$ContentQuery$btnQuery', '__EVENTTARGET' => 'ctl00$ContentQuery$btnQuery',
'__EVENTARGUMENT' => '', '__EVENTARGUMENT' => '',
...@@ -248,8 +278,8 @@ class SourceGalanz extends Source ...@@ -248,8 +278,8 @@ class SourceGalanz extends Source
'ctl00$ContentQuery$hidMainId' => '', 'ctl00$ContentQuery$hidMainId' => '',
'ctl00$ContentQuery$hidAttrCode' => '', 'ctl00$ContentQuery$hidAttrCode' => '',
'ctl00$ContentQuery$hidMainIdName' => '', 'ctl00$ContentQuery$hidMainIdName' => '',
'ctl00$ContentQuery$new_finishtime_s' => $stime, 'ctl00$ContentQuery$new_finishtime_s' => $this->HandelSearcheOrderTimeParam($stime),
'ctl00$ContentQuery$new_finishtime_e' => $etime, 'ctl00$ContentQuery$new_finishtime_e' => $this->HandelSearcheOrderTimeParam($etime),
'ctl00$ContentQuery$new_number' => $name, 'ctl00$ContentQuery$new_number' => $name,
'ctl00$ContentQuery$new_custname' => '', 'ctl00$ContentQuery$new_custname' => '',
'ctl00$ContentQuery$new_custmobile' => $custmobile, 'ctl00$ContentQuery$new_custmobile' => $custmobile,
...@@ -260,24 +290,51 @@ class SourceGalanz extends Source ...@@ -260,24 +290,51 @@ class SourceGalanz extends Source
'ctl00$ContentQuery$txtproducenumber' => $producenumber, 'ctl00$ContentQuery$txtproducenumber' => $producenumber,
'ctl00$ContentQuery$new_name' => '', 'ctl00$ContentQuery$new_name' => '',
'ctl00$ContentQuery$new_iskt' => 0, 'ctl00$ContentQuery$new_iskt' => 0,
'ctl00$ContentData$PagerToolBar1$ctl00' => 500, 'ctl00$ContentData$PagerToolBar1$ctl00' => '25',
'ctl00$ContentData$PagerToolBar1$ctl05' => 1, 'ctl00$ContentData$PagerToolBar1$ctl05' => '1',
]; ];
$url = self::$host . '/repair/new_srv_workorderMP.aspx'; $url = self::$host . '/repair/new_srv_workorderMP.aspx';
$orders = $this->HandelSearchOrder($url, $post); return $this->HandelSearchOrder($url, $post);
return $orders;
} }
/** /**
* 安装单搜索 * 安装单搜索
* @param string $mobile * @param string $mobile 顾客手机
* @param string $new_number * @param string $status 单据状态: -1:默认; 0:待发送; 1:已发送; 2:驳回; 3:复议; 4:合格; 5:虚假单
* @param string $investstatus 回访状态: -1:默认; 1:未回访; 2:待回访; 3:已回访:
* @param string $havadetail 是否已录明细: -1:默认; 1:是; 2:否;
* @param string $isuseful 是否生效: -1:默认; 1:是; 2:否;
* @param string $jiesuanstatus 是否已结算: '';默认; 1:是; 2:否;
* @param string $producenumber 机器条码
* @param string $installstarttime 安装日期,格式:2016/08/05
* @param string $installendtime
* @param string $inputstarttime 录入日期,格式:2016/08/05
* @param string $inputendtime
* @return array * @return array
*/ */
public function SearchUserProfieOrder($mobile = '', $new_number = '') public function SearchUserProfieOrder($mobile='', $status='', $investstatus='', $havadetail='', $isuseful='', $jiesuanstatus='', $producenumber='', $installstarttime='', $installendtime='', $inputstarttime='', $inputendtime='')
{ {
if (!in_array($status, [0,1,2,3,4,5])) {
$status = -1;
}
if (!in_array($investstatus, [1,2,3])) {
$investstatus = -1;
}
if (!in_array($havadetail, [1,2])) {
$havadetail = -1;
}
if (!in_array($isuseful, [1,2])) {
$isuseful = -1;
}
if (!in_array($jiesuanstatus, [1,2])) {
$jiesuanstatus = '';
}
$post = [ $post = [
'__EVENTTARGET' => 'ctl00$ContentQuery$btnQuery', '__EVENTTARGET' => 'ctl00$ContentQuery$btnQuery',
'__EVENTARGUMENT' => '', '__EVENTARGUMENT' => '',
...@@ -288,42 +345,72 @@ class SourceGalanz extends Source ...@@ -288,42 +345,72 @@ class SourceGalanz extends Source
'ctl00$ContentQuery$hidAttrCode' => '', 'ctl00$ContentQuery$hidAttrCode' => '',
'ctl00$ContentQuery$hidMainIdName' => '', 'ctl00$ContentQuery$hidMainIdName' => '',
'ctl00$ContentQuery$txtname' => '', 'ctl00$ContentQuery$txtname' => '',
'ctl00$ContentQuery$ddlnew_investstatus' => '-1', 'ctl00$ContentQuery$ddlnew_investstatus' => $investstatus,
'ctl00$ContentQuery$ddlnew_status' => '-1', 'ctl00$ContentQuery$ddlnew_status' => $status,
'ctl00$ContentQuery$txtcontactname' => '', 'ctl00$ContentQuery$txtcontactname' => '',
'ctl00$ContentQuery$txtmobile' => $mobile, 'ctl00$ContentQuery$txtmobile' => $mobile,
'ctl00$ContentQuery$ddlhavaDetail' => '-1', 'ctl00$ContentQuery$ddlhavaDetail' => $havadetail,
'ctl00$ContentQuery$hidDateFrom' => '', 'ctl00$ContentQuery$hidDateFrom' => '',
'ctl00$ContentQuery$txtDateFrom' => '', 'ctl00$ContentQuery$txtDateFrom' => $this->HandelSearcheOrderTimeParam($installstarttime),
'ctl00$ContentQuery$hidDateTo' => '', 'ctl00$ContentQuery$hidDateTo' => '',
'ctl00$ContentQuery$txtDateTo' => '', 'ctl00$ContentQuery$txtDateTo' => $this->HandelSearcheOrderTimeParam($installendtime),
'ctl00$ContentQuery$ddlisuseful' => '-1', 'ctl00$ContentQuery$ddlisuseful' => $isuseful,
'ctl00$ContentQuery$hidCreatedONFrom' => '', 'ctl00$ContentQuery$hidCreatedONFrom' => '',
'ctl00$ContentQuery$txtCreatedONFrom' => '', 'ctl00$ContentQuery$txtCreatedONFrom' => $this->HandelSearcheOrderTimeParam($inputstarttime),
'ctl00$ContentQuery$hidCreatedONTo' => '', 'ctl00$ContentQuery$hidCreatedONTo' => '',
'ctl00$ContentQuery$txtCreatedONTo' => '', 'ctl00$ContentQuery$txtCreatedONTo' => $this->HandelSearcheOrderTimeParam($inputendtime),
'ctl00$ContentQuery$ddlJiesuanStatus' => '', 'ctl00$ContentQuery$ddlJiesuanStatus' => $jiesuanstatus,
'ctl00$ContentQuery$txtproducenumber' => '', 'ctl00$ContentQuery$txtproducenumber' => $producenumber,
'ctl00$ContentQuery$txtnew_accountaddr' => '', 'ctl00$ContentQuery$txtnew_accountaddr' => '',
'ctl00$ContentToolbar$PagerToolBar1$ctl00' => '50', 'ctl00$ContentToolbar$PagerToolBar1$ctl00' => '25',
'ctl00$ContentToolbar$PagerToolBar1$ctl05' => '1', 'ctl00$ContentToolbar$PagerToolBar1$ctl05' => '1',
]; ];
$url = self::$host . '/Warranty/new_srv_userprofileMP.aspx'; $url = self::$host . '/Warranty/new_srv_userprofileMP.aspx';
return $this->HandelSearchOrder($url, $post);
}
$orders = $this->HandelSearchOrder($url, $post); /**
* 处理搜索订单业务
* @param $url
* @param $post
* @return array
*/
private function HandelSearchOrder($url, $post)
{
$content = $this->GetUrlContents($url);
preg_match('/<input[^>]+name="__VIEWSTATE"[^>]+value="([^"]*)"/', $content, $arr);
$post['__VIEWSTATE'] = $arr[1];
if ($orders && $new_number) { //return_msg(true, '', $post);
foreach ($orders as $k => $v) {
if ($new_number != $v[2]) { $headers = $this->Header($url);
unset($orders[$k]); $result = $this->CurlPost($url, $post, $headers);
} $result = gzdecode($result['data']);
preg_match_all('/<tr>\s+<td class="checkbox">[\s\S]+?<\/tr>/', $result, $tr);
$orders = [];
if ($tr[0]) {
foreach ($tr[0] as $k => $v) {
$orders[$k] = $this->TableTdPreg($v);
} }
} }
return $orders; return $orders;
} }
/**
* 处理搜索订单日期参数
* @param $date
* @return bool|string
*/
private function HandelSearcheOrderTimeParam($date) {
return $date ? date('Y/m/d', strtotime($date)) : '';
}
/** /**
* 处理订单搜索返回信息 * 处理订单搜索返回信息
* @param $list * @param $list
...@@ -464,34 +551,6 @@ class SourceGalanz extends Source ...@@ -464,34 +551,6 @@ class SourceGalanz extends Source
return $result; return $result;
} }
/**
* 处理搜索订单业务
* @param $url
* @param $post
* @return array
*/
private function HandelSearchOrder($url, $post)
{
$content = $this->GetUrlContents($url);
preg_match('/<input[^>]+name="__VIEWSTATE"[^>]+value="([^"]*)"/', $content, $arr);
$post['__VIEWSTATE'] = $arr[1];
$headers = $this->Header($url);
$result = $this->CurlPost($url, $post, $headers);
$result = gzdecode($result['data']);
preg_match_all('/<tr>\s+<td class="checkbox">[\s\S]+?<\/tr>/', $result, $tr);
$orders = [];
if ($tr[0]) {
foreach ($tr[0] as $k => $v) {
$orders[$k] = $this->TableTdPreg($v);
}
}
return $orders;
}
/** /**
* 派工单详情 * 派工单详情
...@@ -2512,6 +2571,7 @@ class SourceGalanz extends Source ...@@ -2512,6 +2571,7 @@ class SourceGalanz extends Source
'Cache-Control: max-age=0', 'Cache-Control: max-age=0',
'Connection: keep-alive', 'Connection: keep-alive',
'Host: 202.104.26.131:3081', 'Host: 202.104.26.131:3081',
'Origin: http://202.104.26.131:3081',
'Referer: ' . $referer, 'Referer: ' . $referer,
'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0', 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0',
]; ];
......
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