浏览代码

钱包首页

lizhen_gitee 1 年之前
父节点
当前提交
57343f6acc
共有 2 个文件被更改,包括 36 次插入2 次删除
  1. 2 2
      application/api/controller/Pay.php
  2. 34 0
      application/api/controller/Userwallet.php

+ 2 - 2
application/api/controller/Pay.php

@@ -160,7 +160,7 @@ class Pay extends Api
 
         $orderid = Db::name('pay_order')->insertGetId($data);
 
-//        $openid = $this->auth->mini_openid;
+        $openid = $this->auth->wechat_openid;
         //下单
         $params = [
             'type'         => $pay_type,
@@ -168,7 +168,7 @@ class Pay extends Api
             'title'        => '支付订单',
             'amount'       => $data['order_amount'],
             'method'       => $platform,
-//            'openid'       => $openid,
+            'openid'       => $openid,
             'notifyurl' => config('pay_notify_url').'/api/notify/recharge_notify_base/paytype/'.$pay_type,
             'returnurl' => '',
         ];

+ 34 - 0
application/api/controller/Userwallet.php

@@ -17,6 +17,40 @@ class Userwallet extends Api
     public function my_wallet(){
         $wallet = model('wallet')->getwallet($this->auth->id);
         $wallet['is_vip'] = $wallet['vip_endtime'] > time() ? 1 : 0;
+
+
+        //日报数据
+        $date = input('date',date('Y-m-d'));
+        $starttime = strtotime($date);
+        $endtime = $starttime + 86399;
+
+        //当日收益
+        $log_type = [];
+        Db::name('user_gold_log')
+            ->where('createtime','IN',[$starttime,$endtime])
+            ->where('user_id',$this->auth->id)
+            ->where('money_type','jewel')
+            ->where('log_type','IN',$log_type)
+            ->sum('change_value');
+
+        //通话时长
+        $where = [
+            'to_user_id' => $this->auth->id,
+            'createtime' => ['BETWEEN',[$starttime,$endtime]],
+        ];
+        $audio_log = Db::name('user_match_audio_log')->where($where)->select();
+        $audio_times = count($audio_log);//次数
+        $audio_call_minutes = array_sum(array_column($audio_log,'call_minutes'));//通话时长
+
+
+
+        $video_log = Db::name('user_match_video_log')->where($where)->select();
+        $video_times = count($video_log);//次数
+        $video_call_minutes = array_sum(array_column($video_log,'call_minutes'));//通话时长
+
+        //平均通话(分钟)
+        //互动个人数
+
         $this->success('success',$wallet);
     }