|
@@ -3,6 +3,8 @@ use Dever;
|
|
|
|
|
|
class Cash
|
|
|
{
|
|
|
+ # 千分制
|
|
|
+ private $num = 1000;
|
|
|
# 入账:待确认
|
|
|
public function add($merchant_id, $amount, $order_num, $source_order_num, $fenzhang = 0)
|
|
|
{
|
|
@@ -35,7 +37,7 @@ class Cash
|
|
|
public function up($id, $status = 2, $amount = false, $fenzhang = 0)
|
|
|
{
|
|
|
if ($amount) {
|
|
|
- $amount = $amount * 100;
|
|
|
+ $amount = $amount * $this->num;
|
|
|
}
|
|
|
if (is_numeric($id)) {
|
|
|
$where['id'] = $id;
|
|
@@ -99,14 +101,14 @@ class Cash
|
|
|
if (!$cash_per || $cash_per <= 0) {
|
|
|
$cash_per = 0;
|
|
|
} else {
|
|
|
- $cash_per = $cash_per/100;
|
|
|
+ $cash_per = $cash_per/$this->num;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $per = $yspay['per']/100;
|
|
|
- $cash_jy_per = $yspay['cash_jy_per']/100;
|
|
|
+ $per = $yspay['per']/$this->num;
|
|
|
+ $cash_jy_per = $yspay['cash_jy_per']/$this->num;
|
|
|
|
|
|
- $data['ycash'] = $amount/100;
|
|
|
+ $data['ycash'] = $amount/$this->num;
|
|
|
$data['yl_cash'] = round($data['ycash'] * $per, 2);
|
|
|
$data['pt_cash'] = round($data['ycash'] * $cash_jy_per, 2);
|
|
|
$data['cash'] = round($data['ycash'] - $data['yl_cash'] - $data['pt_cash'], 2);
|
|
@@ -122,12 +124,12 @@ class Cash
|
|
|
}
|
|
|
$data['hf_cash'] = round($data['cash'] - $data['fz_cash'], 2);
|
|
|
|
|
|
- $data['ycash'] *= 100;
|
|
|
- $data['yl_cash'] *= 100;
|
|
|
- $data['pt_cash'] *= 100;
|
|
|
- $data['cash'] *= 100;
|
|
|
- $data['fz_cash'] *= 100;
|
|
|
- $data['hf_cash'] *= 100;
|
|
|
+ $data['ycash'] *= $this->num;
|
|
|
+ $data['yl_cash'] *= $this->num;
|
|
|
+ $data['pt_cash'] *= $this->num;
|
|
|
+ $data['cash'] *= $this->num;
|
|
|
+ $data['fz_cash'] *= $this->num;
|
|
|
+ $data['hf_cash'] *= $this->num;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -170,19 +172,6 @@ class Cash
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- # 定时获取总额
|
|
|
-
|
|
|
- # 测试数据
|
|
|
- public function test_add_api()
|
|
|
- {
|
|
|
- $info['mid'] = 'test';
|
|
|
- $info['merOrderId'] = 'test123';
|
|
|
- $info['amount'] = 10000;
|
|
|
-
|
|
|
- $this->add('test123', array(), $info);
|
|
|
- return 'ok';
|
|
|
- }
|
|
|
-
|
|
|
# 将测试数据改成待入账
|
|
|
public function test_edit_api()
|
|
|
{
|
|
@@ -236,8 +225,8 @@ class Cash
|
|
|
$cash = Dever::param('cash', $data);
|
|
|
$merchant = Dever::db('pay/yspay_merchant')->one($merchant_id);
|
|
|
if ($merchant) {
|
|
|
- $cash = $cash*100;
|
|
|
- $yue = $merchant['hf_cash'] - $merchant['hf_tx_cash'] - 10000;
|
|
|
+ $cash = $cash*$this->num;
|
|
|
+ $yue = $merchant['hf_cash'] - $merchant['hf_tx_cash'] - $this->num*100;
|
|
|
if ($yue < $cash) {
|
|
|
Dever::alert('余额不足');
|
|
|
}
|