rabin 9 months ago
parent
commit
634249863d
2 changed files with 58 additions and 0 deletions
  1. 26 0
      database/yspay_merchant_log.php
  2. 32 0
      yspay/Merchant.php

+ 26 - 0
database/yspay_merchant_log.php

@@ -5,6 +5,14 @@ $type = array
 	//2 => '分账',
 	3 => '提现',
 );
+
+$tixian_status = array
+(
+    1 => '未提现',
+    2 => '提现中',
+    3 => '提现成功',
+    4 => '提现失败',
+);
 $link = Dever::decode(Dever::input('refer'));
 $button = array
 (
@@ -18,6 +26,10 @@ return array
     'lang' => '银联资金日志列表',
     'order' => -200,
     'menu' => false,
+    'end' => array
+    (
+        'update' => 'pay/yspay/merchant.updateLog',
+    ),
     # 数据结构
     'struct' => array
     (
@@ -106,6 +118,20 @@ return array
             'list'      => 'Dever::number({yue}/100, 2)',
         ),
 
+        'tixian_status'      => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '提现状态',
+            'default'   => '1',
+            'desc'      => '提现状态',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'option'    => $tixian_status,
+            'search'    => 'select',
+            'list'      => true,
+            'edit'      => '{my_role_id}==1'
+        ),
+
         'state'     => array
         (
             'type'      => 'tinyint-1',

+ 32 - 0
yspay/Merchant.php

@@ -165,7 +165,39 @@ class Merchant
             $data['cash'] = $cash;
             $data['yue'] = $yue;
             $data['name'] = $name;
+            if ($data['type'] == 3) {
+                $data['tixian_status'] = 2;
+            } else {
+                $data['tixian_status'] = 1;
+            }
             Dever::db('pay/yspay_merchant_log')->insert($data);
         }
     }
+
+    # 更新提现状态
+    public function updateLog($id, $name, $data)
+    {
+        $tixian_status = Dever::param('tixian_status', $data);
+        if ($tixian_status == 4) {
+            $info = Dever::db('pay/yspay_merchant_log')->one($id);
+            if ($info) {
+                $cash = $info['cash'] * -1;
+                Dever::db('pay/yspay_merchant')->updateTxCash(array('where_id' => $info['merchant_id'], 'hf_tx_cash' => $cash));
+            }
+        }
+    }
+
+    # 检测提现状态
+    public function checkTixian()
+    {
+        $where['type'] = 3;
+        $where['tixian_status'] = 2;
+        $data = Dever::db('pay/yspay_merchant_log')->select($where);
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                
+            }
+        }
+    }
 }