|
@@ -225,6 +225,10 @@ class Usercenter extends Api
|
|
|
//女性不收费,互关不收费,设置不收费的也不收费
|
|
|
public function video_onemin(){
|
|
|
$to_user_id = input_post('to_user_id');
|
|
|
+ $to_user_info = Db::name('user')->field('id,gender,free_video,free_audio,free_typing')->where('id',$to_user_id)->find();
|
|
|
+ if(!$to_user_info){
|
|
|
+ $this->error('不存在的用户');
|
|
|
+ }
|
|
|
|
|
|
//先检查今天免费的一分钟
|
|
|
$start = strtotime(date('Y-m-d'));
|
|
@@ -261,7 +265,7 @@ class Usercenter extends Api
|
|
|
}
|
|
|
|
|
|
//扣费
|
|
|
- if($price > 0){
|
|
|
+ if($price > 0 && $this->auth->gender == 1){
|
|
|
$rs = model('wallet')->lockChangeAccountRemain($this->auth->id,'gold',-$price,11,'','user_match_video_log',$log_id);
|
|
|
if($rs['status'] === false){
|
|
|
Db::rollback();
|
|
@@ -269,7 +273,7 @@ class Usercenter extends Api
|
|
|
}
|
|
|
}
|
|
|
//另一方加钱
|
|
|
- if($money > 0){
|
|
|
+ if($money > 0 && $to_user_info['gender'] == 0 && $to_user_info['free_video'] == 0){
|
|
|
$rs = model('wallet')->lockChangeAccountRemain($to_user_id,'money',$money,21,'','user_match_video_log',$log_id);
|
|
|
if($rs['status'] === false){
|
|
|
Db::rollback();
|
|
@@ -283,6 +287,10 @@ class Usercenter extends Api
|
|
|
//语音通话每分钟调用一次
|
|
|
public function audio_onemin(){
|
|
|
$to_user_id = input_post('to_user_id');
|
|
|
+ $to_user_info = Db::name('user')->field('id,gender,free_video,free_audio,free_typing')->where('id',$to_user_id)->find();
|
|
|
+ if(!$to_user_info){
|
|
|
+ $this->error('不存在的用户');
|
|
|
+ }
|
|
|
|
|
|
//先检查今天免费的一分钟
|
|
|
$start = strtotime(date('Y-m-d'));
|
|
@@ -319,7 +327,7 @@ class Usercenter extends Api
|
|
|
}
|
|
|
|
|
|
//扣费
|
|
|
- if($price > 0){
|
|
|
+ if($price > 0 && $this->auth->gender == 1){
|
|
|
$rs = model('wallet')->lockChangeAccountRemain($this->auth->id,'gold',-$price,12,'','user_match_audio_log',$log_id);
|
|
|
if($rs['status'] === false){
|
|
|
Db::rollback();
|
|
@@ -327,7 +335,7 @@ class Usercenter extends Api
|
|
|
}
|
|
|
}
|
|
|
//另一方加钱
|
|
|
- if($money > 0){
|
|
|
+ if($money > 0 && $to_user_info['gender'] == 0 && $to_user_info['free_audio'] == 0){
|
|
|
$rs = model('wallet')->lockChangeAccountRemain($to_user_id,'money',$money,22,'','user_match_audio_log',$log_id);
|
|
|
if($rs['status'] === false){
|
|
|
Db::rollback();
|
|
@@ -341,6 +349,10 @@ class Usercenter extends Api
|
|
|
//打字聊天每句话调用一次
|
|
|
public function typing_once(){
|
|
|
$to_user_id = input_post('to_user_id');
|
|
|
+ $to_user_info = Db::name('user')->field('id,gender,free_video,free_audio,free_typing')->where('id',$to_user_id)->find();
|
|
|
+ if(!$to_user_info){
|
|
|
+ $this->error('不存在的用户');
|
|
|
+ }
|
|
|
|
|
|
|
|
|
//设置价格
|
|
@@ -366,15 +378,15 @@ class Usercenter extends Api
|
|
|
}
|
|
|
|
|
|
//扣费
|
|
|
- if($price > 0){
|
|
|
+ if($price > 0 && $this->auth->gender == 1){
|
|
|
$rs = model('wallet')->lockChangeAccountRemain($this->auth->id,'gold',-$price,13,'','user_match_typing_log',$log_id);
|
|
|
if($rs['status'] === false){
|
|
|
Db::rollback();
|
|
|
$this->error($rs['msg']);
|
|
|
}
|
|
|
}
|
|
|
- //另一方加钱
|
|
|
- if($money > 0){
|
|
|
+ //另一方加钱,设置不免费
|
|
|
+ if($money > 0 && $to_user_info['gender'] == 0 && $to_user_info['free_typing'] == 0){
|
|
|
$rs = model('wallet')->lockChangeAccountRemain($to_user_id,'money',$money,23,'','user_match_typing_log',$log_id);
|
|
|
if($rs['status'] === false){
|
|
|
Db::rollback();
|