From ebe26c18da051d329b17b54bf7456a205a4ebe05 Mon Sep 17 00:00:00 2001 From: SisMaker <156736github> Date: Sat, 9 Apr 2022 01:03:37 +0800 Subject: [PATCH] =?UTF-8?q?ft:=20=E5=88=9D=E5=A7=8B=E5=8C=96=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 29 +++++++++++++++++++++++++++++ LICENSE | 21 +++++++++++++++++++++ README.md | 9 +++++++++ include/ranks.hrl | 7 +++++++ rebar.config | 10 ++++++++++ src/rank/rankMgr.erl | 5 +++++ src/rank/rankWork.erl | 5 +++++ src/ranks.app.src | 12 ++++++++++++ src/ranks.erl | 33 +++++++++++++++++++++++++++++++++ src/ranks_app.erl | 11 +++++++++++ src/ranks_sup.erl | 30 ++++++++++++++++++++++++++++++ 11 files changed, 172 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 include/ranks.hrl create mode 100644 rebar.config create mode 100644 src/rank/rankMgr.erl create mode 100644 src/rank/rankWork.erl create mode 100644 src/ranks.app.src create mode 100644 src/ranks.erl create mode 100644 src/ranks_app.erl create mode 100644 src/ranks_sup.erl diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ad44f1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +.eunit +*.o +*.beam +*.plt +erl_crash.dump +.concrete/DEV_MODE + +# rebar 2.x +.rebar +rel/example_project +ebin/* +deps + +# rebar 3 +.rebar3 +_build/ +_checkouts/ +rebar.lock + +# idea +.idea +*.iml +cmake-build* +CMakeLists.txt + +# nif compile temp file +*.pdb +*.d +compile_commands.json \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3d9494a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 AICells + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b395b1b --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +ranks +===== + +排行榜 + +Build +----- + + $ rebar3 compile diff --git a/include/ranks.hrl b/include/ranks.hrl new file mode 100644 index 0000000..2d76a24 --- /dev/null +++ b/include/ranks.hrl @@ -0,0 +1,7 @@ +-ifndef(RANKS_H_). +-define(RANKS_H_, true). + + + + +-endif. diff --git a/rebar.config b/rebar.config new file mode 100644 index 0000000..e196c7e --- /dev/null +++ b/rebar.config @@ -0,0 +1,10 @@ +{erl_opts, [no_debug_info, {i, "include"}]}. +{deps, [ + {eGbh, ".*", {git, "http://sismaker.tpddns.cn:53000/SisMaker/eGbh.git", {branch, "master"}}}, + {eSync, ".*", {git, "http://sismaker.tpddns.cn:53000/SisMaker/eSync.git", {branch, "master"}}} +]}. + +{shell, [ + % {config, "config/sys.config"}, + {apps, [ranks]} +]}. diff --git a/src/rank/rankMgr.erl b/src/rank/rankMgr.erl new file mode 100644 index 0000000..0b8037e --- /dev/null +++ b/src/rank/rankMgr.erl @@ -0,0 +1,5 @@ +-module(rankMgr). + +-behavior(gen_srv). + +-export([]). diff --git a/src/rank/rankWork.erl b/src/rank/rankWork.erl new file mode 100644 index 0000000..1f05884 --- /dev/null +++ b/src/rank/rankWork.erl @@ -0,0 +1,5 @@ +-module(rankWork). + +-behavior(gen_srv). + +-export([]). diff --git a/src/ranks.app.src b/src/ranks.app.src new file mode 100644 index 0000000..825a9f6 --- /dev/null +++ b/src/ranks.app.src @@ -0,0 +1,12 @@ +{application, ranks, + [{description, "An OTP application"}, + {vsn, "0.1.0"}, + {registered, []}, + {mod, {ranks_app, []}}, + {applications, [kernel, stdlib]}, + {env,[]}, + {modules, []}, + + {licenses, ["MIT"]}, + {links, []} + ]}. diff --git a/src/ranks.erl b/src/ranks.erl new file mode 100644 index 0000000..1356a08 --- /dev/null +++ b/src/ranks.erl @@ -0,0 +1,33 @@ +-module(ranks). + +-export([ + start/0 + , stop/0 + , + , initRank/1 %% 创建新的排行榜 + , updateScore/3 %% 更新分数 + , updateInfo/2 %% 更新其他分数 + , getRankInfo/3 %% 获取排行某页的信息 +]). + +start() -> + application:ensure_all_started(ranks). + +stop() -> + application:stop(ranks). + +startWork(Cnt) -> + ok. + +initRank(RankType) -> + ok. + +updateScore(RankType, Key, Score) -> + ok. + +updateInfo(Key, Infos) -> + ok. + +getRankInfo(RankType, Cnt, PageInfo) -> + ok. + diff --git a/src/ranks_app.erl b/src/ranks_app.erl new file mode 100644 index 0000000..86908ea --- /dev/null +++ b/src/ranks_app.erl @@ -0,0 +1,11 @@ +-module(ranks_app). + +-behaviour(application). + +-export([start/2, stop/1]). + +start(_StartType, _StartArgs) -> + ranks_sup:start_link(). + +stop(_State) -> + ok. diff --git a/src/ranks_sup.erl b/src/ranks_sup.erl new file mode 100644 index 0000000..27315c4 --- /dev/null +++ b/src/ranks_sup.erl @@ -0,0 +1,30 @@ +-module(ranks_sup). + +-behaviour(supervisor). + +-export([start_link/0]). + +-export([init/1]). + +-define(SERVER, ?MODULE). + +start_link() -> + supervisor:start_link({local, ?SERVER}, ?MODULE, []). + +%% sup_flags() = #{strategy => strategy(), % optional +%% intensity => non_neg_integer(), % optional +%% period => pos_integer()} % optional +%% child_spec() = #{id => child_id(), % mandatory +%% start => mfargs(), % mandatory +%% restart => restart(), % optional +%% shutdown => shutdown(), % optional +%% type => worker(), % optional +%% modules => modules()} % optional +init([]) -> + SupFlags = #{strategy => one_for_all, + intensity => 0, + period => 1}, + ChildSpecs = [], + {ok, {SupFlags, ChildSpecs}}. + +%% internal functions