lizhen_gitee vor 9 Monaten
Ursprung
Commit
fab0c95fd4
2 geänderte Dateien mit 35 neuen und 38 gelöschten Zeilen
  1. 33 38
      application/api/controller/Userwallet.php
  2. 2 0
      application/extra/wallet.php

+ 33 - 38
application/api/controller/Userwallet.php

@@ -71,45 +71,7 @@ class Userwallet extends Api
         return $list;
     }
 
-    //互动收益,打视频,语音,文字聊天,聊天送礼物
-    public function hudong_money(){
-        $map = [
-            'user_id' => $this->auth->id,
-            'log_type'=> ['IN',[21,22,23,54]],
-        ];
-        $list = Db::name('user_money_log')
-            ->field('id,log_type,change_value,remain,remark,createtime')
-            ->where($map)->order('id desc')->autopage()->select();
 
-        $list = $this->list_appen_logtext($list);
-        $this->success('success',$list);
-    }
-    //音聊收益,语聊间礼物
-    public function party_money(){
-        $map = [
-            'user_id' => $this->auth->id,
-            'log_type'=> 52,
-        ];
-        $list = Db::name('user_money_log')
-            ->field('id,log_type,change_value,remain,remark,createtime')
-            ->where($map)->order('id desc')->autopage()->select();
-
-        $list = $this->list_appen_logtext($list);
-        $this->success('success',$list);
-    }
-    //直播收益,直播间礼物
-    public function livebc_money(){
-        $map = [
-            'user_id' => $this->auth->id,
-            'log_type'=> 56,
-        ];
-        $list = Db::name('user_money_log')
-            ->field('id,log_type,change_value,remain,remark,createtime')
-            ->where($map)->order('id desc')->autopage()->select();
-
-        $list = $this->list_appen_logtext($list);
-        $this->success('success',$list);
-    }
 
     //我的余额日志
     public function my_money_log(){
@@ -431,4 +393,37 @@ class Userwallet extends Api
 
         $this->success('success', $list);
     }
+
+    //用户之间钻石转赠
+    public function jewel_transfer(){
+        $jewel = input('jewel',0,'intval');
+        $user_id = input('user_id',0,'intval');
+
+        if(!$jewel || !$user_id){
+            $this->error();
+        }
+
+        if($jewel < 0){
+            $this->error('输入数量为0');
+        }
+
+        Db::startTrans();
+
+        $wallet_rs = model('wallet')->lockChangeAccountRemain($this->auth->id,0,'jewel',-$jewel,36,'钻石转赠');
+        if($wallet_rs['status'] === false){
+            Db::rollback();
+            $this->error($wallet_rs['msg']);
+        }
+
+        $wallet_rs = model('wallet')->lockChangeAccountRemain($user_id,0,'jewel',$jewel,37,'钻石获赠');
+        if($wallet_rs['status'] === false){
+            Db::rollback();
+            $this->error($wallet_rs['msg']);
+        }
+
+        Db::commit();
+
+        $this->success();
+
+    }
 }

+ 2 - 0
application/extra/wallet.php

@@ -24,6 +24,8 @@ return [
 
 
         33 => '聊天赠送礼物',//jewel 减少
+        36 => '钻石转赠',//jewel 减少
+        37 => '钻石获赠',//jewel 增加
         39 => '动态赠送礼物',//jewel 减少
         41 => '签到赠送金币',//gold增加