作者 郭盛
1 个管道 的构建 通过 耗费 1 秒

授权登录

... ... @@ -2,8 +2,9 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e93f11c2-a7d9-4d35-8b1c-8dd18e7f5fef" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/application/api/controller/User.php" afterPath="$PROJECT_DIR$/application/api/controller/User.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/application/common/library/Auth.php" afterPath="$PROJECT_DIR$/application/common/library/Auth.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/application/extra/verify.php" afterPath="$PROJECT_DIR$/application/extra/verify.php" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
... ... @@ -17,17 +18,43 @@
<file leaf-file-name="User.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/application/api/controller/User.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="137">
<caret line="54" column="65" lean-forward="true" selection-start-line="54" selection-start-column="65" selection-end-line="54" selection-end-column="65" />
<state relative-caret-position="325">
<caret line="69" column="52" lean-forward="true" selection-start-line="69" selection-start-column="52" selection-end-line="69" selection-end-column="52" />
<folding>
<element signature="e#38#68#0#PHP" expanded="true" />
<element signature="e#391#463#0#PHP" expanded="false" />
<element signature="e#469#1207#0#PHP" expanded="false" />
<element signature="e#2881#3155#0#PHP" expanded="false" />
<element signature="e#3160#3384#0#PHP" expanded="false" />
<element signature="e#3390#3780#0#PHP" expanded="false" />
<element signature="e#3785#3994#0#PHP" expanded="false" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Auth.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/application/common/library/Auth.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="100">
<caret line="214" column="47" lean-forward="true" selection-start-line="214" selection-start-column="47" selection-end-line="214" selection-end-column="47" />
<folding>
<element signature="e#38#64#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Validate.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/thinkphp/library/think/Validate.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="378">
<caret line="112" column="20" lean-forward="false" selection-start-line="112" selection-start-column="20" selection-end-line="112" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindInProjectRecents">
... ... @@ -75,8 +102,9 @@
<option value="$PROJECT_DIR$/.gitlab-ci.yml" />
<option value="$PROJECT_DIR$/.gitignore" />
<option value="$PROJECT_DIR$/public/.gitignore" />
<option value="$PROJECT_DIR$/application/extra/verify.php" />
<option value="$PROJECT_DIR$/application/api/controller/User.php" />
<option value="$PROJECT_DIR$/application/extra/verify.php" />
<option value="$PROJECT_DIR$/application/common/library/Auth.php" />
</list>
</option>
</component>
... ... @@ -94,11 +122,11 @@
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
<component name="ProjectFrameBounds">
<option name="x" value="200" />
<option name="y" value="8" />
<option name="width" value="1940" />
<option name="height" value="1074" />
<component name="ProjectFrameBounds" extendedState="1">
<option name="x" value="143" />
<option name="y" value="78" />
<option name="width" value="1589" />
<option name="height" value="934" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
... ... @@ -133,6 +161,19 @@
<item name="areial" type="b2602c69:ProjectViewProjectNode" />
<item name="areial" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="application" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="admin" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
<path>
<item name="areial" type="b2602c69:ProjectViewProjectNode" />
<item name="areial" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="application" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="admin" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="model" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
<path>
<item name="areial" type="b2602c69:ProjectViewProjectNode" />
<item name="areial" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="application" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="extra" type="2a2b976b:PhpTreeStructureProvider$1" />
</path>
<path>
... ... @@ -183,7 +224,7 @@
<workItem from="1574062081278" duration="18239000" />
<workItem from="1574122453532" duration="15780000" />
<workItem from="1574141466352" duration="745000" />
<workItem from="1574143209694" duration="1978000" />
<workItem from="1574143209694" duration="3312000" />
</task>
<task id="LOCAL-00001" summary="调试">
<created>1574145133364</created>
... ... @@ -196,13 +237,13 @@
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="46671000" />
<option name="totallyTimeSpent" value="48005000" />
</component>
<component name="ToolWindowManager">
<frame x="200" y="8" width="1940" height="1074" extended-state="0" />
<frame x="143" y="78" width="1589" height="934" extended-state="1" />
<editor active="true" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.14893617" sideWeight="0.5" order="1" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18312623" sideWeight="0.5" order="1" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
... ... @@ -257,20 +298,6 @@
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/application/admin/view/wonderful/add.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="925">
<caret line="37" column="81" lean-forward="true" selection-start-line="37" selection-start-column="81" selection-end-line="37" selection-end-column="81" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/admin/view/wonderful/edit.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="125">
<caret line="5" column="156" lean-forward="false" selection-start-line="5" selection-start-column="156" selection-end-line="5" selection-end-column="156" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/admin/view/video/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="250">
... ... @@ -549,14 +576,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/common/library/Auth.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="303">
<caret line="195" column="20" lean-forward="false" selection-start-line="195" selection-start-column="20" selection-end-line="195" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/common/controller/Api.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="303">
... ... @@ -573,14 +592,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/extra/verify.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="100">
<caret line="4" column="55" lean-forward="true" selection-start-line="4" selection-start-column="55" selection-end-line="4" selection-end-column="55" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="25">
... ... @@ -605,14 +616,52 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/thinkphp/library/think/Validate.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="378">
<caret line="112" column="20" lean-forward="false" selection-start-line="112" selection-start-column="20" selection-end-line="112" selection-end-column="20" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/admin/model/User.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-300">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/extra/verify.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="12" column="11" lean-forward="true" selection-start-line="12" selection-start-column="11" selection-end-line="12" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/common/library/Auth.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="100">
<caret line="214" column="47" lean-forward="true" selection-start-line="214" selection-start-column="47" selection-end-line="214" selection-end-column="47" />
<folding>
<element signature="e#38#64#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/api/controller/User.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="137">
<caret line="54" column="65" lean-forward="true" selection-start-line="54" selection-start-column="65" selection-end-line="54" selection-end-column="65" />
<state relative-caret-position="325">
<caret line="69" column="52" lean-forward="true" selection-start-line="69" selection-start-column="52" selection-end-line="69" selection-end-column="52" />
<folding>
<element signature="e#38#68#0#PHP" expanded="true" />
<element signature="e#391#463#0#PHP" expanded="false" />
<element signature="e#469#1207#0#PHP" expanded="false" />
<element signature="e#2881#3155#0#PHP" expanded="false" />
<element signature="e#3160#3384#0#PHP" expanded="false" />
<element signature="e#3390#3780#0#PHP" expanded="false" />
<element signature="e#3785#3994#0#PHP" expanded="false" />
</folding>
</state>
</provider>
... ...
... ... @@ -108,4 +108,31 @@ class User extends Api
$this->success('SUCCESS',$data);
}
/**
* @ApiTitle (地区分类)
* @ApiSummary (地区分类)
* @ApiMethod (GET)
* @ApiRoute (/api/user/type)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
"id": 4,//分类id
"area_name": //分类名称
"thumbnail": //图片
}
})
*/
public function type()
{
$data = Db::name('type')
->field('id,area_name,thumbnail')
->order('id desc')
->select();
$this->success('SUCCESS',$data);
}
}
... ...
... ... @@ -193,23 +193,36 @@ class Auth
* @param string $password 密码
* @return boolean
*/
public function login($account, $password)
public function login($result)
{
$field = Validate::is($account, 'email') ? 'email' : (Validate::regex($account, '/^1\d{10}$/') ? 'mobile' : 'username');
$user = User::get([$field => $account]);
if (!$user) {
$this->setError('Account is incorrect');
return false;
}
if ($user->status != 'normal') {
$this->setError('Account is locked');
return false;
}
if ($user->password != $this->getEncryptPassword($password, $user->salt)) {
$this->setError('Password is incorrect');
return false;
// $field = Validate::is($account, 'email') ? 'email' : (Validate::regex($account, '/^1\d{10}$/') ? 'mobile' : 'username');
// $user = User::get([$field => $account]);
// if (!$user) {
// $this->setError('Account is incorrect');
// return false;
// }
//
// if ($user->status != 'normal') {
// $this->setError('Account is locked');
// return false;
// }
// if ($user->password != $this->getEncryptPassword($password, $user->salt)) {
// $this->setError('Password is incorrect');
// return false;
// }
$userModel = new \app\admin\model\User();
$where = ['openid'=>$result['openid']];
$ret = $userModel->where($where)->find();
if ($ret) {
unset($result['nickname']);
$userModel->where($where)->update($result);
} else {
$result['jointime'] = time();
$result['joinip'] = request()->ip();
$userModel->create($result);
}
$user = User::get($where);
//直接登录会员
$this->direct($user->id);
... ...
... ... @@ -4,4 +4,16 @@ return [
'app_id' => 'wx1f51f42105b63343',
'secret' => 'e7f2d59e21fff6f503744c584d2d6f26',
],
'user' => [
'rule' => [
'code' => 'require',
'nickname' => 'require',
'avatar' => 'require',
],
'msg' => [
'name.require' => '昵称不能为空',
'code.require' => 'code码不能为空',
'avatar' => '头像不能为空',
]
],
];
\ No newline at end of file
... ...