Browse Source

转让订单购买

afa 7 months ago
parent
commit
ec97c35452

+ 1 - 1
application/admin/controller/user/Airdrop.php

@@ -105,7 +105,7 @@ class Airdrop extends Backend
             if($params['type_id'] == 1){
                 $totalNum = WelfareLoginc::getUserRwaProductNum($params['rwa_product_id'], $params['rwa_num'], $params['rwa_mod'], $params['num']);
                 // $result = ProductPopular::getPopularByTime($params['product_id'], 'zh', strtotime($params['start_time']));
-                //if(!$result || $totalNum > ($result->stock -$result->init_num - $result->num)) throw new Exception(__('库存不足'));
+                if($totalNum == 0) throw new Exception(__('暂无符合条件的用户'));
                 $params['total_num'] = $totalNum;
             }
             if(!empty($params['area_id'][0])){

+ 2 - 1
application/api/controller/Order.php

@@ -176,7 +176,8 @@ class Order extends Api
             $popular_order = $productOrder->where('id', $order_info['order_id'])->find();
 
             // 生成订单
-            $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);
+            $popularPrice = empty($popular_order->popular_price)? $order_info->price: $popular_order->popular_price;
+            $productOrder::setCreateOrder($params['order_id'], $order_info, $productOrder::Transfer, $this->auth->id, $order_info['user_id'], $popular_order->order_no, $order_info['fees'], $popularPrice);
            
             //扣除余额记录 
             $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$order_info['price'], LedgerTokenChangeModel::Payment, $order_info['user_id']);

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

@@ -7,7 +7,7 @@ use app\common\model\ProductOrder;
 use app\common\model\LedgerSmhChangeModel;
 use app\common\model\LedgerTokenChangeModel;
 use app\common\model\LedgerWalletModel;
-use app\common\model\OfflineWithdrawRecordModel;
+use app\common\model\ProductTransfer;
 use app\common\model\TeamLevelModel;
 use app\common\model\UserModel;
 use app\common\model\ParametersModel;
@@ -72,7 +72,7 @@ class User extends Api
      * param int $type_id 0总览 1转让中 2已转让 3存储中 4已赠送 5已提货
      * @return void
      */
-    public function getNftList(ProductOrder $productOrder)
+    public function getNftList(ProductOrder $productOrder, ProductTransfer $productTransfer)
     {
         $typeId = $this->request->post('type_id/d', 0);
         $productId = $this->request->post('product_id/d', 0);
@@ -88,6 +88,10 @@ class User extends Api
               ->where($where)
               ->order('a.id DESC')
               ->paginate($this->pageSize);
+        //地板价格 
+        foreach ($list as &$item) {
+            if($item->price == 0) $item->floor_price = $productTransfer::getTransferMinPrice($item->product_id);
+        }      
         $this->success('', $list);
     }
 

+ 18 - 0
application/common/model/ProductPledgePid.php

@@ -0,0 +1,18 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+//质押产品表
+class ProductPledgePid extends Model
+{
+
+    protected $name = "product_pledge_pid";
+
+
+
+    
+
+
+}

+ 5 - 0
application/common/model/ProductTransfer.php

@@ -56,6 +56,11 @@ class ProductTransfer extends Model
     }
 
 
+    //获取转让订单
+    public static function getTransferMinPrice(int $product_id)
+    {
+        return self::where('product_id', $product_id)->where('status', self::Normal)->min('price');
+    }
     
     //产品
     public function products()

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

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