lizhen_gitee před 2 měsíci
rodič
revize
f51c7b717a
1 změnil soubory, kde provedl 29 přidání a 4 odebrání
  1. 29 4
      application/api/controller/Userwallet.php

+ 29 - 4
application/api/controller/Userwallet.php

@@ -4,6 +4,7 @@ namespace app\api\controller;
 
 use app\common\controller\Api;
 use think\Db;
+use app\admin\model\shopro\user\WalletLog as UserWalletLogModel;
 //use app\common\model\wallet;
 /**
  * 用户钱包
@@ -15,15 +16,39 @@ class Userwallet extends Api
 
     //我的钱包余额
     public function my_wallet(){
-        $wallet = model('wallet')->getwallet($this->auth->id);
-        $wallet['is_vip'] = $wallet['vip_endtime'] > time() ? 1 : 0;
+        $wallet['money'] = $this->auth->money;
         $this->success('success',$wallet);
     }
 
 
 
     //我的余额日志
-    public function my_money_log(){
+    public function my_money_log()
+    {
+        $tab = $this->request->param('type', 'all');
+
+        $user = auth_user();
+
+        $where = [
+            'user_id' => $user->id,
+            'type'    => 'money',
+        ];
+
+        if($tab == 1){
+            $where['amount'] = ['>', 0];
+        }
+        if($tab == 2){
+            $where['amount'] = ['<', 0];
+        }
+
+        $logs = UserWalletLogModel::where($where)
+            ->order('id', 'desc')
+            ->autopage()->select();
+
+        $this->success(1, $logs);
+    }
+
+    /*public function my_money_log(){
         $type = input('type',0);
 
         $map = [
@@ -39,7 +64,7 @@ class Userwallet extends Api
         $list = $this->list_appen_logtext($list);
 
         $this->success('success',$list);
-    }
+    }*/