|
@@ -0,0 +1,53 @@
|
|
|
+<?php
|
|
|
+/**
|
|
|
+ * Created by PhpStorm.
|
|
|
+ * User: Administrator
|
|
|
+ * Date: 2019-06-20
|
|
|
+ * Time: 14:23
|
|
|
+ */
|
|
|
+
|
|
|
+namespace App\Repositories;
|
|
|
+
|
|
|
+
|
|
|
+use App\Models\MemberGroup;
|
|
|
+use App\Models\MemberGroupInfo;
|
|
|
+use App\Traits\UserTrait;
|
|
|
+
|
|
|
+class MemberGroupRepository {
|
|
|
+ use UserTrait;
|
|
|
+ public function __construct(MemberGroup $memberGroup,MemberGroupInfo $memberGroupInfo) {
|
|
|
+ $this->memberGroup = $memberGroup;
|
|
|
+ $this->memberGroupInfo = $memberGroupInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param $request
|
|
|
+ * @return array
|
|
|
+ * 获取推荐用户
|
|
|
+ */
|
|
|
+ public function isSuggestMember(){
|
|
|
+ $group = $this->memberGroup->where('is_suggest',1)->first();
|
|
|
+ if($group){
|
|
|
+ $groupInfo = $this->memberGroupInfo
|
|
|
+ ->where('member_group_id',$group->id)
|
|
|
+ ->orderBy('sort')
|
|
|
+ ->select('uid','sort')
|
|
|
+ ->get();
|
|
|
+ if($groupInfo){
|
|
|
+ $array = $groupInfo->toArray();
|
|
|
+ $userData = [];
|
|
|
+ foreach ($array as $key=>$value){
|
|
|
+ $userData[] = $value['uid'];
|
|
|
+ }
|
|
|
+ //请求用户接口获取用户信息
|
|
|
+ $uids = implode(',',$userData);
|
|
|
+ $data = $this->getMemberSortIdList($uids);
|
|
|
+ if($data){
|
|
|
+ return jsonSuccess($data);
|
|
|
+ }
|
|
|
+ return jsonSuccess();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return jsonSuccess();
|
|
|
+ }
|
|
|
+}
|