V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  gfreezy  ›  全部回复第 2 页 / 共 24 页
回复总数  462
1  2  3  4  5  6  7  8  9  10 ... 24  
265 天前
回复了 aababc 创建的主题 程序员 关于连续订阅的业务设计
@aababc 不记得细节了,只参与了设计,没写具体的代码。
但是 expire date 和扣费肯定是一致的,扣费成功 expire date 延长,扣费失败,expire date 不变。

是否可以使用 expires_date - purchase_date

这个应该是不行的。purchase date 不是开始时间。自动续费的时候一般会在周期结束前几天扣款。

我记得我们好像是固定死 31 天,这样实现比较简单(相当于没有 31 天的月份多送用户几天)
265 天前
回复了 aababc 创建的主题 程序员 关于连续订阅的业务设计
restore 并不会影响 expire time 。expire time 只受 3 个因素影响:
1. 自动扣费成功,延长时间
2. 退款完成,扣减时间
3. 其他类似赠送、单次购买等


如果说切换账号 restore ,这是另外一个问题了。原来的账号要如何处理,是否要作废掉?新账号怎么算?

@aababc
265 天前
回复了 aababc 创建的主题 程序员 关于连续订阅的业务设计
@fengYH8080 +1 。我们也是类似的实现,只要订阅没关,所有赠送的时长都永远用不上
349 天前
回复了 shrinco 创建的主题 买买买 给程序猿推荐一口锅吧
#小程序://下厨房商店/59mEQ4xPYgsFpTp 推荐个我们公司在卖的
github 搜 WrappingHStack 。这个用 HStack 是实现不了的,要用 Layout 协议自己实现布局
@liufengsoft722 fakedns ,需要将需要中转的域名都解析道 10.11.*.* ,然后 10.11.*.* 这个网段的 ip 都路由到 tun 。
自己实现一个 dns 服务器,然后将本机 dns ip 设置为自己服务器启动的地址。
可以试一下“多说” https://talkface.ai/
2024-03-14 16:09:36 +08:00
回复了 anson264556364 创建的主题 音乐 繁体批量更改为简体
用 chatgpt
@jukanntenn 字符串模糊匹配性能足够,windows 应该也有剪贴板历史软件吧
无限历史的剪贴板是不是就可以,raycast 自带的剪切板就挺好用的
2023-10-27 14:24:42 +08:00
回复了 dtekol 创建的主题 服务器 阿里云 e 系列服务器最低价购买(无 aff)
可以看看这个 UCloud ,1C1G1M 香港一年 120 ,可以买 3 年

https://www.ucloud.cn/site/active/kuaijiesale.html
2023-07-25 19:36:14 +08:00
回复了 xiaoqidev 创建的主题 分享发现 自由职业/独立开发第 5 年,把自己玩废了
好奇是什么软件
2023-07-12 15:24:11 +08:00
回复了 evada 创建的主题 iOS 不是推广,只是觉得有点意思, 利用 AI 锻炼口语
可以试试我们的产品,叫 “多说”,美区可以搜 talkface 。https://talkface.ai/
ios 不是不支持 sideload 吗?怎么安装第三方 app ?
这是干嘛的?没看明白
2023-05-09 23:30:31 +08:00
回复了 coderQiQin 创建的主题 问与答 服务器代理有什么好的方式?
可以看下我写的 https://github.com/gfreezy/seeker ,可以全局代理
2023-04-13 12:17:48 +08:00
回复了 0littleboy 创建的主题 Swift Swift 如何优化数据加载方式?
getPredictiveContestList 这个应该是个 publisher
2023-04-13 12:09:41 +08:00
回复了 JinTianYi456 创建的主题 问与答 求个算法,均摊问题
```

def reallocate_prices(total: Decimal, prices: List[Decimal], fraction_number: int = 0) -> List[Decimal]:
"""
把总金额按照 prices 里面各自数目比例均分。
:param total: 总金额
:param prices: 金额的数组
:param fraction_number: 保留小数的位数,最大为 2 位小数
返回均分后的金额数组
假设 total = 10 ,prices = [10, 20, 30, 40]
计算过程是,先把 prices 求和为 sum_prices
主要逻辑就是 new_prices = [
total/sum_prices*10,
total/sum_prices*(10+20) - total/sum_prices*10,
total/sum_prices*(10+20+30) - total/sum_prices*(10+20) - total/sum_prices*10,
total/sum_prices*(10+20+30+40) - total/sum_prices*(10+20+30) - total/sum_prices*(10+20) - total/sum_prices*10
]
"""
total = Decimal(total)
prices = [Decimal(str(p)) for p in prices]
sum_price = sum(prices)
new_prices: List[Decimal] = []
# 用 index 来保留原有的位置
accumulated = Decimal('0')
for price in prices:
accumulated += price
# 按比例分配,并且保留特定的小数位数。
new_price = fraction(total * accumulated / sum_price, fraction_number) - sum(new_prices)
new_prices.append(new_price)

if sum(new_prices) != total:
raise PriceCalculationError
return new_prices

```
1  2  3  4  5  6  7  8  9  10 ... 24  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1383 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 36ms · UTC 16:51 · PVG 00:51 · LAX 09:51 · JFK 12:51
Developed with CodeLauncher
♥ Do have faith in what you're doing.