<?php
 namespace App\Http\Controllers\Admin; use TechSoft\Laravel\Admin\Cms\Field\FieldEmpty; use TechSoft\Laravel\Member\Controllers\MemberAdminController; use TechSoft\Laravel\Member\MemberUtil; use TechSoft\Laravel\Oauth\OauthType; class MemberController extends MemberAdminController { public function __construct() { parent::__construct(); $this->cmsConfigData['fields']['oauthWechat'] = ['type' => FieldEmpty::class, 'title' => 'PC微信', 'list' => true,]; $this->cmsConfigData['fields']['oauthWechatMobile'] = ['type' => FieldEmpty::class, 'title' => '手机微信', 'list' => true,]; $this->cmsConfigData['fields']['oauthWeibo'] = ['type' => FieldEmpty::class, 'title' => '微博', 'list' => true,]; $this->cmsConfigData['fields']['oauthQQ'] = ['type' => FieldEmpty::class, 'title' => 'QQ', 'list' => true,]; } public function dataProcessViewField($key, &$record) { switch ($key) { case 'oauthWechat': if (MemberUtil::getOauthOpenId($record['id'], OauthType::WECHAT)) { return '<span class="uk-badge uk-badge-success">已绑定</span>'; } return ''; case 'oauthWechatMobile': if (MemberUtil::getOauthOpenId($record['id'], OauthType::WECHAT_MOBILE)) { return '<span class="uk-badge uk-badge-success">已绑定</span>'; } return ''; case 'oauthWeibo': if (MemberUtil::getOauthOpenId($record['id'], OauthType::WEIBO)) { return '<span class="uk-badge uk-badge-success">已绑定</span>'; } return ''; case 'oauthQQ': if (MemberUtil::getOauthOpenId($record['id'], OauthType::QQ)) { return '<span class="uk-badge uk-badge-success">已绑定</span>'; } return ''; } } }