|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
namespace app\models\system;
|
|
namespace app\models\system;
|
|
|
|
|
|
|
|
|
|
+use app\admin\model\store\StoreProductCate;
|
|
|
use app\models\lala\LalaPinkJoin;
|
|
use app\models\lala\LalaPinkJoin;
|
|
|
use app\models\store\StoreCart;
|
|
use app\models\store\StoreCart;
|
|
|
use app\models\store\StoreOrder;
|
|
use app\models\store\StoreOrder;
|
|
@@ -149,6 +150,14 @@ class SystemUserTask extends BaseModel
|
|
|
'min_number' => 0,
|
|
'min_number' => 0,
|
|
|
'unit' => '号'
|
|
'unit' => '号'
|
|
|
],
|
|
],
|
|
|
|
|
+ [
|
|
|
|
|
+ 'type' => 'BuySomeProductNum',
|
|
|
|
|
+ 'name' => '购买升级商品{$num}',
|
|
|
|
|
+ 'real_name' => '购买商品',
|
|
|
|
|
+ 'max_number' => 1000000,
|
|
|
|
|
+ 'min_number' => 0,
|
|
|
|
|
+ 'unit' => '台'
|
|
|
|
|
+ ],
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
public function profile()
|
|
public function profile()
|
|
@@ -205,6 +214,7 @@ class SystemUserTask extends BaseModel
|
|
|
if ($SumPayPrice >= $number) $isComplete = UserTaskFinish::setFinish($uid, $task_id) ? true : false;
|
|
if ($SumPayPrice >= $number) $isComplete = UserTaskFinish::setFinish($uid, $task_id) ? true : false;
|
|
|
return ['还需消费{$num}元', $SumPayPrice, $isComplete];
|
|
return ['还需消费{$num}元', $SumPayPrice, $isComplete];
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
public static function BuySomeProduct($task_id, $uid = 0, $start_time = 0, $number = 0)
|
|
public static function BuySomeProduct($task_id, $uid = 0, $start_time = 0, $number = 0)
|
|
|
{
|
|
{
|
|
|
$isComplete = false;
|
|
$isComplete = false;
|
|
@@ -220,6 +230,28 @@ class SystemUserTask extends BaseModel
|
|
|
return ['还需购买ID为{$num}的商品一件', 0, $isComplete];
|
|
return ['还需购买ID为{$num}的商品一件', 0, $isComplete];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static function BuySomeProductNum($task_id, $uid = 0, $start_time = 0, $number = 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ $isComplete = false;
|
|
|
|
|
+ $orders = StoreOrder::where('paid', 1)
|
|
|
|
|
+ ->where('refund_status', 0)
|
|
|
|
|
+ ->where('is_del', 0)
|
|
|
|
|
+ ->where('uid', $uid)
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ $count = 0;
|
|
|
|
|
+ foreach ($orders as $v) {
|
|
|
|
|
+ $product_ids = StoreCart::where('id', 'in', $v['cart_id'])->select();
|
|
|
|
|
+ foreach ($product_ids as $vv) {
|
|
|
|
|
+ $cates = StoreProductCate::where('product_id', $vv['product_id'])->column('cate_id');
|
|
|
|
|
+ if (in_array(49, $cates)) {
|
|
|
|
|
+ $count += $vv['cart_num'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($number <= $count) $isComplete = UserTaskFinish::setFinish($uid, $task_id) ? true : false;
|
|
|
|
|
+ return ['还需购买升级商品{$num}台', 0, $isComplete];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 累计消费次数
|
|
* 累计消费次数
|