Browse Source

操作记录

afa 10 tháng trước cách đây
mục cha
commit
3f52ad5a37

+ 11 - 48
application/api/controller/User.php

@@ -173,54 +173,25 @@ class User extends Api
     }
 
 
-
-
     /**
-     * 获取smh出款信息
+     * 获取操作信息 购买、赠送、提货、转让
      * @return void
      */
-    public function smhInfo()
+    public function getOperateLog(ProductOrder $productOrder)
     {
-        $user = $this->auth->getUser();
-        if (empty($user)) {
-            $this->error('用户信息不存在');
-        }
+        $list['data'] = $productOrder->alias('a')
+                ->join("product_list b", "b.id = a.product_id", "left")
+                ->field('a.id as order_id,a.product_id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,a.price,a.status,a.type_id')
+                ->where('a.user_id', $this->auth->id)
+                ->order('a.id DESC')
+                ->paginate($this->pageSize);
+        $list['statusList'] = $productOrder::getStatusAll();
+        $this->success('', $list);
+    }
 
-        $resp = [
-            'smh'          => '0', // 平台币余额
-            'smh_min_amount' => 0, // 最低提现U数量
-            'tips'           => "", //提现提示信息
-            'address'        => "", // 出款地址,此地址有值时,前台不允许重新输入
-            'smh_price'      => (new SmhWithdrawRecordModel())->getEtcPrice(), //smh价格
-            'smh_exchange_ratio' => (new ParametersModel())->getValue('smhExchangeRatio'), // smh兑换USDT手续费
-            'smh_fee_rate'   => (new ParametersModel())->getValue('smhFeeRate'), // smh提现手续费
-        ];
 
-        $wallet = (new LedgerWalletModel())->getWallet($user['id']);
-        if (!empty($wallet)) {
-            $resp['smh'] = $wallet['smh'];
-        }
 
-        $config = (new ParametersModel)
-            ->where('name', '=', 'smhMinAmount')
-            ->find();
-        if(empty($config)){
-            $this->error('未配置SMH出款参数');
-        }
-        $resp['smh_min_amount'] = $config['value'];
-        $resp['tips'] = $config['tip'];
 
-        $wallet = (new OfflineWithdrawRecordModel())
-            ->where('user_id', $user['id'])
-            ->where('symbol', 'smh')
-            ->where('status', OfflineWithdrawRecordModel::StatusSuccess)
-            ->find();
-        if (!empty($wallet)) {
-            $resp['address'] = $wallet['to_address'];
-        }
-
-        $this->success('', $resp);
-    }
 
     /**
      * 提交出款信息
@@ -231,11 +202,9 @@ class User extends Api
         $amount = $this->request->post('amount'); // 金额
         $sign = $this->request->post('sign'); // 签名信
         $address = $this->request->post('address'); // 提现地址
-//        $sign = 'test';
         if(empty($sign)){
             $this->error('参数错误');
         }
-
         $real   = $amount; // 实际到账
         $min    = (new ParametersModel)->getValue('smhMinAmount') ?? '0';
         if ($amount <= 0) {
@@ -243,9 +212,7 @@ class User extends Api
         } else if ($amount < $min) {
             $this->error('提现金额不能小于' . $min);
         }
-
         $uid = $this->auth->getTokenUserID();
-
         // 用户信息
         $user = (new UserModel())->getById($uid);
         if (empty($user)) {
@@ -256,20 +223,16 @@ class User extends Api
         if (empty($wallet)) {
             $this->error('用户不存在');
         }
-
         if($amount > $wallet['smh']){
             $this->error('SMH余额不足');
         }
-
         $rate   = (new ParametersModel)->getValue('smhFeeRate') ?? '0';
-
         // 扣除手续费后
         if ($rate >= 0 && $rate < 1) { // 比例范围只在0-1之间
             $real = bcmul($amount, bcsub(1, $rate, 6), 6);
         }else{
             $this->error('手续费设置错误:' . $rate);
         }
-
         // 验签
         $signMsg = "EtcWithdraw"; // 与前端约定的固定值
         if (!checkSign($signMsg, $sign, $user['address'])) {

+ 5 - 0
application/api/lang/en.php

@@ -27,4 +27,9 @@ return [
     '赠送收款'                                                                    => 'Gift Receipt',
     '抢购未开始'                                                                  => 'The flash sale has not started yet',
     '当前订单最低转让金额为'                                                       => 'The current minimum transfer amount for an order is',
+    '已购买'                                                                        => 'Purchased',
+    '转让中'                                                                        => 'Transferring',
+    '已赠送'                                                                        => 'Gifted',
+    '已转让'                                                                        => 'Transferred',
+    '已提货'                                                                        => 'Gifted',
 ]; 

+ 6 - 0
application/api/lang/zh-cn.php

@@ -116,5 +116,11 @@ return [
     '服务津贴'                                                                    => '服务津贴',
     '共创津贴'                                                                    => '共创津贴',
     '当前订单最低转让金额为'                                                       => '当前订单最低转让金额为',
+    '已购买'                                                                        => '已购买',
+    '转让中'                                                                        => '转让中',
+    '已赠送'                                                                        => '已赠送',
+    '已转让'                                                                        => '已转让',
+    '已提货'                                                                        => '已提货',
+
 
 ];

+ 6 - 1
application/common/model/ProductOrder.php

@@ -60,7 +60,6 @@ class ProductOrder extends Model
     public static function setCreateOrder(int $orderId, $orderInfo, $typeId, $userId, $fromUser, string $orderNo, float $fees): object
     {   
 
-    
         return self::create([
                 'order_id'   => $orderId,
                 'product_id' => $orderInfo['product_id'],
@@ -84,6 +83,12 @@ class ProductOrder extends Model
         self::Shipped => __('提货'), self::Cancelled  => __('已取消'), self::Closure => __('关闭')];
     }
 
+    //全部类型: 
+    public static function getStatusAll()
+    {
+        return [0 => __('已购买'), 1 => __('转让中'), 2 => __('已赠送'), 3 => __('已转让'), 4 => __('已提货')];
+    }
+
     //产品
     public function products()
     {