Commit c8183734 authored by 蒋林's avatar 蒋林

呼叫受理-安装业务

parent 6f7520ad
...@@ -55,6 +55,78 @@ class Chigo extends BaseController ...@@ -55,6 +55,78 @@ class Chigo extends BaseController
$obj->ReturnMessage(true, '', $result); $obj->ReturnMessage(true, '', $result);
} }
//家用安装业务-业务-安装单录入
public function queryInstallBill()
{
$param = $this->input->post();
//验证参数
$obj = $this->receiveObj();
$obj->SetValues($param);
$obj->CheckQueryInstallBillValues();
$values = $obj->GetValues();
$this->saveLog('', 'queryInstallBill', $values);
$sourceObj = $this->sourceObj($values['account'], $values['pwd']);
$result = $sourceObj->QueryInstallBill($values);
$obj->ReturnMessage(true, '', $result);
}
//家用安装业务-业务-安装单据结算
public function browseCloseAccount()
{
$param = $this->input->post();
//验证参数
$obj = $this->receiveObj();
$obj->SetValues($param);
$obj->CheckBrowseCloseAccountValues();
$values = $obj->GetValues();
$this->saveLog('', 'browseCloseAccount', $values);
$sourceObj = $this->sourceObj($values['account'], $values['pwd']);
$result = $sourceObj->BrowseCloseAccount($values);
$obj->ReturnMessage(true, '', $result);
}
//服务商编号
public function pickupAllSerNodeForUser()
{
$param = $this->input->post();
//验证参数
$obj = $this->receiveObj();
$obj->SetValues($param);
$values = $obj->GetValues();
$this->saveLog('', 'pickupAllSerNodeForUser', $values);
$sourceObj = $this->sourceObj($values['account'], $values['pwd']);
$result = $sourceObj->PickupAllSerNodeForUser();
$obj->ReturnMessage(true, '', $result);
}
//服务中心
public function pickupAllForUser()
{
$param = $this->input->post();
//验证参数
$obj = $this->receiveObj();
$obj->SetValues($param);
$values = $obj->GetValues();
$this->saveLog('', 'pickupAllForUser', $values);
$sourceObj = $this->sourceObj($values['account'], $values['pwd']);
$result = $sourceObj->PickupAllForUser();
$obj->ReturnMessage(true, '', $result);
}
/** /**
* 保存日志 * 保存日志
* *
......
This diff is collapsed.
...@@ -168,4 +168,100 @@ class Receive ...@@ -168,4 +168,100 @@ class Receive
return_msg($code, $msg, $data); return_msg($code, $msg, $data);
} }
/**
* 检查参数
* @param array $fields
*/
protected function CheckValues($fields = [])
{
if (!$this->GetValues()) {
$this->ReturnMessage(false, '参数错误!');
}
if ($this->CheckAppid() == false) {
$this->ReturnMessage(false, 'appid参数错误!');
}
if ($this->CheckSign() == false) {
$this->ReturnMessage(false, '签名错误!');
}
if (!array_key_exists('account', $this->values) || $this->values['account'] == '') {
$this->ReturnMessage(false, "account参数错误!");
} else {
$this->values['account'] = trim(urldecode($this->values['account']));
}
if (!array_key_exists('pwd', $this->values) || $this->values['pwd'] == '') {
$this->ReturnMessage(false, "pwd参数错误!");
} else {
$this->values['pwd'] = trim(urldecode($this->values['pwd']));
}
if ($fields) {
foreach ($fields as $v) {
if (!array_key_exists($v, $this->values) || $this->values[$v] == '') {
$this->ReturnMessage(false, "{$v}参数错误!");
} else {
$this->values[$v] = trim(urldecode($this->values[$v]));
}
}
}
}
/**
* 给指定参数增加默认值
* @param $fields
*/
protected function SetDefaultValues($fields)
{
if ($fields) {
foreach ($fields as $v) {
if (!array_key_exists($v, $this->values)) {
$this->values[$v] = '';
} else {
$this->values[$v] = urldecode($this->values[$v]);
}
}
}
}
protected function SelectValues($val, $options, $default='')
{
if (empty($val)) {
return $val;
}
return isset($options[$val]) ? $options[$val] : $default;
}
protected function IntValues($val, $out='int')
{
if (empty($val)) {
return $val;
}
$val = intval($val);
return $out=='int' ? $val : strval($val);
}
protected function DateFormatValues($date, $format='Y-m-d')
{
if (empty($val)) {
return $date;
}
return date($format, strtotime($date));
}
protected function TimeFormatValues($time, $format='Y-m-d')
{
if (empty($val)) {
return $time;
}
return date($format, $time);
}
} }
\ No newline at end of file
...@@ -26,26 +26,10 @@ class ReceiveChigo extends Receive ...@@ -26,26 +26,10 @@ class ReceiveChigo extends Receive
]; ];
$this->SetDefaultValues($dfields); $this->SetDefaultValues($dfields);
if ($this->values['adat_begin']) { $this->values['adat_begin'] = $this->DateFormatValues($this->values['adat_begin']);
$this->values['adat_begin'] = date('Y-m-d', strtotime($this->values['adat_begin'])); $this->values['adat_end'] = $this->DateFormatValues($this->values['adat_end']);
} $select = ['', 'Y', 'N'];
if ($this->values['adat_end']) { $this->values['read_state'] = $this->SelectValues($this->values['read_state'], $select);
$this->values['adat_end'] = date('Y-m-d', strtotime($this->values['adat_end']));
}
if ($this->values['read_state']) {
switch ($this->values['read_state']) {
case 1:
$this->values['read_state'] = 'Y';
break;
case 2:
$this->values['read_state'] = 'N';
break;
default:
$this->values['read_state'] = '';
}
}
} }
public function CheckVisitingServiceValues() public function CheckVisitingServiceValues()
...@@ -65,109 +49,50 @@ class ReceiveChigo extends Receive ...@@ -65,109 +49,50 @@ class ReceiveChigo extends Receive
]; ];
$this->SetDefaultValues($dfields); $this->SetDefaultValues($dfields);
if ($this->values['adat_begin']) { $this->values['adat_begin'] = $this->DateFormatValues($this->values['adat_begin']);
$this->values['adat_begin'] = date('Y-m-d', strtotime($this->values['adat_begin'])); $this->values['adat_end'] = $this->DateFormatValues($this->values['adat_end']);
} $this->values['bxcd'] = $this->IntValues($this->values['bxcd'], 'str');
if ($this->values['adat_end']) { $select = ['0', '1', '2'];
$this->values['adat_end'] = date('Y-m-d', strtotime($this->values['adat_end'])); $this->values['proc_state'] = $this->SelectValues($this->values['proc_state'], $select);
} $select = ['', '家用', '制冷设备', '商用'];
if ($this->values['bxcd']) { $this->values['ctype'] = $this->SelectValues($this->values['proc_state'], $select);
$this->values['bxcd'] = strval(intval($this->values['bxcd']));
}
if ($this->values['proc_state']) {
switch ($this->values['proc_state']) {
case 0:
$this->values['proc_state'] = '0';
break;
case 1:
$this->values['proc_state'] = '1';
break;
case 2:
$this->values['proc_state'] = '2';
break;
default:
$this->values['proc_state'] = '';
}
}
if ($this->values['ctype']) {
switch ($this->values['ctype']) {
case 1:
$this->values['ctype'] = '家用';
break;
case 2:
$this->values['ctype'] = '制冷设备';
break;
case 3:
$this->values['ctype'] = '商用';
break;
default:
$this->values['ctype'] = '';
}
}
} }
/** public function CheckQueryInstallBillValues()
* 检查参数
* @param array $fields
*/
private function CheckValues($fields = [])
{ {
if (!$this->GetValues()) { $fileds = [];
$this->ReturnMessage(false, '参数错误!'); $this->CheckValues($fileds);
}
if ($this->CheckAppid() == false) {
$this->ReturnMessage(false, 'appid参数错误!');
}
if ($this->CheckSign() == false) {
$this->ReturnMessage(false, '签名错误!');
}
if (!array_key_exists('account', $this->values) || $this->values['account'] == '') {
$this->ReturnMessage(false, "account参数错误!");
} else {
$this->values['account'] = trim(urldecode($this->values['account']));
}
if (!array_key_exists('pwd', $this->values) || $this->values['pwd'] == '') { $dfields = [
$this->ReturnMessage(false, "pwd参数错误!"); 'input_date_begin', //20161011
} else { 'input_date_end',
$this->values['pwd'] = trim(urldecode($this->values['pwd'])); 'node_id', //0200145
} 'install_date_begin', //20161011
'install_date_end',
'customer_name', //菲菲
'warranty' //
];
$this->SetDefaultValues($dfields);
if ($fields) { $this->values['input_date_begin'] = $this->DateFormatValues($this->values['input_date_begin']);
foreach ($fields as $v) { $this->values['input_date_end'] = $this->DateFormatValues($this->values['input_date_end']);
if (!array_key_exists($v, $this->values) || $this->values[$v] == '') { $this->values['install_date_begin'] = $this->DateFormatValues($this->values['install_date_begin']);
$this->ReturnMessage(false, "{$v}参数错误!"); $this->values['install_date_end'] = $this->DateFormatValues($this->values['install_date_end']);
} else {
$this->values[$v] = trim(urldecode($this->values[$v]));
}
}
}
} }
/** public function CheckBrowseCloseAccountValues()
* 给指定参数增加默认值
* @param $fields
*/
private function SetDefaultValues($fields)
{ {
if ($fields) { $fileds = [];
foreach ($fields as $v) { $this->CheckValues($fileds);
if (!array_key_exists($v, $this->values)) {
$this->values[$v] = ''; $dfields = [
} else { 'periodb', //201610
$this->values[$v] = urldecode($this->values[$v]); 'periode',
} 'ser_node_id',
} 'center_code',
} ];
$this->SetDefaultValues($dfields);
} }
} }
\ No newline at end of file
...@@ -591,63 +591,5 @@ class ReceiveGalanz extends Receive ...@@ -591,63 +591,5 @@ class ReceiveGalanz extends Receive
$fileds = ['siteid','errorpartsid']; $fileds = ['siteid','errorpartsid'];
$this->CheckValues($fileds); $this->CheckValues($fileds);
} }
/**
* 检查参数
* @param array $fields
*/
private function CheckValues($fields = [])
{
if (!$this->GetValues()) {
$this->ReturnMessage(false, '参数错误!');
}
if ($this->CheckAppid() == false) {
$this->ReturnMessage(false, 'appid参数错误!');
}
if ($this->CheckSign() == false) {
$this->ReturnMessage(false, '签名错误!');
}
if (!array_key_exists('account', $this->values) || $this->values['account'] == '') {
$this->ReturnMessage(false, "account参数错误!");
} else {
$this->values['account'] = trim(urldecode($this->values['account']));
}
if (!array_key_exists('pwd', $this->values) || $this->values['pwd'] == '') {
$this->ReturnMessage(false, "pwd参数错误!");
} else {
$this->values['pwd'] = trim(urldecode($this->values['pwd']));
}
if ($fields) {
foreach ($fields as $v) {
if (!array_key_exists($v, $this->values) || $this->values[$v] == '') {
$this->ReturnMessage(false, "{$v}参数错误!");
} else {
$this->values[$v] = trim(urldecode($this->values[$v]));
}
}
}
}
/**
* 给指定参数增加默认值
* @param $fields
*/
private function SetDefaultValues($fields)
{
if ($fields) {
foreach ($fields as $v) {
if (!array_key_exists($v, $this->values)) {
$this->values[$v] = '';
} else {
$this->values[$v] = urldecode($this->values[$v]);
}
}
}
}
} }
\ No newline at end of file
...@@ -25,13 +25,9 @@ class ReceiveSuning extends Receive ...@@ -25,13 +25,9 @@ class ReceiveSuning extends Receive
'processType', 'processType',
]; ];
$this->SetDefaultValues($dfields); $this->SetDefaultValues($dfields);
if ($this->values['startTime']) { $this->values['startTime'] = $this->DateFormatValues($this->values['startTime']);
$this->values['startTime'] = date('Y-m-d', strtotime($this->values['startTime'])); $this->values['endTime'] = $this->DateFormatValues($this->values['endTime']);
}
if ($this->values['endTime']) {
$this->values['endTime'] = date('Y-m-d', strtotime($this->values['endTime']));
}
} }
public function CheckReceiveServiceOrderValues() public function CheckReceiveServiceOrderValues()
...@@ -66,70 +62,8 @@ class ReceiveSuning extends Receive ...@@ -66,70 +62,8 @@ class ReceiveSuning extends Receive
]; ];
$this->SetDefaultValues($dfields); $this->SetDefaultValues($dfields);
if ($this->values['startTime']) { $this->values['startTime'] = $this->DateFormatValues($this->values['startTime']);
$this->values['startTime'] = date('Y-m-d', strtotime($this->values['startTime'])); $this->values['endTime'] = $this->DateFormatValues($this->values['endTime']);
}
if ($this->values['endTime']) {
$this->values['endTime'] = date('Y-m-d', strtotime($this->values['endTime']));
}
}
/**
* 检查参数
* @param array $fields
*/
private function CheckValues($fields = [])
{
if (!$this->GetValues()) {
$this->ReturnMessage(false, '参数错误!');
}
if ($this->CheckAppid() == false) {
$this->ReturnMessage(false, 'appid参数错误!');
}
if ($this->CheckSign() == false) {
$this->ReturnMessage(false, '签名错误!');
}
if (!array_key_exists('account', $this->values) || $this->values['account'] == '') {
$this->ReturnMessage(false, "account参数错误!");
} else {
$this->values['account'] = trim(urldecode($this->values['account']));
}
if (!array_key_exists('pwd', $this->values) || $this->values['pwd'] == '') {
$this->ReturnMessage(false, "pwd参数错误!");
} else {
$this->values['pwd'] = trim(urldecode($this->values['pwd']));
}
if ($fields) {
foreach ($fields as $v) {
if (!array_key_exists($v, $this->values) || $this->values[$v] == '') {
$this->ReturnMessage(false, "{$v}参数错误!");
} else {
$this->values[$v] = trim(urldecode($this->values[$v]));
}
}
}
} }
/**
* 给指定参数增加默认值
* @param $fields
*/
private function SetDefaultValues($fields)
{
if ($fields) {
foreach ($fields as $v) {
if (!array_key_exists($v, $this->values)) {
$this->values[$v] = '';
} else {
$this->values[$v] = urldecode($this->values[$v]);
}
}
}
}
} }
\ No newline at end of file
...@@ -39,7 +39,7 @@ class SourceChigo extends Source ...@@ -39,7 +39,7 @@ class SourceChigo extends Source
{ {
$post = [ $post = [
'adat_begin' => $condition['adat_begin'], //开始时间 'adat_begin' => $condition['adat_begin'], //开始时间 2011-11-11
'adat_end' => $condition['adat_end'], //结束时间 'adat_end' => $condition['adat_end'], //结束时间
'mobile' => $condition['mobile'], //手机 'mobile' => $condition['mobile'], //手机
'phone' => $condition['phone'], //电话 'phone' => $condition['phone'], //电话
...@@ -49,10 +49,7 @@ class SourceChigo extends Source ...@@ -49,10 +49,7 @@ class SourceChigo extends Source
'check_state' => 'N', 'check_state' => 'N',
]; ];
//debug $data = $this->HandelAction('CallAcceptAction', 'QuerySerNode', $post);
$this->Debug('FacilitatorReservation', $post);
$data = $this->CallAcceptAction('QuerySerNode', $post);
return $data; return $data;
} }
...@@ -64,7 +61,7 @@ class SourceChigo extends Source ...@@ -64,7 +61,7 @@ class SourceChigo extends Source
public function VisitingService($condition) public function VisitingService($condition)
{ {
$post = [ $post = [
'adat_begin' => $condition['adat_begin'], //开始时间 'adat_begin' => $condition['adat_begin'], //开始时间 2011-11-11
'adat_end' => $condition['adat_end'], //结束时间 'adat_end' => $condition['adat_end'], //结束时间
'mobile' => $condition['mobile'], //手机 'mobile' => $condition['mobile'], //手机
'phone' => $condition['phone'], //电话 'phone' => $condition['phone'], //电话
...@@ -75,25 +72,132 @@ class SourceChigo extends Source ...@@ -75,25 +72,132 @@ class SourceChigo extends Source
'bxcd' => $condition['bxcd'], //报修催单: 1:选中; 0:未选中 'bxcd' => $condition['bxcd'], //报修催单: 1:选中; 0:未选中
]; ];
//debug //转码
$this->Debug('VisitingService', $post); $post['ctype'] = $this->Utf8ToGbk($post['ctype']);
$data = $this->HandelAction('CallAcceptAction', 'QuerySerNode', $post);
return $data;
}
/**
* 家用安装业务-业务-安装单录入-浏览
* @param $condition
* @return array
*/
public function QueryInstallBill($condition)
{
$post = [
'input_date_begin' => $condition['input_date_begin'], //输单日期 2011-11-11
'input_date_end' => $condition['input_date_end'],
'telephone_no' => '', //用户电话
'node_id' => $condition['node_id'], //服务商编号, PickupAllSerNodeForUser->node_id
'install_date_begin' => $condition['install_date_begin'], //安装日期 2011-11-11
'install_date_end' => $condition['install_date_end'],
'customer_name' => $condition['customer_name'], //用户名称
'warranty' => $condition['warranty'], //保修卡号
];
//转码 //转码
$post['ctype'] = iconv('UTF-8', 'GBK', $post['ctype']); $post['customer_name'] = $this->Utf8ToGbk($post['customer_name']);
$data = $this->CallAcceptAction('QuerySerNode', $post); $data = $this->HandelAction('InstallBillAction', 'QueryInstallBill', $post);
return $data; return $data;
} }
/** /**
* 呼叫受理订单处理 * 家用安装业务-业务-安装单据结算-浏览
* @param $condition
* @return array
*/
public function BrowseCloseAccount($condition)
{
$post = [
'periodb' => $condition['periodb'], //'201610'
'periode' => $condition['periode'],
'ser_node_id' => $condition['ser_node_id'], //服务商, PickupAllSerNodeForUser->node_id
'center_code' => $condition['center_code'], //中心, PickupAllForUser->center_code
'ins_rep' => 'I',
'wxqx' => '',
];
$data = $this->HandelAction('BrowseCloseAccount', 'BrowseCloseAccount', $post);
return $data;
}
//服务商编号
public function PickupAllSerNodeForUser()
{
$post = [
'type' => '家用',
];
//转码
$post['type'] = $this->Utf8ToGbk($post['type']);
$data = $this->HandelAction('SerNodeAction', 'PickupAllSerNodeForUser', $post);
return $data;
}
//服务中心
public function PickupAllForUser()
{
$post = [
'type' => '家用',
];
//转码
$post['type'] = $this->Utf8ToGbk($post['type']);
$data = $this->HandelAction('SerCenterAction', 'PickupAllForUser', $post);
return $data;
}
/**
* 查询处理
* @param $action
* @param $type * @param $type
* @param $post * @param $post
* @return array * @return array
*/ */
private function CallAcceptAction($type, $post) private function HandelAction($action, $type, $post)
{ {
$url = "http://58.254.204.86:9001/cus/CallAcceptAction.do"; switch ($action) {
//服务商编号
case 'SerNodeAction':
$url = "http://58.254.204.86:9001/cus/SerNodeAction.do";
break;
//家用安装业务-录入
case 'InstallBillAction':
$url = "http://58.254.204.86:9001/cus/InstallBillAction.do";
break;
//呼叫受理
case 'CallAcceptAction':
$url = "http://58.254.204.86:9001/cus/CallAcceptAction.do";
break;
//服务中心
case 'SerCenterAction':
$url = "http://58.254.204.86:9001/cus/SerCenterAction.do";
break;
//家用安装业务-结算
case 'BrowseCloseAccount':
$url = "http://58.254.204.86:9001/cus/BrowseCloseAccount.do";
break;
default:
$url = '';
}
if ($url == '') {
return_msg(false, '请求参数错误');
}
//debug
$this->Debug($type, $post);
$xml = $this->ArrayToXml($type, $post); $xml = $this->ArrayToXml($type, $post);
$data = $this->CurlPostXml($url, $xml); $data = $this->CurlPostXml($url, $xml);
...@@ -228,7 +332,7 @@ class SourceChigo extends Source ...@@ -228,7 +332,7 @@ class SourceChigo extends Source
} }
//匹配数据 //匹配数据
preg_match_all('/<ROW\s+([^>]+)\/?>/', $xml, $data); preg_match_all('/<ROW\s+([^>]+)\/>/', $xml, $data);
//debug //debug
$this->Debug('XmlToArray', $data); $this->Debug('XmlToArray', $data);
...@@ -236,8 +340,8 @@ class SourceChigo extends Source ...@@ -236,8 +340,8 @@ class SourceChigo extends Source
if (isset($data[1]) && $data[1]) { if (isset($data[1]) && $data[1]) {
//数据处理个数 //数据处理个数
if (count($data[1]) > 50) { if (count($data[1]) > 200) {
$data[1] = array_slice($data[1], 0, 50); $data[1] = array_slice($data[1], 0, 200);
} }
foreach ($data[1] as $key => $val) { foreach ($data[1] as $key => $val) {
...@@ -331,4 +435,9 @@ class SourceChigo extends Source ...@@ -331,4 +435,9 @@ class SourceChigo extends Source
return $header; return $header;
} }
private function Utf8ToGbk($txt)
{
return iconv('UTF-8', 'GBK', $txt);
}
} }
\ No newline at end of file
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