|
@@ -8,6 +8,7 @@ use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use Modules\Audience\Models\GzhUgMapModel;
|
|
|
use Modules\Audience\Models\UserGroupModel;
|
|
|
+use Modules\Audience\Services\UserGroupService;
|
|
|
|
|
|
class UserGroupController extends CatchController
|
|
|
{
|
|
@@ -42,19 +43,22 @@ class UserGroupController extends CatchController
|
|
|
'id' => $request->input('id')
|
|
|
])->first();
|
|
|
if($obj) {
|
|
|
- // ToDo:完善
|
|
|
- $obj->user_num = '-1';
|
|
|
- $obj->tags_arr = \json_decode($obj->tags, true);
|
|
|
- $obj->gzh_names = DB::table('gzh_ug_maps as a')
|
|
|
- ->join('wechat_authorization_infos as b', function($query) use ($uid) {
|
|
|
- $query->on('a.gzh_id', '=', 'b.id')
|
|
|
- ->where([
|
|
|
- 'b.is_enabled' => 1,
|
|
|
- 'b.user_id' => $uid
|
|
|
- ]);
|
|
|
- })->where([
|
|
|
- 'a.ug_id' => $request->input('id')
|
|
|
- ])->select('b.nick_name')->get()->pluck('nick_name')->toArray();
|
|
|
+ $gzhInfo = DB::table('gzh_ug_maps as a')
|
|
|
+ ->join('wechat_authorization_infos as b', function($query) use ($uid) {
|
|
|
+ $query->on('a.gzh_id', '=', 'b.id')
|
|
|
+ ->where([
|
|
|
+ 'b.is_enabled' => 1,
|
|
|
+ 'b.user_id' => $uid
|
|
|
+ ]);
|
|
|
+ })->where([
|
|
|
+ 'a.ug_id' => $request->input('id')
|
|
|
+ ])->select('b.nick_name', 'b.authorizer_appid')->get();
|
|
|
+ $tags = \json_decode($obj->tags, true);
|
|
|
+ $tags['gzh_appids'] = $gzhInfo->pluck('authorizer_appid')->toArray();
|
|
|
+ $tags['in_48_hour'] = 1;
|
|
|
+ $obj->user_num = UserGroupService::getSQL($tags)->distinct()->count('a.uid');
|
|
|
+ $obj->tags_arr = $tags;
|
|
|
+ $obj->gzh_names = $gzhInfo->pluck('nick_name')->toArray();
|
|
|
}
|
|
|
|
|
|
return $obj;
|