|
@@ -33,6 +33,9 @@ class Record
|
|
|
if($type == 4){
|
|
|
$where['explan'] = '采购商品';
|
|
|
}
|
|
|
+ if($type == 4){
|
|
|
+ $where['price'] = -1*$price;
|
|
|
+ }
|
|
|
$where['status'] = 2;
|
|
|
$where['state'] = 1;
|
|
|
$where['cdate'] = time();
|
|
@@ -40,11 +43,7 @@ class Record
|
|
|
$ids = Dever::db('shop/record')->insert($where);
|
|
|
|
|
|
$update['where_id'] = $shop_id;
|
|
|
- if ($type == 3 || $type == 8){
|
|
|
- $update['set_price'] = $price;
|
|
|
- } elseif ($type == 4){
|
|
|
- $update['set_price'] = -1*$price;
|
|
|
- }
|
|
|
+ $update['set_price'] = $where['price'];
|
|
|
Dever::db('shop/info')->upCash($update);
|
|
|
return $ids;
|
|
|
}
|
|
@@ -52,8 +51,18 @@ class Record
|
|
|
public function updateRecord($id,$name,$data){
|
|
|
$audit = Dever::input('audit',$data);
|
|
|
$sid = Dever::input('sid',$data);
|
|
|
+ $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'];
|
|
|
+ }
|
|
|
+ }
|
|
|
if ($info) {
|
|
|
$where['where_id'] = $shop['id'];
|
|
|
$where['price'] = $info['price'];
|
|
@@ -61,6 +70,7 @@ class Record
|
|
|
if($info['price']>$shop['price']){
|
|
|
Dever::alert('提现大于余额');
|
|
|
}
|
|
|
+ $info['price'] = -1*$info['price'];
|
|
|
$where['price'] = 0;
|
|
|
$insert['yue'] = $shop['price'];
|
|
|
|
|
@@ -78,10 +88,12 @@ class Record
|
|
|
$insert['status'] = 2;
|
|
|
$insert['operdate'] = time();
|
|
|
}elseif($info['type'] == 2){
|
|
|
+
|
|
|
$insert['status'] = 1;
|
|
|
$insert['audit'] = 1;
|
|
|
$insert['fafang'] = 1;
|
|
|
}
|
|
|
+
|
|
|
|
|
|
Dever::db('shop/record')->update($insert);
|
|
|
}
|
|
@@ -112,7 +124,7 @@ class Record
|
|
|
if($info['price']>$shop['price']){
|
|
|
Dever::alert('提现大于余额');
|
|
|
}
|
|
|
- $where['price'] = -1*$info['price'];
|
|
|
+ $where['price'] = $info['price'];
|
|
|
|
|
|
$yue = $shop['price'] + $where['price'];
|
|
|
Dever::db('shop/record')->update(array('where_id' => $id, 'yue'=>$yue,'status' => 2, 'operdate' => time()));
|