Skip to content

Commit 29b4382

Browse files
author
zhangjiangbin
committed
修正支付订单时的BUG
1 parent 6033a49 commit 29b4382

File tree

5 files changed

+13
-23
lines changed

5 files changed

+13
-23
lines changed

app/Http/Controllers/AdminController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function index(Request $request)
5252
$flowCount = UserTrafficLog::query()->sum('u') + UserTrafficLog::query()->sum('d');
5353
$flowCount = $this->flowAutoShow($flowCount);
5454
$view['flowCount'] = $flowCount;
55-
$view['totalBalance'] = User::query()->sum('balance');
55+
$view['totalBalance'] = User::query()->sum('balance') / 100;
5656
$view['totalWaitRefAmount'] = ReferralLog::query()->whereIn('status', [0, 1])->sum('ref_amount');
5757
$view['totalRefAmount'] = ReferralApply::query()->where('status', 2)->sum('amount');
5858
$view['expireWarningUserCount'] = User::query()->where('expire_time', '<=', date('Y-m-d', strtotime("+" . self::$config['expire_days'] . " days")))->where('enable', 1)->count();
@@ -1570,7 +1570,7 @@ public function makeInvite(Request $request)
15701570
$obj = new Invite();
15711571
$obj->uid = $user['id'];
15721572
$obj->fuid = 0;
1573-
$obj->code = strtoupper(substr(md5(microtime() . $this->makeRandStr(6)), 8, 16));
1573+
$obj->code = strtoupper(substr(md5(microtime() . $this->makeRandStr(6)), 8, 12));
15741574
$obj->status = 0;
15751575
$obj->dateline = date('Y-m-d H:i:s', strtotime("+ 7days"));
15761576
$obj->save();

app/Http/Controllers/UserController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,8 @@ public function addOrder(Request $request)
758758
$userBalanceLogObj->user_id = $user->id;
759759
$userBalanceLogObj->order_id = $order->oid;
760760
$userBalanceLogObj->before = $user->balance;
761-
$userBalanceLogObj->after = $user->balance - $totalPrice;
762-
$userBalanceLogObj->balance = $totalPrice;
761+
$userBalanceLogObj->after = $user->balance - $totalPrice * 100;
762+
$userBalanceLogObj->amount = $totalPrice * 100;
763763
$userBalanceLogObj->desc = '购买流量包';
764764
$userBalanceLogObj->created_at = date('Y-m-d H:i:s');
765765
$userBalanceLogObj->save();

resources/views/admin/import.blade.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
<form action="{{url('admin/import')}}" method="post" enctype="multipart/form-data" class="form-horizontal form-bordered">
4141
<div class="form-body">
4242
<div class="form-group">
43-
<label class="control-label col-md-3"> JSON文件 </label>
44-
<div class="col-md-3">
43+
<label class="control-label col-md-2"> JSON文件 </label>
44+
<div class="col-md-6">
4545
<div class="fileinput fileinput-new" data-provides="fileinput">
4646
<div class="input-group input-large">
4747
<div class="form-control uneditable-input input-fixed input-medium" data-trigger="fileinput">
@@ -60,10 +60,10 @@
6060
</div>
6161
</div>
6262
</div>
63-
<div class="form-actions">
63+
<div class="form-actions left">
6464
<div class="row">
65-
<div class="col-md-offset-4 col-md-9">
66-
<button type="submit" class="btn green"> 导 入 </button>
65+
<div class="col-md-offset-2">
66+
<button type="submit" class="btn green"> 导入 </button>
6767
</div>
6868
</div>
6969
</div>

resources/views/admin/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
<h3 class="font-red">
112112
¥<span data-counter="counterup" data-value="{{$totalBalance}}"></span>
113113
</h3>
114-
<small>盈利</small>
114+
<small>总余额</small>
115115
</div>
116116
<div class="icon">
117117
<i class="icon-diamond"></i>

sql/update/20171129.sql

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,10 @@ INSERT INTO `country` VALUES ('45', '卢森堡', 'lu');
77
INSERT INTO `country` VALUES ('46', '比利时', 'be');
88

99

10-
-- 用户余额字段由decimal改为int,数值变大十倍
10+
-- 用户余额字段由decimal改为int,数值变大一百倍
1111
ALTER TABLE `user` MODIFY `balance` int(11) NOT NULL DEFAULT '0' COMMENT '余额,单位分';
1212
UPDATE `user` SET balance = balance * 100;
1313

1414

15-
DROP TABLE `user_balance_log`;
16-
CREATE TABLE `user_balance_log` (
17-
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
18-
`user_id` int(11) NOT NULL DEFAULT '0' COMMENT '账号ID',
19-
`order_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单ID',
20-
`before` int(11) NOT NULL DEFAULT '0' COMMENT '发生前余额,单位分',
21-
`after` int(11) NOT NULL DEFAULT '0' COMMENT '发生后金额,单位分',
22-
`amount` int(11) NOT NULL DEFAULT '0' COMMENT '发生金额,单位分',
23-
`desc` varchar(255) DEFAULT '' COMMENT '操作描述',
24-
`created_at` datetime DEFAULT NULL COMMENT '创建时间',
25-
PRIMARY KEY (`id`)
26-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
15+
-- 用于余额日志表 balance 字段改 amount字段
16+
ALTER TABLE `user_balance_log` CHANGE `balance` `amount` int(11) NOT NULL DEFAULT '0' COMMENT '发生金额,单位分';

0 commit comments

Comments
 (0)