|
@@ -30,7 +30,7 @@ class Unlockorder extends Api
|
|
|
'to_user_id' => $to_user_id,
|
|
|
'endtime' => ['gt',time()],
|
|
|
];
|
|
|
- $check_repeat = Db::name('order_wechataccount')->where($check_map)->find();
|
|
|
+ $check_repeat = Db::name('order_wechataccount')->where($check_map)->order('id desc')->find();
|
|
|
if(!empty($check_repeat)){
|
|
|
$this->error('尚未过期无需再次解锁');
|
|
|
}
|
|
@@ -83,7 +83,7 @@ class Unlockorder extends Api
|
|
|
'to_user_id' => $to_user_id,
|
|
|
'endtime' => ['gt',time()],
|
|
|
];
|
|
|
- $check_repeat = Db::name('order_secretvideo')->where($check_map)->find();
|
|
|
+ $check_repeat = Db::name('order_secretvideo')->where($check_map)->order('id desc')->find();
|
|
|
if(!empty($check_repeat)){
|
|
|
$this->error('尚未过期无需再次解锁');
|
|
|
}
|
|
@@ -98,14 +98,25 @@ class Unlockorder extends Api
|
|
|
'createtime' => time(),
|
|
|
'endtime' => time() + 604800,
|
|
|
'price' => $price,
|
|
|
- 'type' => 1,
|
|
|
+ 'type' => 1, //1 金币付费
|
|
|
];
|
|
|
|
|
|
- //年费vip干预
|
|
|
+ //年费vip干预,一天只一次
|
|
|
+ $today_start = strtotime(date('y-m-d'));
|
|
|
+ $today_end = $today_start + 86399;
|
|
|
+ $check_free_map = [
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
+ 'to_user_id' => $to_user_id,
|
|
|
+ 'createtime' => ['between',[$today_start,$today_end]],
|
|
|
+ 'type' => 2,
|
|
|
+ ];
|
|
|
+ $check_free = Db::name('order_secretvideo')->where($check_free_map)->count('id');
|
|
|
+
|
|
|
+ //年费vip,且今天没使用过权限,优先使用vip权限
|
|
|
$wallet = model('wallet')->getwallet($this->auth->id);
|
|
|
- if($wallet['vip_endtime'] > time() && $wallet['vip_level'] == 30){
|
|
|
+ if($wallet['vip_endtime'] > time() && $wallet['vip_level'] == 30 && $check_free == 0 ){
|
|
|
$data['price'] = 0;
|
|
|
- $data['type'] = 2;
|
|
|
+ $data['type'] = 2; //2 年vip免费
|
|
|
$data['endtime'] = time(); //立即过期,就看一下
|
|
|
$price = 0;
|
|
|
}
|