|
@@ -28,20 +28,22 @@ bfdc6069eaeb89ec0c4295f5230c13820a578f13ef0086d15a720ea2712ff2040f3ae09a8d3b8f12
|
|
|
|
|
|
public function query()
|
|
|
{
|
|
|
-
|
|
|
- $class = new Chinaums();
|
|
|
-
|
|
|
# 查看当前余额
|
|
|
$sid = Dever::input('sid');
|
|
|
- $cash = $class->query($sid);
|
|
|
+ $cash = $this->query_action($sid);
|
|
|
return $cash;
|
|
|
}
|
|
|
|
|
|
- public function record()
|
|
|
+ public function query_action($sid)
|
|
|
{
|
|
|
-
|
|
|
$class = new Chinaums();
|
|
|
+ $data = $class->query($sid);
|
|
|
+
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
|
|
|
+ public function record()
|
|
|
+ {
|
|
|
# 查看提现记录
|
|
|
$sid = Dever::input('sid');
|
|
|
$start = Dever::input('start');
|
|
@@ -68,13 +70,13 @@ bfdc6069eaeb89ec0c4295f5230c13820a578f13ef0086d15a720ea2712ff2040f3ae09a8d3b8f12
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
- public function action($mid, $order, $order_id, $type, $cash)
|
|
|
+ public function action($mid, $order, $order_id, $type, $cash, $order_info = array())
|
|
|
{
|
|
|
$class = new Chinaums();
|
|
|
|
|
|
$notify = Dever::url('yspay.notify?order=' . $order, 'shop');
|
|
|
|
|
|
- $result = $class->act($mid, $order, $order_id, $type, $cash, $notify);
|
|
|
+ $result = $class->act($mid, $order, $order_id, $type, $cash, $notify, $order_info);
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
@@ -97,8 +99,17 @@ bfdc6069eaeb89ec0c4295f5230c13820a578f13ef0086d15a720ea2712ff2040f3ae09a8d3b8f12
|
|
|
|
|
|
$content = $class->privateDecrypt($content);
|
|
|
|
|
|
+ $log = Dever::db('shop/yspay_tixian_log')->one(array('order_num' => $order, 'shop_id' => $order['shop_id']));
|
|
|
if ($content && isset($content['responseCode']) && ($content['responseCode'] == '000000' || $content['responseCode'] == '000001')) {
|
|
|
Dever::db('shop/sell_order')->update(array('where_id' => $order['id'], 'withdraw' => 2));
|
|
|
+ if ($log) {
|
|
|
+ Dever::db('shop/yspay_tixian_log')->update(array('where_id' => $log['id'], 'status' => 2, 'response' => Dever::json_encode($content)));
|
|
|
+
|
|
|
+ $account = Dever::db('shop/yspay_account')->one(array('shop_id' => $log['shop_id']));
|
|
|
+ if ($account) {
|
|
|
+ Dever::db('shop/yspay_account')->dec(array('where_id' => $account['id'], 'set_cash' => $log['cash']));
|
|
|
+ }
|
|
|
+ }
|
|
|
echo 'SUCCESS';die;
|
|
|
} else {
|
|
|
Dever::load('shop/lib/cron')->yspayOne($order);
|
|
@@ -159,8 +170,6 @@ class Chinaums
|
|
|
$result = Dever::curl($url, $body, 'post');
|
|
|
|
|
|
$decryptData = $this->privateDecrypt($result);
|
|
|
- print_r($decryptData);die;
|
|
|
-
|
|
|
if (isset($decryptData['tzWithdrawAmtPublic'])) {
|
|
|
return $decryptData['tzWithdrawAmtPublic'];
|
|
|
} elseif (isset($decryptData['t0WithdrawAmtPublic'])) {
|
|
@@ -181,7 +190,7 @@ class Chinaums
|
|
|
'sysId' => $this->sys_id,
|
|
|
'mchntNo' => $mid,
|
|
|
'timestamp' => date('YmdHis'),
|
|
|
- 'page' => '"' . $page . '"',
|
|
|
+ 'page' => (string) $page,
|
|
|
'beginDate' => $start,
|
|
|
'endDate' => $end,
|
|
|
];
|
|
@@ -191,16 +200,22 @@ class Chinaums
|
|
|
$result = Dever::json_decode($result);
|
|
|
$decryptData = $this->privateDecrypt($result['result']);
|
|
|
if (isset($decryptData['recordList']) && $decryptData['recordList']) {
|
|
|
- if ($page < $decryptData['totalPage']) {
|
|
|
- return $this->record($mid, $start, $end, $page+1);
|
|
|
+ $data = Dever::json_decode($decryptData['recordList']);
|
|
|
+ if ($page == 1 && isset($decryptData['totalPage']) && $decryptData['totalPage'] > 1) {
|
|
|
+ for ($i = 2; $i <= $decryptData['totalPage']; $i++) {
|
|
|
+ $temp = $this->record($mid, $start, $end, $i);
|
|
|
+ if ($temp) {
|
|
|
+ $data = array_merge($data, $temp);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- return Dever::json_decode($decryptData['recordList']);
|
|
|
+ return $data;
|
|
|
}
|
|
|
return array();
|
|
|
}
|
|
|
|
|
|
# 提现
|
|
|
- public function act($mid, $order, $order_id, $type = 2, $cash = 1, $notify = '')
|
|
|
+ public function act($mid, $order, $order_id, $type = 2, $cash = 1, $notify = '', $order_info = array())
|
|
|
{
|
|
|
$url = $this->host() . 'uisouterfront/withdrawback/process';
|
|
|
|
|
@@ -219,6 +234,16 @@ class Chinaums
|
|
|
'withdrawAmt' => $cash,
|
|
|
];
|
|
|
Dever::log($content, 'yspay_act');
|
|
|
+ $data['shop_id'] = $order_info['shop_id'];
|
|
|
+ $data['mid'] = $mid;
|
|
|
+ $data['order_num'] = $order;
|
|
|
+ $data['type'] = $type;
|
|
|
+ $data['cash'] = $cash;
|
|
|
+ $data['tdate'] = time();
|
|
|
+ $data['status'] = 1;
|
|
|
+ $data['desc'] = $order_info['desc'];
|
|
|
+ $data['mtype'] = $order_info['mtype'];
|
|
|
+ Dever::db('shop/yspay_tixian_log')->insert($data);
|
|
|
//设置签名并加密
|
|
|
$body['content'] = $this->createSignature($content);
|
|
|
|