Bläddra i källkod

Merge branch 'dev' of http://ylsjtt.game7000.com:3000/YLSJ/jzhj2024server into dev

cyzhao 5 månader sedan
förälder
incheckning
0c68d8a5a7

+ 4 - 3
Gameserver/App/Services/AppServer.php

@@ -61,7 +61,7 @@ class AppServer {
      * 后处理逻辑
      * @param Resp $resp
      */
-    private static function AfterProc(&$resp) {
+    static function AfterProc(&$resp) {
         if (req()->cmd != CmdCode::cmd_user_delUserUid) {
             if (req()->userInfoChanged || (null != ctx() && ctx()->NeedSave())) {   # 回写玩家数据
                 if (!UserProc::setUserInfo(ctx())) {                                # 失败, 改写返回值
@@ -70,8 +70,9 @@ class AppServer {
             }
         }
 
-        $resp->AfterProc();
-
+        if (null != $resp) {                                                    # resp后处理
+            $resp->AfterProc();
+        }
         self::LogCmdMongo($resp);                                               # 向MongoDB写入操作日志
 //        CLog::flush();                                                          # flush日志
         return true;

+ 2 - 1
Gameserver/App/index.php

@@ -142,7 +142,8 @@ class Index {
             $err = ErrCode::err_innerfault;
         }
         $resp = Resp::err($err, $msg);
-        $resp->AfterProc();
+//        $resp->AfterProc();
+        AppServer::AfterProc($resp);                                            # 后处理
         exit(Index::OverPass($resp));                                           # 直接返回错误信息
     }
 }

+ 23 - 22
Gameserver/App/service_call/pay/Mo/payRequest.php

@@ -134,6 +134,7 @@ class PayRequest extends loyalsoft\Object_ext {
         unset($arr['order_id']);
         unset($arr['ageRange']);
         unset($arr['product_desc']);
+        unset($arr['clientVer']);
         $n = loyalsoft\daoInst()->update(self::orderTab)
                 ->data($arr)
                 ->where('id')->eq($this->order_id)
@@ -205,20 +206,20 @@ class PayRequest extends loyalsoft\Object_ext {
         $infoArr = array();
         \loyalsoft\CLog::pay($params);
         $callbackInfo = $params['developerPayload'];
-        $infos = explode(',', $callbackInfo);                                                                                                                                     # uid,zoneid,cpOrderId,productId
+        $infos = explode(',', $callbackInfo);                                                                          # uid,zoneid,cpOrderId,productId
 
         $infoArr['orderId'] = $params['orderId'];
-        $infoArr['accountId'] = $infos[0];                                                                                                                                         # uid
-        $infoArr['amount'] = number_format($params['price'] / 100, 2, '.', ''); # 分转元                                                                                                                               # 华为给过来是分, 这里先转换为元, 入库时再统一以分为单位
-        $infoArr['currency'] = $params['currency'];                                                                                                                         # 如果是海外会有不同的货币类型
+        $infoArr['accountId'] = $infos[0];                                                                             # uid
+        $infoArr['amount'] = number_format($params['price'] / 100, 2, '.', ''); # 分转元                               # 华为给过来是分, 这里先转换为元, 入库时再统一以分为单位
+        $infoArr['currency'] = $params['currency'];                                                                    # 如果是海外会有不同的货币类型
         $infoArr['product_id'] = $params['productId'];
         $infoArr['product_count'] = 1;
-        $infoArr['channel'] = "huawei";                                                                                                                                            # 华为
-        $infoArr['zoneid'] = (int) $infos[1];                                                                                                                                       # 分区信息
+        $infoArr['channel'] = "huawei";                                                                                # 华为
+        $infoArr['zoneid'] = (int) $infos[1];                                                                          # 分区信息
         $infoArr['callbackInfo'] = $callbackInfo;
 
         $o = new payRequest($infoArr);
-        $o->cpOrderId = $infos[2];                                                                                                                                                  # 重新修订下cpOrderId
+        $o->cpOrderId = $infos[2];                                                                                     # 重新修订下cpOrderId
         return $o;
     }
 
@@ -248,13 +249,13 @@ class PayRequest extends loyalsoft\Object_ext {
                 exit('{"err":1,"msg":"金额不符!"}');
             }
         }
-        loyalsoft\daoInst()->insert(self::orderTab)                                                                                                                          # 创建一个新的订单
+        loyalsoft\daoInst()->insert(self::orderTab)                                                                 # 创建一个新的订单
                 ->data(array('order_ts' => loyalsoft\now()))
                 ->exec();
-        $this->order_id = loyalsoft\daoInst()->select('last_insert_id() as id')->fetch('id');                                                           # 取刚才创建的订单的自增id
-        $this->cpOrderId = LoyalsoftAPPID . \date('ymdHi') . substr(sprintf("%1$06d", $this->order_id), -6);                          # 商户唯一id(尾部附加自增id后6位数)
-        $this->callbackInfo .= "," . $this->cpOrderId;                                                                                                                     # 将cpOrderId追加到透传参数中
-        $this->notifyUrl = $this::get_notify_url();                                                                                                                              # 自动提取支付回调地址
+        $this->order_id = loyalsoft\daoInst()->select('last_insert_id() as id')->fetch('id');                       # 取刚才创建的订单的自增id
+        $this->cpOrderId = LoyalsoftAPPID . \date('ymdHi') . substr(sprintf("%1$06d", $this->order_id), -6);        # 商户唯一id(尾部附加自增id后6位数)
+        $this->callbackInfo .= "," . $this->cpOrderId;                                                              # 将cpOrderId追加到透传参数中
+        $this->notifyUrl = $this::get_notify_url();                                                                 # 自动提取支付回调地址
     }
 
     /**
@@ -285,24 +286,24 @@ class PayRequest extends loyalsoft\Object_ext {
         $amt = $this->amount;
 
         if (isset($uid) && isset($ageRange)) {
-            $monthTS = loyalsoft\TimeUtil::tsMonthBegin();                                                             # 本月初起始时间戳
-            $dayTS = loyalsoft\TimeUtil::tsDayBegin();                                                                       # 当天起始时间戳
+            $monthTS = loyalsoft\TimeUtil::tsMonthBegin();                                                           # 本月初起始时间戳
+            $dayTS = loyalsoft\TimeUtil::tsDayBegin();                                                               # 当天起始时间戳
             $monthTotal = loyalsoft\daoInst()
-                    ->select("sum(`amount`)/100 as total")                                                                         # 总金额(单位:分转元)
+                    ->select("sum(`amount`)/100 as total")                                                           # 总金额(单位:分转元)
                     ->from(self::orderTab)
-                    ->where("uid")->eq($uid)                                                                                               # 该玩家
-                    ->andWhere("status")->eq(1)                                                                                         # 成交订单
-                    ->andWhere("order_ts")->ge($monthTS)                                                                      # 本月
+                    ->where("uid")->eq($uid)                                                                         # 该玩家
+                    ->andWhere("status")->eq(1)                                                                      # 成交订单
+                    ->andWhere("order_ts")->ge($monthTS)                                                             # 本月
                     ->fetch('total');
             if (!is_numeric($monthTotal)) {
                 $monthTotal = 0;
             }
             $dayTotal = loyalsoft\daoInst()
-                    ->select("sum(`amount`)/100 as total")                                                                         # 总金额(单位:分转元)
+                    ->select("sum(`amount`)/100 as total")                                                           # 总金额(单位:分转元)
                     ->from(self::orderTab)
-                    ->where("uid")->eq($uid)                                                                                               # 该玩家
-                    ->andWhere("status")->eq(1)                                                                                        # 成交订单
-                    ->andWhere("order_ts")->ge($dayTS)                                                                           # 今日
+                    ->where("uid")->eq($uid)                                                                         # 该玩家
+                    ->andWhere("status")->eq(1)                                                                      # 成交订单
+                    ->andWhere("order_ts")->ge($dayTS)                                                               # 今日
                     ->fetch('total');
             if (!is_numeric($dayTotal)) {
                 $dayTotal = 0;

+ 3 - 1
Gameserver/App/service_call/pay/official/alipay/notify.php

@@ -25,7 +25,9 @@ if ($flag) {
         if ($order->Check()) {                                                  # 订单校验, 1代表支付成功
             if ($order->status == 1) {                                          # 订单状态是成功
                 $order->UpdateOrderStatus();                                    # 更新订单状态,->已付款
-//                loyalsoft\TapDBUtil::PushPayEvent($order, 'alipay');            # 向tapdb推送充值记录
+//                if (PLAT == 'tap') {
+                loyalsoft\TapDBUtil::PushPayEvent($order, 'alipay');        # 向tapdb推送充值记录
+//                }
                 CLog::pay("[notify.zfb] [发货] " . $order->cpOrderId . " >>> " . $order->amount);
             } else if ($order->status == 2) {                                   # status为2(failed)的情况
                 $order->UpdateOrderStatus();                                    # 直接更新订单状态,->支付失败

+ 3 - 1
Gameserver/App/service_call/pay/official/wxpay/notify.php

@@ -63,7 +63,9 @@ class PayNotifyCallBack extends WxPayNotify {
         }
         if ($order->status == 1) {                                              # 订单状态是成功 1代表支付成功
             $order->UpdateOrderStatus();                                        # [数据库操作]更新订单状态,->已付款
-//            loyalsoft\TapDBUtil::PushPayEvent($order, 'wxpay');                 # 向tapdb推送充值记录
+//            if (PLAT == 'tap') {
+            loyalsoft\TapDBUtil::PushPayEvent($order, 'wxpay');                 # 向tapdb推送充值记录
+//            }
             CLog::pay("[notify.wx] [发货] " . $order->cpOrderId . " >>> " . $order->amount);
             $msg = "success";
             return true;

+ 2 - 3
Gameserver/App/util/tapdb/TapDBUtil.php

@@ -47,8 +47,8 @@ class TapDBUtil {
 
     public static function TestPay() {
         $args = [];
-        $args['openid'] = 'oEW_p0gt1shMJMY4S2KiUSaLxNp0_yyb'; // openid                                    # 玩家uid(不带_yyb)
-        $args['amt'] = 600;                                              # 支付金额, 游戏后台统一单位是分
+        $args['openid'] = 'oEW_p0gt1shMJMY4S2KiUSaLxNp0_yyb'; // openid         # 玩家uid(不带_yyb)
+        $args['amt'] = 600;                                                     # 支付金额, 游戏后台统一单位是分
         $args['appmeta'] = 'oEW_p0gt1shMJMY4S2KiUSaLxNp0_yyb,1,1022304201408000815*qbqd*wechat';
         $order = pay\OrderNotice::Parse_ysdkOrder($args);
         self::PushPayEvent($order, 'yyb');
@@ -109,5 +109,4 @@ class TapDBUtil {
 
         return $ok;
     }
-
 }

+ 7 - 8
Gameserver/App/util/tapdb/TapDB_config.php

@@ -28,16 +28,15 @@ class TapDB_config {
     }
 
     private function __construct() {
-        $arr = [Enum_Plat::Online, Enum_Plat::Online_yyb, Enum_Plat::Online_hw];
+        $arr = [Enum_Plat::Online_tap];
         if (in_array(PLAT, $arr)) {                                                    // 正式
-            $this->gameClientId = "zof26AtQDfSoOUjMeY";                         // appid
-            $this->gameToken = "InclpY9ioQeKSt40yZNjcp1uPOJ8lqCHPgmaZTUb";      // 客户端接口秘钥
-            $this->serverToken = "lSFgVNpsYbxGlV4MRfhdyS8rEeusd2j4";            // 服务端接口秘钥
+            $this->gameClientId = "ltbfeedazslnjfqnfy";                         // appid
+            $this->gameToken = "TQ2IectpHd5PnTS9XVlNsytSTaVrFUagXzHURYAE";      // 客户端接口秘钥
+            $this->serverToken = "lNSO2E41b7zjTVcHbTxzs2KBGjjFpwj8";            // 服务端接口秘钥
         } else {                                                                // 测试
-            $this->gameClientId = "TNFmYW7SBavcZk5lU2";                         // appid
-            $this->gameToken = "x2jdwJFyH48hAIl47c7swZTIA49Dq5MQoglAUYb5";      // 客户端接口秘钥
-            $this->serverToken = "ptVLcjXr1YiW2dL4J2llRHKlisA5GgUg";            // 服务端接口秘钥
+            $this->gameClientId = "ltbfeedazslnjfqnfy";                         // appid
+            $this->gameToken = "TQ2IectpHd5PnTS9XVlNsytSTaVrFUagXzHURYAE";      // 客户端接口秘钥
+            $this->serverToken = "lNSO2E41b7zjTVcHbTxzs2KBGjjFpwj8";            // 服务端接口秘钥
         }
     }
-
 }