dever 3 years ago
parent
commit
18aecf1b2f

+ 18 - 0
service/option/database/agreement.php

@@ -131,6 +131,24 @@ return array
             'match'     => 'is_numeric',
         ),
 
+        'jiaofu_qiquan'      => array
+        (
+            'type'      => 'float-11,2',
+            'name'      => '交付的期权价值',
+            'default'   => '',
+            'desc'      => '交付的期权价值',
+            'match'     => 'is_numeric',
+        ),
+
+        'jiaofu_yuanshi'      => array
+        (
+            'type'      => 'float-11,2',
+            'name'      => '交付的原始期权价值',
+            'default'   => '',
+            'desc'      => '交付的原始期权价值',
+            'match'     => 'is_numeric',
+        ),
+
         'sign'     => array
         (
             'type'      => 'varchar-150',

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

@@ -136,7 +136,7 @@ class Agreement
     }
 
     # 新建合同
-    public function up($account, $date, $total, $status = 1)
+    public function up($account, $date, $total, $qiquan, $yuanshi, $status = 1)
     {
         $member = Dever::db('option/member')->find($account['mid']);
         $agreement = Dever::db('setting/agreement')->find(array('type' => 6));
@@ -149,6 +149,8 @@ class Agreement
         $where['aid'] = $account['id'];
         $where['agreement_id'] = $agreement['id'];
         $where['jiaofu_total'] = $total;
+        $where['jiaofu_qiquan'] = $qiquan;
+        $where['jiaofu_yuanshi'] = $yuanshi;
         $where['jiaofu_date'] = $date;
 
         $info = Dever::db('option/agreement')->find($where);
@@ -423,10 +425,9 @@ class Agreement
         if (isset($info['jiaofu_date'])) {
             $info['jiaofu_date'] = date("Y年m月d日", $info['jiaofu_date']);
         } else {
-            $info['jiaofu_total'] = '0.00';
+            $info['jiaofu_total'] = $info['jiaofu_qiquan'] = $info['jiaofu_yuanshi'] = '0.00';
             $info['jiaofu_date'] = date("Y年m月d日");
         }
-        
 
         if (isset($info['qdate']) && $info['qdate']) {
             $qdate = date('Y年m月d日', $info['qdate']);

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

@@ -249,20 +249,25 @@ class My extends Core
         }
 
         $date = 0;
-        $total = 0;
+        $total = $qiquan = $yuanshi = 0;
         if ($data) {
             foreach ($data as $k => $v) {
                 if ($v['daijiaofu_date'] > $date) {
                     $date = $v['daijiaofu_date'];
                 }
                 $total += $v['daijiaofu'];
+                if ($v['type'] == 1) {
+                    $qiquan += $v['daijiaofu'];
+                } else {
+                    $yuanshi += $v['daijiaofu'];
+                }
             }
         }
         $total = number_format($total, 2, '.', '');
 
         # 签署合同
         $this->user['sign'] = $update['sign'];
-        $agreement_id = Dever::load('option/lib/agreement')->up($this->user, $date, $total);
+        $agreement_id = Dever::load('option/lib/agreement')->up($this->user, $date, $total, $qiquan, $yuanshi);
 
         return $this->user;
     }