|
@@ -32,7 +32,7 @@ class Info
|
|
|
if (!$info) {
|
|
|
Dever::error('角色信息错误');
|
|
|
}
|
|
|
- $info['score'] = Dever::db('info', 'place_score')->find($info['score_id'], ['col' => 'id,exp,name,symbol,symbol_location']);
|
|
|
+ $info['score'] = Dever::load('info', 'place_score')->get($info['score_id']);
|
|
|
//$info['rebate'] = Dever::load('rebate', 'place_score')->get(4, $info['id']);
|
|
|
return $info;
|
|
|
}
|
|
@@ -46,14 +46,19 @@ class Info
|
|
|
$where['level'] = ['>=', $user['level']];
|
|
|
}
|
|
|
$where['status'] = 1;
|
|
|
- $data = Dever::db('level', 'place_role')->select($where, ['col' => 'id,info_id,name,info,level,pay_price as price,day,pay,type']);
|
|
|
+ $data = Dever::db('level', 'place_role')->select($where, ['col' => 'id,info_id,name,info,level,pay_price as price,day,upday,pay,type']);
|
|
|
$type = Dever::load('item', 'place_benefit')->getType(2, true);
|
|
|
if ($data) {
|
|
|
+ $user_level = Dever::db('level', 'place_role')->find($user['level_id']);
|
|
|
+ $set = ['user' => $user, 'score' => $score];
|
|
|
foreach ($data as $v) {
|
|
|
- if ($user['level_id'] > 0 && $v['id'] != $user['level_id'] && $v['type'] == 1 && $v['pay'] == 1) {
|
|
|
- $v['price'] -= $user['price'];
|
|
|
- $v['price'] = Dever::number($v['price']);
|
|
|
+ if ($v['type'] > 1) {
|
|
|
+ continue;
|
|
|
}
|
|
|
+ if ($v['price'] <= 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $v = Dever::load('price', 'place_role')->get($v, $set);
|
|
|
$v['active'] = 0;
|
|
|
if ($v['day'] > 0) {
|
|
|
$v['day_desc'] = $v['day'] . '天';
|
|
@@ -61,8 +66,22 @@ class Info
|
|
|
$v['day_desc'] = '永久';
|
|
|
}
|
|
|
|
|
|
+ if ($user['level_id'] == $v['id']) {
|
|
|
+ $v['button'] = '立即续费';
|
|
|
+ $v['day_desc'] = '续期' . $v['day_desc'];
|
|
|
+ } elseif ($user['level_id'] > 0) {
|
|
|
+ $v['button'] = '立即升级';
|
|
|
+ if ($v['upday'] == 2 && $user_level['type'] == $v['type']) {
|
|
|
+ $v['day_desc'] = '续期' . $v['day_desc'];
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $v['button'] = '立即开通';
|
|
|
+ }
|
|
|
+
|
|
|
$v['price_text'] = Dever::load('info', 'place_score')->getText($v['price'], $score);
|
|
|
|
|
|
+ $v['profit'] = [];
|
|
|
+
|
|
|
# 获取权益
|
|
|
$upgrade = Dever::db('role_upgrade', 'place_benefit')->select(['level_id' => $v['id']]);
|
|
|
$v['upgrade'] = [];
|
|
@@ -80,8 +99,8 @@ class Info
|
|
|
# 获取权益
|
|
|
$period = Dever::db('role_period', 'place_benefit')->select(['level_id' => $v['id']]);
|
|
|
$v['period'] = [];
|
|
|
- $v['profit'][] = '周期权益';
|
|
|
if ($period) {
|
|
|
+ $v['profit'][] = '周期权益';
|
|
|
foreach ($period as $v1) {
|
|
|
$desc['config_day'] = $v1['day'];
|
|
|
$desc['config_num'] = $v1['num'];
|
|
@@ -94,9 +113,7 @@ class Info
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (isset($v['profit']) && $v['profit']) {
|
|
|
- $result[] = $v;
|
|
|
- }
|
|
|
+ $result[] = $v;
|
|
|
}
|
|
|
}
|
|
|
return $result;
|