|
@@ -254,13 +254,7 @@ class ROrderController extends AdminController{
|
|
|
// }
|
|
|
// }
|
|
|
}
|
|
|
- //修改点评订单预约时间
|
|
|
- if($order->channel == 'dianping' && $order->booking_time != $booking_time){
|
|
|
- $update_dianping = ROrder::updateOrderInfo($order->_id,array('serviceTime' => date('Y-m-d H:i:s',$booking_time)));
|
|
|
- if($update_dianping == false){
|
|
|
- CommonFn::requestAjax(false, '更新点评到家数据失败');
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
//取消订单
|
|
|
if($order->status!=-1 && $status == -1){
|
|
@@ -271,61 +265,34 @@ class ROrderController extends AdminController{
|
|
|
|
|
|
$order->cancel_time = time();
|
|
|
$order_info = $order->parseRow($order);
|
|
|
- if($order->channel == 'dianping'){
|
|
|
- $update_dianping = ROrder::cancelDianPingOrder($order->_id);
|
|
|
- if($update_dianping == false){
|
|
|
- CommonFn::requestAjax(false, '更新点评到家数据失败');
|
|
|
- }
|
|
|
- // 客服取消订单,用户有效订单数减少
|
|
|
- // zhouxuchen 2015-11-16
|
|
|
- if (!empty($user) && $user->order_count > 0 && $order->status > 0) {
|
|
|
- $user->order_count -= 1;
|
|
|
- $user->save();
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
//确认接单
|
|
|
if($order->status!=3 && $status == 3){
|
|
|
- if($order->channel == 'dianping'){
|
|
|
- $update_dianping = ROrder::setDianPingStatus($order->_id,13);
|
|
|
- if($update_dianping == false){
|
|
|
- CommonFn::requestAjax(false, '更新点评到家数据失败');
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
$order_info = $order->parseRow($order);
|
|
|
}
|
|
|
//订单完成后执行
|
|
|
if($order->status!=6 && $status == 6 ){
|
|
|
$order->finish_time = time();
|
|
|
- if($order->channel == 'dianping'){
|
|
|
- if($order->status == -1){
|
|
|
- CommonFn::requestAjax(false, '已取消大众点评订单,不可设置为已完成状态');
|
|
|
- }
|
|
|
- $update_dianping = ROrder::setDianPingStatus($order->_id,5);
|
|
|
- if($update_dianping == false){
|
|
|
- // CommonFn::requestAjax(false, '更新点评到家数据失败');
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
$order_info = $order->parseRow($order);
|
|
|
- if($order->channel == 'dianping'){
|
|
|
- CommonSMS::send('dianping_final_order',array('mobile'=>$order_info['address']['mobile']));
|
|
|
- }else{
|
|
|
- $result = Service::factory('ScoreService')->changeScore((string)$order->user,intval($order->final_price),'下单奖爪币');
|
|
|
- if($result){
|
|
|
- $z_message = new ZMessage();
|
|
|
- $from_user = Yii::app()->params['sys_user'];
|
|
|
- $message_data = array(
|
|
|
- 'from_user' => $from_user,
|
|
|
- 'to_user' => (string)$order->user,
|
|
|
- 'content' => '您成功下单,获得了'.intval($order->final_price).'个爪币的奖励。',
|
|
|
- 'pics' => array(),
|
|
|
- 'voice' => array(),
|
|
|
- 'video'=> array()
|
|
|
- );
|
|
|
- $z_message->addMessage($message_data);
|
|
|
- CommonSMS::send('final_order',array('name' =>$order_info['address']['name'],'num' =>intval($order->final_price),'mobile'=>$order_info['address']['mobile']));
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ /*$result = Service::factory('ScoreService')->changeScore((string)$order->user,intval($order->final_price),'下单奖爪币');
|
|
|
+ if($result){
|
|
|
+ $z_message = new ZMessage();
|
|
|
+ $from_user = Yii::app()->params['sys_user'];
|
|
|
+ $message_data = array(
|
|
|
+ 'from_user' => $from_user,
|
|
|
+ 'to_user' => (string)$order->user,
|
|
|
+ 'content' => '您成功下单,获得了'.intval($order->final_price).'个爪币的奖励。',
|
|
|
+ 'pics' => array(),
|
|
|
+ 'voice' => array(),
|
|
|
+ 'video'=> array()
|
|
|
+ );
|
|
|
+ $z_message->addMessage($message_data);
|
|
|
+ CommonSMS::send('final_order',array('name' =>$order_info['address']['name'],'num' =>intval($order->final_price),'mobile'=>$order_info['address']['mobile']));
|
|
|
+ }*/
|
|
|
+
|
|
|
|
|
|
// 保洁师订单统计处理
|
|
|
if ($technician_obj) {
|
|
@@ -335,87 +302,6 @@ class ROrderController extends AdminController{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 葡萄订单状态处理
|
|
|
- if ($order->channel == 'putao' && $status != $order->status) {
|
|
|
- if (in_array($status, array(0, 1, 2, 7, -2))) {
|
|
|
- CommonFn::requestAjax(false, '该选项状态不适用于葡萄生活', array());
|
|
|
- }
|
|
|
-
|
|
|
- $update_putao = Putao::getInstance()->updateToPlatform($order->_id, $status);
|
|
|
- if ($update_putao['code'] == -1) {
|
|
|
- CommonFn::requestAjax(false, '更新葡萄生活数据失败/'.$update_putao['msg'], array());
|
|
|
- } else {
|
|
|
- $remark_info = $update_putao['msg'];
|
|
|
- $remark = $remark == '' ? $remark : $remark."\n";
|
|
|
- $remark .= $remark_info."\n".date('Y-m-d H:i:s', time());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 触宝订单状态处理
|
|
|
- // TODO
|
|
|
- if ($order->channel == 'chubao' && $status != $order->status) {
|
|
|
- $chubao_info = $order->third_platform_info;
|
|
|
- if (empty($user->name) || !isset($chubao_info['transactionId'])) {
|
|
|
- CommonFn::requestAjax(false, '触宝用户信息不全');
|
|
|
- } else {
|
|
|
- $userId = $user->name;
|
|
|
- }
|
|
|
-
|
|
|
- if (in_array($status, array(-1, 6))) {
|
|
|
- $chubao = new Chubao();
|
|
|
- $chubaoClient = $chubao->getClient();
|
|
|
- $chubaoConfig = Yii::app()->params['chubao'];
|
|
|
- // 服务信息
|
|
|
- $product_list = $order->products;
|
|
|
- $product_id = $product_list[0]['product'];
|
|
|
- $product = Product::get($product_id);
|
|
|
- $o2o_service = Yii::app()->params['o2o_service'];
|
|
|
- $shortInfo = $o2o_service[$product->type]['name'];
|
|
|
- // chubaoOrderPush实例化及基本设置
|
|
|
- $chubaoPush = $chubao->getOrderPush();
|
|
|
- $chubaoPush->setUserId($userId);
|
|
|
- $chubaoPush->setOrderId($id);
|
|
|
- $chubaoPush->setOrderService($chubaoConfig['service']);
|
|
|
- $chubaoPush->setOrderTitle('壹管家宠物');
|
|
|
- $chubaoPush->setOrderShortInfo('壹管家上门服务-'.$shortInfo);
|
|
|
- $chubaoPush->setOrderCreateTime(date('YmdHis', $order->order_time));
|
|
|
- $chubaoPush->setOrderFinishTime('');
|
|
|
- $chubaoPush->setOrderUrl($chubaoConfig['orderUrl'].'/'.$id);
|
|
|
- // 取消订单
|
|
|
- if ($status == -1) {
|
|
|
- // 已付款情况下申请退款
|
|
|
- if (in_array($order->status, array(1,2,3,4,5))) {
|
|
|
- $chubaoRefund = $chubao->getTradeRefund();
|
|
|
- $chubaoRefund->setUserId($userId);
|
|
|
- $chubaoRefund->setNotifyUrl($chubaoConfig['refundCallbackUrl']);
|
|
|
- $chubaoRefund->setTransactionId($chubao_info['transactionId']);
|
|
|
- $chubaoRefund->setRefundNo($id);
|
|
|
- $chubaoRefund->setTotalFee($order->final_price * 100);
|
|
|
- $chubaoRefund->setCashFee($order->final_price * 100);
|
|
|
- $chubaoRefund->setRefundFee($order->final_price * 100);
|
|
|
- $refundRes = $chubaoClient->execute($chubaoRefund);
|
|
|
- if ($refundRes['refundStatus'] == 'REFUND_FAIL') {
|
|
|
- CommonFn::requestAjax(false, '触宝订单退款失败');
|
|
|
- }
|
|
|
- }
|
|
|
- // 取消订单
|
|
|
- $chubaoPush->setOrderStatus('订单已被客服取消');
|
|
|
- $chubaoPush->setTradeStatus('TRADE_CLOSED');
|
|
|
- $pushRes = $chubaoClient->execute($chubaoPush);
|
|
|
- if ($pushRes['result'] == 'FAIL') {
|
|
|
- CommonFn::requestAjax(false, '触宝订单取消失败');
|
|
|
- }
|
|
|
- // 确认订单
|
|
|
- } else if ($status == 6) {
|
|
|
- $chubaoPush->setOrderStatus('订单已被客服确认完成');
|
|
|
- $chubaoPush->setTradeStatus('TRADE_FINISH');
|
|
|
- $pushRes = $chubaoClient->execute($chubaoPush);
|
|
|
- if ($pushRes['result'] == 'FAIL') {
|
|
|
- CommonFn::requestAjax(false, '触宝订单确认失败');
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
$order->status = $status;
|
|
|
$order->booking_time = $booking_time;
|
|
@@ -459,33 +345,6 @@ class ROrderController extends AdminController{
|
|
|
CommonFn::requestAjax($success, '', array());
|
|
|
}
|
|
|
|
|
|
- public function actionGetDianPingInfo(){
|
|
|
- $id = Yii::app()->request->getParam('id', '');
|
|
|
- $post_args = array(
|
|
|
- 'methodName' => 'loadOrderInfo',
|
|
|
- 'orderId' => $id
|
|
|
- );
|
|
|
- $sign = CommonFn::getDianPingSing($post_args);
|
|
|
- if($sign === false){
|
|
|
- return false;
|
|
|
- }
|
|
|
- $post_args['sign'] = $sign;
|
|
|
- $ch = curl_init();
|
|
|
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
|
|
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
|
|
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
|
|
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
|
|
- curl_setopt($ch, CURLOPT_URL, 'http://m.api.51ping.com/tohome/openapi/wozhua/');
|
|
|
- curl_setopt($ch, CURLOPT_POSTFIELDS,$post_args);
|
|
|
- $result = curl_exec($ch);
|
|
|
- if($result === false) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- curl_close($ch);
|
|
|
- echo $result;
|
|
|
- die();
|
|
|
- }
|
|
|
|
|
|
// 根据手机号 获取对应用户的地址信息
|
|
|
public function actionGetUserInfo(){
|