afa 4 månader sedan
förälder
incheckning
2e21facab4

+ 10 - 8
application/api/controller/Ledger.php

@@ -98,7 +98,7 @@ class Ledger extends Api
                 $paginator = Loader::model('LedgerTeacChangeModel');
                 $res['data'] = $paginator->where($where)->order('id DESC')->paginate($this->pageSize);
                 break;
-            case 'usdt':
+            case 'teac_angel':
                 $paginator = (new LedgerUsdtChangeModel());
                 break;
             case 'smh':
@@ -113,14 +113,15 @@ class Ledger extends Api
     }
 
     /**
-     * Teac资产转账
+     * 标记茶宝资产转账
      * @return void
      */
     public function frozenTransfer(UserModel $userModel,  LedgerWalletModel $ledgerWalletModel)
     {
         $amount = $this->request->post('amount'); // 茶宝
-        $address = $this->request->post('address'); // 地址
-        if(empty($amount) || empty($address)){
+        $type    = $this->request->post('type/d', 0);    // type: 0地址 1uid
+        $account= $this->request->post('account/s', ''); // 账号
+        if(empty($amount) || empty($account)){
             $this->error(__('Parameter error'));
         }
         $real   = bcsub($amount, bcmul(getConfig('frozen_transfer'), $amount, 2), 2) ; // 手续费
@@ -128,7 +129,7 @@ class Ledger extends Api
         Db::startTrans();
         try {
 
-            $user = $userModel->getByAddress($address);
+            $user = (empty($type))? $userModel->getByAddress($account): $userModel->getById($account); 
             if(empty($user)) throw new Exception(__("赠送用户不存在"));    
             if($user['id'] == $this->auth->id) throw new Exception(__("赠送用户不能是自己"));
 
@@ -169,8 +170,9 @@ class Ledger extends Api
     public function chabaoGift(UserModel $userModel,  LedgerWalletModel $ledgerWalletModel)
     {
         $amount = $this->request->post('amount'); // 茶宝
-        $address = $this->request->post('address'); // 地址
-        if(empty($amount) || empty($address)){
+        $type    = $this->request->post('type/d', 0);    // type: 0地址 1uid
+        $account= $this->request->post('account/s', ''); // 账号
+        if(empty($amount) || empty($account)){
             $this->error(__('Parameter error'));
         }
         $real   = bcsub($amount, bcmul(getConfig('chabao_giveaway'), $amount, 2), 2) ; // 手续费
@@ -179,7 +181,7 @@ class Ledger extends Api
         Db::startTrans();
         try {
 
-            $user = $userModel->getByAddress($address);
+            $user = (empty($type))? $userModel->getByAddress($account): $userModel->getById($account); 
             if(empty($user)) throw new Exception(__("赠送用户不存在"));    
             if($user['id'] == $this->auth->id) throw new Exception(__("赠送用户不能是自己"));  
             $chabao = $ledgerWalletModel::getWalletChaBao($this->auth->id);

+ 58 - 0
application/common/model/LedgerTeacAngelChangeModel.php

@@ -0,0 +1,58 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+class LedgerTeacAngelChangeModel extends Model
+{
+    // Teac-天使
+    protected $name = "ledger_teac_angel_change";
+
+
+    //0支付 1转让支付 2 转让收款 3 充值 4 提现 5扣除书续费
+    const Pledge           = 0;
+    const Sell             = 1;
+    const SellBuy          = 2;
+    const Buying           = 3;
+    const BuySell          = 4;
+    const SellCancel       = 5;
+    const Exchange         = 6;
+    const PledgeFee        = 7; //存储服务费
+    const TeamLevel        = 8; //等级分佣
+    const System           = 100; //系统调整
+    /*
+     * 支付状态
+     * 0未支付 100支付中 200支付成功 400支付失败
+     */
+    public $pay_status = [
+        '-1'                   => '全部',
+        self::Pledge           => '质押存储',
+        self::Sell             => 'C2C出售',
+        self::SellBuy          => 'C2C出售购买',
+        self::Buying           => 'C2C求购',
+        self::BuySell          => 'C2C求购出售',
+        self::SellCancel       => 'C2C取消出售',
+        self::Exchange         => 'Teac兑换',
+        self::PledgeFee        => '存储服务费',
+        self::TeamLevel        => '社区服务奖励',
+        self::System           => '系统调整',
+    ];
+
+    //getStatusList
+    public static function getStatusList()
+    {
+        return [
+            self::Pledge    => __('质押存储'),
+            self::Sell      => __('C2C出售'),
+            self::SellBuy   => __('C2C出售购买'),
+            self::Buying    => __('C2C存储'),
+            self::BuySell   => __('C2C存储出售'),
+            self::SellCancel   => __('C2C取消出售'),
+            self::Exchange     => __('C2C兑换产品'),
+            self::PledgeFee    => __('存储服务费'),
+            self::TeamLevel    => __('社区服务奖励'),
+            self::System       => __('系统调整'),
+        ];
+    }
+}