|
|
@@ -87,7 +87,6 @@ class ProductOrder extends Model
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
/**
|
|
|
* @param int $orderId 订单id
|
|
|
@@ -116,6 +115,12 @@ class ProductOrder extends Model
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
+ //判断是否购买持有产品
|
|
|
+ public function isBuyHoldProduct(array $productId, int $uid){
|
|
|
+
|
|
|
+ return self::where('user_id', $uid)->whereIn('product_id', $productId)->whereIn('a.status', [self::Paid, self::Transferred, self::Freeze])->count();
|
|
|
+ }
|
|
|
+
|
|
|
//获取持有产品数量
|
|
|
public static function getByOrderProductNum($productId, $num, $uid)
|
|
|
{
|
|
|
@@ -129,16 +134,16 @@ class ProductOrder extends Model
|
|
|
return $productId;
|
|
|
}
|
|
|
|
|
|
- //空投产品向达到一定持有量的用户 total_num
|
|
|
+ //空投产品向达到一定持有量的用户
|
|
|
public static function getUserOrderByProductId(int $rwaProductId, int $rwaNum){
|
|
|
return ProductOrder::alias('a')
|
|
|
- ->join('product_list b', 'a.product_id = b.id', 'left')
|
|
|
- ->where('b.is_show', ProductLists::Normal)
|
|
|
- ->whereIn('a.status', [self::Paid, self::Transferred, self::Freeze])
|
|
|
- ->where('a.product_id', $rwaProductId)
|
|
|
- ->group('a.user_id')->having('total_num>='.$rwaNum)
|
|
|
- ->field('a.id,a.user_id,count(a.num) as total_num')
|
|
|
- ->select();
|
|
|
+ ->join('product_list b', 'a.product_id = b.id', 'left')
|
|
|
+ ->where('b.is_show', ProductLists::Normal)
|
|
|
+ ->whereIn('a.status', [self::Paid, self::Transferred, self::Freeze])
|
|
|
+ ->where('a.product_id', $rwaProductId)
|
|
|
+ ->group('a.user_id')->having('total_num>='.$rwaNum)
|
|
|
+ ->field('a.id,a.user_id,count(a.num) as total_num')
|
|
|
+ ->select();
|
|
|
}
|
|
|
|
|
|
//获取持有产品数量订单
|
|
|
@@ -160,7 +165,8 @@ class ProductOrder extends Model
|
|
|
}
|
|
|
|
|
|
// 获取订单状态
|
|
|
- public static function getProductOrder($orderId, $status, string $field){
|
|
|
+ public static function getProductOrder($orderId, $status, string $field)
|
|
|
+ {
|
|
|
return self::alias('a')->where('a.id', $orderId)
|
|
|
->join("product_list b", "a.product_id = b.id", "left")
|
|
|
->field('a.*,'.$field)
|
|
|
@@ -169,20 +175,15 @@ class ProductOrder extends Model
|
|
|
}
|
|
|
|
|
|
// 获取新人福利领取订单记录
|
|
|
- public static function getUserWelfare($uid, $typeId){
|
|
|
- return self::where('user_id', $uid)
|
|
|
- ->where('type_id', $typeId)
|
|
|
- ->order('create_time desc')
|
|
|
- ->find();
|
|
|
+ public static function getUserWelfare($uid, $typeId)
|
|
|
+ {
|
|
|
+ return self::where('user_id', $uid)->where('type_id', $typeId)->order('create_time desc')->find();
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
public static function getStatusList()
|
|
|
{
|
|
|
- return [self::Paid => __('已付款'), self::Transferred => __('已转让'),
|
|
|
- self::Shipped => __('提货'), self::Cancelled => __('已取消'), self::Closure => __('关闭'), self::Freeze => __('质押')];
|
|
|
+ return [self::Paid => __('已付款'), self::Transferred => __('已转让'), self::Shipped => __('提货'), self::Cancelled => __('已取消'), self::Closure => __('关闭'), self::Freeze => __('质押')];
|
|
|
}
|
|
|
|
|
|
//全部类型:
|