diff --git a/admin/controllers/receiver/Orders.php b/admin/controllers/receiver/Orders.php index 373cc33d..70d830e5 100644 --- a/admin/controllers/receiver/Orders.php +++ b/admin/controllers/receiver/Orders.php @@ -308,7 +308,6 @@ class Orders extends HD_Controller //日志 $logs = []; $row['is_admin'] = $this->role == SUPER_ADMIN ? true : false; - $row['is_admin'] = ($this->role == SUPER_ADMIN || $this->role == 40) ? true : false; $info = $row; $this->data['info'] = $info; diff --git a/common/libraries/receiver/Orders_entity.php b/common/libraries/receiver/Orders_entity.php index 7a01bbcf..c6cb7515 100644 --- a/common/libraries/receiver/Orders_entity.php +++ b/common/libraries/receiver/Orders_entity.php @@ -30,47 +30,55 @@ class Orders_entity $customer_row = $this->ci->customers_model->get(['id' => $order_row['customer_id']]); $car_row = $this->ci->auto_cars_model->get(['id' => $order_row['car_id']]); $order_data = $this->ci->receiver_order_datas_model->get(['o_id' => $order_row['id']]); - $sign_row = $this->ci->sign_model->get(['customer_id' => $order_row['customer_id']]); + $sign_row = $this->ci->sign_model->get(['customer_id' => $order_row['customer_id'], 'status' => 1]); if (!$order_row) { return ['code' => 0, 'msg' => '订单不存在']; } - $map_cfrom2 = $this->clues_cfrom_model->get(array('id' => $customer_row['of2_id'])); - $map_cfrom = $this->clues_cfrom_model->get(array('id' => $map_cfrom2['pid'])); + $map_cfrom2 = $this->ci->clues_cfrom_model->get(array('id' => $customer_row['of2_id'])); + $map_cfrom = $this->ci->clues_cfrom_model->get(array('id' => $map_cfrom2['pid'])); $money_json = json_decode($order_row['money_json'], true); $post_data = [ 'buyerType' => $order_row['main_type'] ? 2 : 1, 'buyerName' => $order_row['name'], 'buyerPhone' => $order_row['mobile'], - 'specId' => $car_row['third_car_id'], + 'specId' => intval($car_row['third_car_id']), 'outOrderId' => $order_row['sid'], 'outLeadId' => $customer_row['cid'], 'outOrderCreateTime' => date('Y-m-d H:i:s', $order_row['c_time']), 'registerCityId' => $customer_row['city_id'], ]; $order_row['auto_order_id'] && $post_data['autohomeOrderId'] = $order_row['auto_order_id']; - $money_json['invoice_amount'] && $post_data['invoiceAmount'] = $money_json['invoice_amount']; + $money_json['invoice_amount'] && $post_data['invoiceAmount'] = floatval($money_json['invoice_amount']); if ($order_row['if_num']) { //是否上牌 $post_data['isRegisterInStore'] = 1; - $money_json['register_amount'] && $post_data['registerAmount'] = $money_json['register_amount']; + $money_json['register_amount'] && $post_data['registerAmount'] = floatval($money_json['register_amount']); } $post_data['isInsured'] = $order_row['if_insure'] ? 1 : 0; if (!$order_row['payway']) { //贷款 + $post_data['downpaymentType'] = intval($order_row['downpayment_type']); $post_data['isLoan'] = 1; - $money_json['loan_amount'] && $post_data['loanAmount'] = $money_json['loan_amount']; - $money_json['loan_periods'] && $post_data['loanPeriods'] = $money_json['loan_periods']; - $money_json['monthly_payment'] && $post_data['monthlyPayment'] = $money_json['monthly_payment']; + $money_json['loan_amount'] && $post_data['loanAmount'] = floatval($money_json['loan_amount']); + $money_json['loan_periods'] && $post_data['loanPeriods'] = intval($money_json['loan_periods']); + $money_json['monthly_payment'] && $post_data['monthlyPayment'] = floatval($money_json['monthly_payment']); } -// $data['carryCarDate'] = '2024-06-02'; -// $data['payDate'] = '2024-05-27'; - $order_data['contract_img'] && $post_data['contractImg'] = build_qiniu_image_url($order_data['contract_img']); +// $post_data['carryCarDate'] = '2024-06-02'; + /*付款时间去订单下定时间*/ + $post_data['order_time'] != '0000-00-00 00:00:00' && $post_data['payDate'] = date('Y-m-d', strtotime($post_data['order_time'])); + $contract_imgs = []; + if ($order_data['contract_img']) { //多图 + $img_arr = explode(',', $order_data['contract_img']); + foreach ($img_arr as $item) { + $contract_imgs[] = build_qiniu_image_url($item); + } + } + $contract_imgs && $post_data['contractImg'] = implode(',', $contract_imgs); $order_data['bill_img'] && $post_data['invoiceImg'] = build_qiniu_image_url($order_data['bill_img']); $order_data['pay_img'] && $post_data['payImg'] = build_qiniu_image_url($order_data['pay_img']); $order_row['color'] && $post_data['outColor'] = $order_row['color']; $order_row['in_color'] && $post_data['inColor'] = $order_row['in_color']; $post_data['deliveryDate'] = date('Y-m-d', strtotime($order_row['delry_time'])); - $post_data['downpaymentType'] = $order_row['downpayment_type']; - $money_json['confirm_amount'] && $post_data['confirmAmount'] = $money_json['confirm_amount']; - $money_json['discount_amount'] && $post_data['discountAmount'] = $money_json['discount_amount']; + $money_json['confirm_amount'] && $post_data['confirmAmount'] = floatval($money_json['confirm_amount']); + $money_json['discount_amount'] && $post_data['discountAmount'] = floatval($money_json['discount_amount']); // $data['isLocalInvoice'] = 0; $post_data['idCardNo'] = $order_row['card_id']; $order_data['car_img'] && $post_data['carDocumentImg'] = build_qiniu_image_url($order_data['car_img']); @@ -83,18 +91,18 @@ class Orders_entity $post_data['leadStairSource'] = $map_cfrom['title'] ?: ''; //线索⼀级来源 $post_data['leadSecondSource'] = $map_cfrom2['title'] ?: ''; //线索⼆级来源 $post_data['leadTime'] = date('Y-m-d H:i:s', $customer_row['c_time']); //线索时间 - $customer_row['province_id'] && $post_data['leadProvinceCode'] = $customer_row['province_id']; //线索所在省份 - $customer_row['city_id'] && $post_data['leadCityCode'] = $customer_row['city_id']; //线索所在城市 - $customer_row['county_id'] && $post_data['leadDistrictCode'] = $customer_row['county_id']; //线索所在区县 + $customer_row['province_id'] && $post_data['leadProvinceCode'] = intval($customer_row['province_id']); //线索所在省份 + $customer_row['city_id'] && $post_data['leadCityCode'] = intval($customer_row['city_id']); //线索所在城市 + $customer_row['county_id'] && $post_data['leadDistrictCode'] = intval($customer_row['county_id']); //线索所在区县 $sign_data = []; //签到数据 if ($sign_row) { $sign_data['signinId'] = $sign_row['sid']; $sign_data['signinTime'] = date('Y-m-d H:i:s', $sign_row['c_time']); - $sign_data['signinGdLongitude'] = $sign_row['lng']; - $sign_data['signinGdLatitude'] = $sign_row['lat']; - $sign_data['storeGdLongitude'] = $sign_row['biz_lng']; - $sign_data['storeGdLatitude'] = $sign_row['biz_lng']; - $sign_data['storeLinearDistance'] = $sign_row['distance']; + $sign_data['signinGdLongitude'] = floatval($sign_row['lng']); + $sign_data['signinGdLatitude'] = floatval($sign_row['lat']); + $sign_data['storeGdLongitude'] = floatval($sign_row['biz_lng']); + $sign_data['storeGdLatitude'] = floatval($sign_row['biz_lng']); + $sign_data['storeLinearDistance'] = floatval($sign_row['distance']); } $sign_data && $post_data['signinList'] = [$sign_data]; $req = $this->ci->carhome->saveOrder($post_data, $order_row['id']);