瀏覽代碼

标记转账

afa 7 月之前
父節點
當前提交
9db9f5be6d

+ 2 - 6
application/admin/controller/offline/OfflineWithdraw.php

@@ -5,7 +5,7 @@ namespace app\admin\controller\offline;
 use app\common\controller\Backend;
 use app\common\logic\BscApi;
 use app\common\logic\KangApi;
-use app\common\logic\MyBscApi;
+use app\common\model\LedgerTokenChangeModel;
 use app\common\model\LedgerWalletModel;
 use app\common\model\OfflineWithdrawRecordModel;
 use app\common\model\UserModel;
@@ -13,13 +13,9 @@ use Exception;
 use fast\Action;
 use fast\Asset;
 use fast\WithdrawStatus;
-use think\Cache;
 use think\Db;
 use think\Env;
 use think\exception\DbException;
-use think\Model;
-use app\api\controller\Offline as OfflineApi;
-use think\Lang;
 use think\response\Json;
 
 /**
@@ -145,7 +141,7 @@ class OfflineWithdraw extends Backend
             
             // 拒绝时,将提交的金额退回到用户余额里
             if ($params['status'] == OfflineWithdrawRecordModel::StatusReturn) {
-                (new LedgerWalletModel())->changeWalletAccount($row['user_id'], Asset::TOKEN, $row['amount'], LedgerWalletModel::Return);
+                (new LedgerWalletModel())->changeWalletAccount($row['user_id'], Asset::TOKEN, $row['amount'], LedgerTokenChangeModel::Return);
             }
             Db::commit();
         } catch (\Exception $e) {

+ 2 - 2
application/admin/controller/user/User.php

@@ -4,7 +4,7 @@ namespace app\admin\controller\user;
 
 use app\common\controller\Backend;
 use app\common\model\LedgerWalletModel;
-use app\common\model\TeamLevelModel;
+use app\common\model\LedgerTokenChangeModel;
 use app\common\model\UserModel;
 use Exception;
 use fast\GoogleAuthenticator;
@@ -134,7 +134,7 @@ class User extends Backend
         try {
             // 更新茶宝
             if (bccomp($newPower, 0, 6) !== 0) {
-                (new LedgerWalletModel)->changeWalletAccount($ids, Asset::TOKEN, $newPower, LedgerWalletModel::System);
+                (new LedgerWalletModel)->changeWalletAccount($ids, Asset::TOKEN, $newPower, LedgerTokenChangeModel::System);
 
             }
             // 提交事务

+ 2 - 0
application/admin/lang/zh-cn/general/config.php

@@ -93,4 +93,6 @@ return [
     'Pv rate'                              => '直推收益比例',
     'Chabao giveaway'                      => '茶宝赠送比例',
     'Chabao giveaway txt'                  => '茶宝赠送描述',
+    'Frozen transfer'                      => '标记茶宝转账手续费', 
+    'Frozen transfer txt'                  => '标记茶宝转账描述',
 ];

+ 2 - 2
application/api/controller/Airdrop.php

@@ -8,7 +8,7 @@ use app\api\logic\WelfareLoginc;
 use app\common\model\UserModel;
 use app\common\controller\Api;
 use app\common\model\UserWelfare;
-use think\Db;
+use app\common\model\LedgerTokenChangeModel;
 use app\common\model\LedgerWalletModel;
 use app\common\model\ProductOrder;
 //空投
@@ -73,7 +73,7 @@ class Airdrop extends Api
         Db::startTrans();
         try {
             //把9.9茶宝转入冻结账号
-            if($row->frozen > 0) (new LedgerWalletModel)->sendUserSubFrozen($this->auth->id, $row->frozen, LedgerWalletModel::Super, '-');
+            if($row->frozen > 0) (new LedgerWalletModel)->sendUserSubFrozen($this->auth->id, $row->frozen, LedgerTokenChangeModel::Super, '-');
 
             //添加Rwa茶记录
             $result = WelfareLoginc::setUserWelfareLos($this->auth->id, $row->super_product_id, $row->super_num, time(), $this->lan, $productOrder::Super);

+ 54 - 47
application/api/controller/Ledger.php

@@ -36,7 +36,7 @@ class Ledger extends Api
         $res['assets']        = $wallet->token;
         $res['transfes_fee']  = $config['transfer_fee'];  //转让手续费比例
         $res['transfes_txt']  = $config['transfes_txt'];   //转让文字表述
-        $res['chabao_rate']  = $config['chabao_rate'];    //茶宝汇率
+        $res['chabao_rate']   = $config['chabao_rate'];    //茶宝汇率
         $res['withdrawal_next_fee']  = $config['withdrawal_next_fee'];  //600以下提现收费
         $res['withdrawal_up_fee']    = $config['withdrawal_up_fee'];    //600以上提现收费
         $res['coin_list'] = [
@@ -44,13 +44,17 @@ class Ledger extends Api
                 'coin_name' => '茶宝',
                 'coin_key'  => 'token', 
                 'amount'    => $wallet->token,
-                'frozen_amount'=> $wallet->frozen //冻结金额
-            ],
-            [
+                'frozen_amount'=> 0 //冻结金额
+            ],[
                 'coin_name' => 'Teac',
                 'coin_key'  => 'teac', 
                 'amount'    => $wallet->teac,
                 'frozen_amount'=> 0 //冻结金额
+            ],[
+                'coin_name' => '茶宝(标记账户)',
+                'coin_key'  => 'frozen', 
+                'amount'    => $wallet->frozen,
+                'frozen_amount'=> 0 //冻结金额
             ]
         ];
         $this->success('', $res);
@@ -60,7 +64,7 @@ class Ledger extends Api
      * 资产变动明细
      * @return void
      */
-    public function coinList(LedgerWalletModel $ledgerWalletModel)
+    public function coinList()
     {
         $type_id  = $this->request->post('query.action'); // 账变类型
         $coin_type  = $this->request->post('query.coin_type'); // 資金类型
@@ -73,15 +77,14 @@ class Ledger extends Api
             case 'teac':
                 $paginator = Loader::model('LedgerTeacChangeModel');
                 $res['data'] = $paginator->where($where)->order('id DESC')->paginate($this->pageSize);
-                $res['statusList'] = $paginator::getStatusList();
                 break;
             case 'token':
-                $res['data'] = Loader::model('LedgerTokenChangeModel')->alias('a')
+                $paginator = Loader::model('LedgerTokenChangeModel');
+                $res['data'] = $paginator->alias('a')
                     ->join('user u', 'a.from_id = u.id and a.action > 9 and a.action < 12', 'LEFT')
                     ->field('a.*, u.address')
                     ->where($where)
                     ->order('a.id DESC')->paginate($this->pageSize);
-                $res['statusList'] = LedgerWalletModel::getStatusList();
                 break;
             case 'smh':
                 $paginator = (new LedgerSmhChangeModel());
@@ -93,50 +96,68 @@ class Ledger extends Api
                 $this->error(__('Invalid parameters'));
                 break;
         }
+        $res['statusList'] = $paginator::getStatusList();
         $this->success('',$res);
     }
 
     /**
-     * 资产变动类型
+     * Teac资产转账
      * @return void
      */
-    public function coinAction()
+    public function freezeTransfer(UserModel $userModel,  LedgerWalletModel $ledgerWalletModel)
     {
-        $coin_type  = $this->request->post('coin_type'); // 資金类型
-        switch ($coin_type){
-            case 'smh':
-                $res = (new LedgerSmhChangeModel())->pay_status;//资金变动类型列表
-                break;
-            case 'qubic':
-                $res = (new LedgerQubicChangeModel())->aciton_name;//资金变动类型列表
-                break;
-            case 'aleo':
-                $res = (new LedgerTokenChangeModel())->aciton_name;//资金变动类型列表
-                break;
-            default:
-                $res = Action::getAll($coin_type);//资金变动类型列表
-                break;
+        $amount = $this->request->post('amount'); // 茶宝
+        $address = $this->request->post('address'); // 地址
+        if(empty($amount) || empty($address)){
+            $this->error(__('Parameter error'));
         }
-        $this->success('',$res);
+        $real   = bcsub($amount, bcmul(getConfig('frozen_transfer'), $amount, 2), 2) ; // 手续费
+
+        // 启动事务
+        Db::startTrans();
+        try {
+
+            $user = $userModel->getByAddress($address);
+            if(empty($user)) throw new Exception(__("赠送用户不存在"));    
+            if($user['id'] == $this->auth->id) throw new Exception(__("赠送用户不能是自己"));
+
+            $freeze = $ledgerWalletModel::getWalletFrozen($this->auth->id);
+            //剩余冻结金额
+            $available = bcsub($freeze, config('min_frozen'), 2);
+            if(bccomp($amount, $available, 2) > 0) throw new Exception(__("余额不足请前往充值"), 15001);
+            
+            // 更新USDT和账变
+            $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::FROZEN, -$amount, LedgerTokenChangeModel::FroTrans, $user['id']);
+
+            $ledgerWalletModel->changeWalletAccount($user['id'], Asset::FROZEN, $real, LedgerTokenChangeModel::FroRecei, $this->auth->id);
+            // 提交事务
+            Db::commit();
+        } catch (Exception $e) {
+            // 回滚事务
+            Db::rollback();
+            $this->error($e->getMessage(), null, $e->getCode());
+        }
+        $this->success('ok');
     }
 
 
+
+
     /**
-     * 茶宝赠送明细 
+     * 赠送/转账明细
      * @return void
      */
-    public function chabao()
+    public function getGiftDesc()
     {
-        $this->success('', ['value' => getConfig('chabao_giveaway'), 'text' => getConfig('chabao_giveaway_txt')]);
+        $this->success('', ['chabao'=>['value' => getConfig('chabao_giveaway'), 'text' => getConfig('chabao_giveaway_txt')], 
+        'frozen'=>['value' => getConfig('frozen_transfer'), 'text' => getConfig('frozen_transfer_txt')]]);
     }
-
     /**
      * 茶宝赠送
      * @return void
      */
     public function chabaoGift(UserModel $userModel,  LedgerWalletModel $ledgerWalletModel)
     {
-   
         $amount = $this->request->post('amount'); // 茶宝
         $address = $this->request->post('address'); // 地址
         if(empty($amount) || empty($address)){
@@ -155,9 +176,9 @@ class Ledger extends Api
             if(bccomp($amount, $chabao, 2) > 0) throw new Exception(__("余额不足请前往充值"), 15001);
         
             // 更新USDT和账变
-            $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$amount, $ledgerWalletModel::GiftPay, $user['id']);
+            $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$amount, LedgerTokenChangeModel::GiftPay, $user['id']);
 
-            $ledgerWalletModel->changeWalletAccount($user['id'], Asset::TOKEN, $real, $ledgerWalletModel::GiftReceipt, $this->auth->id);
+            $ledgerWalletModel->changeWalletAccount($user['id'], Asset::TOKEN, $real, LedgerTokenChangeModel::GiftReceipt, $this->auth->id);
             // 提交事务
             Db::commit();
         } catch (Exception $e) {
@@ -168,25 +189,11 @@ class Ledger extends Api
         $this->success('ok');
     }
 
-    /**
-     * 虚拟币明细
-     * @return void
-     */
-    public function tokenList()
-    {
-        $type  = $this->request->post('query.action'); // 账变类型
-        $where = ['user_id' => $this->auth->getTokenUserID()];
-        if ($type != Action::All) {
-            $where['action'] = $type;
-        }
-        $paginator = (new LedgerTokenChangeModel())->where($where)->order('id DESC')->paginate($this->pageSize);
-        $this->success('', $this->buildResp($paginator->total(), $paginator->currentPage(), $paginator->items()));
-    }
+
 
     /**
      * 提现自动打款回调
      * 接口回调信息格式:
-     *
      * @return void
      */
     public function withdrawCallback_my()

+ 2 - 2
application/api/controller/Offline.php

@@ -8,7 +8,7 @@ use app\common\library\Token;
 use app\common\model\LedgerWalletModel;
 use app\common\model\OfflineRechargeRecordModel;
 use app\common\model\OfflineWithdrawRecordModel;
-use app\common\model\ParametersModel;
+use app\common\model\LedgerTokenChangeModel;
 use app\common\model\UserModel;
 use fast\Action;
 use fast\Asset;
@@ -80,7 +80,7 @@ class Offline extends Api
         Db::startTrans();
         try {
             // 更新USDT和账变
-            (new LedgerWalletModel())->changeWalletAccount($uid, Asset::TOKEN, -$amount, LedgerWalletModel::Withdraw);
+            (new LedgerWalletModel())->changeWalletAccount($uid, Asset::TOKEN, -$amount, LedgerTokenChangeModel::Withdraw);
 
             // 创建提现记录
             $txHash = Random::uuid();

+ 7 - 6
application/api/controller/Order.php

@@ -10,6 +10,7 @@ use app\common\model\ProductArea;
 use app\common\model\LedgerWalletModel;
 use app\common\model\UserArea;
 use app\common\model\UserModel;
+use app\common\model\LedgerTokenChangeModel;
 use app\common\model\OfflineRechargeRecordModel;
 use Exception;
 use fast\Asset;
@@ -52,12 +53,12 @@ class Order extends Api
                 $result =$productOrder::setPopularNoAreaOrder($areaNum, $params['order_id'], $order_info->price, $params['product_id'], $this->auth->id,ProductOrder::Popular);
             
             //余额记录
-            $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$totalPrice, $ledgerWalletModel::Popular, $this->auth->id);
+            $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$totalPrice, LedgerTokenChangeModel::Popular, $this->auth->id);
 
             //直推收益: pv* ×10%
             if($order_info['pv'] > 0 && $this->auth->parent_id > 0 && $userModel::getUserRwaNum($this->auth->parent_id) > 0){
                 $pv = bcmul(($order_info['pv'] * $areaNum), getConfig('pv_rate'), 2);
-                if($pv > 0) $ledgerWalletModel->changeWalletAccount($this->auth->parent_id, Asset::TOKEN, $pv, $ledgerWalletModel::Direct, $this->auth->id);
+                if($pv > 0) $ledgerWalletModel->changeWalletAccount($this->auth->parent_id, Asset::TOKEN, $pv, LedgerTokenChangeModel::Direct, $this->auth->id);
                 //社区奖励
                 $pvs = bcmul(($order_info['pv'] * $areaNum), config('community_ratio'), 2);
                 if($pvs > 0)$userModel::setCommunityRewards($this->auth->id, $pvs, Asset::TOKEN);
@@ -105,7 +106,7 @@ class Order extends Api
             if($order_info->popular_price > config('min_rwa_price')) $userModel::updateForRwaNum($order_info->user_id, $userModel::getByParentId($order_info->user_id), 1, '-');
 
             //扣除运费
-            if($order_info->freight > 0) $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$order_info->freight, $ledgerWalletModel::Freight, $this->auth->id);
+            if($order_info->freight > 0) $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$order_info->freight, LedgerTokenChangeModel::Freight, $this->auth->id);
 
             $order_info->status= $productOrder::Shipped; 
             $order_info->save();
@@ -178,12 +179,12 @@ class Order extends Api
             $productOrder::setCreateOrder($params['order_id'], $order_info, $productOrder::Transfer, $this->auth->id, $order_info['user_id'], $popular_order->order_no, $order_info['fees'], $popular_order->popular_price);
            
             //扣除余额记录 
-            $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$order_info['price'], $ledgerWalletModel::Payment, $order_info['user_id']);
+            $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$order_info['price'], LedgerTokenChangeModel::Payment, $order_info['user_id']);
             
 
             //增加转让人余额
             $amount = bcsub($order_info['price'], $order_info['fees'], 2);
-            $ledgerWalletModel->changeWalletAccount($order_info['user_id'], Asset::TOKEN, $amount, $ledgerWalletModel::Receive, $this->auth->id);
+            $ledgerWalletModel->changeWalletAccount($order_info['user_id'], Asset::TOKEN, $amount, LedgerTokenChangeModel::Receive, $this->auth->id);
 
             if($popular_order->popular_price > config('min_rwa_price')) {
                 //扣除转让人Rwa有效  
@@ -234,7 +235,7 @@ class Order extends Api
             if($order_info->popular_price > config('min_rwa_price')) $userModel::updateForRwaNum($user['id'], $userModel::getByParentId($user['id']), 1, '+');
 
             //扣除手续费
-            $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$fees, $ledgerWalletModel::Giveaway, $user['id']);
+            $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$fees, LedgerTokenChangeModel::Giveaway, $user['id']);
 
             //扣除Rwa有效-1
             if($order_info->popular_price > config('min_rwa_price')) $userModel::updateForRwaNum($this->auth->id, $this->auth->parent_id, 1, '-');

+ 3 - 3
application/api/controller/User.php

@@ -121,15 +121,15 @@ class User extends Api
         Db::startTrans();
         try {
             $list['total'] = $ledgerTokenChangeModel::where('user_id', $this->auth->id)
-                            ->where('action', $ledgerWalletModel::Share)
+                            ->where('action', $ledgerTokenChangeModel::Share)
                             ->sum("change_amount");
 
             $list['data']  = $ledgerTokenChangeModel::where('user_id', $this->auth->id)
-                            ->where('action', $ledgerWalletModel::Share)
+                            ->where('action', $ledgerTokenChangeModel::Share)
                             ->order('id desc')
                             ->paginate($this->pageSize);
 
-            $list['statusList'] = $ledgerWalletModel::getStatusList();
+            $list['statusList'] = $ledgerTokenChangeModel::getStatusList();
             // 提交事务
             Db::commit();
         } catch (Exception $e) {

+ 0 - 3
application/common/logic/AirdropLogic.php

@@ -8,9 +8,6 @@ use app\common\model\ProductOrder;
 use app\common\model\UserAirdrop;
 use app\api\logic\WelfareLoginc;
 use app\common\model\ProductPopular;
-use app\common\model\LedgerTokenChangeModel;
-use app\common\model\LedgerWalletModel;
-use app\common\model\TimedTaskLogModel;
 use app\common\model\UserModel;
 use app\common\model\UserPathModel;
 use app\common\model\UserWelfare;

+ 3 - 3
application/common/logic/BonusRewardsLogic.php

@@ -3,7 +3,7 @@
 
 namespace app\common\logic;
 
-use app\common\model\EtcWithdrawRecordModel;
+use app\common\model\ledgerTokenChangeModel;
 use app\common\model\LedgerWalletModel;
 use app\common\model\ProductOrder;
 use app\common\model\UserModel;
@@ -76,7 +76,7 @@ class BonusRewardsLogic
         $recharge_count  = count($recharge_record);//总人数
         $pv = bcdiv(bcmul($bonus, config('service_ratio')), $recharge_count, 2); //收益
         foreach ($recharge_record as $info) {
-            $ledgerWalletModel->changeWalletAccount($info->id, Asset::TOKEN, $pv, $ledgerWalletModel::Service, 0);
+            $ledgerWalletModel->changeWalletAccount($info->id, Asset::TOKEN, $pv, ledgerTokenChangeModel::Service, 0);
         }
         //2.共享津贴收益
         $rewards_record = UserModel::where('rwa_num', '>', 4)->column('id');
@@ -84,7 +84,7 @@ class BonusRewardsLogic
             $rewards_count  = count($rewards_record);//总人数
             $pvs = bcdiv(bcmul($bonus, config('together_ratio')), $rewards_count, 2); //收益
             foreach ($rewards_record as $info) {
-                $ledgerWalletModel->changeWalletAccount($info, Asset::TOKEN, $pvs, $ledgerWalletModel::Together, 0);
+                $ledgerWalletModel->changeWalletAccount($info, Asset::TOKEN, $pvs, ledgerTokenChangeModel::Together, 0);
             }
         }
         return $log_id;

+ 1 - 9
application/common/logic/OrderPay.php

@@ -2,24 +2,16 @@
 
 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;
 use app\common\model\OfflineRechargeVerifyModel;
-use app\common\model\ParametersModel;
-use app\common\model\UserModel;
-use app\common\model\ServersModel;
 use Exception;
 use fast\Action;
 use fast\Asset;
 use fast\Http;
-use fast\RechargeOrderType;
-use fast\RechargeStatus;
-use fast\RechargeType;
 use think\Config;
 use think\Db;
 use think\Env;

+ 0 - 11
application/common/model/LedgerServersPowerChangeModel.php

@@ -1,11 +0,0 @@
-<?php
-
-namespace app\common\model;
-
-use think\Model;
-
-class LedgerServersPowerChangeModel extends Model
-{
-
-    protected $name = "ledger_servers_power_change";
-}

+ 1 - 1
application/common/model/LedgerTeacChangeModel.php

@@ -18,7 +18,7 @@ class LedgerTeacChangeModel extends Model
      * 0未支付 100支付中 200支付成功 400支付失败
      */
     public $pay_status = [
-        '-1'                    => '全部',
+        '-1'                   => '全部',
         self::Pledge           => '质押存储',
 
     ];

+ 73 - 8
application/common/model/LedgerTokenChangeModel.php

@@ -10,18 +10,17 @@ class LedgerTokenChangeModel extends Model
     protected $name = "ledger_token_change";
 
 
-    const Payment           = 0;
+    /*const Payment           = 0;
     const Transfer          = 1;
     const Receive           = 2;
     const Recharge          = 3;
     const Withdraw          = 4;
     const Share             = 5;
     const WithdrawReturn    = 6;
-
     /*
      * 支付状态 支付 1转让支付 2 转让收款 3充值 4提现 5分享 6提现退回
      */
-    public $aciton_name = [
+   /* public $aciton_name = [
         '-1'                    => '全部',
         self::Payment           => '支付',
         self::Transfer          => '转让支付',
@@ -30,10 +29,8 @@ class LedgerTokenChangeModel extends Model
         self::Withdraw          => '提现',
         self::Share             => '分享',
         self::WithdrawReturn    => '提现退回',
-    ];
-
-
-    public static function getStatusList()
+    ];*/
+   /* public static function getStatusList()
     {
         return [
             self::Payment => __('支付'),
@@ -44,9 +41,77 @@ class LedgerTokenChangeModel extends Model
             self::Share => __('分享'),
             self::WithdrawReturn => __('提现退回')
         ];
-    }
+    }*/
+
 
+     //0支付 1转让支付 2 转让收款 3 充值 4 提现 5扣除书续费
+     const Popular           = 0;
+     const Payment           = 1;
+     const Receive           = 2;
+     const Recharge          = 3;
+     const Withdraw          = 4;
+     const Share             = 5;
+     const Return            = 6;
+     const Giveaway          = 7;
+     const Direct            = 8;
+     const System            = 9;
+     const GiftPay           = 10; //赠送支出
+     const GiftReceipt       = 11;
+     const Community         = 12; //社区津贴
+     const Service           = 13; //服务津贴
+     const Together          = 14; //共创津贴
+     const Freight           = 15; //物流运费
+     const Super             = 16; //茶宝标记激活 
+     const FroTrans          = 17; //冻结资产转让
+     const FroRecei          = 18; //冻结资产转让收款
+     /*
+      * 支付状态
+      * 0未支付 100支付中 200支付成功 400支付失败
+      */
+     public $pay_status = [
+         '-1'                    => '全部',
+         self::Popular           => '热销支付',
+         self::Payment           => '转让支付',
+         self::Receive           => '转让收款',
+         self::Recharge          => '充值',
+         self::Withdraw          => '提现',
+         self::Share             => '分享',
+         self::Return            => '退回',
+         self::Giveaway          => '赠送手续费',
+         self::Direct            => '布道津贴', //直推
+         self::System            => '系统调整',
+         self::GiftPay           => '转账支出',
+         self::GiftReceipt       => '转账收款',
+         self::Community         => '社区津贴',
+         self::Service           => '服务津贴',
+         self::Together          => '共创津贴',
+         self::Freight           => '物流运费',
+         self::Super             => '茶宝标记激活',
 
+     ];
+
+           
+    public static function getStatusList()
+    {
+        return [
+            self::Popular => __('热销支付'),
+            self::Payment  => __('转让支付'),
+            self::Receive => __('转让收款'),
+            self::Recharge => __('充值'),
+            self::Withdraw  => __('提现'),
+            self::Share => __('分享'),
+            self::Return => __('退回'),
+            self::Giveaway => __('赠送'),
+            self::Direct => __('布道津贴'),
+            self::System => __('系统调整'),
+            self::GiftPay => __('转账支出'),
+            self::GiftReceipt => __('转账收款'),
+            self::Community => __('社区津贴'),
+            self::Service => __('服务津贴'),
+            self::Together => __('共创津贴'),
+            self::Freight => __('物流运费'),
+            self::Super => __('茶宝标记激活')];
+    }
    
 
 }

+ 11 - 71
application/common/model/LedgerWalletModel.php

@@ -24,54 +24,18 @@ class LedgerWalletModel extends Model
     protected $updateTime = 'update_time';
     protected $deleteTime = false;
 
-    //0支付 1转让支付 2 转让收款 3 充值 4 提现 5扣除书续费
-    const Popular           = 0;
-    const Payment           = 1;
-    const Receive           = 2;
-    const Recharge          = 3;
-    const Withdraw          = 4;
-    const Share             = 5;
-    const Return            = 6;
-    const Giveaway          = 7;
-    const Direct            = 8;
-    const System            = 9;
-    const GiftPay           = 10; //赠送支出
-    const GiftReceipt       = 11;
-    const Community         = 12; //社区津贴
-    const Service           = 13; //服务津贴
-    const Together          = 14; //共创津贴
-    const Freight           = 15; //物流运费
-    const Super             = 16; //茶宝标记激活 
-    /*
-     * 支付状态
-     * 0未支付 100支付中 200支付成功 400支付失败
-     */
-    public $pay_status = [
-        '-1'                    => '全部',
-        self::Popular           => '热销支付',
-        self::Payment           => '转让支付',
-        self::Receive           => '转让收款',
-        self::Recharge          => '充值',
-        self::Withdraw          => '提现',
-        self::Share             => '分享',
-        self::Return            => '退回',
-        self::Giveaway          => '赠送手续费',
-        self::Direct            => '布道津贴', //直推
-        self::System            => '系统调整',
-        self::GiftPay           => '转账支出',
-        self::GiftReceipt       => '转账收款',
-        self::Community         => '社区津贴',
-        self::Service           => '服务津贴',
-        self::Together          => '共创津贴',
-        self::Freight           => '物流运费',
-        self::Super             => '茶宝标记激活',
-    ];
+   
 
     public static function getWalletChaBao($userID)
     {
         return self::where('user_id', $userID)->value('token');
     }
 
+    public static function getWalletFrozen($userID)
+    {
+        return self::where('user_id', $userID)->value('frozen');
+    }
+
     public static function getWalletTotalChaBao($userID)
     {
         return self::where('user_id', $userID)->value('token + frozen');
@@ -92,28 +56,7 @@ class LedgerWalletModel extends Model
         return $this->lock(true)->where('user_id', $userID)->find();
     }
 
-       
-    public static function getStatusList()
-    {
-        return [
-            self::Popular => __('热销支付'),
-            self::Payment  => __('转让支付'),
-            self::Receive => __('转让收款'),
-            self::Recharge => __('充值'),
-            self::Withdraw  => __('提现'),
-            self::Share => __('分享'),
-            self::Return => __('退回'),
-            self::Giveaway => __('赠送'),
-            self::Direct => __('布道津贴'),
-            self::System => __('系统调整'),
-            self::GiftPay => __('转账支出'),
-            self::GiftReceipt => __('转账收款'),
-            self::Community => __('社区津贴'),
-            self::Service => __('服务津贴'),
-            self::Together => __('共创津贴'),
-            self::Freight => __('物流运费'),
-            self::Super => __('茶宝标记激活')];
-    }
+
 
     /**
      * 更新钱包余额并添加账变记录
@@ -131,24 +74,21 @@ class LedgerWalletModel extends Model
         $frozen = 0; //冻结金额
         // 账变资产模型
         switch ($asset) {
-            case Asset::POWER:
-                $changeModel = new LedgerPowerChangeModel();
-                break;
             case Asset::USDT:
                 $changeModel = new LedgerUsdtChangeModel();
                 break;
             case Asset::TOKEN:
                 $changeModel = new LedgerTokenChangeModel();
-                if($action == self::Giveaway || $action == self::Freight) $frozen = $available->frozen;
+                if($action == $changeModel::Giveaway || $action == $changeModel::Freight) $frozen = $available->frozen; //冻结
                 break;
             case Asset::TEAC:
-                $changeModel = new LedgerTeacChangeModel();
+                $changeModel = new LedgerTokenChangeModel();
                 break;
             case Asset::SMH:
                 $changeModel = new LedgerSmhChangeModel();
                 break;
-            case Asset::QUBIC:
-                $changeModel = new LedgerQubicChangeModel();
+            case Asset::FROZEN:
+                $changeModel = new LedgerTokenChangeModel();
                 break;
             default:
                 throw new Exception('币种错误:' . $asset);

+ 2 - 2
application/common/model/UserModel.php

@@ -184,11 +184,11 @@ class UserModel extends Model
             $model = new LedgerWalletModel();
             foreach ($paths as $kk=>$item) {
                 if($kk== 1){
-                    $model->changeWalletAccount($item, $token, $pv, $model::Community, $uid);
+                    $model->changeWalletAccount($item, $token, $pv, ledgerTokenChangeModel::Community, $uid);
                 }else{
                     //间接推荐有效会员大于层级
                     if(self::where('parent_id', $item)->where('rwa_num','>', 0)->count() >= $kk){
-                        $model->changeWalletAccount($item, $token, $pv, $model::Community, $uid);
+                        $model->changeWalletAccount($item, $token, $pv, ledgerTokenChangeModel::Community, $uid);
                     }
                 }
             }

+ 12 - 0
application/common/model/ledgerFrozenModel.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+//冻结表
+class ledgerFrozenModel extends Model
+{
+
+    protected $name = "ledger_frozen";
+}

+ 1 - 0
application/config.php

@@ -321,4 +321,5 @@ return [
     'min_rwa_price'   => 499, //Rwa最低价格统计数量,
     'withdraw_in_amount' => 600, //提现金额手续费
     'super_weal_end_time' => 168 * 3600, //168小时
+    'min_frozen'          => 9.9 //最小保留标记金额
 ];

+ 9 - 9
application/extra/site.php

@@ -1,7 +1,7 @@
 <?php
 
 return array (
-  'name' => 'RWA茶',
+  'name' => '掘金路',
   'beian' => '',
   'cdnurl' => '',
   'version' => '1.0.7',
@@ -38,17 +38,17 @@ return array (
     'custom' => '自定义',
   ),
   'direct_income' => '10',
-  'transfer_fee' => '0.05',
+  'transfer_fee' => '0.8',
+  'transfes_txt' => '收取交易百分之五',
   'recharge_txt' => 'xxddddss',
-  'chabao_rate' => '1',
-  'withdrawal_fee' => '0.1',
+  'chabao_rate' => '0.7',
+  'withdrawal_next_fee' => '3',
+  'withdrawal_up_fee' => '0.1',
   'withdraw_min_amount' => '100',
   'convert_rate' => '7.2',
-  'giveaway' => '0.05',
-  'giveaway_txt' => '赠送收取5%网络费',
   'pv_rate' => '0.1',
   'chabao_giveaway' => '0.03',
-  'chabao_giveaway_txt' => '赠送收取3%网络费',
-  'transfes_txt' => '收取交易百分之五',
-  'logistics_freight' => '6',
+  'chabao_giveaway_txt' => '标记茶宝转账',
+  'frozen_transfer' => '0.03',
+  'frozen_transfer_txt' => '标记茶宝转账4xxxxx',
 );

+ 2 - 2
extend/fast/Asset.php

@@ -49,9 +49,9 @@ class Asset
      */
     const SMH = 'smh';
     /**
-     * SMH
+     * 标记金额
      * @var string
      */
-    const QUBIC = 'qubic';
+    const FROZEN = 'frozen';
 
 }