|
@@ -14,6 +14,7 @@ class Unlockorder extends Api
|
|
|
|
|
|
//解锁微信订单
|
|
|
public function wechataccount(){
|
|
|
+ //检查用户
|
|
|
$to_user_id = input('to_user_id','');
|
|
|
if(empty($to_user_id)){
|
|
|
$this->error();
|
|
@@ -23,9 +24,20 @@ class Unlockorder extends Api
|
|
|
$this->error('不存在的用户');
|
|
|
}
|
|
|
|
|
|
+ //检查防重复解锁
|
|
|
+ $check_map = [
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
+ 'to_user_id' => $to_user_id,
|
|
|
+ 'endtime' => ['gt',time()],
|
|
|
+ ];
|
|
|
+ $check_repeat = Db::name('order_wechataccount')->where($check_map)->find();
|
|
|
+ if(!empty($check_repeat)){
|
|
|
+ $this->error('尚未过期无需再次解锁');
|
|
|
+ }
|
|
|
+
|
|
|
+ //订单
|
|
|
$price = config('site.unlock_wechataccount');
|
|
|
$price = bcadd(intval($price),0,0);
|
|
|
-
|
|
|
$data = [
|
|
|
'user_id' => $this->auth->id,
|
|
|
'to_user_id' => $to_user_id,
|
|
@@ -42,7 +54,7 @@ class Unlockorder extends Api
|
|
|
}
|
|
|
|
|
|
if($price > 0){
|
|
|
- $wallet_rs = model('wallet')->lockChangeAccountRemain($this->auth->id,'gold',$price,71,'解锁:'.$to_user_id,'order_wechataccount',$order_id);
|
|
|
+ $wallet_rs = model('wallet')->lockChangeAccountRemain($this->auth->id,'gold',$price,71,'解锁:'.$to_user_info['username'],'order_wechataccount',$order_id);
|
|
|
if($wallet_rs['status'] === false){
|
|
|
Db::rollback();
|
|
|
$this->error($wallet_rs['msg']);
|
|
@@ -55,6 +67,7 @@ class Unlockorder extends Api
|
|
|
|
|
|
//解锁私密视频订单
|
|
|
public function secretvideo(){
|
|
|
+ //检查用户
|
|
|
$to_user_id = input('to_user_id','');
|
|
|
if(empty($to_user_id)){
|
|
|
$this->error();
|
|
@@ -64,6 +77,18 @@ class Unlockorder extends Api
|
|
|
$this->error('不存在的用户');
|
|
|
}
|
|
|
|
|
|
+ //检查防重复解锁
|
|
|
+ $check_map = [
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
+ 'to_user_id' => $to_user_id,
|
|
|
+ 'endtime' => ['gt',time()],
|
|
|
+ ];
|
|
|
+ $check_repeat = Db::name('order_secretvideo')->where($check_map)->find();
|
|
|
+ if(!empty($check_repeat)){
|
|
|
+ $this->error('尚未过期无需再次解锁');
|
|
|
+ }
|
|
|
+
|
|
|
+ //订单
|
|
|
$price = config('site.unlock_secretvideo');
|
|
|
$price = bcadd(intval($price),0,0);
|
|
|
|
|
@@ -83,7 +108,7 @@ class Unlockorder extends Api
|
|
|
}
|
|
|
|
|
|
if($price > 0){
|
|
|
- $wallet_rs = model('wallet')->lockChangeAccountRemain($this->auth->id,'gold',$price,71,'解锁:'.$to_user_id,'order_secretvideo',$order_id);
|
|
|
+ $wallet_rs = model('wallet')->lockChangeAccountRemain($this->auth->id,'gold',$price,72,'解锁:'.$to_user_info['username'],'order_secretvideo',$order_id);
|
|
|
if($wallet_rs['status'] === false){
|
|
|
Db::rollback();
|
|
|
$this->error($wallet_rs['msg']);
|