afa 11 сар өмнө
parent
commit
74dfef3040

+ 8 - 9
application/api/controller/Offline.php

@@ -21,7 +21,6 @@ use think\Hook;
 use think\Log;
 use think\Model;
 use think\Validate;
-use function fast\e;
 
 /**
  * 会员接口
@@ -33,8 +32,8 @@ class Offline extends Api
     {
         $resp   = [
             'usdt'                => '0', // 系统余额(U)
-            'withdraw_min_amount' => (new ParametersModel)->getValue('withdrawMinAmount') ?? '0', // 最低提现U数量
-            'withdraw_fee_rate'   => (new ParametersModel)->getValue('withdrawFeeRate') ?? '0', // 手续费比例
+            'withdraw_min_amount' => Env::get('rental.withdraw_min_amount'), // 最低提现U数量
+            'withdraw_fee_rate'   => Env::get('rental.withdraw_fee_rate') // 手续费比例
         ];
         $wallet = (new LedgerWalletModel)->getWallet($this->auth->getTokenUserID());
         if (!empty($wallet)) {
@@ -51,14 +50,13 @@ class Offline extends Api
     {
         $amount = $this->request->post('amount'); // 金额
         $sign = $this->request->post('sign'); // 签名信
-//        $sign = 'test';
         if(empty($sign)){
             $this->error('参数错误');
         }
 
         $real   = $amount; // 实际到账
-        $min    = (new ParametersModel)->getValue('withdrawMinAmount') ?? '0';
-        $rate   = (new ParametersModel)->getValue('withdrawFeeRate') ?? '0';
+        $min    = Env::get('rental.withdraw_min_amount');
+        $rate   = Env::get('rental.withdraw_fee_rate');
         if ($amount <= 0) {
             $this->error('提现金额必须大于0');
         } else if ($amount < $min) {
@@ -110,13 +108,14 @@ class Offline extends Api
     }
 
     /**
-     * 充值地址
+     * 提现地址
      * @return void
      */
     public function withdrawList()
     {
-       
-        $this->success('', getConfig('recharge_address'));
+        $where     = ['user_id' => $this->auth->getTokenUserID()];
+        $paginator = (new OfflineWithdrawRecordModel)->where($where)->order('id DESC')->paginate($this->pageSize);
+        $this->success('', $this->buildResp($paginator->total(), $paginator->currentPage(), $paginator->items()));
     }
 
 

+ 6 - 2
application/api/controller/User.php

@@ -93,9 +93,13 @@ class User extends Api
         // 启动事务
         Db::startTrans();
         try {
+            $list['total'] = $userBalanceLog::where('user_id', $this->auth->id)
+                            ->where('type_id', $userBalanceLog::Share)
+                            ->sum("amount");
+
             $list['data']  = $userBalanceLog::where('user_id', $this->auth->id)
-                   ->order('id desc')
-                   ->paginate($this->pageSize);
+                            ->order('id desc')
+                            ->paginate($this->pageSize);
             $list['statusList'] = $userBalanceLog::getStatusList();
             // 提交事务
             Db::commit();

+ 6 - 7
application/api/lang/zh-cn/order.php

@@ -5,14 +5,13 @@ return [
       '订单不存在'            => '订单不存在',
       '参数有误,无可用产品'   => '参数有误,无可用产品',
       '抢购已结束'            => '抢购已结束',
-
       '交易金额不能为空'       => '交易金额不能为空',
       '交易Hash不能为空'       => '交易Hash不能为空',
-      '已下单'                                => '已下单',
-      '已付款'                                => '已付款',
-      '已转让'                                => '已转让',
-      '已发货'                                => '已发货',
-      '已取消'                                => '已取消',
-      '已完成'                                => '已完成',
+      '已下单'                => '已下单',
+      '已付款'                => '已付款',
+      '已转让'                => '已转让',
+      '已发货'                => '已发货',
+      '已取消'                => '已取消',
+      '已完成'                => '已完成'
       
 ];

+ 23 - 0
application/common/model/OfflineRechargeRecordModel.php

@@ -112,4 +112,27 @@ class OfflineRechargeRecordModel extends Model
             throw new Exception("处理充值订单状态的影响行数为0,orderID:$orderID,status:$status");
         }
     }
+
+    public function getCreateTimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+
+    public function getUpdateTimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+    protected function setCreateTimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+    protected function setUpdateTimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
 }