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 @@ - + - + - + + - + +