|
@@ -1,7 +1,7 @@
|
|
|
<?php
|
|
|
class ROrderController extends AdminController{
|
|
|
|
|
|
- public function actionIndex()
|
|
|
+ public function actionIndex1()
|
|
|
{
|
|
|
$status_option = ROrder::$status_option;
|
|
|
$status = CommonFn::getComboboxData($status_option, 100, true, 100);
|
|
@@ -357,22 +357,16 @@ class ROrderController extends AdminController{
|
|
|
$res = self::DelOrder((string)$order->_id);
|
|
|
}
|
|
|
}else if($order->channel == 'jingbai'){
|
|
|
- if ($status == 1) {//已支付
|
|
|
- $res = self::UpdateStatus((string)$order->_id, 5);
|
|
|
- } else if($status ==3){//已接单
|
|
|
- $res = self::UpdateStatus((string)$order->_id, 15);
|
|
|
+ if($status ==3){//已接单
|
|
|
+ $res = self::UpdateStatusForJingBai($order->OrderNo,(string)$order->_id, $status,$order->remark);
|
|
|
}else if($status ==6){//服务完成
|
|
|
- $res = self::UpdateStatus((string)$order->_id, 20);
|
|
|
- }else if($status ==-1){//取消订单
|
|
|
- $res = self::DelOrder((string)$order->_id);
|
|
|
+ $res = self::UpdateStatusForJingBai($order->OrderNo,(string)$order->_id, $status,$order->remark);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!$res) {
|
|
|
CommonFn::requestAjax(false,'修改失败');
|
|
|
}
|
|
|
- //
|
|
|
-
|
|
|
$arr_order = array('cancel_time','refund_time','finish_time','status','booking_time','deal_time','remark', 'station', 'technicians');
|
|
|
$success = $order->save(true,$arr_order);
|
|
|
$char = false;
|
|
@@ -862,6 +856,54 @@ class ROrderController extends AdminController{
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ }
|
|
|
+ //更新订单状态
|
|
|
+ /**
|
|
|
+ * @param $orderId => order->orderNo
|
|
|
+ * @param $status "00" 为创建订单,"01"为服务派单,"02"为服务完成
|
|
|
+ * @param $HouseKeepingId 巾帼园自己的订单号 对应order->_id
|
|
|
+ * @param $remark 订单备注
|
|
|
+ * Sign 计算方法:OrderId+ StatusCode+ Remark+ HouseKeepingId+ Time+KEY 然后计算md5 值 KEY为巾帼园的key值
|
|
|
+ * @return bool
|
|
|
+ */
|
|
|
+ public function UpdateStatusForJingBai($orderId,$HouseKeepingId,$status,$remark){
|
|
|
+
|
|
|
+ $key = Yii::app()->params['JingBai'];
|
|
|
+ $data['OrderId'] = $orderId;
|
|
|
+ $data['HouseKeepingId'] = $HouseKeepingId;
|
|
|
+ $data['Remark'] = $remark;
|
|
|
+ if ($status == 3){//已接单
|
|
|
+ $data['StatusCode'] = '01';
|
|
|
+ } else if($status == 6){//已完成
|
|
|
+ $data['StatusCode'] = '02';
|
|
|
+ }
|
|
|
+
|
|
|
+ $data['Time'] = date('Y-m-d H:i:s');
|
|
|
+ $data['Sign'] = md5($data['OrderId'].$data['StatusCode'].$data['Remark'].$data['HouseKeepingId'].$data['Time'].$key);
|
|
|
+
|
|
|
+ $dat = '';
|
|
|
+ foreach ($data as $key => $value) {
|
|
|
+ $dat .= $key.'='.urlencode($value).'&';
|
|
|
+ }
|
|
|
+ $dat = rtrim(trim($dat),'&');
|
|
|
+
|
|
|
+ $url = 'http://139.196.47.211:9030/ServiceController/SetHouseKeepingStatus'; //调用接口的平台服务地址
|
|
|
+
|
|
|
+ $ch = curl_init();
|
|
|
+ curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false);
|
|
|
+ curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
+ curl_setopt($ch, CURLOPT_POST, 1);
|
|
|
+ curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
|
|
|
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $dat);
|
|
|
+ $result = curl_exec($ch);
|
|
|
+ curl_close($ch);
|
|
|
+ $res = json_decode($result,true);
|
|
|
+ if ($res['ReturnCode'] == '00'){
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
public function actionOutputExcel(){
|
|
|
$data = ROrder::model()->findAll(); //
|