diff --git a/app/admin/form/User.php b/app/admin/form/User.php index 467cf581c..b11866496 100644 --- a/app/admin/form/User.php +++ b/app/admin/form/User.php @@ -10,6 +10,8 @@ // +---------------------------------------------------------------------- namespace app\admin\form; +use think\facade\Db; + /** * 用户动态表格 * @author Devil @@ -203,12 +205,17 @@ class User ], ], [ - 'label' => '邀请人id', - 'view_type' => 'field', - 'view_key' => 'referrer', + 'label' => '邀请用户', + 'view_type' => 'module', + 'view_key' => 'user/module/referrer', + 'grid_size' => 'sm', 'is_sort' => 1, 'search_config' => [ - 'form_type' => 'input', + 'form_type' => 'input', + 'form_name' => 'referrer', + 'where_type_custom' => 'in', + 'where_value_custom' => 'WhereValueUserInfo', + 'placeholder' => '请输入邀请用户名/昵称/手机/邮箱', ], ], [ @@ -239,5 +246,28 @@ class User ], ]; } + + /** + * 用户信息条件处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-08 + * @desc description + * @param [string] $value [条件值] + * @param [array] $params [输入参数] + */ + public function WhereValueUserInfo($value, $params = []) + { + if(!empty($value)) + { + // 获取用户 id + $ids = Db::name('User')->where('username|nickname|mobile|email', 'like', '%'.$value.'%')->column('id'); + + // 避免空条件造成无效的错觉 + return empty($ids) ? [0] : $ids; + } + return $value; + } } ?> \ No newline at end of file diff --git a/app/admin/view/default/user/module/referrer.html b/app/admin/view/default/user/module/referrer.html new file mode 100644 index 000000000..0701b1042 --- /dev/null +++ b/app/admin/view/default/user/module/referrer.html @@ -0,0 +1,10 @@ + +{{if !empty($module_data) and !empty($module_data['referrer_info'])}} + {{$module_data.referrer_info.user_name_view}} + +{{/if}} \ No newline at end of file diff --git a/app/service/UserService.php b/app/service/UserService.php index b619cfbb6..e502ae6d9 100755 --- a/app/service/UserService.php +++ b/app/service/UserService.php @@ -183,6 +183,15 @@ class UserService 'data' => &$data, ]); + // 字段列表 + $keys = ArrayKeys($data); + + // 邀请用户列表 + if(in_array('referrer', $keys)) + { + $referrer_list = self::GetUserViewInfo(array_column($data, 'referrer')); + } + // 开始处理数据 $common_gender_list = MyConst('common_gender_list'); $common_user_status_list = MyConst('common_user_status_list'); @@ -205,6 +214,12 @@ class UserService } } + // 邀请用户信息 + if(array_key_exists('referrer', $v)) + { + $v['referrer_info'] = (!empty($referrer_list) && is_array($referrer_list) && array_key_exists($v['referrer'], $referrer_list)) ? $referrer_list[$v['referrer']] : []; + } + // 时间 if(array_key_exists('add_time', $v)) { diff --git a/composer.lock b/composer.lock index 3867b4c08..4e0712263 100644 --- a/composer.lock +++ b/composer.lock @@ -31,12 +31,12 @@ }, "type": "library", "autoload": { - "psr-0": { - "HTMLPurifier": "library/" - }, "files": [ "library/HTMLPurifier.composer.php" ], + "psr-0": { + "HTMLPurifier": "library/" + }, "exclude-from-classmap": [ "/library/HTMLPurifier/Language/" ] @@ -546,16 +546,16 @@ }, { "name": "phpoffice/phpspreadsheet", - "version": "1.21.0", + "version": "1.22.0", "source": { "type": "git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "1a359d2ccbb89c05f5dffb32711a95f4afc67964" + "reference": "3a9e29b4f386a08a151a33578e80ef1747037a48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/1a359d2ccbb89c05f5dffb32711a95f4afc67964", - "reference": "1a359d2ccbb89c05f5dffb32711a95f4afc67964", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/3a9e29b4f386a08a151a33578e80ef1747037a48", + "reference": "3a9e29b4f386a08a151a33578e80ef1747037a48", "shasum": "", "mirrors": [ { @@ -592,7 +592,7 @@ "dompdf/dompdf": "^1.0", "friendsofphp/php-cs-fixer": "^3.2", "jpgraph/jpgraph": "^4.0", - "mpdf/mpdf": "^8.0", + "mpdf/mpdf": "8.0.17", "phpcompatibility/php-compatibility": "^9.3", "phpstan/phpstan": "^1.1", "phpstan/phpstan-phpunit": "^1.0", @@ -650,9 +650,9 @@ ], "support": { "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", - "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.21.0" + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.22.0" }, - "time": "2022-01-06T11:10:08+00:00" + "time": "2022-02-18T12:57:07+00:00" }, { "name": "psr/cache", @@ -1056,7 +1056,7 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", @@ -1094,12 +1094,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1125,7 +1125,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" }, "funding": [ { @@ -1244,12 +1244,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "think\\": "src" - }, "files": [ "src/helper.php" - ] + ], + "psr-4": { + "think\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1324,16 +1324,16 @@ }, { "name": "topthink/think-orm", - "version": "v2.0.51", + "version": "v2.0.52", "source": { "type": "git", "url": "https://github.com/top-think/think-orm.git", - "reference": "149d266acdc4b2f07c6a94f1733b6b97d340e0e2" + "reference": "407a60658f37fc57422ab95a9922c6f69af90f46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-orm/zipball/149d266acdc4b2f07c6a94f1733b6b97d340e0e2", - "reference": "149d266acdc4b2f07c6a94f1733b6b97d340e0e2", + "url": "https://api.github.com/repos/top-think/think-orm/zipball/407a60658f37fc57422ab95a9922c6f69af90f46", + "reference": "407a60658f37fc57422ab95a9922c6f69af90f46", "shasum": "", "mirrors": [ { @@ -1355,12 +1355,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "think\\": "src" - }, "files": [ "stubs/load_stubs.php" - ] + ], + "psr-4": { + "think\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1379,9 +1379,9 @@ ], "support": { "issues": "https://github.com/top-think/think-orm/issues", - "source": "https://github.com/top-think/think-orm/tree/v2.0.51" + "source": "https://github.com/top-think/think-orm/tree/v2.0.52" }, - "time": "2022-01-21T06:25:25+00:00" + "time": "2022-01-25T06:00:05+00:00" }, { "name": "topthink/think-template", @@ -1481,7 +1481,7 @@ "packages-dev": [ { "name": "symfony/polyfill-php72", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", @@ -1513,12 +1513,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1543,7 +1543,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.25.0" }, "funding": [ { @@ -1563,16 +1563,16 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", "shasum": "", "mirrors": [ { @@ -1595,12 +1595,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1632,7 +1632,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" }, "funding": [ { @@ -1648,20 +1648,20 @@ "type": "tidelift" } ], - "time": "2021-09-13T13:58:33+00:00" + "time": "2022-03-04T08:16:47+00:00" }, { "name": "symfony/var-dumper", - "version": "v4.4.36", + "version": "v4.4.39", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "02685c62fcbc4262235cc72a54fbd45ab719ce3c" + "reference": "35237c5e5dcb6593a46a860ba5b29c1d4683d80e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/02685c62fcbc4262235cc72a54fbd45ab719ce3c", - "reference": "02685c62fcbc4262235cc72a54fbd45ab719ce3c", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/35237c5e5dcb6593a46a860ba5b29c1d4683d80e", + "reference": "35237c5e5dcb6593a46a860ba5b29c1d4683d80e", "shasum": "", "mirrors": [ { @@ -1727,7 +1727,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v4.4.36" + "source": "https://github.com/symfony/var-dumper/tree/v4.4.39" }, "funding": [ { @@ -1743,7 +1743,7 @@ "type": "tidelift" } ], - "time": "2021-12-29T09:28:53+00:00" + "time": "2022-02-25T10:38:15+00:00" }, { "name": "topthink/think-trace", diff --git a/public/static/common/js/common.js b/public/static/common/js/common.js index 2acaeb0b8..2e9881f78 100755 --- a/public/static/common/js/common.js +++ b/public/static/common/js/common.js @@ -2024,6 +2024,24 @@ function GetQueryValue(field) return false; } +/** + * uuid生成 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-03-13 + * @desc description + */ +function UUId() +{ + var d = new Date().getTime(); + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = (d + Math.random() * 16) % 16 | 0; + d = Math.floor(d / 16); + return (c == 'x' ? r : r & 0x3 | 0x8).toString(16); + }); +} + // 公共数据操作