Your Name 2 years ago
parent
commit
7c9c42fec4

+ 15 - 0
service/agent/database/member.php

@@ -739,6 +739,7 @@ return array
                 'fend' => array('yes-rdate', '<='),
                 'status' => 'yes',
                 'role' => 'yes',
+                'parent_mid' =>'yes',
                 'state' => 1,
             ),
             'type' => 'count',
@@ -821,5 +822,19 @@ return array
             'limit' => '0,20',
             'col' => 'concat(name, "(", mobile , ")") as name, id, id as value, "" as selected, "" as disabled|id',
         ),
+
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start' => array('yes-rdate', '>='),
+                'end' => array('yes-rdate', '<='),
+                'status' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'col' => 'id,name,mobile,idcard,role,group_sell',
+        ),
     ),
 );

+ 15 - 0
service/agent/database/order.php

@@ -959,5 +959,20 @@ return array
             'type' => 'one',
             'col' => 'sum(price) as total',
         ),
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start' => array('yes-fdate','>='),
+                'end' => array('yes-fdate','<='),
+                'mid' => 'yes',
+                'area' => array('yes','in'),
+                'role' => array('yes','in'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'col' => 'id,mid,name,mobile,idcard,soft_cash,option_price,price,area,role,agent_cash',
+        ),
     ),
 );

+ 17 - 1
service/agent/database/soft_cash.php

@@ -118,7 +118,7 @@ return array
             'match'     => 'is_string',
             // 'update'    => 'text',
             //'search'    => 'fulltext',
-            'list_name' => '订单号<br />购买时间',
+            'list_name' => '订单号<br />购买时间<br/>添加时间',
             'list'      => 'Dever::load("agent/lib/soft_cash.soft_show#num",{id})',
             'list_order' => 1,
         ),
@@ -347,11 +347,27 @@ return array
                 'fend' => array('yes-fdate', '<='),
                 'status' => array('yes', 'in'),
                 'role' =>'yes',
+                'mid' => 'yes',
                 'state' => 1,
             ),
             'type' => 'one',
             'col' => 'sum(cash) as total',
         ),
+        'getPrice' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'fstart' => array('yes-fdate', '>='),
+                'fend' => array('yes-fdate', '<='),
+                'status' => array('yes', 'in'),
+                'role' =>'yes',
+                'mid' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(price) as total',
+        ),
 
         'getExcelAll' => array
         (

+ 3 - 4
service/agent/lib/Soft_cash.php

@@ -103,7 +103,7 @@ Class Soft_cash
     }
     public function soft_show($id){
         $info = Dever::db('agent/soft_cash')->find($id);
-        $html['num'] = $info['order_num'].'</br>'.date('Y-m-d',$info['buy_date']);
+        $html['num'] = $info['order_num'].'</br>'.date('Y-m-d',$info['buy_date']).'<br/>'.date('Y-m-d',$info['cdate']);
         return $html;
     }
 	public function show(){
@@ -401,8 +401,7 @@ Class Soft_cash
                 $config_type= Dever::db('setting/agreement')->config['config_type'];
                 $agreement_name = Dever::status($config_type,$name['type']);
             }
-            
-            
+            // print_R($v);
             $type = 2;
 
             // if (!isset($info['soft_cash'])) {
@@ -464,7 +463,7 @@ Class Soft_cash
                 $member['name'],
                 $v['mobile'],
                 $year,
-                $agreement_name,
+                $name,
                 $fdate,
                 $v['cash'],
                 $buy_date,

+ 39 - 13
service/bill/database/tixian.php

@@ -350,19 +350,19 @@ return array
             'type' => 'one',
             'col' => 'sum(cash) as total',
         ),
-        'getdfCash' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'start' => array('yes-cdate', '>='),
-                'end' => array('yes-cdate', '<='),
-                'status' => array('yes', 'in'),
-                'state' => 1,
-            ),
-            'type' => 'one',
-            'col' => 'sum(cash) as total',
-        ),
+        // 'getdfCash' => array
+        // (
+        //     # 匹配的正则或函数 选填项
+        //     'option' => array
+        //     (
+        //         'start' => array('yes-cdate', '>='),
+        //         'end' => array('yes-cdate', '<='),
+        //         'status' => array('yes', 'in'),
+        //         'state' => 1,
+        //     ),
+        //     'type' => 'one',
+        //     'col' => 'sum(cash) as total',
+        // ),
          'getwsCash' => array
         (
             # 匹配的正则或函数 选填项
@@ -403,5 +403,31 @@ return array
             'order' => array('cdate' => 'desc'),
             'col' => '*',
         ),
+
+        'getdfCash' => array
+         (
+             'option' => array
+             (
+                'start' => array('yes-t_2.operdate', '>='),
+                'end' => array('yes-t_2.operdate', '<='),
+                'status' => array('yes-t_1.status', 'in'),
+               'state' => 'yes-t_1.state',
+             ),
+             'join' => array
+            (
+             array
+             (
+              'table' => 'bill/cash',
+              'type' => 'left join',
+              'on' => array('cash_id','id'),
+              'col' => 't_2.id as cid',
+             ),
+            ),
+                 'type' => 'one',
+                 // 'limit' => '0,5',
+                 // 'order' => array('t_2.sdate' => 'desc','id' => 'desc'),
+           // 'col' => 'id,t_1.name,t_1.content,t_2.name as company_name',
+                 'col' => 'id,sum(t_1.cash) as total',
+      ),
     ),
 );

+ 1 - 0
service/bill/lib/Cron.php

@@ -461,6 +461,7 @@ class Cron
             #已审核待发放提现
             $data['df_cash']=0;
             $where['status']=1;
+            $where['state'] = 1;
             $cash=Dever::db('bill/tixian')->getdfCash($where);
             if($cash){
                 $data['df_cash'] = $cash['total'] *(-1);

+ 118 - 0
service/mail/assets/pc/html/option_grant.html

@@ -0,0 +1,118 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>代理商期权发放</title>
+<meta name="renderer" content="webkit">
+<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+<meta name="apple-mobile-web-app-status-bar-style" content="black"> 
+<meta name="apple-mobile-web-app-capable" content="yes">
+<meta name="format-detection" content="telephone=no">
+<link rel="stylesheet" type="text/css" href="../script/lib/layui/css/layui.css" />
+<script src="../script/lib/jquery/jquery.min.js"></script>
+<script src="../script/lib/layui/layui.js"></script>
+<script src="../script/lib/echarts/echarts.common.min.js"></script>
+<script><{Dever::script()}></script>
+<script src="../script/dever/core.js"></script>
+<style>
+.dever-upload-pic
+{
+  width:100px;
+}
+h5 {
+    margin-bottom: 10px;
+}
+td {
+  color: black;
+}
+</style>
+
+</head>
+<body>
+<div class="layui-container">
+<div class="layui-card">
+     <blockquote class="layui-elem-quote"><input type="text" value="<{$start}> ~ <{$end}>" autocomplete="off" id="date" class="layui-input" style="width: auto;display: inline;" placeholder="选择日期"><a href="javascript:;" class="layui-btn" id="search">搜索</a><a href="javascript:;" class="layui-btn" id="excel">数据导出</a></blockquote>
+
+  <!-- <div class="layui-card-header" style="font-size: 20px"><{$day['time']}></div> -->
+  
+  <div class="layui-card-body">
+     
+     
+     
+    <table class="table layui-table layui-table-body" id="table">
+          <thead id="list-thead">
+              <tr>
+                <th data-priority="1">用户姓名</th>
+                <th data-priority="1">手机号</th>
+                <th data-priority="1">身份证号</th>
+                <th data-priority="1">角色</th>
+                <th data-priority="1">完成团队业绩</th>
+                <th data-priority="1">完成直推创V</th>
+                <th data-priority="1">完成直推创客</th>
+              </tr>
+          </thead>
+            <tbody>
+              <{foreach($data as $k => $v):}>
+                <tr>
+                  <td><{$v['name']}></td>
+                  <td><{$v['mobile']}></td>
+                  <td><{$v['idcard']}></td>
+                  <td><{$v['role_name']}></td>
+                  <td><{$v['group_sell']}></td>
+                  <td><{$v['cv_num']}></td>
+                  <td><{$v['ck_num']}></td>
+                </tr>
+                  <{endforeach}>
+          </tbody> 
+      </table>
+	</div>
+	</div>
+</div>
+</div>
+      
+
+</div>
+<script>
+layui.use(['form','element', 'layer', 'jquery', 'laydate'], function(){
+  var form = layui.form;
+  var laydate = layui.laydate;
+  laydate.render({
+    elem: '#date',
+    range: '~'
+  });
+});
+
+function search()
+{
+  var date = $('#date').val();
+  if (date) {
+    var s = date.split(' ~ ');
+  } else {
+    var s = [];
+    s[0] = '';
+    s[1] = '';
+  }
+  location.href = config.host + 'lib/manage.option_grant&start=' + s[0] + '&end=' + s[1];
+}
+$('#search').click(function() {
+  search();
+})
+function excel()
+{
+  var date = $('#date').val();
+  if (date) {
+    var s = date.split(' ~ ');
+  } else {
+    var s = [];
+    s[0] = '';
+    s[1] = '';
+  }
+  location.href = config.host + 'lib/manage.out_option_grant&start=' + s[0] + '&end=' + s[1];
+}
+$('#excel').click(function() {
+  excel();
+})
+</script>
+</body>
+</html>

+ 118 - 0
service/mail/assets/pc/html/option_nopay.html

@@ -0,0 +1,118 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>代理商期权待交付</title>
+<meta name="renderer" content="webkit">
+<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+<meta name="apple-mobile-web-app-status-bar-style" content="black"> 
+<meta name="apple-mobile-web-app-capable" content="yes">
+<meta name="format-detection" content="telephone=no">
+<link rel="stylesheet" type="text/css" href="../script/lib/layui/css/layui.css" />
+<script src="../script/lib/jquery/jquery.min.js"></script>
+<script src="../script/lib/layui/layui.js"></script>
+<script src="../script/lib/echarts/echarts.common.min.js"></script>
+<script><{Dever::script()}></script>
+<script src="../script/dever/core.js"></script>
+<style>
+.dever-upload-pic
+{
+  width:100px;
+}
+h5 {
+    margin-bottom: 10px;
+}
+td {
+  color: black;
+}
+</style>
+
+</head>
+<body>
+<div class="layui-container">
+<div class="layui-card">
+     <blockquote class="layui-elem-quote"><input type="text" value="<{$start}> ~ <{$end}>" autocomplete="off" id="date" class="layui-input" style="width: auto;display: inline;" placeholder="选择日期"><a href="javascript:;" class="layui-btn" id="search">搜索</a><a href="javascript:;" class="layui-btn" id="excel">数据导出</a></blockquote>
+
+  <!-- <div class="layui-card-header" style="font-size: 20px"><{$day['time']}></div> -->
+  
+  <div class="layui-card-body">
+     
+     
+     
+    <table class="table layui-table layui-table-body" id="table">
+          <thead id="list-thead">
+              <tr>
+                <th data-priority="1">用户姓名</th>
+                <th data-priority="1">手机号</th>
+                <th data-priority="1">身份证号</th>
+                <th data-priority="1">软件服务费(订单)</th>
+                <th data-priority="1">软件服务费(购买)</th>
+                <th data-priority="1">原始期权</th>
+                <th data-priority="1">期权赠送</th>
+              </tr>
+          </thead>
+            <tbody>
+              <{foreach($data as $k => $v):}>
+                <tr>
+                  <td><{$v['name']}></td>
+                  <td><{$v['mobile']}></td>
+                  <td><{$v['idcard']}></td>
+                  <td><{$v['soft_cash']}></td>
+                  <td><{$v['buy_cash']}></td>
+                  <td><{$v['y_price']}></td>
+                  <td><{$v['option_price']}></td>
+                </tr>
+                  <{endforeach}>
+          </tbody> 
+      </table>
+	</div>
+	</div>
+</div>
+</div>
+      
+
+</div>
+<script>
+layui.use(['form','element', 'layer', 'jquery', 'laydate'], function(){
+  var form = layui.form;
+  var laydate = layui.laydate;
+  laydate.render({
+    elem: '#date',
+    range: '~'
+  });
+});
+
+function search()
+{
+  var date = $('#date').val();
+  if (date) {
+    var s = date.split(' ~ ');
+  } else {
+    var s = [];
+    s[0] = '';
+    s[1] = '';
+  }
+  location.href = config.host + 'lib/manage.option_nopay&start=' + s[0] + '&end=' + s[1];
+}
+$('#search').click(function() {
+  search();
+})
+function excel()
+{
+  var date = $('#date').val();
+  if (date) {
+    var s = date.split(' ~ ');
+  } else {
+    var s = [];
+    s[0] = '';
+    s[1] = '';
+  }
+  location.href = config.host + 'lib/manage.out_option_nopay&start=' + s[0] + '&end=' + s[1];
+}
+$('#excel').click(function() {
+  excel();
+})
+</script>
+</body>
+</html>

+ 104 - 0
service/mail/assets/pc/html/qiquan.html

@@ -0,0 +1,104 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>厨人意料代理商每日汇总</title>
+<meta name="renderer" content="webkit">
+<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+<meta name="apple-mobile-web-app-status-bar-style" content="black"> 
+<meta name="apple-mobile-web-app-capable" content="yes">
+<meta name="format-detection" content="telephone=no">
+<link rel="stylesheet" type="text/css" href="../script/lib/layui/css/layui.css" />
+<script src="../script/lib/jquery/jquery.min.js"></script>
+<script src="../script/lib/layui/layui.js"></script>
+<script src="../script/lib/echarts/echarts.common.min.js"></script>
+<script><{Dever::script()}></script>
+<script src="../script/dever/core.js"></script>
+<style>
+.dever-upload-pic
+{
+  width:100px;
+}
+h5 {
+    margin-bottom: 10px;
+}
+th {
+  color: black;
+}
+</style>
+
+</head>
+<body>
+<div class="layui-container">
+<div class="layui-card">
+
+  <div class="layui-card-body">
+      <h3>账户情况:</h3>
+     
+     
+    <table class="table layui-table layui-table-body" id="table">
+          <thead id="list-thead">
+              <tr>
+                <th data-priority="1">主账户:<{$account}>, 全部账户(含子账户):<{$member}></th>
+
+              </tr>
+              <tr>
+				<th data-priority="1">已认证完成:<{$y_num}></th>
+              </tr>
+              <tr>
+				<th data-priority="1">尚未任何交付:<{$no_num}></th>
+              </tr>
+          </thead>
+      </table>
+</div>
+</div>
+<div class="layui-card">
+      
+  <div class="layui-card-body">
+      <h3>原始期权情况:</h3>
+    <table class="table layui-table layui-table-body" id="table">
+          <thead id="list-thead">
+              <tr>
+                <th data-priority="1">待交付:¥<{$yq_nonum}></th>
+              </tr>
+              <tr>
+              	<th data-priority="1">已交付未发放:¥<{$yq_nof}></th>
+              </tr>
+              <tr>
+              	<th data-priority="1">已发放:¥<{$yq_fnum}></th>
+              </tr>
+          </thead>
+            
+      </table>
+      </div>
+      </div>
+<div class="layui-card">
+      
+  <div class="layui-card-body">
+      <h3>期权情况:</h3>
+    <table class="table layui-table layui-table-body" id="table">
+          <thead id="list-thead">
+              <tr>
+                <th data-priority="1">待交付:¥<{$q_nonum}></th>
+              </tr>
+              <tr>
+				<th data-priority="1">已交付未发放:¥<{$q_nof}></th>
+              </tr>
+              <tr>
+				<th data-priority="1">已发放:¥<{$q_fnum}></th>
+              </tr>
+          </thead>
+      </table>
+      </div>
+      </div>
+      
+      </div>
+      </div>
+      
+
+</div>
+<script>
+</script>
+</body>
+</html>

+ 232 - 31
service/mail/lib/Manage.php

@@ -25,7 +25,6 @@ class Manage
         $w['fstart'] = Dever::maketime($fstart . ' 00:00:00');
         $w['fend'] = strtotime(date('Y-m-d 23:59:59',
                 strtotime($fstart."+1 month - 1 day")));;
-        // print_R($w);die;
         $data = array();
         $data['start'] = date('Y-m-d',$start);
         $data['day'] = $this->content_api($where,1);
@@ -268,35 +267,7 @@ class Manage
             $this->send($val['email'], $val['name'], $title, $content);
         }
     }
-    #代理商周统计
-    public function week_api(){
-        $title = '代理商周数据统计';
-        $data = Dever::db('mail/feature')->find(array('key'=>'lib/cron.week'));
-        $email = explode(',',$data['email_id']);
-        foreach($email as $k => $v){
-            $res[] = Dever::db('mail/email')->find(array('id'=>$v));
-        }
-        $content = $this->zhou_api();
-        foreach($res as $key => $val){
-            $this->send($val['email'], $val['name'], $title, $content);
-        }
-    }
-    #代理商月统计
-    public function yue_api(){
-        $title = '代理商月数据统计';
-        $data = Dever::db('mail/feature')->find(array('key'=>'lib/cron.yue'));
-        $email = explode(',',$data['email_id']);
-        foreach($email as $k => $v){
-            $res[] = Dever::db('mail/email')->find(array('id'=>$v));
-        }
-        $content = $this->month_api();
-        if(!$content){
-            return false;
-        }
-        foreach($res as $key => $val){
-            $this->send($val['email'], $val['name'], $title, $content);
-        }
-    }
+    
     #代理商统计发送邮件
     public function send($email, $username, $title, $content)
     {
@@ -328,5 +299,235 @@ class Manage
             return 'ok';
         }
     }
-	
+    #期权统计
+    public function option_api(){
+        #主账户数量
+        $data['account'] = Dever::db('option/account')->getCount(array('state'=>1));
+        #所有数量
+        $data['member'] = Dever::db('option/member')->getCount(array('state'=>1));
+        #已认证完成
+        $data['y_num'] = Dever::db('option/account')->getCount(array('audit'=>3,'state'=>1));
+        #尚未任何交付的
+        $data['no_num'] = Dever::db('option/bill_jiaofu')->getCount(array('status'=>2,'state'=>1));
+        #原始期权待交付
+        $yq_nonum = Dever::db('option/bill_jiaofu')->getCash(array('status'=>2,'type'=>2,'state'=>1));
+        if($yq_nonum['total']){
+            $data['yq_nonum'] = $yq_nonum['total'];
+        }else{
+            $data['yq_nonum'] = 0;
+        }
+        
+        #原始期权已交付未发放
+        $yq_nof = Dever::db('option/bill_jiaofu')->getCash(array('status'=>1,'type'=>2,'state'=>1));
+        
+        if($yq_nof['total']){
+            $data['yq_nof'] = $yq_nof['total'];
+        }else{
+            $data['yq_nof'] = 0;
+        }
+        #原始期权已发放
+        $yq_fnum = Dever::db('option/bill_fafang')->getCash(array('status'=>1,'type'=>2,'state'=>1));
+        if($yq_fnum['total']){
+            $data['yq_fnum'] = $yq_fnum['total'];
+        }else{
+            $data['yq_fnum'] = 0;
+        }
+        
+        #期权待交付
+        $q_nonum = Dever::db('option/bill_jiaofu')->getCash(array('status'=>2,'type'=>1,'state'=>1));
+        if($q_nonum['total']){
+            $data['q_nonum'] = $q_nonum['total'];
+        }else{
+            $data['q_nonum'] = 0;
+        }
+        
+        #期权已交付未发放
+        $q_nof = Dever::db('option/bill_jiaofu')->getCash(array('status'=>1,'type'=>1,'state'=>1));
+        if($q_nof['total']){
+            $data['q_nof'] = $q_nof['total'];
+        }else{
+            $data['q_nof'] = 0;
+        }
+        
+        #期权已发放
+        $q_fnum = Dever::db('option/bill_fafang')->getCash(array('status'=>1,'type'=>1,'state'=>1));
+        if($q_fnum['total']){
+            $data['q_fnum'] = $q_fnum['total'];
+        }else{
+            $data['q_fnum'] = 0;
+        }
+        
+        return Dever::render('qiquan', $data);
+    }
+    #代理商期权待交付	
+    public function option_nopay_api($start,$end,$type=false){
+        $start = Dever::input('start',$start);
+        $end = Dever::input('end',$end);
+        if($start && $end){
+            $start = strtotime($start);
+            $end = strtotime($end);
+        }else{
+            $start=Dever::maketime(date('Y-m-01') . ' 00:00:00');
+            $end = strtotime(date('Y-m-d 23:59:59',
+                strtotime(date('Y-m-01')."+1 month - 1 day")));
+        }
+        $where['start'] = $start;
+        $where['end'] = $end;
+        $where['state'] = 1;
+        $rest = array();
+        $rest['start'] = date('Y-m-d',$start);
+        $rest['end'] = date('Y-m-d',$end);
+        $data = Dever::db('agent/order')->getAll($where);
+        foreach($data as $k => $v){
+            #单独购买的软件服务费
+            $cash = Dever::db('agent/soft_cash')->getTotal(array('fstart'=>$start,'fend'=>$end,'mid'=>$v['mid']));
+             $data[$k]['buy_cash'] = $cash['total'];
+             $option = Dever::db('agent/soft_cash')->getPrice(array('fstart'=>$start,'fend'=>$end,'mid'=>$v['mid']));
+             $data[$k]['y_price'] = $option['total'];
+        }
+        $rest['data'] = $data;
+        if($type == 1){
+            return $rest['data'];
+        }else{
+            return Dever::render('option_nopay', $rest);
+        }
+    }
+    #代理商期权待交付导出
+    public function out_option_nopay_api(){
+        $start = Dever::input('start');
+        $end = Dever::input('end');
+        if($start && $end){
+            $start = strtotime($start);
+            $end = strtotime($end);
+        }else{
+            $start=Dever::maketime(date('Y-m-01') . ' 00:00:00');
+            $end = strtotime(date('Y-m-d 23:59:59',
+                strtotime(date('Y-m-01')."+1 month - 1 day")));
+        }
+        $data = $this->option_nopay_api($start,$end,1);
+        $header = array('用户姓名', '手机号', '身份证号', '软件服务费(订单)', '软件服务费(购买)', '原始期权', '期权赠送');
+        if($data){
+            $body = array();
+            foreach($data as $k => $v){
+                $d = array
+                (
+                    $v['name'],
+                    $v['mobile'],
+                    $v['idcard'],
+                    $v['soft_cash'],
+                    $v['buy_cash'],
+                    $v['y_price'],
+                    $v['option_price'],
+                );
+                $body[] = $d;
+            }
+            $file = '代理商期权待交付';
+            Dever::excelExport($body, $header, $file);
+        }
+    }
+    #代理商期权发放统计
+    public function option_grant_api($start,$end,$type=false){
+        $start = Dever::input('start',$start);
+        $end = Dever::input('end',$end);
+        if($start && $end){
+            $start = strtotime($start);
+            $end = strtotime($end);
+        }else{
+            $start=Dever::maketime(date('Y-m-01') . ' 00:00:00');
+            $end = strtotime(date('Y-m-d 23:59:59',
+                strtotime(date('Y-m-01')."+1 month - 1 day")));
+        }
+        $data = array();
+        $data['start'] = date('Y-m-d',$start);
+        $data['end'] = date('Y-m-d',$end);
+        $res = Dever::db('agent/member')->getAll(array('start'=>$start,'end'=>$end,'state'=>1));
+        foreach($res as $k=>$v){
+            $role = Dever::db('setting/role')->find($v['role']);
+            $res[$k]['role_name'] = $role['name'];
+            $res[$k]['cv_num'] = Dever::db('agent/member')->getNum(array('parent_mid'=>$v['id'],'fstart'=>$start,'fend'=>$end,'role'=>8,'state'=>1));
+            $res[$k]['ck_num'] = Dever::db('agent/member')->getNum(array('parent_mid'=>$v['id'],'fstart'=>$start,'fend'=>$end,'role'=>6,'state'=>1));
+        }
+        $data['data'] = $res;
+        if($type == 1){
+            return $res;
+        }else{
+            return Dever::render('option_grant', $data);
+        }
+    }
+    #期权发放导出
+    public function out_option_grant_api(){
+        $start = Dever::input('start',$start);
+        $end = Dever::input('end',$end);
+        if($start && $end){
+            $start = strtotime($start);
+            $end = strtotime($end);
+        }else{
+            $start=Dever::maketime(date('Y-m-01') . ' 00:00:00');
+            $end = strtotime(date('Y-m-d 23:59:59',
+                strtotime(date('Y-m-01')."+1 month - 1 day")));
+        }
+        $data = $this->option_grant_api($start,$end,1);
+        $header = array('用户姓名', '手机号', '身份证号', '角色', '完成团队业绩', '完成直推创v', '完成直推创客');
+        if($data){
+            $body = array();
+            foreach($data as $k => $v){
+                $d = array
+                (
+                    $v['name'],
+                    $v['mobile'],
+                    $v['idcard'],
+                    $v['role_name'],
+                    $v['group_sell'],
+                    $v['cv_num'],
+                    $v['ck_num'],
+                );
+                $body[] = $d;
+            }
+            $file = '代理商期权发放';
+            Dever::excelExport($body, $header, $file);
+        }
+    }
+    // #城市数据统计
+    // public function city_api(){
+    //     // $provice = Dever::input('provice');
+    //     // $city = Dever::input('city');
+    //     $area = Dever::input('area');
+    //     $role = Dever::input('role');
+    //     $start = Dever::input('start');
+    //     $end = Dever::input('end');
+    //     $where = array();
+    //     // if($provice){
+    //     //     $where['provice'] = $provice;
+    //     // }
+    //     // if($city){
+    //     //     $where['city'] = $city;
+    //     // }
+    //      if($area){
+    //         $where['area'] = $area;
+    //     }
+    //     if($role){
+    //         $where['role'] = $role;
+    //     }
+        
+    //     if($start && $end){
+    //         $where['start'] = strtotime($start);
+    //         $where['end'] = strtotime($end);
+    //     }else{
+    //         $where['start']=Dever::maketime(date('Y-m-01') . ' 00:00:00');
+    //         $where['end'] = strtotime(date('Y-m-d 23:59:59',
+    //             strtotime(date('Y-m-01')."+1 month - 1 day")));
+    //     }
+    //     $data = Dever::db('agent/order')->getAll($where);
+    //     $rest = array();
+    //     foreach($data as $k => $v){
+    //         $data[$k]['area_name'] = Dever::load("area/api.string", $v['area']);
+    //         $role = Dever::db('setting/role')->find($v['role']);
+    //         $data[$k]['role_name'] = $role['name'];
+    //     }
+    //     $rest['role'] = Dever::db('setting/role')->find();
+    //     $rest['start'] = date('Y-m-d',$where['start']);
+    //     $rest['end'] = date('Y-m-d',$where['end']); 
+    //     $rest['data'] = $data;
+    //     return Dever::render('city', $rest);
+    // }
 }

+ 14 - 0
service/option/database/account.php

@@ -515,5 +515,19 @@ return array
             'type' => 'count',
             'col' => '*',
         ),
+        #获取所有数据
+        'getCount' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'status' => 2,
+                'state' => 1,
+                'audit' => 'yes',
+            ),
+            // 'order' => array('id' => 'desc'),
+            'type' => 'count',
+            'col' => '*',
+        ),
     ),
 );

+ 12 - 0
service/option/database/bill_fafang.php

@@ -290,5 +290,17 @@ return array
             'type' => 'all',
             'col' => '*',
         ),
+        'getCash' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'type' => 'yes',
+                'status' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(cash) as total',
+        ),
     ),
 );

+ 26 - 0
service/option/database/bill_jiaofu.php

@@ -351,5 +351,31 @@ return array
             ),
             'type' => 'update',
         ),
+        #获取所有数据
+        'getCount' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'state' => 1,
+                'status' =>'yes',
+            ),
+            // 'order' => array('id' => 'desc'),
+            'type' => 'count',
+            'group' => 'mid',
+            'col' => '*',
+        ),
+        'getCash' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'type' => 'yes',
+                'status' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(cash) as total',
+        ),
     ),
 );

+ 12 - 0
service/option/database/member.php

@@ -297,5 +297,17 @@ return array
             'type' => 'all',
             'col' => '*',
         ),
+        #获取所有数据
+        'getCount' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'state' => 1,
+            ),
+            // 'order' => array('id' => 'desc'),
+            'type' => 'count',
+            'col' => '*',
+        ),
     ),
 );