浏览代码

/添加质抵

afa 7 月之前
父节点
当前提交
9522bdd8d2

+ 0 - 8
application/admin/controller/user/Airdrop.php

@@ -31,16 +31,8 @@ class Airdrop extends Backend
     {
         parent::_initialize();
         $this->model = new \app\common\model\UserAirdrop;
-
     }
 
-
-
-    /**
-     * 1. 从平台向指定账号空投一定数量的指定产品
-     * 2. 向所有持有超过设定数量RWA茶的用户空投一定"数量"的指定产品(同一用户是否重复空头) a.先统计(RWA茶的用户)
-     * 3. 茶付宝上指定区域消费指定金额空投 D 茶权需要开发回调接口
-     */
     /**
      * 查看
      *

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

@@ -79,13 +79,14 @@ class Pledge extends Api
         if(empty($pledge_id) || empty($order_no)) $this->error(__("参数有误,无可用产品"));
 
         $pledge = $productPledges::get($pledge_id);
+
         if($pledge->type_id == $productPledges::Combin && count(explode(',', $pledge->product_id)) != count($order_no)) $this->error(__("质押商品数量与订单数量不匹配"));
 
         if (empty($pledge)) $this->error(__("质抵活动不存在"));
         if (empty($pledge->status) )$this->error(__("质抵活动已结束"));
         Db::startTrans();
         try {
-
+         
             // 质抵押订单 
             $pledgeLogic::setPledgeOrder($pledge, $order_no, $this->auth->id);
             // 提交事务

+ 1 - 1
application/common.php

@@ -549,6 +549,6 @@ if (!function_exists('paymentLog')) {
      */
     function getOrderSN(string $prefix = 'ORD'): string
     {  
-        return $prefix.date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 10);
+        return $prefix.time() . '_' . str_pad(random_int(0, 999999), 6, '0', STR_PAD_LEFT);
     }
 }

+ 3 - 4
application/common/logic/PledgeLogic.php

@@ -10,7 +10,6 @@ use fast\Asset;
 use app\common\model\ProductOrder;
 use app\common\model\LedgerTeacChangeModel;
 use app\common\model\ProductPledges;
-use Google\Service\Storage\Resource\Objects;
 
 class PledgeLogic
 {
@@ -47,8 +46,8 @@ class PledgeLogic
             ->where('a.user_id', $user_id)
             ->where('a.status', $model::Paid)
             ->whereIn('a.order_no', $order_no)->field('b.id,b.zh_name,b.thum,a.order_no')->select();
-
-        if(empty($product) || count($product) != count($order_no))  throw new Exception('订单不存在');
+        
+        if(empty($product) || count($product) < count($order_no))  throw new Exception('订单不存在');
         $pledge_num = 1;
         if($pledge->type_id == ProductPledges::Single){
             $pledge_num = count($order_no);
@@ -60,7 +59,7 @@ class PledgeLogic
         $pledge->day_num, $pledge_num);
        
         //修改状态
-        return $model->whereIn('order_no', $order_no)->setField('status', $model::Freeze);
+        return $model->whereIn('order_no', $order_no)->limit(count($order_no))->setField('status', $model::Freeze);
     }
 
     //获取质抵押订单列表