server icon indicating copy to clipboard operation
server copied to clipboard

feat: timeline

Open TWT233 opened this issue 3 years ago • 106 comments

timeline is a post arrangement component in bgm, which based on posts' chrono order

this commit introduces the package timeline and wraps its CRUD functionality into interface

#176

TWT233 avatar Jun 20 '22 12:06 TWT233

是draft,开错了

TWT233 avatar Jun 20 '22 12:06 TWT233

这个Create分类型提供几个不同的方法?现在这样的话上层有点太难用了

trim21 avatar Jun 20 '22 12:06 trim21

再封一层服务层吧,现在的repo看起来像是封装dal的业务层

TWT233 avatar Jun 20 '22 14:06 TWT233

Housa Hitomi @.***> 于2022年6月20日周一 22:50写道:

再封一层服务层吧,现在的repo看起来像是封装dal的业务层

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

trim21 avatar Jun 20 '22 14:06 trim21

合一下master然后重新生成下gorm,加了个配置不生成json tag

trim21 avatar Jun 21 '22 23:06 trim21

有进展吗,收藏的部分做得差不多了,就差时间线了(

trim21 avatar Jun 27 '22 21:06 trim21

没进展,这周在搬家,今晚一定(

TWT233 avatar Jun 28 '22 08:06 TWT233

暂时需要的只有两种时间线。我暂时只写了会生成前者的那个 API,可以先只做第一种,第二种后面再做也不急

看过 ep.1 South Park Season 25 2天9小时前 · web

完成了 Criminal Minds Season 13 3 of 22 话 2天2小时前 · web

trim21 avatar Jun 29 '22 01:06 trim21

暂时需要的只有两种时间线。我暂时只写了会生成前者的那个 API,可以先只做第一种,第二种后面再做也不急

看过 ep.1 South Park Season 25 2天9小时前 · web

完成了 Criminal Minds Season 13 3 of 22 话 2天2小时前 · web

第一种在dev env的mysql里没搜到,cat=4?

TWT233 avatar Jun 29 '22 13:06 TWT233

可能漏了,晚点我再导出下

trim21 avatar Jun 29 '22 14:06 trim21

也加到dev-env了

trim21 avatar Jun 29 '22 14:06 trim21

ok 我看看

TWT233 avatar Jun 29 '22 14:06 TWT233

应该不至于把176直接就关了,改了一下PR的描述。

trim21 avatar Jun 30 '22 02:06 trim21

也对,应该下一个commit才关

TWT233 avatar Jun 30 '22 06:06 TWT233

创建时需要把 model 转换成 dao,需要 phpserialize.Marshal(),这里表现有点怪: 上面的是数据库里的 raw data 下面是 raw data -> model -> re data

`a:5:{s:5:"ep_id";s:6:"751409";s:7:"ep_name";s:10:"Killer App";s:7:"ep_soZrt";s:1:"4";s:10:"subject_id";s:6:"214114";s:12:"subject_name";s:24:"Criminal Minds Season 13";}`
`a:5:{s:5:"ep_id";d:751409    ;s:7:"ep_name";s:10:"Killer App";s:7:"ep_so rt";d:4    ;s:10:"subject_id";d  :214114  ;s:12:"subject_name";s:24:"Criminal Minds Season 13";}`

看起来是数据类型的问题,原本是不是用了 IntString 之类的东西

TWT233 avatar Jun 30 '22 11:06 TWT233

有些int原本是存了str…

trim21 avatar Jun 30 '22 15:06 trim21

忍受不了 github.com/elliotchance/phpserialize 了,等我写个新的php序列化库

trim21 avatar Jul 01 '22 01:07 trim21

这个我也可以一起写

TWT233 avatar Jul 01 '22 02:07 TWT233

写个支持嵌套struct的 Unmarshal吧,Marshal我写的差不多了

trim21 avatar Jul 01 '22 03:07 trim21

要支持到go的json那个程度会不会太费劲了点(

trim21 avatar Jul 01 '22 03:07 trim21

就这个仓库里?

TWT233 avatar Jul 01 '22 03:07 TWT233

php 的 serialize 支持传什么参数来改变行为吗,不支持的话先写个标准的 marshal/unmarshal 就好

TWT233 avatar Jul 01 '22 03:07 TWT233

有些int原本是存了str…

那要转回IntString吗,感觉得再加一层

TWT233 avatar Jul 01 '22 03:07 TWT233

就标准的序列化成php array,从php array解析就好了,应该没用到其他的。

我建了个仓库倒是,感觉marshal和unmarshal也共用不了多少代码吧。

https://github.com/Trim21/go-phpserialize

trim21 avatar Jul 01 '22 03:07 trim21

mapstructure支持WeakTyped可以自动转

trim21 avatar Jul 01 '22 03:07 trim21

mapstructure 是 unmarshal 时用,现在是要 marshal 写回数据库

得看要不要兼容老系统,不兼容的话肯定现在这么用还更好,毕竟 IntString 有额外存储开销

TWT233 avatar Jul 01 '22 03:07 TWT233

啊。。。。。。。。那问题复杂了起来

trim21 avatar Jul 01 '22 03:07 trim21

那还是得兼容

trim21 avatar Jul 01 '22 03:07 trim21

TWT233 avatar Jul 01 '22 03:07 TWT233

我看https://github.com/Trim21/go-phpserialize 还是empty

TWT233 avatar Jul 01 '22 06:07 TWT233