dever 3 years ago
parent
commit
f3985c9516

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

@@ -293,6 +293,7 @@ return array
             'option' => array
             (
                 'aid' => 'yes',
+                'mid' => 'yes',
                 'type' => 'yes',
                 'audit' => 'yes',
                 'status' => 'yes',
@@ -310,6 +311,7 @@ return array
             'where' => array
             (
                 'aid' => 'yes',
+                'mid' => 'yes',
                 'type' => 'yes',
                 'end' => array('yes-cdate', '<='),
                 'status' => 'yes',
@@ -325,6 +327,7 @@ return array
             'where' => array
             (
                 'aid' => 'yes',
+                'mid' => 'yes',
                 'end' => array('yes-cdate', '<='),
                 'status' => 'yes',
                 'state' => 1,

+ 35 - 0
service/option/database/cash.php

@@ -61,6 +61,26 @@ return array
             'list_order' => 3,
         ),
 
+        'mid'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '子账号手机号',
+            'default'   => '-1',
+            'desc'      => '期权账户',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => array
+            (
+                'api' => 'option/member-getChild',
+                'col' => 'mobile',
+                'result' => 'id',
+                'search' => 'aid',//本表的字段,默认为当前的字段
+            ),
+            'list_name' => '子账户',
+            'list'      => 'Dever::load("option/lib/member.getInfo", {mid})',
+            'list_order' => 3,
+        ),
+
         'daijiaofu_date'     => array
         (
             'type'      => 'int-11',
@@ -146,6 +166,21 @@ return array
 
     'request' => array
     (
+        'getTotal' => array
+        (
+            'type' => 'all',
+            'option' => array
+            (
+                'id' => 'yes',
+                'aid' => 'yes',
+                'mid' => 'yes',
+                'state' => 1,
+            ),
+            'group' => 'type',
+            'order' => array('daijiaofu_date' => 'desc', 'id' => 'desc'),
+            'col' => '*,sum(daijiaofu) as daijiaofu, sum(jiaofu) as jiaofu, sum(fafang) as fafang, sum(duifu) as duifu',
+        ),
+
         'upCash_daijiaofu' => array
         (
             'type' => 'update',

+ 3 - 3
service/option/lib/Account.php

@@ -164,7 +164,7 @@ class Account
 
             # 获取账户资金
             $cash_type = Dever::db('option/cash')->config['config_type'];
-            $cash = Dever::db('option/cash')->select(array('aid' => $aid));
+            $cash = Dever::db('option/cash')->getTotal(array('aid' => $aid));
 
             if ($cash) {
                 $table = array();
@@ -334,7 +334,7 @@ class Account
         $where['aid'] = $id;
         $total = Dever::db('option/bill_jiaofu')->total($where);
         $html = $total . '条';
-        $cash = Dever::db('option/cash')->select(array('aid' => $id));
+        $cash = Dever::db('option/cash')->getTotal(array('aid' => $id));
         $total = 0;
         if ($cash) {
             foreach ($cash as $k => $v) {
@@ -351,7 +351,7 @@ class Account
         $where['status'] = 2;
         $total = Dever::db('option/bill_jiaofu')->total($where);
         $daijiaofu = $total . '条';
-        $cash = Dever::db('option/cash')->select(array('aid' => $id, 'status' => 2));
+        $cash = Dever::db('option/cash')->getTotal(array('aid' => $id, 'status' => 2));
         $total = 0;
         $qiquan = '';
         $yuanshiqiquan = '';

+ 3 - 4
service/option/lib/Cash.php

@@ -246,7 +246,7 @@ class Cash
         $account_cash = Dever::db('option/cash')->select(array('aid' => $info['aid']));
         if ($account_cash) {
             foreach ($account_cash as $k => $v) {
-                $cash = Dever::db('option/bill_jiaofu')->getTotal(array('where_end' => $info['jiaofu_date'], 'where_type' => $v['type'], 'where_aid' => $info['aid'], 'where_status' => 2));
+                $cash = Dever::db('option/bill_jiaofu')->getTotal(array('where_end' => $info['jiaofu_date'], 'where_type' => $v['type'], 'where_aid' => $v['aid'], 'where_mid' => $v['mid'], 'where_status' => 2));
                 if ($cash) {
                     $update = array();
                     $update['where_id'] = $v['id'];
@@ -259,7 +259,7 @@ class Cash
                     Dever::db('option/cash')->update($update);
 
                     # 获取待发放数据 对之前发放的数据进行发放
-                    $fafang = Dever::db('option/bill_fafang')->find(array('status' => 2, 'type' => $v['type'], 'aid' => $info['aid']));
+                    $fafang = Dever::db('option/bill_fafang')->find(array('status' => 2, 'type' => $v['type'], 'aid' => $v['aid'], 'mid' => $v['mid']));
                     if ($fafang) {
                         foreach ($fafang as $v1) {
                             if ($cash['total'] >= $v1['cash']) {
@@ -268,10 +268,9 @@ class Cash
                             }
                         }
                     }
+                    Dever::db('option/bill_jiaofu')->upYes(array('where_end' => $info['jiaofu_date'], 'where_aid' => $v['aid'], 'where_mid' => $v['mid'], 'where_status' => 2, 'set_agreement_id' => $info['id'], 'set_status' => 1, 'set_qdate' => time()));
                 }
             }
-
-            Dever::db('option/bill_jiaofu')->upYes(array('where_end' => $info['jiaofu_date'], 'where_aid' => $info['aid'], 'where_status' => 2, 'set_agreement_id' => $info['id'], 'set_status' => 1, 'set_qdate' => time()));
         }
     }
 

+ 2 - 4
service/option/src/My.php

@@ -24,7 +24,7 @@ class My extends Core
     {
         $this->data['user'] = $this->user;
 
-        $this->data['cash'] = Dever::db('option/cash')->select(array('aid' => $this->uid));
+        $this->data['cash'] = Dever::db('option/cash')->getTotal(array('aid' => $this->uid));
 
         $jiaofu = Dever::db('option/bill_jiaofu')->find(array('status' => 2, 'aid' => $this->uid));
 
@@ -56,7 +56,7 @@ class My extends Core
     # 待交付期权列表
     public function getValue()
     {
-        $this->data['list'] = Dever::db('option/cash')->select(array('aid' => $this->uid));
+        $this->data['list'] = Dever::db('option/cash')->getTotal(array('aid' => $this->uid));
 
         $agreement = Dever::db('option/agreement')->getOne(array('aid' => $this->uid));
 
@@ -67,8 +67,6 @@ class My extends Core
             'date' => date('Y.m.d H:i'),
         );
 
-        
-
         $date = 0;
         $total = 0;