DengTao 8 年之前
父节点
当前提交
5b0a2d8c17

+ 33 - 30
www/protected/controllers/ROrderController.php

@@ -238,44 +238,47 @@ class ROrderController extends AdminController{
                 $user_coupon->update(array('status'),true);
             }
         }
-        if($order->status!=-2 && $status == -2){
+        if($order->status!=-2 && $status == -2) {
             $order->refund_time = time();
             $order_info = $order->parseRow($order);
-            $month = date('m',$order_info['booking_time']);
-            $day = date('d',$order_info['booking_time']);
-            $address = $order_info['address']['poi']['name'].$order_info['address']['detail'];
-            CommonSMS::send('order_retrieve',array('month'=>$month,'day'=>$day,'address'=>$address,'mobile'=>$order_info['address']['mobile']));
-
-            // 申请退款处理完成后通知保洁师
-            foreach($technician_ids as $key => $technician_id) {
-                $technician_obj = TechInfo::get($technician_id);
-                if ($technician_obj && $technician_obj->weixin_userid) {
-                    $url_prefix = ENVIRONMENT == 'product' ? 'http://api.yiguanjia.me' : 'http://apitest.yiguanjia.me';
-                    $wechat = O2oApp::getWechatActive();
-                    $wechat_data = array(
-                        'touser' => $technician_obj->weixin_userid,
-                        'msgtype' => 'news',
-                        'agentid' => '1',
-                        'news' => array(
-                            'articles' => array(
-                                array(
-                                    'title' => '壹管家提示-订单退款完成',
-                                    'description' => $technician_obj->name . '你好!用户于' . date('m月d日H:i', $order->apply_refund_time) . '申请退款的订单已处理完成。',
-                                    //'url' => $url_prefix . '/index.php?r=o2o/myOrder/info&order=' . $id . '&user=' . $technician_id,
-                                    'url' => $url_prefix . '/index.php?r=o2o/myOrder/index'
+            $month = date('m', $order_info['booking_time']);
+            $day = date('d', $order_info['booking_time']);
+            $address = $order_info['address']['poi']['name'] . $order_info['address']['detail'];
+            $result = Service::factory('PayService')->retrieve($order->charge_id);
+            if($result === false){
+                CommonFn::requestAjax(false,'退款遇到点问题了,请稍候再试');
+            }else{
+                CommonSMS::send('order_retrieve', array('month' => $month, 'day' => $day, 'address' => $address, 'mobile' => $order_info['address']['mobile']));
+                // 申请退款处理完成后通知保洁师
+                foreach ($technician_ids as $key => $technician_id) {
+                    $technician_obj = TechInfo::get($technician_id);
+                    if ($technician_obj && $technician_obj->weixin_userid) {
+                        $url_prefix = ENVIRONMENT == 'product' ? 'http://api.yiguanjia.me' : 'http://apitest.yiguanjia.me';
+                        $wechat = O2oApp::getWechatActive();
+                        $wechat_data = array(
+                            'touser' => $technician_obj->weixin_userid,
+                            'msgtype' => 'news',
+                            'agentid' => '1',
+                            'news' => array(
+                                'articles' => array(
+                                    array(
+                                        'title' => '壹管家提示-订单退款完成',
+                                        'description' => $technician_obj->name . '你好!用户于' . date('m月d日H:i', $order->apply_refund_time) . '申请退款的订单已处理完成。',
+                                        //'url' => $url_prefix . '/index.php?r=o2o/myOrder/info&order=' . $id . '&user=' . $technician_id,
+                                        'url' => $url_prefix . '/index.php?r=o2o/myOrder/index'
+                                    ),
                                 ),
                             ),
-                        ),
-                    );
+                        );
 
-                    if (!empty($order->append_orders)) {
-                        $count = count($order->append_orders);
-                        $wechat_data['news']['articles'][0]['description'] .= "\n\n本订单包含" . $count . "个追加订单,请注意查看。";
+                        if (!empty($order->append_orders)) {
+                            $count = count($order->append_orders);
+                            $wechat_data['news']['articles'][0]['description'] .= "\n\n本订单包含" . $count . "个追加订单,请注意查看。";
+                        }
+                        $wechat->sendMessage($wechat_data);
                     }
-                    $wechat->sendMessage($wechat_data);
                 }
             }
-
         }
 
         //取消订单

+ 2 - 2
www/protected/modules/o2o/controllers/OrderController.php

@@ -84,9 +84,9 @@ class  OrderController extends O2oBaseController{
             //$flag_book = 1;
         }
 
-        //end
+        //end  //取出双十一活动暂用
+
 
-            //取出双十一活动暂用
         if(!$user_id||!$products||!$address_id){
             CommonFn::requestAjax(false,CommonFn::getMessage('message','params_illegal'));
         }