|
|
@@ -22,7 +22,7 @@ class GiftLevel extends BaseModel
|
|
|
{
|
|
|
if (in_array($uid, $pass)) return true;
|
|
|
$user = User::find($uid);
|
|
|
- $group_users = $this->get_group_user($user);
|
|
|
+ $group_users = \get_group_user($user);
|
|
|
//Todo 获取在$group_users内所有用户的消费情况
|
|
|
$achievement = 0;
|
|
|
//获取该用户购买过的礼包商品的全部订单
|
|
|
@@ -45,25 +45,25 @@ class GiftLevel extends BaseModel
|
|
|
if ($spread) return $this->checkLevel($spread['id'], $pass);
|
|
|
return true;
|
|
|
}
|
|
|
- public function get_group_user($id, $init = true, $members = null){
|
|
|
- if ($init) {
|
|
|
- $us = \app\common\model\user\User::column('spread_uid', 'uid');
|
|
|
- $members = [];
|
|
|
- foreach ($us as $k => $v) {
|
|
|
- if ($v > 0)
|
|
|
- $members[$v][] = $k;
|
|
|
- }
|
|
|
- $id = [$id];
|
|
|
- }
|
|
|
- $arr = array();
|
|
|
- foreach ($id as $v) {
|
|
|
- $child = $members[$v] ?? [];
|
|
|
- $arr = array_merge($arr, $child);
|
|
|
- }
|
|
|
- if (count($arr)) {
|
|
|
- return array_merge($arr, get_group_user($arr, false, $members));
|
|
|
- } else {
|
|
|
- return $arr;
|
|
|
- }
|
|
|
- }
|
|
|
+// public function get_group_user($id, $init = true, $members = null){
|
|
|
+// if ($init) {
|
|
|
+// $us = \app\common\model\user\User::column('spread_uid', 'uid');
|
|
|
+// $members = [];
|
|
|
+// foreach ($us as $k => $v) {
|
|
|
+// if ($v > 0)
|
|
|
+// $members[$v][] = $k;
|
|
|
+// }
|
|
|
+// $id = [$id];
|
|
|
+// }
|
|
|
+// $arr = array();
|
|
|
+// foreach ($id as $v) {
|
|
|
+// $child = $members[$v] ?? [];
|
|
|
+// $arr = array_merge($arr, $child);
|
|
|
+// }
|
|
|
+// if (count($arr)) {
|
|
|
+// return array_merge($arr, get_group_user($arr, false, $members));
|
|
|
+// } else {
|
|
|
+// return $arr;
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|