|
@@ -47,6 +47,18 @@ class Record
|
|
|
Dever::db('shop/info')->upCash($update);
|
|
|
return $ids;
|
|
|
}
|
|
|
+ public function insertRecord($id,$name,$data){
|
|
|
+ $sid= Dever::param('sid',$data);
|
|
|
+ $type = Dever::param('type',$data);
|
|
|
+ $price = Dever::param('price',$data);
|
|
|
+ $shop = Dever::db('shop/info')->find(array('sid'=>$sid));
|
|
|
+
|
|
|
+ if($type && $type == 2 && $price){
|
|
|
+ if($shop['price']<$price){
|
|
|
+ Dever::alert('提现大于余额');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
#充值和提现
|
|
|
public function updateRecord($id,$name,$data){
|
|
|
$audit = Dever::input('audit',$data);
|
|
@@ -54,15 +66,7 @@ class Record
|
|
|
$type = Dever::input('type',$data);
|
|
|
$price = Dever::input('price',$data);
|
|
|
$info = Dever::db('shop/record')->find($id);
|
|
|
- $shop = Dever::db('shop/info')->find(array('sid'=>$info['sid']));
|
|
|
- if($type && $type == 2 && $price){
|
|
|
- $insert['price'] = -1*$price;
|
|
|
-
|
|
|
- }else{
|
|
|
- if(isset($data['add_type']) && $data['add_type'] == 2 && isset($data['add_price']) && $data['add_price']){
|
|
|
- $insert['price'] = -1*$data['add_price'];
|
|
|
- }
|
|
|
- }
|
|
|
+ $shop = Dever::db('shop/info')->find(array('sid'=>$info['sid']));
|
|
|
if ($info) {
|
|
|
$where['where_id'] = $shop['id'];
|
|
|
$where['price'] = $info['price'];
|
|
@@ -70,11 +74,14 @@ class Record
|
|
|
if($info['price']>$shop['price']){
|
|
|
Dever::alert('提现大于余额');
|
|
|
}
|
|
|
- $info['price'] = -1*$info['price'];
|
|
|
- $where['price'] = 0;
|
|
|
- $insert['yue'] = $shop['price'];
|
|
|
+
|
|
|
+ $insert['yue'] = $shop['price']+(-1*$info['price']);
|
|
|
|
|
|
$insert['type_id'] = Dever::load('bill/lib/tixian')->up($shop['id'], $info['price'], $info['price'], $info['pic'], 2,$id);
|
|
|
+
|
|
|
+ $info['price'] = -1*$info['price'];
|
|
|
+ $where['price'] = $info['price'];
|
|
|
+
|
|
|
}
|
|
|
Dever::db('shop/info')->upCash($where);
|
|
|
$ids = Dever::db('shop/info')->find(array('sid'=>$info['sid'],'s'=>1));
|
|
@@ -88,13 +95,12 @@ class Record
|
|
|
$insert['status'] = 2;
|
|
|
$insert['operdate'] = time();
|
|
|
}elseif($info['type'] == 2){
|
|
|
-
|
|
|
+ $insert['price'] =$info['price'];
|
|
|
$insert['status'] = 1;
|
|
|
$insert['audit'] = 1;
|
|
|
$insert['fafang'] = 1;
|
|
|
- }
|
|
|
- // print_R($insert);die;
|
|
|
-
|
|
|
+ }
|
|
|
+ // print_R($insert);die;
|
|
|
Dever::db('shop/record')->update($insert);
|
|
|
}
|
|
|
}
|
|
@@ -126,7 +132,7 @@ class Record
|
|
|
}
|
|
|
$where['price'] = $info['price'];
|
|
|
|
|
|
- $yue = $shop['price'] + $where['price'];
|
|
|
+ $yue = $shop['price'];
|
|
|
Dever::db('shop/record')->update(array('where_id' => $id, 'yue'=>$yue,'status' => 2, 'operdate' => time()));
|
|
|
$tixian = Dever::db('bill/tixian')->find($info['type_id']);
|
|
|
if($tixian){
|
|
@@ -136,17 +142,17 @@ class Record
|
|
|
$where['price'] = $info['price'];
|
|
|
Dever::db('shop/record')->update(array('where_id' => $id, 'status' => 2, 'operdate' => time()));
|
|
|
}
|
|
|
-
|
|
|
- Dever::db('shop/info')->upCash($where);
|
|
|
}
|
|
|
}else {
|
|
|
#作废
|
|
|
- Dever::db('shop/record')->update(array('where_id' => $id, 'status' => 3, 'operdate' => time()));
|
|
|
+
|
|
|
$info = Dever::db('shop/record')->find($id);
|
|
|
if ($info && $info['type'] == 2) {
|
|
|
$where['where_id'] = $info['shop_id'];
|
|
|
- $where['cash'] = -1*$info['price'];
|
|
|
- Dever::db('shop/info')->upCash($where);
|
|
|
+ $where['set_price'] = -1*$info['price'];
|
|
|
+ $ids = Dever::db('shop/info')->upCash($where);
|
|
|
+ $shop = Dever::db('shop/info')->find($ids);
|
|
|
+ Dever::db('shop/record')->update(array('where_id' => $id, 'status' => 3, 'operdate' => time(),'yue'=>$shop['price']));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -182,14 +188,14 @@ class Record
|
|
|
}else{
|
|
|
$audit_name = '已作废';
|
|
|
}
|
|
|
- $f_name = '-';
|
|
|
- if($info['fafang'] == 1){
|
|
|
- $f_name = '待发放';
|
|
|
- }elseif($info['fafang'] == 2){
|
|
|
- $f_name = '已发放';
|
|
|
- }else{
|
|
|
- $f_name = '已作废';
|
|
|
- }
|
|
|
+ // $f_name = '-';
|
|
|
+ // if($info['fafang'] == 1){
|
|
|
+ // $f_name = '待发放';
|
|
|
+ // }elseif($info['fafang'] == 2){
|
|
|
+ // $f_name = '已发放';
|
|
|
+ // }else{
|
|
|
+ // $f_name = '已作废';
|
|
|
+ // }
|
|
|
|
|
|
$result = array();
|
|
|
$result['门店信息'] = array
|