|
@@ -29,7 +29,7 @@ class Recharge
|
|
|
if(!$rs){
|
|
|
Db::rollback();
|
|
|
filePut('[wallet][paySucc] pay_order update fail'.$orderId);
|
|
|
- abort(500,lang('订单更新失败'));
|
|
|
+ abort(500,'订单更新失败');
|
|
|
}
|
|
|
|
|
|
//先充值
|
|
@@ -38,15 +38,61 @@ class Recharge
|
|
|
{
|
|
|
Db::rollback();
|
|
|
filePut('[wallet][paySucc]网银充值入账更新余额失败 recharge money fail'.$orderId.$result['msg']);
|
|
|
- abort(500,lang('网银充值入账 model wallet recharge money fail'));
|
|
|
+ abort(500,'网银充值入账 model wallet recharge money fail');
|
|
|
}
|
|
|
+
|
|
|
+ //首充
|
|
|
+ $first_map = [
|
|
|
+ 'uid' => $args['user_id'],
|
|
|
+ 'pg_id' => $args['pg_id'],
|
|
|
+ ];
|
|
|
+ $first_check = Db::name('user_paygold_log')->where($first_map)->find();
|
|
|
+ if(empty($first_check)){
|
|
|
+
|
|
|
+ //首充日志
|
|
|
+ $first_log_id = Db::name('user_paygold_log')->insertGetId($first_map);
|
|
|
+ if(!$first_log_id){
|
|
|
+ Db::rollback();
|
|
|
+ abort(500,'首充赠送失败');
|
|
|
+ }
|
|
|
+ //送金币
|
|
|
+ if(isset($args['first_gold']) && $args['first_gold'] > 0){
|
|
|
+ $result = model('Wallet')->lockChangeAccountRemain($args['user_id'],'gold',$args['first_gold'],14, '金币充值:'.$orderId,'pay_order',$order['id']);
|
|
|
+ if($result['status']===false)
|
|
|
+ {
|
|
|
+ Db::rollback();
|
|
|
+ filePut('[wallet][paySucc]网银充值入账更新余额失败 recharge money fail'.$orderId.$result['msg']);
|
|
|
+ abort(500,'网银充值入账 model wallet recharge money fail');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //送vip
|
|
|
+ if(isset($args['first_vipdays']) && $args['first_vipdays'] > 0){
|
|
|
+ $user_info = Db::name('user_wallet')->where('user_id',$args['user_id'])->lock(true)->find();
|
|
|
+ if($user_info['vip_endtime'] < time()){
|
|
|
+ //过期了
|
|
|
+ $vip_endtime = time() + (intval($args['first_vipdays']) * 86400);
|
|
|
+ }else{
|
|
|
+ //追加vip
|
|
|
+ $vip_endtime = $user_info['vip_endtime'] + (intval($args['first_vipdays']) * 86400);
|
|
|
+ }
|
|
|
+ $result = Db::name('user_wallet')->where('user_id',$args['user_id'])->update(['vip_endtime'=>$vip_endtime]);
|
|
|
+ if($result === false)
|
|
|
+ {
|
|
|
+ Db::rollback();
|
|
|
+ filePut('[wallet][paySucc]网银充值入账更新vip时间失败 recharge money fail'.$orderId);
|
|
|
+ abort(500,'网银充值入账 model wallet recharge money fail');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
Db::commit();
|
|
|
|
|
|
|
|
|
return true;
|
|
|
}else{
|
|
|
filePut('[wallet][paySucc]在线支付订单有误 '.$orderId);
|
|
|
- abort(500,lang('model wallet fail'));
|
|
|
+ abort(500,'model wallet fail');
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -62,7 +108,7 @@ class Recharge
|
|
|
if(!$rs){
|
|
|
Db::rollback();
|
|
|
filePut('[wallet][paySucc] pay_order update fail'.$orderId);
|
|
|
- abort(500,lang('订单更新失败'));
|
|
|
+ abort(500,'订单更新失败');
|
|
|
}
|
|
|
|
|
|
//先充值
|
|
@@ -78,8 +124,8 @@ class Recharge
|
|
|
if($result === false)
|
|
|
{
|
|
|
Db::rollback();
|
|
|
- filePut('[wallet][paySucc]网银充值入账更新vip时间失败 recharge money fail'.$orderId.$result['msg']);
|
|
|
- abort(500,lang('网银充值入账 model wallet recharge money fail'));
|
|
|
+ filePut('[wallet][paySucc]网银充值入账更新vip时间失败 recharge money fail'.$orderId);
|
|
|
+ abort(500,'网银充值入账 model wallet recharge money fail');
|
|
|
}
|
|
|
|
|
|
Db::commit();
|
|
@@ -98,7 +144,7 @@ class Recharge
|
|
|
return true;
|
|
|
}else{
|
|
|
filePut('[wallet][paySucc]在线支付订单有误 '.$orderId);
|
|
|
- abort(500,lang('model wallet fail'));
|
|
|
+ abort(500,'model wallet fail');
|
|
|
return false;
|
|
|
}
|
|
|
}
|