Compare commits

...

2 Commits

Author SHA1 Message Date
qyzh 661c8dda85 修复赞助支付bug 2021-05-10 16:15:02 +08:00
qyzh 8b11fb604a 新增:发表issue奖励 2021-04-20 09:58:43 +08:00
2 changed files with 10 additions and 1 deletions

View File

@ -141,6 +141,15 @@ class IssuesController < ApplicationController
end
@issue.project_trends.create(user_id: current_user.id, project_id: @project.id, action_type: "create")
########## sponsor
amount = 2
user_wallet = current_user.get_wallet
user_wallet.receive(amount)
reason = "创建任务"
CoinChange.create(amount: amount, reason: reason, to_wallet_id: user_wallet.id)
##########
render json: {status: 0, message: "创建成", id: @issue.id}
else
normal_status(-1, "创建失败")

View File

@ -30,7 +30,7 @@ class Sponsorship < ApplicationRecord
Wallet.transaction do
success = sponsor_wallet.pay(amount)
if success
success developer_wallet.receive(amount)
developer_wallet.receive(amount)
update(accumulate: self.accumulate += amount)
reason = "#{sponsor.full_name}#{developer.full_name}的赞助支付。"
coinchange = CoinChange.new(amount: amount, reason: reason, to_wallet_id: developer_wallet.id, from_wallet_id: sponsor_wallet.id)