本示例是一个查看电影推荐个性化的微信小程序,小程序后端服务使用了MemFire Cloud,其中使用到的MemFire Cloud功能包括:
其中使用到的MemFire Cloud功能包括:
- 云数据库:存储电影推荐小程序所有数据表的信息。
- 即时API:创建数据表时会自动生成 API。
- 对象存储:存储电影推荐小程序中物料的图片。
创建应用
目的:通过创建的一个MemFire Cloud应用来获得数据库、对象存储等一系列资源,并将获得该应用专属的API访问链接和访问密钥,用户可以轻松的调用API接口与以上资源进行交互。
登录MemFire Cloud, 在“我的应用”页面创建一个新应用
创建数据表
创建moviesList表
在“表编辑器”页面,点击“新建表”,创建moviesList表。moviesList表主要记录电影的信息,表结构字段如下:
名称 | 类型 | 描述 |
---|---|---|
id | bigint | 主键,自动为列分配一个连续的唯一编号,唯一标识ID |
images | text | 电影图片 |
rating | real | 电影评分 |
created_at | timetamptz | 创建时间 |
title | text | 电影标题 |
genres | text | 电影类型 |
type | text | “popular”:热映 “coming”:待映“top”:口碑 |
name | text | 电影名 |
directors | text | 导演信息 |
casts | text | 演员阵容 |
year | text | 上映年份 |
collect_count | bigint | 有多少人看过 |
wish_count | bigint | 有多少人想看 |
ratings_count | bigint | 有多少评分人数 |
summary | text | 剧情简介 |
sql建表语句
create table
public."moviesList" (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
images text null,
rating real null,
title text null,
genres text null,
type text null,
name text null,
directors text null,
casts text null,
year text null,
collect_count bigint null,
wish_count bigint null,
ratings_count bigint null,
summary text null,
constraint popularMovies_pkey primary key (id)
) tablespace pg_default;
数据表创建完后需在表中手动插入一些电影的数据(以csv为例) ,如下图。
genres,year,collect_count,id,type,wish_count,name,ratings_count,created_at,images,summary,directors,casts,rating,title
"[""科幻"",""动画""]",2024,300,35426925,coming,500,机器人之梦,150,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2899644068.jpg,人类与机器人之间的深刻对话,"[{""name"":""巴勃罗·贝格尔"",""id"":""5"",""avatars"":""https://img3.doubanio.com/view/celebrity/m/public/p57957.webp""}]","[{""name"":""伊万·拉班达"",""id"":""6"",""avatars"":""https://img1.doubanio.com/cuphead/elessar-static/pics/personage-default-medium.png""},{""name"":""阿尔伯特·特里佛·塞加拉"",""id"":""7"",""avatars"":""https://img1.doubanio.com/cuphead/elessar-static/pics/personage-default-medium.png""}]",9.1,超越想象的未来
"[""动作"",""剧情""]",2023,120,35633650,top,200,坠落的审判,80,2024-04-03 09:57:31.903668+00,https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2905578172.jpg,一场关乎生死的法庭战役,"[{""name"":""茹斯汀·特里耶"",""id"":""1"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/58ee3c3b2dbb6bc46c41d503bfeede67.jpg""}]","[{""name"":""桑德拉·惠勒"",""id"":""2"",""avatars"":""https:\\img1.doubanio.com/view/personage/m/public/be50e3c89d301dfe5fdc22f2a7239bc9.jpg""},{""name"":""斯万·阿劳德"",""id"":""3"",""avatars"":""https:\\img2.doubanio.com/view/celebrity/m/public/p1404059479.1.webp""},
{""name"":""米洛·马查多·格拉纳"",""id"":""4"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/d38ba14d119026c0773addaabcc03817.jpg""}]",8.6,一场宿命的审判
"[""动作"",""悬疑""]",2022,150,35611467,popular,250,老狐狸,100,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2900908599.jpg,狡猾与正义的较量,"[{""name"":""萧雅全"",""id"":""19"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/5790e0d83f1dca653ac0350f22d53289.jpg""}]","[{""name"":""白润音"",""id"":""20"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/ead2ea153204a01eed8cbd1e6063b2c4.jpg""},{""name"":""刘冠廷"",""id"":""21"",""avatars"":""https://img3.doubanio.com/view/celebrity/m/public/p1579005184.32.webp""},{""name"":""陈慕义"",""id"":""22"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/41e11cc17eacb9c733c75832ddeb83f4.jpg""}]",8,狡猾的老狐狸
"[""喜剧"",""剧情""]",2023,50,35101440,top,80,奇迹俱乐部,30,2024-04-03 09:57:31.903668+00,https://img2.doubanio.com/view/photo/s_ratio_poster/public/p2893044591.jpg,奇迹背后的趣事,"[{""name"":""萨杜斯·奥沙利文"",""id"":""11"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p1475138016.35.webp""}]","[{""name"":""劳拉·琳妮"",""id"":""12"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p38385.webp""},{""name"":""凯西·贝茨"",""id"":""13"",""avatars"":""https://img3.doubanio.com/view/celebrity/m/public/p1594608290.72.webp""},{""name"":""玛吉·史密斯"",""id"":""14"",""avatars"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp""}]",6,天才们的趣事
"[""纪录片""]",2024,40,34971748,coming,60,鲍勃·马利:一份爱,20,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2901664238.jpg,爱与音乐的故事,"[{""name"":""雷纳尔多·马库斯·格林"",""id"":""15"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/22d3a58b34dd4a4dbdfe64317af49778.jpg""}]","[{""name"":""金斯利·本-阿迪尔"",""id"":""16"",""avatars"":""https://img3.doubanio.com/view/celebrity/m/public/p1594487115.02.webp""},{""name"":""拉什纳·林奇"",""id"":""17"",""avatars"":""https://img2.doubanio.com/view/celebrity/m/public/p1551871803.11.webp""},{""name"":""詹姆斯·诺顿"",""id"":""18"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p1527044721.75.webp""}]",6.3,浪漫的人生
"[""爱情"",""青春""]",2022,80,36245685,popular,100,青春18×2 通往有你的旅程,50,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2903683628.jpg,青春的热情与梦想,"[{""name"":""藤井道人"",""id"":""8"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/71632b460cc74f302c411239a868e848.jpg""}]","[{""name"":""许光汉"",""id"":""9"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/55b2f229f7b8828d0bfac9bb24aad3fb.jpg""},{""name"":""清原果耶"",""id"":""10"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/adf718b0fc24e8e3b9287c5375eba0f6.jpg""}]",7,青春的故事
"[""历史"",""传记""]",2023,200,36151692,popular,300,周处除三害,120,2024-04-03 09:57:31.903668+00,https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2905021483.jpg,智勇双全的周处,"[{""name"":""黄精甫"",""id"":""23"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/569cc1eb0ecd381c5de0b1024b069c3c.jpg""}]","[{""name"":""阮经天"",""id"":""24"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/87912c8b0d90d75ae5573931ee1122a2.jpg""},{""name"":""袁富华"",""id"":""25"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/3392a320776342313cd2c47b54b6dc0f.jpg""},{""name"":""陈以文"",""id"":""26"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/ec7c39ad326c0cc7b31ed02a50e1d8c9.jpg""}]",8.1,古代传奇
"[""剧情"",""家庭""]",2022,90,35350109,top,120,可怜的东西,70,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2897662939.jpg,家庭中的困境,"[{""name"":""欧格斯·兰斯莫斯"",""id"":""27"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/5d6d74e2ea830aa057add8d3207eeb8d.jpg""}]","[{""name"":""艾玛·斯通"",""id"":""28"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/4e463fd806e9f16d743364be7f9f82b3.jpg""},{""name"":""马克·鲁弗洛"",""id"":""29"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p15885.webp""},{""name"":""威廉·达福"",""id"":""30"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/9965dfe370e790a5f6b3d1b97b6aae8b.jpg""}]",7,家庭的挣扎
"[""爱情"",""剧情""]",2022,180,35712804,top,250,首尔之春,130,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2905204009.jpg,首尔的浪漫爱情故事,"[{""name"":""金成洙"",""id"":""43"",""avatars"":""https://img3.doubanio.com/view/celebrity/m/public/p1389952256.17.webp""}]","[{""name"":""黄政民"",""id"":""44"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/a4fc89306adb681dc5abc2788aef62d2.jpg""},{""name"":""郑雨盛"",""id"":""45"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p11924.webp""},{""name"":""李星民"",""id"":""46"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/c25b077d4b26b0b5eee6963186664f35.jpg""}]",8.8,浪漫之都
"[""动作"",""喜剧""]",2024,60,26608246,coming,90,新威龙杀阵,40,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2905374090.jpg,警匪间的战斗,"[{""name"":""道格·里曼"",""id"":""31"",""avatars"":""https://img2.doubanio.com/view/celebrity/m/public/p1515589113.61.webp""}]","[{""name"":""杰克·吉伦哈尔"",""id"":""32"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/79f100c47345218da474049984648e66.jpg""},{""name"":""康纳·麦格雷戈"",""id"":""33"",""avatars"":""https://img1.doubanio.com/view/celebrity/m/public/pClK58KJTpN0cel_avatar_uploaded1523030939.98.webp""},{""name"":""杰西卡·威廉姆斯"",""id"":""34"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p1499136016.86.webp""}]",6.3,喜剧动作电影
"[""动作"",""冒险""]",2022,70,35074609,popular,100,金手指,50,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2901830629.jpg,危险的冒险之旅,"[{""name"":""庄文强"",""id"":""35"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/872ce845d4e6e3395ff1766bff891505.jpg""}]","[{""name"":""梁朝伟"",""id"":""36"",""avatars"":""https://img2.doubanio.com/view/personage/m/public/b896568be8b524ede111bedc47c8211e.jpg""},{""name"":""刘德华"",""id"":""37"",""avatars"":""https://img2.doubanio.com/view/personage/m/public/8af9415de20cb759a27ad9c0565b9991.jpg""},{""name"":""蔡卓妍"",""id"":""38"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p35594.webp""}]",6.1,惊险刺激
"[""剧情""]",2023,120,36212631,popular,180,美国小说,90,2024-04-03 09:57:31.903668+00,https://img9.doubanio.com/view/photo/s_ratio_poster/public/p2902166424.jpg,美国文学作品的深度剖析,"[{""name"":""柯德·杰弗森"",""id"":""39"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/b780514987c271559d30a553d03bac56.jpg""}]","[{""name"":""杰弗里·怀特"",""id"":""40"",""avatars"":""https://img1.doubanio.com/view/celebrity/m/public/p1501005389.48.webp""},{""name"":""翠西·艾利斯·罗斯"",""id"":""41"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/451fc39af0f001a727a6186216c7214f.jpg""},{""name"":""约翰·奥提兹"",""id"":""42"",""avatars"":""https://img2.doubanio.com/view/celebrity/m/public/p17181.webp""}]",7.7,美国文学精粹
"[""悬疑"",""惊悚""]",2023,100,35169716,top,150,利益区域,80,2024-04-03 09:57:31.903668+00,https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2899514583.jpg,黑暗势力的较量,"[{""name"":""乔纳森·格雷泽"",""id"":""47"",""avatars"":""https://img3.doubanio.com/view/celebrity/m/public/p46473.webp""}]","[{""name"":""克里斯蒂安·富里道尔"",""id"":""48"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/f2b40ba26837fa0335d468e09810b353.jpg""},{""name"":""桑德拉·惠勒"",""id"":""49"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/be50e3c89d301dfe5fdc22f2a7239bc9.jpg""},{""name"":""约翰·卡特豪斯"",""id"":""50"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/94942d8b4f061d5894dcdbe95a4e8878.jpg""}]",7.4,暗流涌动的利益
"[""剧情"",""家庭""]",2022,150,35902857,popular,200,完美的日子,100,2024-04-03 09:57:31.903668+00,https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2898894527.jpg,一家人的幸福生活,"[{""name"":""维姆·文德斯"",""id"":""51"",""avatars"":""https://img3.doubanio.com/img/author/medium/public/1511495449.53.jpg""}]","[{""name"":""役所广司"",""id"":""52"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/e665f9516ac7422c877237accc525245.jpg""},{""name"":""柄本时生"",""id"":""53"",""avatars"":""https://img2.doubanio.com/view/celebrity/m/public/p1514644037.21.webp""},{""name"":""中野有纱"",""id"":""54"",""avatars"":""https://img2.doubanio.com/view/personage/m/public/d925a87faf237590ceb1d7f8cca04951.jpg""}]",8.3,幸福的家庭
"[""喜剧"",""爱情""]",2022,120,35875476,popular,180,法式火锅,90,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2898166668.jpg,法国浪漫爱情故事,"[{""name"":""陈英雄"",""id"":""59"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/ad433c8bd4082b17ff9497187afe6ad9.jpg""}]","[{""name"":""朱丽叶·比诺什"",""id"":""60"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/c5e6505d1ce1237608028d9e723dffac.jpg""},{""name"":""伯努瓦·马吉梅尔"",""id"":""61"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/bc709c44ae76428e1d420b742736a050.jpg""},{""name"":""埃马努埃尔·萨兰热"",""id"":""62"",""avatars"":""https://img2.doubanio.com/view/celebrity/m/public/p51941.webp""}]",7.5,美食与爱情
"[""悬疑"",""惊悚""]",2024,120,35448539,coming,200,奇美拉,80,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2892253589.jpg,奇幻世界中的生物,"[{""name"":""阿莉切·罗尔瓦赫尔"",""id"":""75"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/ffb97fa8db34f89a038fc77637bed8eb.jpg""}]","[{""name"":""乔什·奥康纳"",""id"":""76"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p1461729139.76.webp""},{""name"":""卡罗尔·杜阿尔特"",""id"":""77"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/8fccc0c0a7f3098bac0fda3a01f1e842.jpg""},{""name"":""文森佐·内莫拉托"",""id"":""78"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p1578294839.45.webp""}]",8,神秘的生物
"[""剧情"",""爱情""]",2022,150,36445098,popular,200,还有明天,120,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2906163989.jpg,爱情永不消逝,"[{""name"":""宝拉·柯特莱西"",""id"":""87"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p1433686654.16.webp""}]","[{""name"":""宝拉·柯特莱西"",""id"":""88"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p1433686654.16.webp""},{""name"":""瓦莱里奥·马斯坦德雷亚"",""id"":""89"",""avatars"":""https://img1.doubanio.com/view/celebrity/m/public/p7800.webp""},{""name"":""罗马纳·马乔拉·韦尔加诺"",""id"":""90"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/89c95b4fd83d5b72e27cb7babfca76f8.jpg""}]",8.7,爱情的未来
"[""动画"",""奇幻""]",2022,200,35797709,top,300,怪物,150,2024-04-03 09:57:31.903668+00,https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2903852637.jpg,奇幻世界中的冒险,"[{""name"":""是枝裕和"",""id"":""99"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/bf3076aab44ea8b9036672ae1664b467.jpg""}]","[{""name"":""安藤樱"",""id"":""100"",""avatars"":""https://img2.doubanio.com/view/personage/m/public/d0a7842d493d0735ed6e18d08dc0e291.jpg""},{""name"":""永山瑛太"",""id"":""101"",""avatars"":""https://img3.doubanio.com/view/celebrity/m/public/p6642.webp""},{""name"":""黑川想矢"",""id"":""102"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/26153dace6daf3b7e39e621ff74514c5.jpg""}]",8.6,奇幻之旅
"[""剧情"",""悬疑""]",2023,80,36151614,top,120,恶女,50,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2897435928.jpg,女性间的较量,"[{""name"":""宋欣颖"",""id"":""55"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/bef40d8b61c75b7b969baf2daec1503c.jpg""}]","[{""name"":""邵雨薇"",""id"":""56"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/67ffe1e365c6e2730ed424dfda894a6c.jpg""},{""name"":""林美秀"",""id"":""57"",""avatars"":""https://img3.doubanio.com/view/celebrity/m/public/p35113.webp""},{""name"":""凤小岳"",""id"":""58"",""avatars"":""https://img2.doubanio.com/view/personage/m/public/9fcd4111ce626e6770f702e10bd7c54e.jpg""}]",6.3,女人心计
"[""悬疑"",""犯罪""]",2023,70,35927496,top,100,潜行,50,2024-04-03 09:57:31.903668+00,https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2900207662.jpg,黑暗之中的追踪,"[{""name"":""关智耀"",""id"":""63"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/10eafc539a4dd6312a17f8da6e3597c6.jpg""}]","[{""name"":""刘德华"",""id"":""64"",""avatars"":""https://img2.doubanio.com/view/personage/m/public/8af9415de20cb759a27ad9c0565b9991.jpg""},{""name"":""林家栋"",""id"":""65"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/1791cbd7f119add0cf4fb4e1e6b88df5.jpg""},{""name"":""彭于晏"",""id"":""66"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p1368156632.65.webp""}]",5.2,秘密的潜行
"[""悬疑"",""恐怖""]",2022,90,35490167,popular,150,破墓,70,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2905896429.jpg,一场古墓冒险,"[{""name"":""张宰贤"",""id"":""67"",""avatars"":""https://img3.doubanio.com/view/celebrity/m/public/p1453634341.62.webp""}]","[{""name"":""崔岷植"",""id"":""68"",""avatars"":""https://img2.doubanio.com/view/personage/m/public/e746f48d9792aadc4be9f6fe5bce621e.jpg""},{""name"":""金高银"",""id"":""69"",""avatars"":""https://img3.doubanio.com/view/celebrity/m/public/p1466160094.63.webp""},{""name"":""李到晛"",""id"":""70"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p1612585194.65.webp""}]",7,古墓中的秘密
"[""剧情"",""喜剧""]",2024,100,35496212,coming,150,留校联盟,80,2024-04-03 09:57:31.903668+00,https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2902526533.jpg,友谊与爱情的故事,"[{""name"":""亚历山大·佩恩"",""id"":""71"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p1392345017.24.webp""}]","[{""name"":""保罗·吉亚玛提"",""id"":""72"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/6372e31d0a6c585e055619e544ad73e2.jpg""},{""name"":""达明·乔伊·伦道夫"",""id"":""73"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/a9afcf27c20588469ba4498a837255f6.jpg""},{""name"":""多米尼克·塞萨"",""id"":""74"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/31b8612f543816d70c17295b8988770f.jpg""}]",7.9,校园的温情
"[""剧情"",""家庭""]",2024,90,35579652,coming,150,养蜂人,70,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2902861438.jpg,养蜂人的故事,"[{""name"":""大卫·阿耶"",""id"":""79"",""avatars"":""https://img1.doubanio.com/view/celebrity/m/public/p47469.webp""}]","[{""name"":""杰森·斯坦森"",""id"":""80"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/d7af5026c75eee58f34f80a9a96768f7.jpgp""},{""name"":""乔什·哈切森"",""id"":""81"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/1cc7f8ae1889f197aef7ee9aaeef5b05.jpg""},{""name"":""杰瑞米·艾恩斯"",""id"":""82"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/e818c5c717efe11364da03d2b4cfcf86.jpg""}]",6.1,甜蜜的生活
"[""剧情"",""动作""]",2023,100,26745332,top,150,花月杀手,80,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2897460998.jpg,枪林弹雨的江湖之战,"[{""name"":""马丁·斯科塞斯"",""id"":""83"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/43fb2ed0ca3e05305ca1743b809b3ae7.jpg""}]","[{""name"":""莱昂纳多·迪卡普里奥"",""id"":""84"",""avatars"":""https://img9.doubanio.com/view/personage/m/public/610e400f3fd1ecab407677f7300bc735.jpg""},{""name"":""罗伯特·德尼罗"",""id"":""85"",""avatars"":""https://img2.doubanio.com/view/celebrity/m/public/p47221.webp""},{""name"":""莉莉·格莱斯顿"",""id"":""86"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/6fab8effd17cd11cfc84f39e0a46b1bf.jpg""}]",7.2,花月之杀
"[""动作"",""奇幻""]",2024,80,30444942,coming,120,海王2:失落的王国,60,2024-04-03 09:57:31.903668+00,https://img9.doubanio.com/view/photo/s_ratio_poster/public/p2900515564.jpg,海底世界的奇幻冒险,"[{""name"":""温子仁"",""id"":""91"",""avatars"":""https://img1.doubanio.com/view/personage/m/public/b55653316617fb515b3e0b9f15887af9.jpg""}]","[{""name"":""杰森·莫玛"",""id"":""92"",""avatars"":""https://img2.doubanio.com/view/personage/m/public/07af5fb783a9ba94c9ccd33cd10100fe.jpg""},{""name"":""帕特里克·威尔森"",""id"":""93"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p1386481612.26.webp""},{""name"":""叶海亚·阿卜杜勒-迈丁"",""id"":""94"",""avatars"":""https://img3.doubanio.com/view/celebrity/m/public/p1496195480.27.webp""}]",6.3,海底的奇幻之旅
"[""动作"",""冒险""]",2023,110,34438298,top,180,饥饿游戏:鸣鸟与蛇之歌,90,2024-04-03 09:57:31.903668+00,https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2900895923.jpg,生死搏斗的残酷竞赛,"[{""name"":""弗朗西斯·劳伦斯"",""id"":""95"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p24555.webp""}]","[{""name"":""汤姆·布莱斯"",""id"":""96"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/c1677ca7be6c1852d9b3853ca41bab9a.jpg""},{""name"":""瑞秋·齐格勒"",""id"":""97"",""avatars"":""https://img3.doubanio.com/view/personage/m/public/8eee54fc5e4b449ff2bd4b98fac4aa7f.jpg""},{""name"":""彼特·丁拉基"",""id"":""98"",""avatars"":""https://img1.doubanio.com/view/celebrity/m/public/p1395482254.99.webp""}]",6.7,生死之战
"[""剧情"",""战争""]",2022,120,35928797,popular,200,枯叶,80,2024-04-03 09:57:31.903668+00,https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2906351399.jpg,战争中的人性之光,"[{""name"":""阿基·考里斯马基"",""id"":""103"",""avatars"":""https://img9.doubanio.com/view/celebrity/m/public/p1024.webp""}]"," [{""name"":""阿尔玛·波斯蒂"",""id"":""104"",""avatars"":""https://img3.doubanio.com/view/celebrity/m/public/p1622085477.72.webp""},{""name"":""尤西·瓦塔宁"",""id"":""105"",""avatars"":""https://img2.doubanio.com/view/celebrity/m/public/pIknTsgZeX-ccel_avatar_uploaded1509434483.31.webp""}]",7.9,战火中的生命
创建策略
接下来,需要给moviesList表创建1条策略,此策略通过 SELECT 操作为所有用户提供对表的读取访问权限。,在“SQL执行器”页面,点击“新查询”按钮,新建一个SQL Query,执行以下操作:
CREATE POLICY "Enable read access for all users" ON "public"."moviesList"
AS PERMISSIVE FOR SELECT
TO public
USING (true)
创建movie_person_detail 表
在“表编辑器”页面,点击“新建表”,创建movie_person_detail 表。movie_person_detail 表主要记录导演或者演员的信息,表结构字段如下:
名称 | 类型 | 描述 |
---|---|---|
id | bigint | 主键,自动为列分配一个连续的唯一编号,唯一标识ID |
avatars | text | 导演或者演员的英文名的图片 |
name_en | real | 导演或者演员的英文名 |
created_at | timetamptz | 创建时间 |
name | text | 导演或者演员的中文名 |
born_place | bigint | 导演或者演员的出生地 |
works | bigint | 导演或者演员还有哪些作品 |
sql建表语句
create table
public.movie_person_detail (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
avatars text null,
name text null,
name_en text null,
born_place text null,
works text null,
constraint movie_person_detail_pkey primary key (id)
) tablespace pg_default;
数据表创建完后需在表中手动插入一些演员或者导演信息的数据(以csv为例) ,如下所示。
id,works,created_at,avatars,name,name_en,born_place
2,"[{""roles"":""导演"",""subject"":{""id"":1,""images"":""https://img9.doubanio.com/view/celebrity/m/public/p38385.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:56:00+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E7%A7%91%E6%8A%80.jpg?t=2024-04-03T06%3A27%3A43.988Z,琳达,Linda,上海
1,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
4,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
3,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
5,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
6,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
7,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
8,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
9,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
10,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
11,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
12,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
13,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
14,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
15,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
16,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
17,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
18,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
19,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
20,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
21,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
22,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
23,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
24,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
25,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
26,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
27,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
28,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
29,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
30,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
31,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
32,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
33,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
34,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
35,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
36,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
37,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
38,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
39,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
40,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
41,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
42,"[{""roles"":""主演"",""subject"":{""id"":1,""images"":""https://img1.doubanio.com/view/celebrity/m/public/p4208.webp"",""title"":""是一个非常好看的作品""}}]
",2024-04-03 06:52:08+00,https://cfm40oi5g6hasssesujg.baseapi.memfiredb.com/storage/v1/object/public/avatar/%E6%97%A9%E9%A4%90.jpg?t=2024-04-03T06%3A28%3A05.354Z,王帮,link,湖北武汉
创建策略
接下来,需要给movie_person_detail 表创建1条策略,此策略通过 SELECT 操作为所有用户提供对表的读取访问权限。,在“SQL执行器”页面,点击“新查询”按钮,新建一个SQL Query,执行以下操作:
CREATE POLICY "Enable read access for all users" ON "public"."movie_person_detail "
AS PERMISSIVE FOR SELECT
TO public
USING (true)
创建bucket
1.新建images存储桶
点击‘存储’图标菜单,点击‘创建新bucket’,创建images存储桶,存储桶是用来上传电影物料,像电影图片、电影人的图片等等。
注册小程序
以上是我们在MemFire Cloud上配置的全部步骤,接下来是在微信开发者工具上操作了。
如果您还未注册过小程序,请参考官方步骤注册小程序(只需要通过您的邮箱注册一个小程序获得一个appid,然后下载一个微信开发工具即可)
下载代码
git clone https://github.com/LucaRao/wechat-movie.git
需要下载小程序sdk依赖的版本已经写在package.json文件里,直接下载即可
Node.js (>=14.x <=18.x) 。
用微信开发者工具点击导入项目
选择目录是下载好的小程序项目的目录,AppID为您在微信公众平台注册小程序获得的专属appid。
构建npm
在右侧详情里面的本地设置把“使用npm模块”和“不校验合法域名”勾上。
打开终端,在项目根目录下执行如下命令 (小程序需要的MemFire Cloud的微信小程序SDK已经存在package.json里,可以直接安装全局依赖)。
npm init
npm install
点击开发者工具中的菜单栏:工具 /构建 npm
这一步npm就构建完成了,我们需要的依赖也已经下载好了,根目录下会多出两个文件,如下图。
获取 API密钥
接下来需要创建一个可以访问应用程序数据的客户端,小程序使用了MemFire Cloud 微信小程序SDK包,使用他生态里提供的功能(登录、注册、增删改查等)去进行交互。创建一个可以访问微信小程序数据的客户端需要接口的地址(URL)和一个数据权限的令牌(ANON_KEY),我们需要去应用的首页去获取这两个参数然后配置到lib/supabase.js里面去。
lib/supabase.js
import { createClient } from 'supabase-wechat-stable-v2'
const url = ""
const key = ""
export const supabase = createClient(url, key)
回到MemFire Cloud首页,在应用/首页页面,获取服务地址以及token信息,只需要从首页中获取URL接口地址和anon的密钥。
Anon(公开)密钥是客户端API密钥。它允许“匿名访问”您的数据库,直到用户登录。登录后,密钥将切换到用户自己的登录令牌。这将为数据启用行级安全性。
编译小程序
点击“编译”即可展示小程序完成后的效果。