修复注册赠送bug

pull/361/head
HXY 2 years ago
parent d999cdf3e5
commit dd09baa75a

@ -80,7 +80,7 @@ func (s *userManageSrv) UpdateUser(user *ms.User) error {
//获取用户的账单,判断是否赠送过 //获取用户的账单,判断是否赠送过
bills, err := (&dbr.WalletStatement{}).List(tx, &dbr.ConditionsT{ bills, err := (&dbr.WalletStatement{}).List(tx, &dbr.ConditionsT{
"user_id = ?": user.ID, "user_id = ?": user.ID,
"reason = ?": "手机号绑定赠送", "reason = ?": "注册赠送",
}, 0, 1) }, 0, 1)
if err != nil { if err != nil {
return err return err
@ -103,7 +103,8 @@ func (s *userManageSrv) UpdateUser(user *ms.User) error {
//获取当前时间戳并加上14天 //获取当前时间戳并加上14天
user.Balance = time.Now().Unix() + 1209600 user.Balance = time.Now().Unix() + 1209600
} else { } else {
user.Balance = oldUser.Balance + user.Balance //更新当前用户的balance时间戳增加14天
user.Balance = oldUser.Balance + 1209600
} }
err = user.Update(s.db) err = user.Update(s.db)
@ -116,7 +117,7 @@ func (s *userManageSrv) UpdateUser(user *ms.User) error {
UserID: user.ID, UserID: user.ID,
ChangeAmount: 1400, ChangeAmount: 1400,
BalanceSnapshot: user.Balance, BalanceSnapshot: user.Balance,
Reason: "手机号绑定赠送", Reason: "注册赠送",
}).Error; err != nil { }).Error; err != nil {
return err return err
} }

@ -97,7 +97,7 @@ func (s *alipayPrivSrv) UserRechargeLink(req *web.UserRechargeLinkReq) (*web.Use
p.TotalAmount = fmt.Sprintf("%.2f", float64(recharge.Amount)/100.0*a) p.TotalAmount = fmt.Sprintf("%.2f", float64(recharge.Amount)/100.0*a)
p.NotifyURL = "https://" + req.Host + "/v1/alipay/notify" p.NotifyURL = "https://" + req.Host + "/v1/alipay/notify"
//支付宝回调,如果是内网环境的话,需要增加内网穿透 //支付宝回调,如果是内网环境的话,需要增加内网穿透
//p.NotifyURL = "http://uszkjc.natappfree.cc/v1/alipay/notify" //p.NotifyURL = "http://bgqsmb.natappfree.cc/v1/alipay/notify"
rsp, err := s.alipayClient.TradePreCreate(p) rsp, err := s.alipayClient.TradePreCreate(p)
if err != nil { if err != nil {
logrus.Errorf("client.TradePreCreate err: %v\n", err) logrus.Errorf("client.TradePreCreate err: %v\n", err)

@ -20,7 +20,7 @@
:options="optionsRef" :options="optionsRef"
@search="handleSearch" @search="handleSearch"
@update:value="changeContent" @update:value="changeContent"
placeholder="讲讲今天和AI聊的工具吧" placeholder="讲讲今天和AiMo AI聊天的新发现吧"
/> />
</div> </div>
@ -147,7 +147,7 @@
</template> </template>
</n-button> </n-button>
<n-button <!-- <n-button
v-if="allowTweetVisibility" v-if="allowTweetVisibility"
quaternary quaternary
circle circle
@ -159,7 +159,7 @@
<eye-outline /> <eye-outline />
</n-icon> </n-icon>
</template> </template>
</n-button> </n-button> -->
</div> </div>
<div class="submit-wrap"> <div class="submit-wrap">

@ -5,7 +5,7 @@ const routes = [
path: '/', path: '/',
name: 'home', name: 'home',
meta: { meta: {
title: '广场', title: '发现',
keepAlive: true, keepAlive: true,
}, },
component: () => import('@/views/Home.vue'), component: () => import('@/views/Home.vue'),

@ -336,17 +336,17 @@ const userOptions = computed(() => {
}); });
} }
} }
if (user.is_friend) { // if (user.is_friend) {
options.push({ // options.push({
label: '', // label: '删除好友',
key: 'delete', // key: 'delete',
}); // });
} else { // } else {
options.push({ // options.push({
label: '', // label: '添加朋友',
key: 'requesting', // key: 'requesting',
}); // });
} // }
return options; return options;
}); });
const handleUserAction = ( const handleUserAction = (

@ -6,7 +6,7 @@
<div class="balance-wrap"> <div class="balance-wrap">
<div class="balance-line"> <div class="balance-line">
<!-- () --> <!-- () -->
<n-statistic label="会员有效期 (天)" <n-statistic label="订阅有效期 (天)"
><n-number-animation ><n-number-animation
:from="0.0" :from="0.0"
:to="timecal(store.state.userInfo.balance) || 0 " :to="timecal(store.state.userInfo.balance) || 0 "

Loading…
Cancel
Save