ソースを参照

Merge branch 'master' of https://git.oschina.net/yiguanjia/php

e 8 年 前
コミット
906096a646

+ 1 - 6
www/protected/controllers/SiteController.php

@@ -129,11 +129,6 @@ class SiteController extends AdminController
 	}
 
     public function actionTest(){
-        set_time_limit(0);
-
-    $index_xml_file="/Users/songyongming/Desktop/develop/php_code/sitemap/sitemap.xml";
-
-
-        $text = file_get_contents($index_xml_file);
+        echo Yii::app()->params['o2o_service'][2]['name'];exit;
     }
 }

+ 3 - 111
www/protected/modules/o2o/controllers/OrderController.php

@@ -1,9 +1,6 @@
 <?php
 /**
  * OrderController o2o下单相关接口
- *
- *  
- *
  */
 class  OrderController extends O2oBaseController{
 
@@ -232,22 +229,9 @@ class  OrderController extends O2oBaseController{
             }
         }
         if(isset($product)&&$product){
-            switch ($product->type) {
-                case 1:
-                    $str = '宠物洗澡';
-                    break;
-                case 2:
-                    $str = '宠物剪毛';
-                    break;
-                case 3:
-                    $str = '宠物美容';
-                    break;
-                default:
-                    $str = '宠物洗澡';
-                    break;
-            }
+            $str = isset(Yii::app()->params['o2o_service'][$product->type]['name'])?Yii::app()->params['o2o_service'][$product->type]['name']:'';
         }
-        $str = isset($str)?$str:'上门';
+        $str = isset($str)&&$str?$str:'上门';
         $amount = ceil($order->final_price*1000)/10;
         $result = Service::factory('PayService')->Pay($pay_channel,$amount,(string)$order->_id,$str,$str,$user_obj->wx_pub_openid);
         if($result === false){
@@ -291,36 +275,7 @@ class  OrderController extends O2oBaseController{
         }
         // 触宝信息更新
         $from = Yii::app()->request->getParam('from', '');
-        if ($from == 'chubao') {
-            $chubaoConfig = Yii::app()->params['chubao'];
-            $chubao = new Chubao();
-            $client = $chubao->getClient();
-            $orderPush = $chubao->getOrderPush();
-            $userId = $user_obj->name;
-
-            $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'];
 
-            $orderPush->setUserId($userId);
-            $orderPush->setOrderId($order_id);
-            $orderPush->setOrderService($chubaoConfig['service']);
-            $orderPush->setTitle('壹管家宠物');
-            $orderPush->setShortInfo('壹管家上门服务-'.$shortInfo);
-            $orderPush->setOrderStatus('订单已取消');
-            $orderPush->setCreateTime(date('YmdHis', $order->order_time));
-            $orderPush->setFinishTime('');
-            $orderPush->setOrderUrl($chubaoConfig['orderUrl'].'/'.$order_id);
-            $orderPush->setTradeStatus('TRADE_CLOSED');
-
-            $response = $client->execute($orderPush);
-
-            if ($response['result'] == 'FAIL') {
-                CommonFn::requestAjax(false, '订单取消失败,请稍后重试');
-            }
-        }
         $order->status = $status;
         $arr_order = array('status');
         $success = $order->update($arr_order,true);
@@ -599,33 +554,6 @@ class  OrderController extends O2oBaseController{
         $order->status = -3;
         $order->apply_refund_time = time();
 
-        // 触宝平台更新
-        if ($from == 'chubao') {
-            $chubao = new Chubao();
-            $client = $chubao->getClient();
-            $tradeRefund = $chubao->getTradeRefund();
-            $chubaoConfig = Yii::app()->params['chubao'];
-            $chubao_info = $order->third_platform_info;
-            $userId = $user_obj->name;
-
-            $tradeRefund->setUserId($userId);
-            $tradeRefund->setNotifyUrl($chubaoConfig['refundCallbackUrl']);
-            $tradeRefund->setTransactionId($chubao_info['transactionId']);
-            $tradeRefund->setRefundNo($order_id);
-            $tradeRefund->setTotalFee($order->final_price * 100);
-            $tradeRefund->setCashFee($order->final_price * 100);
-            $tradeRefund->setRefundFee($order->final_price * 100);
-            $response = $client->execute($tradeRefund);
-            
-            $refundStatus = $response['refundStatus'];
-            if ($refundStatus == 'REFUND_FAIL') {
-                CommonFn::requestAjax(false, '申请退款失败');
-            }
-
-            $chubao_info['redundId'] = $response['refundId'];
-            $order->third_platform_info = $chubao_info;
-            $order->save(true, array('third_platform_info'));
-        }
 
         if($order->update(array('status','apply_refund_time'),true)){
             // 发送通知给保洁师
@@ -677,45 +605,9 @@ class  OrderController extends O2oBaseController{
         }
         $order->status = 6;
         $order->finish_time = time();
-        // 触宝信息更新
-        if ($from == 'chubao') {
-            $chubaoConfig = Yii::app()->params['chubao'];
-            $chubao = new Chubao();
-            $client = $chubao->getClient();
-            $orderPush = $chubao->getOrderPush();
-            $userId = $user_obj->name;
-
-            $orderPush->setUserId($userId);
-            $orderPush->setOrderId($order_id);
-            $orderPush->setOrderService($chubaoConfig['service']);
-            $orderPush->setTitle('壹管家宠物');
-
-            $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'];
-            $orderPush->setOrderShortInfo('壹管家上门服务-'.$shortInfo);
-            $orderPush->setOrderStatus('订单已完成');
-            $orderPush->setOrderCreateTime(date('YmdHis', $order->order_time));
-            $orderPush->setOrderFinishTime(date('YmdHis', time()));
-            $orderPush->setOrderUrl($chubaoConfig['orderUrl'].'/'.$order_id);
-            $orderPush->setTradeStatus('TRADE_FINISH');
-
-            $response = $client->execute($orderPush);
-            if ($response['result'] == 'FAIL') {
-                CommonFn::requestAjax(false,'请稍后再试');
-            }
-            $success = $order->update(array('finish_time','status'),true);
-            if ($success) {
-                CommonFn::requestAjax(true,'订单已完成,期待您的下次预约');
-            } else {
-                CommonFn::requestAjax(false,'请稍后再试');
-            }
-        }
 
         $success = $order->update(array('finish_time','status'),true);
-        if($success && $from != 'chubao'){
+        if($success ){
             $result = Service::factory('ScoreService')->changeScore($user_id,intval($order->final_price),'下单奖爪币');
             if($result){
                 $z_message = new ZMessage();