Skip to content

Commit

Permalink
Merge pull request #22 from 0xDarker/master
Browse files Browse the repository at this point in the history
一些小改动
  • Loading branch information
jianyan74 authored Jul 30, 2019
2 parents cdd6773 + 58ad20e commit 733a083
Show file tree
Hide file tree
Showing 17 changed files with 99 additions and 76 deletions.
2 changes: 1 addition & 1 deletion addons/RfMerchants/backend/views/manager/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
'format' => 'raw',
],
[
'label'=> '最后登陆',
'label'=> '最后登录',
'filter' => false, //不显示搜索框
'value' => function ($model) {
return "最后访问IP:" . $model->last_ip . '<br>'.
Expand Down
101 changes: 52 additions & 49 deletions api/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,59 +63,62 @@
'showScriptName' => false,
// 指定续接在URL后面的一个后缀,如 .html 之类的。仅在 enablePrettyUrl 启用时有效。
'suffix' => '',
'rules' => [
'rules' => array_merge(
[
'class' => 'yii\rest\UrlRule',
'controller' => [
/**
* 默认登录测试控制器(Post)
* http://当前域名/api/v1/site/login
*/
// 'sign-secret-key',
// 版本1
'v1/default',// 默认测试入口
'v1/site',
'v1/mini-program',
'v1/pay',
'v1/member/member',
'v1/member/address',
'v1/member/auth',
// 版本2
'v2/default', // 默认测试入口
[
'class' => 'yii\rest\UrlRule',
'controller' => [
/**
* 默认登录测试控制器(Post)
* http://当前域名/api/v1/site/login
*/
// 'sign-secret-key',
// 版本1
'v1/default',// 默认测试入口
'v1/site',
'v1/mini-program',
'v1/pay',
'v1/member/member',
'v1/member/address',
'v1/member/auth',
// 版本2
'v2/default', // 默认测试入口
],
'pluralize' => false, // 是否启用复数形式,注意index的复数indices,开启后不直观
'extraPatterns' => [
'POST login' => 'login', // 登录获取token
'POST refresh' => 'refresh', // 重置token
'POST sms-code' => 'sms-code', // 获取验证码
'POST register' => 'register', // 注册
'POST up-pwd' => 'up-pwd', // 重置密码
// 测试查询可删除 例如:http://www.rageframe.com/api/v1/default/search
'GET search' => 'search',
'GET session-key' => 'session-key', // 小程序获取session key
'POST decode' => 'decode', // 解密获取小程序用户信息数据
'GET qr-code' => 'qr-code', // 获取小程序码
]
],
'pluralize' => false, // 是否启用复数形式,注意index的复数indices,开启后不直观
'extraPatterns' => [
'POST login' => 'login', // 登录获取token
'POST refresh' => 'refresh', // 重置token
'POST sms-code' => 'sms-code', // 获取验证码
'POST register' => 'register', // 注册
'POST up-pwd' => 'up-pwd', // 重置密码
// 测试查询可删除 例如:http://www.rageframe.com/api/v1/default/search
'GET search' => 'search',
'GET session-key' => 'session-key', // 小程序获取session key
'POST decode' => 'decode', // 解密获取小程序用户信息数据
'GET qr-code' => 'qr-code', // 获取小程序码
]
],
[
'class' => 'yii\rest\UrlRule',
'controller' => ['v1/file'],
'pluralize' => false,
'extraPatterns' => [
'POST images' => 'images', // 图片上传
'POST videos' => 'videos', // 视频上传
'POST voices' => 'voices', // 语音上传
'POST files' => 'files', // 文件上传
'POST base64' => 'base64', // base64上传 其他上传权限自己添加
'POST merge' => 'merge', // 合并分片
[
'class' => 'yii\rest\UrlRule',
'controller' => ['v1/file'],
'pluralize' => false,
'extraPatterns' => [
'POST images' => 'images', // 图片上传
'POST videos' => 'videos', // 视频上传
'POST voices' => 'voices', // 语音上传
'POST files' => 'files', // 文件上传
'POST base64' => 'base64', // base64上传 其他上传权限自己添加
'POST merge' => 'merge', // 合并分片
],
],
[
'class' => 'api\rest\UrlRule',
'controller' => ['addons'],
'pluralize' => false,
],
],
[
'class' => 'api\rest\UrlRule',
'controller' => ['addons'],
'pluralize' => false,
],
]
require 'routes.php'
)
],
],
'params' => $params,
Expand Down
20 changes: 20 additions & 0 deletions api/config/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Author: [email protected]
* Created At: 2019/7/30 22:26
*/

return [
// 个人业务相关的路由规则
/**
[
'class' => 'yii\rest\UrlRule',
'controller' => ['module/controller'],
'pluralize' => false,
'extraPatterns' => [
'GET action' => 'action',
]
],
*/

];
2 changes: 1 addition & 1 deletion api/modules/v1/forms/LoginForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function attributeLabels()
}

/**
* 用户登陆
* 用户登录
*
* @return mixed|null|static
*/
Expand Down
2 changes: 1 addition & 1 deletion api/modules/v1/forms/RefreshForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function validateTime($attribute)

// 验证有效期
if ($timestamp + $expire <= time()) {
throw new UnauthorizedHttpException('您的重置令牌已经过期,请重新登陆');
throw new UnauthorizedHttpException('您的重置令牌已经过期,请重新登录');
}
}

Expand Down
2 changes: 1 addition & 1 deletion backend/behaviors/AfterLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use yii\base\Behavior;

/**
* 登陆后的行为
* 登录后的行为
*
* Class AfterLogin
* @package backend\behaviors
Expand Down
2 changes: 1 addition & 1 deletion backend/forms/LoginForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function loginCaptchaRequired()
}

/**
* 登陆
* 登录
*
* @return bool
* @throws \yii\base\InvalidConfigException
Expand Down
4 changes: 2 additions & 2 deletions backend/modules/member/views/member/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@
'format' => 'raw',
],
[
'label' => '最后登陆',
'label' => '最后登录',
'filter' => false, //不显示搜索框
'value' => function ($model) {
return "最后访问IP:" . $model->last_ip . '<br>' .
"最后访问:" . Yii::$app->formatter->asDatetime($model->last_time) . '<br>' .
"登陆次数" . $model->visit_count . '<br>' .
"登录次数" . $model->visit_count . '<br>' .
"注册时间:" . Yii::$app->formatter->asDatetime($model->created_at) . '<br>';
},
'format' => 'raw',
Expand Down
4 changes: 2 additions & 2 deletions backend/modules/sys/views/manager/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@
'format' => 'raw',
],
[
'label'=> '最后登陆',
'label'=> '最后登录',
'filter' => false, //不显示搜索框
'value' => function ($model) {
return "最后访问IP:" . $model->last_ip . '<br>'.
"最后访问:" . Yii::$app->formatter->asDatetime($model->last_time) . '<br>'.
"登陆次数" . $model->visit_count;
"登录次数" . $model->visit_count;
},
'format' => 'raw',
],
Expand Down
2 changes: 1 addition & 1 deletion backend/views/site/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>
<!-- /.login-logo -->
<div class="login-box-body">
<p class="login-box-msg">欢迎登陆</p>
<p class="login-box-msg">欢迎登录</p>
<?php $form = ActiveForm::begin([
'id' => 'login-form'
]); ?>
Expand Down
2 changes: 1 addition & 1 deletion common/models/api/AccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static function findIdentityByAccessToken($token, $type = null)

// 验证有效期
if ($timestamp + $expire <= time()) {
throw new UnauthorizedHttpException('您的登录验证已经过期,请重新登陆');
throw new UnauthorizedHttpException('您的登录验证已经过期,请重新登录');
}
}

Expand Down
4 changes: 2 additions & 2 deletions common/models/forms/LoginForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use yii\base\Model;

/**
* 登陆注册基类
* 登录注册基类
*
* Class LoginForm
* @package common\models\base
Expand Down Expand Up @@ -73,7 +73,7 @@ public function validatePassword($attribute)
}

/**
* 登陆
* 登录
*
* @return bool
*/
Expand Down
4 changes: 2 additions & 2 deletions common/models/member/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
* @property string $home_phone 家庭号码
* @property string $mobile 手机号码
* @property int $role 权限
* @property int $last_time 最后一次登陆时间
* @property string $last_ip 最后一次登陆ip
* @property int $last_time 最后一次登录时间
* @property string $last_ip 最后一次登录ip
* @property int $province_id 省
* @property int $city_id 城市
* @property int $area_id 地区
Expand Down
4 changes: 2 additions & 2 deletions common/models/sys/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
* @property string $mobile 手机号码
* @property string $home_phone 家庭号码
* @property int $visit_count 访问次数
* @property int $last_time 最后一次登陆时间
* @property string $last_ip 最后一次登陆ip
* @property int $last_time 最后一次登录时间
* @property string $last_ip 最后一次登录ip
* @property int $role 权限
* @property int $status 状态[-1:删除;0:禁用;1启用]
* @property string $created_at 创建时间
Expand Down
4 changes: 2 additions & 2 deletions console/migrations/m190719_024049_member.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public function up()
'home_phone' => "varchar(20) NULL DEFAULT '' COMMENT '家庭号码'",
'mobile' => "varchar(20) NULL DEFAULT '' COMMENT '手机号码'",
'role' => "smallint(6) NULL DEFAULT '10' COMMENT '权限'",
'last_time' => "int(10) NULL DEFAULT '0' COMMENT '最后一次登陆时间'",
'last_ip' => "varchar(16) NULL DEFAULT '' COMMENT '最后一次登陆ip'",
'last_time' => "int(10) NULL DEFAULT '0' COMMENT '最后一次登录时间'",
'last_ip' => "varchar(16) NULL DEFAULT '' COMMENT '最后一次登录ip'",
'province_id' => "int(10) NULL DEFAULT '0' COMMENT '省'",
'city_id' => "int(10) NULL DEFAULT '0' COMMENT '城市'",
'area_id' => "int(10) NULL DEFAULT '0' COMMENT '地区'",
Expand Down
4 changes: 2 additions & 2 deletions console/migrations/m190719_024049_sys_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function up()
'mobile' => "varchar(20) NULL DEFAULT '' COMMENT '手机号码'",
'home_phone' => "varchar(20) NULL DEFAULT '' COMMENT '家庭号码'",
'visit_count' => "smallint(5) unsigned NULL DEFAULT '0' COMMENT '访问次数'",
'last_time' => "int(10) NULL DEFAULT '0' COMMENT '最后一次登陆时间'",
'last_ip' => "varchar(16) NULL DEFAULT '' COMMENT '最后一次登陆ip'",
'last_time' => "int(10) NULL DEFAULT '0' COMMENT '最后一次登录时间'",
'last_ip' => "varchar(16) NULL DEFAULT '' COMMENT '最后一次登录ip'",
'role' => "smallint(6) NULL DEFAULT '10' COMMENT '权限'",
'status' => "tinyint(4) NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]'",
'created_at' => "int(10) unsigned NULL DEFAULT '0' COMMENT '创建时间'",
Expand Down
12 changes: 6 additions & 6 deletions docs/guide-zh-CN/api-upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

参数名 | 参数类型| 必填 | 默认 | 说明 | 备注
---|---|---|---|---|---
file | string| 是 | 无 | 文件 |
file | file| 是 | 无 | 文件 |
drive | string| 否 | local | 本地上传 | oss:阿里云;qiniu:七牛;cos:腾讯
thumb | array| 否 | 无 | 生成缩略图(具体看例子) |

Expand All @@ -29,10 +29,10 @@ thumb 数组例子(生成`100*100`和`200*200`的缩略图)
```
{
"thumb": [{
"widget": 100,
"width": 100,
"height": 100
}, {
"widget": 200,
"width": 200,
"height": 200
}]
}
Expand Down Expand Up @@ -62,7 +62,7 @@ thumb 数组例子(生成`100*100`和`200*200`的缩略图)

参数名 | 参数类型| 必填 | 默认 | 说明 | 备注
---|---|---|---|---|---
file | string| 是 | 无 | 文件 |
file | file| 是 | 无 | 文件 |
drive | string| 否 | local | 本地上传 | oss:阿里云;qiniu:七牛;cos:腾讯

返回
Expand All @@ -89,7 +89,7 @@ drive | string| 否 | local | 本地上传 | oss:阿里云;qiniu:七牛;cos:腾

参数名 | 参数类型| 必填 | 默认 | 说明 | 备注
---|---|---|---|---|---
file | string| 是 | 无 | 文件 |
file | file| 是 | 无 | 文件 |
drive | string| 否 | local | 本地上传 | oss:阿里云;qiniu:七牛;cos:腾讯

返回
Expand All @@ -116,7 +116,7 @@ drive | string| 否 | local | 本地上传 | oss:阿里云;qiniu:七牛;cos:腾

参数名 | 参数类型| 必填 | 默认 | 说明 | 备注
---|---|---|---|---|---
file | string| 是 | 无 | 文件 |
file | file| 是 | 无 | 文件 |
drive | string| 否 | local | 本地上传 | oss:阿里云;qiniu:七牛;cos:腾讯

返回
Expand Down

0 comments on commit 733a083

Please sign in to comment.