Browse Source

邀请中心接口,账户明细

lizhen_gitee 11 months ago
parent
commit
6b90c6614b
1 changed files with 62 additions and 20 deletions
  1. 62 20
      application/api/controller/Userintro.php

+ 62 - 20
application/api/controller/Userintro.php

@@ -20,24 +20,24 @@ class Userintro extends Api
         }
     }*/
 
+    //邀请页
+    public function introinfo(){
 
-    //生成我的视频海报
-    //生成邀请码二维码图片
-    public function introimage() {
-        $params['text'] = config('h5register_url') .'?intro_no='. $this->auth->introcode;
-        $qrcode_service = \addons\qrcode\library\Service::qrcode($params);
+        $today = date('Y-m-d');
+        $starttime = strtotime($today) - 86400;
+        $endtime   = $starttime + 86399;
+        $zuori_count = Db::name('user')->where('intro_uid',$this->auth->id)->where('yaoqingtime','BETWEEN',[$starttime,$endtime])->count();
 
-        $qrcodePath = ROOT_PATH . 'public/uploads/hbplayer/'.date('Ymd');
-        if (!is_dir($qrcodePath)) {
-            @mkdir($qrcodePath);
-        }
-        if (is_really_writable($qrcodePath)) {
-            $filename = 'intro_'.$this->auth->introcode . '.png';
-            $filePath = $qrcodePath .'/'. $filename;
-            $qrcode_service->writeFile($filePath);
-        }
+        $total_count = Db::name('user')->where('intro_uid',$this->auth->id)->count();
 
-        return '/uploads/hbplayer/'.date('Ymd') .'/'. $filename;
+        $register_url = config('h5register_url') .'?intro_no='. $this->auth->introcode;
+
+        $result = [
+            'zuori_count' => $zuori_count,
+            'total_count' => $total_count,
+            'register_url' => $register_url,
+        ];
+        $this->success(1,$result);
     }
 
     //生成视频分享海报
@@ -84,6 +84,53 @@ class Userintro extends Api
         $this->success('', $imgurl);
     }
 
+    //生成邀请码二维码图片
+    private function introimage() {
+        $params['text'] = config('h5register_url') .'?intro_no='. $this->auth->introcode;
+        $qrcode_service = \addons\qrcode\library\Service::qrcode($params);
+
+        $qrcodePath = ROOT_PATH . 'public/uploads/hbplayer/'.date('Ymd');
+        if (!is_dir($qrcodePath)) {
+            @mkdir($qrcodePath);
+        }
+        if (is_really_writable($qrcodePath)) {
+            $filename = 'intro_'.$this->auth->introcode . '.png';
+            $filePath = $qrcodePath .'/'. $filename;
+            $qrcode_service->writeFile($filePath);
+        }
+
+        return '/uploads/hbplayer/'.date('Ymd') .'/'. $filename;
+    }
+
+    //账户中心 api/withdraw/config
+    //提现 api/withdraw/withdraw
+
+    //账户明细
+    public function agentjewel_log(){
+
+        $map = [
+            'user_id' => $this->auth->id,
+        ];
+
+        $list = Db::name('user_agentjewel_log')
+            ->field('id,log_type,before,change_value,remain,remark,createtime')
+            ->where($map)->order('id desc')->autopage()->select();
+        $list = $this->list_appen_logtext($list);
+
+        $this->success('success',$list);
+    }
+
+    //追加log_text
+    private function list_appen_logtext($list){
+        if(!empty($list)){
+            $conf = config('wallet.logtype');
+            foreach($list as $key => $val){
+                $list[$key]['log_text'] = isset($conf[$val['log_type']]) ? $conf[$val['log_type']] : '';
+            }
+        }
+        return $list;
+    }
+
     //申请绑定
     //申请绑定记录
 
@@ -396,12 +443,7 @@ class Userintro extends Api
     }
 
 
-    //邀请页
-
 
-    //账户中心 api/withdraw/config
-    //提现 api/withdraw/withdraw
-    //账户明细