From 5131c140bc2400f24667292986fe9d457add3a0e Mon Sep 17 00:00:00 2001 From: guosheng <gs@bronet.cn> Date: Tue, 19 Nov 2019 16:04:12 +0800 Subject: [PATCH] 首页接口 --- .idea/workspace.xml | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------- application/api/controller/User.php | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------- application/extra/verify.php | 1 + public/api.html | 304 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 4 files changed, 462 insertions(+), 106 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e2a2623..fd46e46 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,10 @@ <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" /> + <change type="MODIFICATION" beforePath="$PROJECT_DIR$/public/api.html" afterPath="$PROJECT_DIR$/public/api.html" /> </list> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="TRACKING_ENABLED" value="true" /> @@ -18,38 +19,26 @@ <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="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" /> + <state relative-caret-position="523"> + <caret line="199" column="0" lean-forward="true" selection-start-line="199" selection-start-column="0" selection-end-line="199" selection-end-column="0" /> <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" /> + <element signature="e#312#384#0#PHP" expanded="false" /> + <element signature="e#390#1128#0#PHP" expanded="false" /> + <element signature="e#1133#2796#0#PHP" expanded="false" /> + <element signature="e#2802#3330#0#PHP" expanded="false" /> + <element signature="e#3335#4106#0#PHP" expanded="false" /> + <element signature="e#4112#4519#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"> + <file leaf-file-name="verify.php" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/application/extra/verify.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" /> + <state relative-caret-position="450"> + <caret line="18" column="40" lean-forward="true" selection-start-line="18" selection-start-column="40" selection-end-line="18" selection-end-column="40" /> <folding /> </state> </provider> @@ -102,9 +91,9 @@ <option value="$PROJECT_DIR$/.gitlab-ci.yml" /> <option value="$PROJECT_DIR$/.gitignore" /> <option value="$PROJECT_DIR$/public/.gitignore" /> - <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" /> + <option value="$PROJECT_DIR$/application/extra/verify.php" /> + <option value="$PROJECT_DIR$/application/api/controller/User.php" /> </list> </option> </component> @@ -122,11 +111,11 @@ <sorting>DEFINITION_ORDER</sorting> </component> <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" /> - <component name="ProjectFrameBounds" extendedState="1"> - <option name="x" value="143" /> - <option name="y" value="78" /> + <component name="ProjectFrameBounds"> + <option name="x" value="434" /> + <option name="y" value="58" /> <option name="width" value="1589" /> - <option name="height" value="934" /> + <option name="height" value="930" /> </component> <component name="ProjectView"> <navigator currentView="ProjectPane" proportions="" version="1"> @@ -143,8 +132,6 @@ <foldersAlwaysOnTop value="true" /> </navigator> <panes> - <pane id="Scratches" /> - <pane id="Scope" /> <pane id="ProjectPane"> <subPane> <expand> @@ -176,15 +163,12 @@ <item name="application" type="2a2b976b:PhpTreeStructureProvider$1" /> <item name="extra" type="2a2b976b:PhpTreeStructureProvider$1" /> </path> - <path> - <item name="areial" type="b2602c69:ProjectViewProjectNode" /> - <item name="areial" type="2a2b976b:PhpTreeStructureProvider$1" /> - <item name="public" type="2a2b976b:PhpTreeStructureProvider$1" /> - </path> </expand> <select /> </subPane> </pane> + <pane id="Scratches" /> + <pane id="Scope" /> </panes> </component> <component name="PropertiesComponent"> @@ -224,7 +208,8 @@ <workItem from="1574062081278" duration="18239000" /> <workItem from="1574122453532" duration="15780000" /> <workItem from="1574141466352" duration="745000" /> - <workItem from="1574143209694" duration="3312000" /> + <workItem from="1574143209694" duration="3660000" /> + <workItem from="1574146994475" duration="3635000" /> </task> <task id="LOCAL-00001" summary="调试"> <created>1574145133364</created> @@ -237,20 +222,29 @@ <servers /> </component> <component name="TimeTrackingManager"> - <option name="totallyTimeSpent" value="48005000" /> + <option name="totallyTimeSpent" value="51988000" /> + </component> + <component name="TodoView"> + <todo-panel id="selected-file"> + <is-autoscroll-to-source value="true" /> + </todo-panel> + <todo-panel id="all"> + <are-packages-shown value="true" /> + <is-autoscroll-to-source value="true" /> + </todo-panel> </component> <component name="ToolWindowManager"> - <frame x="143" y="78" width="1589" height="934" extended-state="1" /> - <editor active="true" /> + <frame x="434" y="58" width="1589" height="930" extended-state="0" /> <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.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="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18574232" 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.32912987" 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" /> + <window_info id="Find" 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="4" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" 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="1" side_tool="false" content_ui="tabs" /> <window_info id="Run" 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="5" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> - <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.27178425" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> + <window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.26986128" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" 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="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> @@ -258,7 +252,6 @@ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="3" side_tool="false" content_ui="combo" /> - <window_info id="Find" 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="4" side_tool="false" content_ui="tabs" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> </layout> <layout-to-restore> @@ -268,17 +261,17 @@ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="1" 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="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" /> + <window_info id="Version Control" 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="1" side_tool="false" content_ui="tabs" /> <window_info id="Run" 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="5" side_tool="false" content_ui="tabs" /> - <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> - <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3295325" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> - <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.14787234" sideWeight="0.5" order="1" side_tool="false" content_ui="combo" /> + <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.27133757" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> + <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18574232" sideWeight="0.5" order="1" side_tool="false" content_ui="combo" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="3" side_tool="false" content_ui="combo" /> <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" /> <window_info id="Find" 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="4" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> - <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" 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="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> </layout-to-restore> </component> <component name="TypeScriptGeneratedFilesManager"> @@ -293,18 +286,11 @@ </component> <component name="XDebuggerManager"> <breakpoint-manager> - <option name="time" value="3" /> + <option name="time" value="4" /> </breakpoint-manager> <watches-manager /> </component> <component name="editorHistoryManager"> - <entry file="file://$PROJECT_DIR$/application/admin/view/video/index.html"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="250"> - <caret line="13" column="0" lean-forward="true" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/application/admin/view/type/index.html"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="325"> @@ -576,14 +562,6 @@ </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"> - <caret line="57" column="14" lean-forward="false" selection-start-line="57" selection-start-column="14" selection-end-line="57" selection-end-column="14" /> - <folding /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/thinkphp/helper.php"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="3"> @@ -596,7 +574,6 @@ <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="25"> <caret line="1" column="0" lean-forward="true" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" /> - <folding /> </state> </provider> </entry> @@ -604,7 +581,6 @@ <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="0"> <caret line="0" column="7" lean-forward="false" selection-start-line="0" selection-start-column="7" selection-end-line="0" selection-end-column="7" /> - <folding /> </state> </provider> </entry> @@ -616,52 +592,65 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/thinkphp/library/think/Validate.php"> + <entry file="file://$PROJECT_DIR$/application/admin/model/User.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" /> + <state relative-caret-position="-1991"> + <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/admin/model/User.php"> + <entry file="file://$PROJECT_DIR$/application/common/library/Auth.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" /> + <state relative-caret-position="650"> + <caret line="212" column="0" lean-forward="true" selection-start-line="212" selection-start-column="0" selection-end-line="212" selection-end-column="0" /> + <folding> + <element signature="e#38#64#0#PHP" expanded="false" /> + </folding> + </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="453"> + <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/extra/verify.php"> + <entry file="file://$PROJECT_DIR$/application/common/controller/Api.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" /> + <state relative-caret-position="-3497"> + <caret line="57" column="14" lean-forward="false" selection-start-line="57" selection-start-column="14" selection-end-line="57" selection-end-column="14" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/application/common/library/Auth.php"> + <entry file="file://$PROJECT_DIR$/public/uploads/20191118/6c67e6b0911d47744cdffc3d1e422ee4.jpg"> + <provider selected="true" editor-type-id="images"> + <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="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 relative-caret-position="450"> + <caret line="18" column="40" lean-forward="true" selection-start-line="18" selection-start-column="40" selection-end-line="18" selection-end-column="40" /> + <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="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" /> + <state relative-caret-position="523"> + <caret line="199" column="0" lean-forward="true" selection-start-line="199" selection-start-column="0" selection-end-line="199" selection-end-column="0" /> <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" /> + <element signature="e#312#384#0#PHP" expanded="false" /> + <element signature="e#390#1128#0#PHP" expanded="false" /> + <element signature="e#1133#2796#0#PHP" expanded="false" /> + <element signature="e#2802#3330#0#PHP" expanded="false" /> + <element signature="e#3335#4106#0#PHP" expanded="false" /> + <element signature="e#4112#4519#0#PHP" expanded="false" /> </folding> </state> </provider> diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 8720118..60a076e 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -15,7 +15,7 @@ use fast\Http; */ class User extends Api { - protected $noNeedLogin = ['login', 'mobilelogin', 'register', 'resetpwd', 'changeemail', 'changemobile', 'third']; + protected $noNeedLogin = ['login']; protected $noNeedRight = '*'; public function _initialize() @@ -88,30 +88,51 @@ class User extends Api } /** - * @ApiTitle (首页) - * @ApiSummary (首页) + * @ApiTitle (首页视频、图片、精美大片入口) + * @ApiSummary (首页视频、图片、精美大片入口) * @ApiMethod (POST) * @ApiRoute (/api/user/index) * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") * @ApiReturn ({ 'code':'1', - 'msg':'返回成功' + 'msg':'返回成功', + "time": "1571492001", + "data": { + "video_thumbnail": http://mapwww.baidu.com 视频封面图地址 + "pic_thumbnail": http://mapwww.baidu.com 图片地址 + "wonderful_thumbnail": http://mapwww.baidu.com 精美大片地址 + } }) */ public function index() { + $rule = config('verify.path'); $data = Db::name('video') ->field('id,thumbnail') ->order('id desc') ->limit('1') ->find(); - $this->success('SUCCESS',$data); + $pic = Db::name('pic') + ->field('id,thumbnail') + ->order('id desc') + ->limit('1') + ->find(); + $wonderful = Db::name('wonderful') + ->field('id,thumbnail') + ->order('id desc') + ->limit('1') + ->find(); + $this->auth; + $res['video_thumbnail'] = $rule.$data['thumbnail']; + $res['pic_thumbnail'] = $rule.$pic['thumbnail']; + $res['wonderful_thumbnail'] = $rule.$wonderful['thumbnail']; + $this->success('SUCCESS',$res); } /** * @ApiTitle (地区分类) * @ApiSummary (地区分类) - * @ApiMethod (GET) + * @ApiMethod (POST) * @ApiRoute (/api/user/type) * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") * @@ -120,19 +141,70 @@ class User extends Api "msg": "成功", "time": "1571492001", "data": { - "id": 4,//分类id - "area_name": //分类名称 - "thumbnail": //图片 - } + "id": 4,//分类id + "area_name": //分类名称 + "thumbnail": //图片 + } }) */ public function type() { + $rule = config('verify.path'); $data = Db::name('type') ->field('id,area_name,thumbnail') ->order('id desc') ->select(); + foreach ($data as &$v){ + $v['thumbnail'] = $rule.$v['thumbnail']; + } $this->success('SUCCESS',$data); } + /** + * @ApiTitle (搜索页) + * @ApiSummary (搜索页) + * @ApiMethod (POST) + * @ApiRoute (/api/user/search) + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") + * @ApiParams (name="type_id", type="inter", required=false, description="视频/图片 (视频为1 图片为2)") + * @ApiParams (name="keyword", type="string", required=true, description="关键字") + * @ApiReturn({ + "code": 1, + "msg": "成功", + "time": "1571492001", + "data": { + "id": 4,//视频id/图片id, + "thumbnail": //视频封面图地址/图片地址, + "video": //视频路径, + } + }) + */ + public function search() + { + $rule = config('verify.path'); + $type_id = $this->request->post('type_id'); + $keyword = $this->request->post('keyword'); + if(!empty($keyword)){ + if($type_id == 1){ + $where['keyword'] = ['like',"%$keyword%"]; + $where['title'] = ['like',"%$keyword%"]; + $data = Db::name('video') + ->where($where) + ->order('id desc') + ->select(); + foreach ($data as &$v){ + $v['thumbnail'] = $rule.$v['thumbnail']; + $v['video'] = $rule.$v['video']; + } + }elseif($type_id == 2){ + + } + }else{ + $this->error(['code'=>2,'msg'=>'请输入关键字']); + } + + } + + + } diff --git a/application/extra/verify.php b/application/extra/verify.php index 9bc4f10..e65de66 100644 --- a/application/extra/verify.php +++ b/application/extra/verify.php @@ -16,4 +16,5 @@ return [ 'avatar' => '头像不能为空', ] ], + 'path'=>'http://areial.w.brotop.cn', ]; \ No newline at end of file diff --git a/public/api.html b/public/api.html index f324894..32825c9 100644 --- a/public/api.html +++ b/public/api.html @@ -165,7 +165,9 @@ <a href="#个人中心" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">个人中心 <i class="fa fa-caret-down"></i></a> <div class="child collapse" id="个人中心"> <a href="javascript:;" data-id="8" class="list-group-item">小程序登录</a> - <a href="javascript:;" data-id="9" class="list-group-item">首页</a> + <a href="javascript:;" data-id="9" class="list-group-item">首页视频、图片、精美大片入口</a> + <a href="javascript:;" data-id="10" class="list-group-item">地区分类</a> + <a href="javascript:;" data-id="11" class="list-group-item">搜索页</a> </div> </div> </div> @@ -1279,7 +1281,7 @@ <div class="panel-heading" id="heading-9"> <h4 class="panel-title"> <span class="label label-primary">POST</span> - <a data-toggle="collapse" data-parent="#accordion9" href="#collapseOne9"> 首页 <span class="text-muted">/api/user/index</span></a> + <a data-toggle="collapse" data-parent="#accordion9" href="#collapseOne9"> 首页视频、图片、精美大片入口 <span class="text-muted">/api/user/index</span></a> </h4> </div> <div id="collapseOne9" class="panel-collapse collapse"> @@ -1297,7 +1299,7 @@ <div class="tab-pane active" id="info9"> <div class="well"> - 首页 </div> + 首页视频、图片、精美大片入口 </div> <div class="panel panel-default"> <div class="panel-heading"><strong>Headers</strong></div> <div class="panel-body"> @@ -1388,7 +1390,299 @@ <div class="col-md-12"> <pre id="sample_response9">{ 'code':'1', - 'msg':'返回成功' + 'msg':'返回成功', + "time": "1571492001", + "data": { + "video_thumbnail": http://mapwww.baidu.com 视频封面图地址 + "pic_thumbnail": http://mapwww.baidu.com 图片地址 + "wonderful_thumbnail": http://mapwww.baidu.com 精美大片地址 + } + }</pre> + </div> + </div> + </div><!-- #sample --> + + </div><!-- .tab-content --> + </div> + </div> + </div> + <div class="panel panel-default"> + <div class="panel-heading" id="heading-10"> + <h4 class="panel-title"> + <span class="label label-primary">POST</span> + <a data-toggle="collapse" data-parent="#accordion10" href="#collapseOne10"> 地区分类 <span class="text-muted">/api/user/type</span></a> + </h4> + </div> + <div id="collapseOne10" class="panel-collapse collapse"> + <div class="panel-body"> + + <!-- Nav tabs --> + <ul class="nav nav-tabs" id="doctab10"> + <li class="active"><a href="#info10" data-toggle="tab">基础信息</a></li> + <li><a href="#sandbox10" data-toggle="tab">在线测试</a></li> + <li><a href="#sample10" data-toggle="tab">返回示例</a></li> + </ul> + + <!-- Tab panes --> + <div class="tab-content"> + + <div class="tab-pane active" id="info10"> + <div class="well"> + 地区分类 </div> + <div class="panel panel-default"> + <div class="panel-heading"><strong>Headers</strong></div> + <div class="panel-body"> + <table class="table table-hover"> + <thead> + <tr> + <th>名称</th> + <th>类型</th> + <th>必选</th> + <th>描述</th> + </tr> + </thead> + <tbody> + <tr> + <td>token</td> + <td>string</td> + <td>是</td> + <td>请求的Token</td> + </tr> + </tbody> + </table> + </div> + </div> + <div class="panel panel-default"> + <div class="panel-heading"><strong>参数</strong></div> + <div class="panel-body"> + 无 + </div> + </div> + <div class="panel panel-default"> + <div class="panel-heading"><strong>正文</strong></div> + <div class="panel-body"> + 无 </div> + </div> + </div><!-- #info --> + + <div class="tab-pane" id="sandbox10"> + <div class="row"> + <div class="col-md-12"> + <div class="panel panel-default"> + <div class="panel-heading"><strong>Headers</strong></div> + <div class="panel-body"> + <div class="headers"> + <div class="form-group"> + <label class="control-label" for="token">token</label> + <input type="string" class="form-control input-sm" id="token" required placeholder="请求的Token - Ex: " name="token"> + </div> + </div> + </div> + </div> + <div class="panel panel-default"> + <div class="panel-heading"><strong>参数</strong></div> + <div class="panel-body"> + <form enctype="application/x-www-form-urlencoded" role="form" action="/api/user/type" method="POST" name="form10" id="form10"> + <div class="form-group"> + 无 + </div> + <div class="form-group"> + <button type="submit" class="btn btn-success send" rel="10">提交</button> + <button type="reset" class="btn btn-info" rel="10">重置</button> + </div> + </form> + </div> + </div> + <div class="panel panel-default"> + <div class="panel-heading"><strong>响应输出</strong></div> + <div class="panel-body"> + <div class="row"> + <div class="col-md-12" style="overflow-x:auto"> + <pre id="response_headers10"></pre> + <pre id="response10"></pre> + </div> + </div> + </div> + </div> + <div class="panel panel-default"> + <div class="panel-heading"><strong>返回参数</strong></div> + <div class="panel-body"> + 无 + </div> + </div> + </div> + </div> + </div><!-- #sandbox --> + + <div class="tab-pane" id="sample10"> + <div class="row"> + <div class="col-md-12"> + <pre id="sample_response10">{ + "code": 1, + "msg": "成功", + "time": "1571492001", + "data": { + "id": 4,//分类id + "area_name": //分类名称 + "thumbnail": //图片 + } + }</pre> + </div> + </div> + </div><!-- #sample --> + + </div><!-- .tab-content --> + </div> + </div> + </div> + <div class="panel panel-default"> + <div class="panel-heading" id="heading-11"> + <h4 class="panel-title"> + <span class="label label-primary">POST</span> + <a data-toggle="collapse" data-parent="#accordion11" href="#collapseOne11"> 搜索页 <span class="text-muted">/api/user/search</span></a> + </h4> + </div> + <div id="collapseOne11" class="panel-collapse collapse"> + <div class="panel-body"> + + <!-- Nav tabs --> + <ul class="nav nav-tabs" id="doctab11"> + <li class="active"><a href="#info11" data-toggle="tab">基础信息</a></li> + <li><a href="#sandbox11" data-toggle="tab">在线测试</a></li> + <li><a href="#sample11" data-toggle="tab">返回示例</a></li> + </ul> + + <!-- Tab panes --> + <div class="tab-content"> + + <div class="tab-pane active" id="info11"> + <div class="well"> + 搜索页 </div> + <div class="panel panel-default"> + <div class="panel-heading"><strong>Headers</strong></div> + <div class="panel-body"> + <table class="table table-hover"> + <thead> + <tr> + <th>名称</th> + <th>类型</th> + <th>必选</th> + <th>描述</th> + </tr> + </thead> + <tbody> + <tr> + <td>token</td> + <td>string</td> + <td>是</td> + <td>请求的Token</td> + </tr> + </tbody> + </table> + </div> + </div> + <div class="panel panel-default"> + <div class="panel-heading"><strong>参数</strong></div> + <div class="panel-body"> + <table class="table table-hover"> + <thead> + <tr> + <th>名称</th> + <th>类型</th> + <th>必选</th> + <th>描述</th> + </tr> + </thead> + <tbody> + <tr> + <td>type_id</td> + <td>inter</td> + <td>否</td> + <td>视频/图片 (视频为1 图片为2)</td> + </tr> + <tr> + <td>keyword</td> + <td>string</td> + <td>是</td> + <td>关键字</td> + </tr> + </tbody> + </table> + </div> + </div> + <div class="panel panel-default"> + <div class="panel-heading"><strong>正文</strong></div> + <div class="panel-body"> + 无 </div> + </div> + </div><!-- #info --> + + <div class="tab-pane" id="sandbox11"> + <div class="row"> + <div class="col-md-12"> + <div class="panel panel-default"> + <div class="panel-heading"><strong>Headers</strong></div> + <div class="panel-body"> + <div class="headers"> + <div class="form-group"> + <label class="control-label" for="token">token</label> + <input type="string" class="form-control input-sm" id="token" required placeholder="请求的Token - Ex: " name="token"> + </div> + </div> + </div> + </div> + <div class="panel panel-default"> + <div class="panel-heading"><strong>参数</strong></div> + <div class="panel-body"> + <form enctype="application/x-www-form-urlencoded" role="form" action="/api/user/search" method="POST" name="form11" id="form11"> + <div class="form-group"> + <label class="control-label" for="type_id">type_id</label> + <input type="inter" class="form-control input-sm" id="type_id" placeholder="视频/图片 (视频为1 图片为2)" name="type_id"> + </div> + <div class="form-group"> + <label class="control-label" for="keyword">keyword</label> + <input type="string" class="form-control input-sm" id="keyword" required placeholder="关键字" name="keyword"> + </div> + <div class="form-group"> + <button type="submit" class="btn btn-success send" rel="11">提交</button> + <button type="reset" class="btn btn-info" rel="11">重置</button> + </div> + </form> + </div> + </div> + <div class="panel panel-default"> + <div class="panel-heading"><strong>响应输出</strong></div> + <div class="panel-body"> + <div class="row"> + <div class="col-md-12" style="overflow-x:auto"> + <pre id="response_headers11"></pre> + <pre id="response11"></pre> + </div> + </div> + </div> + </div> + <div class="panel panel-default"> + <div class="panel-heading"><strong>返回参数</strong></div> + <div class="panel-body"> + 无 + </div> + </div> + </div> + </div> + </div><!-- #sandbox --> + + <div class="tab-pane" id="sample11"> + <div class="row"> + <div class="col-md-12"> + <pre id="sample_response11">{ + "code": 1, + "msg": "成功", + "time": "1571492001", + "data": { + "id": 4,//视频id/图片id, + "thumbnail": //视频封面图地址/图片地址, + "video": //视频路径, + } }</pre> </div> </div> @@ -1404,7 +1698,7 @@ <div class="row mt0 footer"> <div class="col-md-6" align="left"> - Generated on 2019-11-19 13:24:02 </div> + Generated on 2019-11-19 16:03:49 </div> <div class="col-md-6" align="right"> <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a> </div> -- libgit2 0.24.0