Browse Source

注册男性,送视频分钟数和聊天次数

lizhen_gitee 1 year ago
parent
commit
4eb3c9686e

+ 5 - 0
application/api/controller/Greet.php

@@ -124,6 +124,11 @@ class Greet extends Api
             $type2 = Db::name('user_greet')->where('user_id',$this->auth->id)->where('status',1)->where('type',2)->orderRaw('rand()')->find();
             $type2 = info_domain_image($type2,['image']);
 
+            if(empty($type1)){
+                //未设置搭讪语,强制不让搭讪
+                $type2 = [];
+            }
+
             $result = [
                 'chat' => !empty($type1) ? $type1['title'] : '',
                 'image' => !empty($type2) ? $type2['image'] : '',

+ 15 - 4
application/api/controller/User.php

@@ -424,10 +424,10 @@ class User extends Api
 
             if($data['avatar'] != $this->auth->avatar){
                 $bio_data = [
-                    'user_id' => $this->auth->id,
-                    'type'     => 'avatar',
-                    'old_data'     => $this->auth->avatar,
-                    'new_data' => $data['avatar'],
+                    'user_id'    => $this->auth->id,
+                    'type'       => 'avatar',
+                    'old_data'   => $this->auth->avatar,
+                    'new_data'   => $data['avatar'],
                     'createtime' => time(),
                 ];
                 Db::name('user_audit')->insertGetId($bio_data);
@@ -445,6 +445,17 @@ class User extends Api
             $data['avatar'] = $data['gender'] == 1 ? config('avatar_boy') : config('avatar_girl');
         }
 
+        if(isset($data['gender']) && $data['gender'] == 1){
+            //男性赠送
+            $gift_data = [
+                'audio_sec' => config('site.man_reg_audio_sec'),
+                'video_sec' => config('site.man_reg_video_sec'),
+                'typing_times' => config('site.man_reg_typing_times'),
+            ];
+            Db::name('user_wallet')->where('id',$this->auth->id)->update($gift_data);
+        }
+
+
         //
         if(isset($data['birthday'])){
             $data['birthday'] = strtotime($data['birthday']);

+ 3 - 0
application/extra/site.php

@@ -115,4 +115,7 @@ return array (
   'man_dashan_times' => '20',
   'index_match_video_switch' => '1',
   'index_match_audio_switch' => '1',
+  'man_reg_audio_sec' => '5',
+  'man_reg_video_sec' => '5',
+  'man_reg_typing_times' => '5',
 );