浏览代码

fixed some bug

stanley-king 9 年之前
父节点
当前提交
219c43a219
共有 6 个文件被更改,包括 39 次插入51 次删除
  1. 2 1
      helper/bonus/factory.php
  2. 14 0
      helper/fcgi_server.php
  3. 1 0
      helper/user_helper.php
  4. 17 20
      mobile/alipay_notify_url.php
  5. 5 9
      mobile/control/app_pay.php
  6. 0 21
      request_helper.php

+ 2 - 1
helper/bonus/factory.php

@@ -9,6 +9,7 @@ namespace bonus;
 
 use \predeposit_helper;
 use \Exception;
+use \user_helper;
 
 class factory
 {
@@ -27,7 +28,7 @@ class factory
 
             //$type_paramer = $type->get_param();
             $pre_helper = new predeposit_helper();
-            $pre_helper->hand_out_bonus($money,$type->getType_sn(),$_SESSION['member_name'],"发送了{$money}元的红包.");
+            $pre_helper->hand_out_bonus($money,$type->getType_sn(),user_helper::nickname(),"发送了{$money}元的红包.");
             return $type->getType_sn();
         }
         catch (Exception $ex) {

+ 14 - 0
helper/fcgi_server.php

@@ -75,6 +75,20 @@ class fcgi_server
                         include $file;
                     } else {
                         fcgi_header("Content-Type: text/html; charset=UTF-8");
+
+                        if(!array_key_exists('act',$_GET)) {
+                            $_GET['act'] = 'index';
+                        }
+                        if(!array_key_exists('op',$_GET)) {
+                            $_GET['op'] = 'index';
+                        }
+                        if(!array_key_exists('act',$_POST)) {
+                            $_POST['act'] = 'index';
+                        }
+                        if(!array_key_exists('op',$_POST)) {
+                            $_POST['op'] = 'index';
+                        }
+
                         Base::mobile_control();
                     }
                 }

+ 1 - 0
helper/user_helper.php

@@ -30,6 +30,7 @@ class user_helper
         return '';
     }
 
+
     static public function isLogin()
     {
         return ($_SESSION['is_login'] == 1);

+ 17 - 20
mobile/alipay_notify_url.php

@@ -30,28 +30,25 @@ if ($verify_result)
         $chk = app_payControl::check_fee($out_trade_no,$total_fee,$need_pay);
         if($chk == false) {
             Log::record("AliPay check: pay_sn={$out_trade_no},total_fee={$total_fee},need_pay={$need_pay}",Log::WAIT_HANDLE);
-            echo("success");
+            echo("fail");
         }
-        Log::record("AliPay check: pay_sn={$out_trade_no},total_fee={$total_fee},need_pay={$need_pay}",Log::DEBUG);
-
-        // 步骤二:更新订单状态
-        $cb_info = app_payControl::update_order($out_trade_no, $trade_no, 'alipay');
-        if ($cb_info['state'] == false) {
-            Log::record("update_order fail: out_trade_no={$out_trade_no}", Log::DEBUG);
-            echo('fail');
-        } else {
-            $logic_delivery = Logic('delivery');
-            $ret = $logic_delivery->putOrder($out_trade_no, $trade_no);
-
-            Log::record("update_order success: out_trade_no={$out_trade_no}", Log::DEBUG);
-            echo('success');
+        else
+        {
+            Log::record("AliPay check: pay_sn={$out_trade_no},total_fee={$total_fee},need_pay={$need_pay}",Log::DEBUG);
+            // 步骤二:更新订单状态
+            $cb_info = app_payControl::update_order($out_trade_no, $trade_no, 'alipay');
+            if ($cb_info['state'] == false) {
+                Log::record("update_order fail: out_trade_no={$out_trade_no}", Log::DEBUG);
+                echo('fail');
+            } else {
+                $logic_delivery = Logic('delivery');
+                $ret = $logic_delivery->putOrder($out_trade_no, $trade_no);
+                Log::record("update_order success: out_trade_no={$out_trade_no}", Log::DEBUG);
+                echo('success');
+            }
         }
-        // 步骤三:如果此用户为静默注册用户,将此用户置为普通用户
-        $ret = app_payControl::updateMember($out_trade_no);
-        if(!$ret){
-            Log::record("updateMember fail : out_trade_no={$out_trade_no}",Log::ERR);
-        }
-    } else if ($trade_status == 'WAIT_BUYER_PAY') {
+    }
+    else if ($trade_status == 'WAIT_BUYER_PAY') {
 
     }
     echo("success"); // 交易正确时,返回success

+ 5 - 9
mobile/control/app_pay.php

@@ -265,22 +265,18 @@ class app_payControl extends mbMemberControl
     }
 
     public static function check_fee($pay_sn,$total_fee,&$need_pay)
-    { //todo check_fee is error
+    {
         $logic_payment = Logic('payment');
         $result = $logic_payment->getRealOrderInfo($pay_sn);
 
         if (intval($result['data']['api_pay_state']) != 0) {
-            $val = intval($result['data']['api_pay_state']);
             return false;
         }
 
-        $need_pay = $result['data']['api_pay_amount'];
-        if(bccomp($result['data']['api_pay_amount'],$total_fee,2) == 0) {
-            return true;
-        } else {
-            Log::record("check_fee error.",Log::ERR);
-            return false;
-        }
+        $need_pay = intval($result['data']['api_pay_amount'] * 100);
+        $total_fee = intval($total_fee * 100);
+
+        return ($need_pay === $total_fee);
     }
 
     /**

+ 0 - 21
request_helper.php

@@ -213,13 +213,6 @@ class request_helper
         {
             $param = fcgi_getparam($field);
             $_SERVER[$field] = $param;
-
-//            try {
-//                $param = fcgi_getparam($field);
-//                $_SERVER[$field] = $param;
-//            } catch(Exception $e){
-//                Log::record($e->getTraceAsString(),Log::ERR);
-//            }
         }
     }
 
@@ -234,20 +227,6 @@ class request_helper
     static public function fill_param()
     {
         $method = strtolower(request_helper::method());
-
-        if(!array_key_exists('act',$_GET)) {
-            $_GET['act'] = 'index';
-        }
-        if(!array_key_exists('op',$_GET)) {
-            $_GET['op'] = 'index';
-        }
-        if(!array_key_exists('act',$_POST)) {
-            $_POST['act'] = 'index';
-        }
-        if(!array_key_exists('op',$_POST)) {
-            $_POST['op'] = 'index';
-        }
-
         if ($method == 'get') {
             $squery = request_helper::query_string();
         } else {