测试:- 爵位续费限制-错误修改
This commit is contained in:
@@ -135,7 +135,7 @@ class Nobility extends Model
|
|||||||
->where('lid', $lid)
|
->where('lid', $lid)
|
||||||
->find();
|
->find();
|
||||||
if (!$nobility_info) {
|
if (!$nobility_info) {
|
||||||
return ['code' => 0, 'msg' => '爵位不存在'];
|
return ['code' => 0, 'msg' => '爵位不存在', 'data' => null];
|
||||||
}
|
}
|
||||||
$user_info = db::name('user')
|
$user_info = db::name('user')
|
||||||
->field('id,nickname,avatar')
|
->field('id,nickname,avatar')
|
||||||
@@ -143,7 +143,7 @@ class Nobility extends Model
|
|||||||
->where('id', $user_id)
|
->where('id', $user_id)
|
||||||
->find();
|
->find();
|
||||||
if (!$user_info) {
|
if (!$user_info) {
|
||||||
return ['code' => 0, 'msg' => '用户不存在'];
|
return ['code' => 0, 'msg' => '用户不存在', 'data' => null];
|
||||||
}
|
}
|
||||||
$user_nobility_info = db::name('vs_user_nobility')
|
$user_nobility_info = db::name('vs_user_nobility')
|
||||||
->field('id,user_id,lid,end_time')
|
->field('id,user_id,lid,end_time')
|
||||||
@@ -162,7 +162,7 @@ class Nobility extends Model
|
|||||||
//判断是否可以续费
|
//判断是否可以续费
|
||||||
$end_time_to_day = floor($end_time / 86400);
|
$end_time_to_day = floor($end_time / 86400);
|
||||||
if($end_time_to_day > $nobility_info['day'] * 2){
|
if($end_time_to_day > $nobility_info['day'] * 2){
|
||||||
return ['code' => 0, 'msg' => '已超过2倍有效期,无序续费'];
|
return ['code' => 0, 'msg' => '已超过2倍有效期,无序续费', 'data' => null];
|
||||||
}
|
}
|
||||||
$data = [
|
$data = [
|
||||||
'end_time' => $end_time,
|
'end_time' => $end_time,
|
||||||
@@ -170,7 +170,7 @@ class Nobility extends Model
|
|||||||
];
|
];
|
||||||
$re = db::name('vs_user_nobility')->where('id', $user_nobility_info['id'])->update($data);
|
$re = db::name('vs_user_nobility')->where('id', $user_nobility_info['id'])->update($data);
|
||||||
if (!$re) {
|
if (!$re) {
|
||||||
return ['code' => 0, 'msg' => '失败'];
|
return ['code' => 0, 'msg' => '失败', 'data' => null];
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{ //升级
|
}else{ //升级
|
||||||
@@ -190,7 +190,7 @@ class Nobility extends Model
|
|||||||
db::name('vs_user_nobility')->where('id', $user_nobility_info['id'])->update(['delete_time'=>time()]);
|
db::name('vs_user_nobility')->where('id', $user_nobility_info['id'])->update(['delete_time'=>time()]);
|
||||||
$re = db::name('vs_user_nobility')->insert($data);
|
$re = db::name('vs_user_nobility')->insert($data);
|
||||||
if (!$re) {
|
if (!$re) {
|
||||||
return ['code' => 0, 'msg' => '失败'];
|
return ['code' => 0, 'msg' => '失败', 'data' => null];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{ //未购买 新购
|
}else{ //未购买 新购
|
||||||
@@ -204,7 +204,7 @@ class Nobility extends Model
|
|||||||
];
|
];
|
||||||
$re = db::name('vs_user_nobility')->insert($data);
|
$re = db::name('vs_user_nobility')->insert($data);
|
||||||
if (!$re) {
|
if (!$re) {
|
||||||
return ['code' => 0, 'msg' => '失败'];
|
return ['code' => 0, 'msg' => '失败', 'data' => null];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//记录日志
|
//记录日志
|
||||||
@@ -237,7 +237,7 @@ class Nobility extends Model
|
|||||||
if($pay_coin > 0){
|
if($pay_coin > 0){
|
||||||
$reslut = model('common/UserWallet')->change_user_money($user_id, $pay_coin, model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::NOBILITY_PURCHASE_COIN,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::NOBILITY_PURCHASE_COIN));
|
$reslut = model('common/UserWallet')->change_user_money($user_id, $pay_coin, model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::NOBILITY_PURCHASE_COIN,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::NOBILITY_PURCHASE_COIN));
|
||||||
if (!$reslut) {
|
if (!$reslut) {
|
||||||
return ['code' => 0, 'msg' => '失败'];
|
return ['code' => 0, 'msg' => '失败', 'data' => null];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ['code' => 1, 'msg' => '成功'];
|
return ['code' => 1, 'msg' => '成功'];
|
||||||
@@ -251,7 +251,7 @@ class Nobility extends Model
|
|||||||
->where('lid', $lid)
|
->where('lid', $lid)
|
||||||
->find();
|
->find();
|
||||||
if (!$nobility_info) {
|
if (!$nobility_info) {
|
||||||
return ['code' => 0, 'msg' => '爵位不存在'];
|
return ['code' => 0, 'msg' => '爵位不存在', 'data' => null];
|
||||||
}
|
}
|
||||||
$user_info = db::name('user')
|
$user_info = db::name('user')
|
||||||
->field('id,nickname,avatar')
|
->field('id,nickname,avatar')
|
||||||
@@ -259,7 +259,7 @@ class Nobility extends Model
|
|||||||
->where('id', $user_id)
|
->where('id', $user_id)
|
||||||
->find();
|
->find();
|
||||||
if (!$user_info) {
|
if (!$user_info) {
|
||||||
return ['code' => 0, 'msg' => '用户不存在'];
|
return ['code' => 0, 'msg' => '用户不存在', 'data' => null];
|
||||||
}
|
}
|
||||||
$user_nobility_info = db::name('vs_user_nobility')
|
$user_nobility_info = db::name('vs_user_nobility')
|
||||||
->field('id,user_id,lid,end_time')
|
->field('id,user_id,lid,end_time')
|
||||||
@@ -275,7 +275,7 @@ class Nobility extends Model
|
|||||||
//判断是否可以续费
|
//判断是否可以续费
|
||||||
$end_time_to_day = floor($end_time / 86400);
|
$end_time_to_day = floor($end_time / 86400);
|
||||||
if($end_time_to_day > $nobility_info['day'] * 2){
|
if($end_time_to_day > $nobility_info['day'] * 2){
|
||||||
return ['code' => 0, 'msg' => '已超过2倍有效期,无序续费'];
|
return ['code' => 0, 'msg' => '已超过2倍有效期,无序续费', 'data' => null];
|
||||||
}
|
}
|
||||||
}else{ //升级
|
}else{ //升级
|
||||||
$old_nobility_info = db::name('vs_nobility')
|
$old_nobility_info = db::name('vs_nobility')
|
||||||
|
|||||||
Reference in New Issue
Block a user