|
@@ -13,7 +13,7 @@ function handleOrder($orderInfo) { |
|
@@ -13,7 +13,7 @@ function handleOrder($orderInfo) { |
13
|
}
|
13
|
}
|
14
|
$insertData = [
|
14
|
$insertData = [
|
15
|
'user_id' => $orderInfo['other']['user_id'],
|
15
|
'user_id' => $orderInfo['other']['user_id'],
|
16
|
- 'money' => $orderInfo['other']['money'],
|
16
|
+ 'money' => $orderInfo['money'],
|
17
|
'memo' => '收到打赏',
|
17
|
'memo' => '收到打赏',
|
18
|
'createtime' => time(),
|
18
|
'createtime' => time(),
|
19
|
];
|
19
|
];
|
|
@@ -24,7 +24,7 @@ function handleOrder($orderInfo) { |
|
@@ -24,7 +24,7 @@ function handleOrder($orderInfo) { |
24
|
}
|
24
|
}
|
25
|
|
25
|
|
26
|
$updateData = [
|
26
|
$updateData = [
|
27
|
- 'money' => bcadd($userInfo['money'], $orderInfo['other']['money'], 2)
|
27
|
+ 'money' => bcadd($userInfo['money'], $orderInfo['money'], 2)
|
28
|
];
|
28
|
];
|
29
|
$res = $user->updateOne($orderInfo['other']['user_id'], $updateData);
|
29
|
$res = $user->updateOne($orderInfo['other']['user_id'], $updateData);
|
30
|
if(!$res) {
|
30
|
if(!$res) {
|
|
@@ -32,16 +32,32 @@ function handleOrder($orderInfo) { |
|
@@ -32,16 +32,32 @@ function handleOrder($orderInfo) { |
32
|
}
|
32
|
}
|
33
|
return true;
|
33
|
return true;
|
34
|
} elseif ($orderInfo['type'] == 2) { // 购买vip
|
34
|
} elseif ($orderInfo['type'] == 2) { // 购买vip
|
|
|
35
|
+
|
35
|
$student = new \app\api\model\Student();
|
36
|
$student = new \app\api\model\Student();
|
36
|
$studentInfo = $student->infoByUserIdCanShow($orderInfo['other']['user_id']);
|
37
|
$studentInfo = $student->infoByUserIdCanShow($orderInfo['other']['user_id']);
|
37
|
if(!$student) {
|
38
|
if(!$student) {
|
38
|
return false;
|
39
|
return false;
|
39
|
}
|
40
|
}
|
40
|
|
41
|
|
|
|
42
|
+ //添加明细
|
|
|
43
|
+ $insertData = [
|
|
|
44
|
+ 'user_id' => $orderInfo['other']['user_id'],
|
|
|
45
|
+ 'money' => $orderInfo['money'],
|
|
|
46
|
+ 'memo' => '购买VIP',
|
|
|
47
|
+ 'createtime' => time()
|
|
|
48
|
+ ];
|
|
|
49
|
+
|
41
|
if($studentInfo['vip_endtime']) {
|
50
|
if($studentInfo['vip_endtime']) {
|
42
|
if($studentInfo['vip_level'] == $orderInfo['other']['vip_level']) {
|
51
|
if($studentInfo['vip_level'] == $orderInfo['other']['vip_level']) {
|
43
|
if($studentInfo['vip_endtime'] >= time()) {
|
52
|
if($studentInfo['vip_endtime'] >= time()) {
|
44
|
$vipEndTime = bcadd($studentInfo['vip_endtime'], bcmul($orderInfo['other']['keep'], bcmul(3600, 24, 0), 0), 0);
|
53
|
$vipEndTime = bcadd($studentInfo['vip_endtime'], bcmul($orderInfo['other']['keep'], bcmul(3600, 24, 0), 0), 0);
|
|
|
54
|
+ //添加明细
|
|
|
55
|
+ $insertData = [
|
|
|
56
|
+ 'user_id' => $orderInfo['other']['user_id'],
|
|
|
57
|
+ 'money' => $orderInfo['money'],
|
|
|
58
|
+ 'memo' => '续费VIP',
|
|
|
59
|
+ 'createtime' => time()
|
|
|
60
|
+ ];
|
45
|
} else {
|
61
|
} else {
|
46
|
$vipEndTime = bcadd(bcmul($orderInfo['other']['keep'], bcmul(3600, 24, 0), 0), time(), 0);
|
62
|
$vipEndTime = bcadd(bcmul($orderInfo['other']['keep'], bcmul(3600, 24, 0), 0), time(), 0);
|
47
|
}
|
63
|
}
|
|
@@ -51,13 +67,7 @@ function handleOrder($orderInfo) { |
|
@@ -51,13 +67,7 @@ function handleOrder($orderInfo) { |
51
|
} else {
|
67
|
} else {
|
52
|
$vipEndTime = bcadd(bcmul($orderInfo['other']['keep'], bcmul(3600, 24, 0), 0), time(), 0);
|
68
|
$vipEndTime = bcadd(bcmul($orderInfo['other']['keep'], bcmul(3600, 24, 0), 0), time(), 0);
|
53
|
}
|
69
|
}
|
54
|
- //添加明细
|
|
|
55
|
- $insertData = [
|
|
|
56
|
- 'user_id' => $orderInfo['other']['user_id'],
|
|
|
57
|
- 'money' => $orderInfo['other']['money'],
|
|
|
58
|
- 'memo' => '购买VIP',
|
|
|
59
|
- 'createtime' => time()
|
|
|
60
|
- ];
|
70
|
+
|
61
|
$userMoneyLog = new \app\api\model\UserMoneyLog();
|
71
|
$userMoneyLog = new \app\api\model\UserMoneyLog();
|
62
|
$res1 = $userMoneyLog->addOne($insertData);
|
72
|
$res1 = $userMoneyLog->addOne($insertData);
|
63
|
|
73
|
|
|
@@ -66,6 +76,7 @@ function handleOrder($orderInfo) { |
|
@@ -66,6 +76,7 @@ function handleOrder($orderInfo) { |
66
|
'vip_endtime' => $vipEndTime,
|
76
|
'vip_endtime' => $vipEndTime,
|
67
|
];
|
77
|
];
|
68
|
$res = $student->updateOne($studentInfo['user_id'], $updateData);
|
78
|
$res = $student->updateOne($studentInfo['user_id'], $updateData);
|
|
|
79
|
+
|
69
|
if(!$res) {
|
80
|
if(!$res) {
|
70
|
return false;
|
81
|
return false;
|
71
|
}
|
82
|
}
|