From f6ccbb70dd78b435d3f28ed8ba3d0856b8a29dd6 Mon Sep 17 00:00:00 2001 From: Karson Date: Tue, 27 Nov 2018 11:28:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=89=8D=E5=8F=B0=E4=BC=9A?= =?UTF-8?q?=E5=91=98Money=E5=AD=97=E6=AE=B5=E5=92=8C=E4=BD=99=E9=A2=9D?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=A1=A8=20=E6=96=B0=E5=A2=9E=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E9=85=8D=E7=BD=AE=E6=B8=A9=E9=A6=A8=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD=20=E6=96=B0=E5=A2=9E=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E7=99=BB=E5=BD=95=E5=85=A5=E5=8F=A3=E4=B8=BA=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=97=B6=E7=9A=84=E5=AE=89=E5=85=A8=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E4=BD=99=E9=A2=9D=E5=A2=9E=E5=87=8F?= =?UTF-8?q?=E7=9A=84=E9=9D=99=E6=80=81=E6=96=B9=E6=B3=95=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=89=8D=E5=8F=B0=E9=BB=98=E8=AE=A4=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E7=9A=84=E5=B1=95=E7=A4=BA=20=E4=BC=98=E5=8C=96=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E7=AE=A1=E7=90=86=E4=B8=AD=E9=9D=9E=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=9A=84=E5=9B=BE=E6=A0=87=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=B7=A6?= =?UTF-8?q?=E4=BE=A7=E8=8F=9C=E5=8D=95=E6=A0=8F=E6=BB=91=E5=8A=A8=E4=BD=93?= =?UTF-8?q?=E9=AA=8C=20=E4=BF=AE=E5=A4=8D=E8=AF=AD=E8=A8=80=E5=8C=85?= =?UTF-8?q?=E5=9C=A8=E5=8A=A0=E8=BD=BD=E5=A4=B1=E8=B4=A5=E6=97=B6=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=B8=8D=E5=8A=A0=E8=BD=BD=E7=9A=84BUG=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=80=9A=E7=94=A8=E6=90=9C=E7=B4=A2=E5=9C=A8=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E5=90=8E=E5=88=86=E9=A1=B5=E7=9A=84BUG=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E7=AE=A1=E7=90=86=E5=91=98=E7=A6=81=E7=94=A8=E5=90=8E?= =?UTF-8?q?=E4=BB=8D=E7=84=B6=E8=83=BD=E7=99=BB=E5=BD=95=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E7=9A=84BUG=20=E4=BF=AE=E5=A4=8D=E4=B8=80=E9=94=AE=E6=89=93?= =?UTF-8?q?=E5=8C=85=E6=8F=92=E4=BB=B6=E5=9C=A8Win=E4=B8=8B=E6=89=93?= =?UTF-8?q?=E5=8C=85=E5=90=8E=E7=9B=AE=E5=BD=95=E8=B7=AF=E5=BE=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84BUG=20=E4=BF=AE=E5=A4=8DAPI=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?Token=E6=97=A0=E6=B3=95=E5=88=B7=E6=96=B0=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Addon.php | 4 +- .../admin/command/Api/template/index.html | 12 +- .../admin/command/Install/fastadmin.sql | 26 ++- application/admin/controller/Addon.php | 9 +- application/admin/lang/zh-cn.php | 2 + application/admin/lang/zh-cn/dashboard.php | 1 + application/admin/lang/zh-cn/index.php | 1 + application/admin/library/Auth.php | 7 +- application/admin/library/traits/Backend.php | 6 +- application/admin/model/User.php | 10 ++ application/admin/view/addon/config.html | 158 +++++++++--------- application/admin/view/dashboard/index.html | 5 + application/admin/view/user/user/edit.html | 6 + application/api/controller/Token.php | 8 +- application/common/library/Auth.php | 2 +- application/common/model/Area.php | 41 ++--- application/common/model/MoneyLog.php | 23 +++ application/common/model/User.php | 20 +++ application/config.php | 6 +- application/index/lang/zh-cn.php | 2 + application/index/view/index/index.html | 16 +- application/index/view/user/index.html | 8 +- extend/fast/Tree.php | 14 +- public/api.html | 12 +- public/assets/css/backend.css | 6 +- public/assets/css/backend.min.css | 2 +- public/assets/css/frontend.css | 10 +- public/assets/css/frontend.min.css | 2 +- public/assets/js/adminlte.js | 5 + .../assets/js/backend/general/attachment.js | 2 +- public/assets/js/backend/index.js | 15 +- .../assets/js/bootstrap-table-commonsearch.js | 1 + public/assets/js/fast.js | 2 +- public/assets/js/require-backend.min.js | 17 +- public/assets/js/require-form.js | 2 +- public/assets/js/require-frontend.min.js | 2 +- public/assets/less/backend.less | 6 +- public/assets/less/frontend.less | 9 +- public/install.php | 2 +- 39 files changed, 292 insertions(+), 190 deletions(-) create mode 100644 application/common/model/MoneyLog.php diff --git a/application/admin/command/Addon.php b/application/admin/command/Addon.php index c82335d6..e331367d 100644 --- a/application/admin/command/Addon.php +++ b/application/admin/command/Addon.php @@ -33,7 +33,7 @@ class Addon extends Command { $name = $input->getOption('name') ?: ''; $action = $input->getOption('action') ?: ''; - if(stripos($name, 'addons/')!==false){ + if (stripos($name, 'addons/') !== false) { $name = explode('/', $name)[1]; } //强制覆盖 @@ -241,7 +241,7 @@ class Addon extends Command foreach ($files as $name => $file) { if (!$file->isDir()) { $filePath = $file->getRealPath(); - $relativePath = substr($filePath, strlen($addonDir)); + $relativePath = str_replace(DS, '/', substr($filePath, strlen($addonDir))); if (!in_array($file->getFilename(), ['.git', '.DS_Store', 'Thumbs.db'])) { $zip->addFile($filePath, $relativePath); } diff --git a/application/admin/command/Api/template/index.html b/application/admin/command/Api/template/index.html index 153ad48a..b439c23b 100755 --- a/application/admin/command/Api/template/index.html +++ b/application/admin/command/Api/template/index.html @@ -9,15 +9,15 @@ {$config.title} - + - + +{if preg_match('/\/admin\/|admin\.php|admin_d75KABNWt\.php/i', url())} +
+ {:__('Security tips')} +
+{/if}
{:build_heading(null, false)} diff --git a/application/admin/view/user/user/edit.html b/application/admin/view/user/user/edit.html index a50ed2da..609f4a29 100644 --- a/application/admin/view/user/user/edit.html +++ b/application/admin/view/user/user/edit.html @@ -74,6 +74,12 @@
+
+ +
+ +
+
diff --git a/application/api/controller/Token.php b/application/api/controller/Token.php index fb6f4e42..f8a64ebb 100644 --- a/application/api/controller/Token.php +++ b/application/api/controller/Token.php @@ -3,6 +3,7 @@ namespace app\api\controller; use app\common\controller\Api; +use fast\Random; /** * Token接口 @@ -35,10 +36,13 @@ class Token extends Api */ public function refresh() { + //删除源Token $token = $this->auth->getToken(); + \app\common\library\Token::delete($token); + //创建新Token + $token = Random::uuid(); + \app\common\library\Token::set($token, $this->auth->id, 2592000); $tokenInfo = \app\common\library\Token::get($token); - $tokenInfo->expiretime = time() + 2592000; - $tokenInfo->save(); $this->success('', ['token' => $tokenInfo['token'], 'expires_in' => $tokenInfo['expires_in']]); } diff --git a/application/common/library/Auth.php b/application/common/library/Auth.php index 382ea970..cabbc3bf 100644 --- a/application/common/library/Auth.php +++ b/application/common/library/Auth.php @@ -32,7 +32,7 @@ class Auth { if ($config = Config::get('user')) { - $this->options = array_merge($this->config, $config); + $this->config = array_merge($this->config, $config); } $this->options = array_merge($this->config, $options); } diff --git a/application/common/model/Area.php b/application/common/model/Area.php index 5df6dd25..204ff682 100644 --- a/application/common/model/Area.php +++ b/application/common/model/Area.php @@ -14,9 +14,9 @@ class Area extends Model /** * 根据经纬度获取当前地区信息 * - * @param string $lng 经度 - * @param string $lat 纬度 - * @return array 城市信息 + * @param string $lng 经度 + * @param string $lat 纬度 + * @return Area 城市信息 */ public static function getAreaFromLngLat($lng, $lat, $level = 3) { @@ -24,17 +24,14 @@ class Area extends Model $rangearr = [1 => 15000, 2 => 1000, 3 => 200]; $geoname = isset($namearr[$level]) ? $namearr[$level] : $namearr[3]; $georange = isset($rangearr[$level]) ? $rangearr[$level] : $rangearr[3]; - $neararea = []; // 读取范围内的ID $redis = Cache::store('redis')->handler(); $georadiuslist = []; - if (method_exists($redis, 'georadius')) - { + if (method_exists($redis, 'georadius')) { $georadiuslist = $redis->georadius($geoname, $lng, $lat, $georange, 'km', ['WITHDIST', 'COUNT' => 5, 'ASC']); } - if ($georadiuslist) - { + if ($georadiuslist) { list($id, $distance) = $georadiuslist[0]; } $id = isset($id) && $id ? $id : 3; @@ -44,16 +41,15 @@ class Area extends Model /** * 根据经纬度获取省份 * - * @param string $lng 经度 - * @param string $lat 纬度 - * @return array + * @param string $lng 经度 + * @param string $lat 纬度 + * @return Area */ public static function getProvinceFromLngLat($lng, $lat) { - $provincedata = []; + $provincedata = null; $citydata = self::getCityFromLngLat($lng, $lat); - if ($citydata) - { + if ($citydata) { $provincedata = self::get($citydata['pid']); } return $provincedata; @@ -62,16 +58,15 @@ class Area extends Model /** * 根据经纬度获取城市 * - * @param string $lng 经度 - * @param string $lat 纬度 - * @return array + * @param string $lng 经度 + * @param string $lat 纬度 + * @return Area */ public static function getCityFromLngLat($lng, $lat) { - $citydata = []; + $citydata = null; $districtdata = self::getDistrictFromLngLat($lng, $lat); - if ($districtdata) - { + if ($districtdata) { $citydata = self::get($districtdata['pid']); } return $citydata; @@ -80,9 +75,9 @@ class Area extends Model /** * 根据经纬度获取地区 * - * @param string $lng 经度 - * @param string $lat 纬度 - * @return array + * @param string $lng 经度 + * @param string $lat 纬度 + * @return Area */ public static function getDistrictFromLngLat($lng, $lat) { diff --git a/application/common/model/MoneyLog.php b/application/common/model/MoneyLog.php new file mode 100644 index 00000000..9b3f8377 --- /dev/null +++ b/application/common/model/MoneyLog.php @@ -0,0 +1,23 @@ +money; + $after = $user->money + $money; + //更新会员信息 + $user->save(['money' => $after]); + //写入日志 + MoneyLog::create(['user_id' => $user_id, 'money' => $money, 'before' => $before, 'after' => $after, 'memo' => $memo]); + } + } + /** * 变更会员积分 * @param int $score 积分 diff --git a/application/config.php b/application/config.php index eae9a582..823b5b6c 100755 --- a/application/config.php +++ b/application/config.php @@ -260,8 +260,8 @@ return [ //是否开启前台会员中心 'usercenter' => true, //登录验证码 - 'login_captcha' => false, - //登录失败超过10则1天后重试 + 'login_captcha' => true, + //登录失败超过10次则1天后重试 'login_failure_retry' => true, //是否同一账号同一时间只能在一个地方登录 'login_unique' => false, @@ -272,7 +272,7 @@ return [ //自动检测更新 'checkupdate' => false, //版本号 - 'version' => '1.0.0.20181031_beta', + 'version' => '1.0.0.20181127_beta', //API接口地址 'api_url' => 'https://api.fastadmin.net', ], diff --git a/application/index/lang/zh-cn.php b/application/index/lang/zh-cn.php index acb6f735..397d0e73 100755 --- a/application/index/lang/zh-cn.php +++ b/application/index/lang/zh-cn.php @@ -27,6 +27,8 @@ return [ 'OK' => '确定', 'Cancel' => '取消', 'Loading' => '加载中', + 'Money' => '余额', + 'Score' => '积分', 'More' => '更多', 'Normal' => '正常', 'Hidden' => '隐藏', diff --git a/application/index/view/index/index.html b/application/index/view/index/index.html index 9734f9f8..87d0415c 100755 --- a/application/index/view/index/index.html +++ b/application/index/view/index/index.html @@ -12,17 +12,17 @@ FastAdmin - {:__('The fastest framework based on ThinkPHP5 and Bootstrap')} - + - - + + @@ -163,13 +163,13 @@ - + - + - + + - + +