cost plan recost fixbug use cost.id for update

This commit is contained in:
qianhy
2023-03-02 17:37:08 +08:00
parent 59e5b996c6
commit f28211194c
+15 -9
View File
@@ -508,21 +508,16 @@ class Order extends CI_Controller{
foreach ($rows as $item) {
$if_usedcar = $item['if_usedcar'];
$biz = $this->biz_model->get(['id'=>$item['biz_id']]);
$cost = $srv_json_cost = array();
if ($recost || $debug){
$cost = $this->items_cost_model->get(array('o_id'=>$item['id']));
$srv_json_cost = json_decode($cost['srv_json'], true);
echo $this->items_cost_model->db->last_query()."<br>";
}
if ($debug){
echo "finance_id: {$item['finance_id']}"."<br>";
echo "biz_id: {$item['biz_id']}"."<br>";
echo "status: {$item['status']}"."<br>";
echo "if_usedcar: {$if_usedcar}"."<br>";
echo "<br><br>";
}
$biz = $this->biz_model->get(['id'=>$item['biz_id']]);
if ($debug){
echo "get biz: <br>";
echo $this->biz_model->db->last_query()."<br>";
var_dump($biz);
@@ -530,6 +525,16 @@ class Order extends CI_Controller{
echo "biz_type: {$biz['type']}"."<br>";
echo "<br><br>";
}
$cost = $srv_json_cost = array();
if ($recost || $debug){
$cost = $this->items_cost_model->get(array('o_id'=>$item['id']));
$srv_json_cost = json_decode($cost['srv_json'], true);
echo "get cost: <br>";
echo $this->items_cost_model->db->last_query()."<br>";
echo "<br><br>";
}
$money_json = json_decode($item['money_json'],true);
$info_json = json_decode($item['info_json'],true);
$bill_time_month = date('Y-m-d',strtotime($item['bill_time']));
@@ -934,7 +939,7 @@ class Order extends CI_Controller{
var_dump($add_data);
if ($cost){
echo "<br><br>";
echo "<br><br>get cost data:<br>";
var_dump($cost);
echo "<br>";
echo "c_time: ".date("Y-m-d H:i:s",$cost['c_time'])."<br>";
@@ -948,6 +953,7 @@ class Order extends CI_Controller{
if ($recost){
unset($add_data['c_time']);
$id = $this->items_cost_model->update($add_data, array('o_id' => $item['id']));
$id && $id = $cost['id']; # 如有更新,强制为cost.id
}
else{
$id = $this->items_cost_model->add($add_data);