Browse Source

增加充值到账验证

jason 11 months ago
parent
commit
9eb7b010c5

+ 3 - 1
application/common/logic/MyBscApi.php

@@ -15,7 +15,7 @@ use think\Log;
  */
 class MyBscApi
 {
-    protected $urls = 'https://payment.seso.chat/';
+    protected $urls = 'https://pay.jiaxianbao.com/';
     protected $api_id = 1004;
     protected $api_pwd = 'er`kd34.df';
     protected $bnb_fee = 0.005;
@@ -272,6 +272,8 @@ class MyBscApi
      */
     private  function curlPostData($url , $data=array())
     {
+        dump($url);
+        dump($data);
         $headers = array("Content-type:application/x-www-form-urlencoded;charset=UTF-8");
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);

+ 19 - 16
application/common/logic/OrderPay.php

@@ -5,6 +5,7 @@ namespace app\common\logic;
 use app\common\library\Log;
 use app\common\model\LedgerOrderPayLogModel;
 use app\common\model\LedgerOrderPayModel;
+use app\common\model\LedgerTokenChangeModel;
 use app\common\model\LedgerWalletModel;
 use app\common\model\OfflineRechargePayLogModel;
 use app\common\model\OfflineRechargeRecordModel;
@@ -89,25 +90,22 @@ class OrderPay
                     case 1://产品
                         $uid   = $item['user_id'];
                         $amount= $item['amount'];
-                        $power = $item['power'];
+                        $num = $item['cha_bao'];
 
                         // 启动事务
                         Db::startTrans();
                         try {
-                            // 更新总算力和账变
-                            (new LedgerWalletModel)->changeWalletAccount($uid, Asset::POWER, $power, Action::PowerRentalPower, $item['id']);
-
-//                            // 更新服务器算力,不账变
-//                            (new LedgerWalletModel)->changeWalletOnly($uid, Asset::RENTAL_POWER, $power);
-
-                            // 更新自己(有效会员时间)和所有上级的信息(有效直推人数和团队总算力)
-                            (new UserModel())->updateForRental($uid, $power);
-
-//                            // 发放直推USDT收益
-                            (new LedgerWalletModel)->sendUsdtProfit($uid, $amount);
-
-                            // 发放直推算力收益
-                            (new LedgerWalletModel)->sendDirectProfit($uid, $power);
+                            //充值茶宝
+                            (new LedgerWalletModel)->changeWalletAccount($uid, Asset::TOKEN, $num, LedgerTokenChangeModel::Recharge, $item['id']);
+//
+//                            // 更新自己(有效会员时间)和所有上级的信息(有效直推人数和团队总算力)
+//                            (new UserModel())->updateForRental($uid, $power);
+//
+////                            // 发放直推USDT收益
+//                            (new LedgerWalletModel)->sendUsdtProfit($uid, $amount);
+//
+//                            // 发放直推算力收益
+//                            (new LedgerWalletModel)->sendDirectProfit($uid, $power);
 
 //                            // 间推奖
 //                            (new LedgerWalletModel)->sendGenerateProfit($uid, $amount);
@@ -137,6 +135,11 @@ class OrderPay
  */
     public function updateOrderPayStatus($pay_info, $to_address)
     {
+        $pay_info['from_address'] = strtolower($pay_info['from_address']);
+        if($pay_info['from_address'] != strtolower($pay_info['user_info']['address'])){
+            return _error('from_adress不一致:用户地址:' . $pay_info['user_info']['address'] . ',充值表地址' . $pay_info['from_address']);
+        }
+
         $get_transaction_info = (new MyBscApi())->getInfoByTransactionHash($pay_info['tx_hash']);
         if($get_transaction_info['code'] == 0){
             return $get_transaction_info;
@@ -146,7 +149,7 @@ class OrderPay
         if(!$hash_info['success']){
             return _error('交易失败');
         }
-        $pay_info['from_address'] = strtolower($pay_info['user_info']['address']);
+        //$pay_info['from_address'] = strtolower($pay_info['user_info']['address']);
         $pay_info['to_address']   = strtolower($to_address);
 
         $hash_info['from_address']   = strtolower($hash_info['from_address']);

+ 3 - 1
application/common/model/LedgerTokenChangeModel.php

@@ -8,7 +8,8 @@ class LedgerTokenChangeModel extends Model
 {
 
     protected $name = "ledger_token_change";
-    const SysSend           = 100;
+    const Recharge          = 100;
+    const SysSend           = 105;
     const Exchange          = 101;
     const WithdrawCash      = 102;
     const WithdrawReturn    = 103;
@@ -18,6 +19,7 @@ class LedgerTokenChangeModel extends Model
      */
     public $aciton_name = [
         '-1'                    => '全部',
+        self::Recharge          => '充值',
         self::SysSend           => '今日产出',
         self::Exchange          => '兑换',
         self::WithdrawCash      => '提现',