data($result); } /** * @notes 全局配置 * @return Json * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author 段誉 * @date 2022/9/21 19:41 */ public function config() { $result = IndexLogic::getConfigData(); return $this->data($result); } /** * @notes 政策协议 * @return Json * @author 段誉 * @date 2022/9/20 20:00 */ public function policy() { $type = $this->request->get('type/s', ''); $result = IndexLogic::getPolicyByType($type); return $this->data($result); } /** * @notes 装修信息 * @return Json * @author 段誉 * @date 2022/9/21 18:37 */ public function decorate() { $id = $this->request->get('id/d'); $result = IndexLogic::getDecorate($id); return $this->data($result); } /**签约回调 */ public function notifyUrl() { $a = Request()->get(); if ($a) { $find = Db::name('contract')->where('id', $a['id'])->find(); if ($find) { if ($find['signing_timer'] == 0) { Db::name('contract')->where('id', $a['id'])->update(['signing_timer' => 1]); return true; } else if ($find['signing_timer'] == 1) { Db::name('contract')->where('id', $a['id'])->update(['status' => 1, 'signing_timer' => 2]); if ($find['type'] == 1) { Db::name('company')->where('id', $find['party_a'])->update(['status' => 1, 'is_contract' => 1]); Db::name('company')->where('id', $find['party_b'])->update(['status' => 1, 'is_contract' => 1]); } else { Db::name('company')->where('id', $find['party_a'])->update(['status' => 1, 'is_contract' => 1]); Db::name('user')->where('id', $find['party_b'])->update(['is_contract' => 1]); } } try { //获取租赁信息 $vehicleRent = Db::name('vehicle_rent')->where('contract_id',$a['id'])->find(); //获取公司信息 $company = Db::name('company')->where('id',$vehicleRent['party_b'])->find(); //通知物流系统 if($vehicleRent && $company){ $result = curl_post('http://logistics.lihaink.cn/api/updateRentRecord', [], [ 'contract_id' => $a['id'], 'car_id' => $vehicleRent['car_ids'], 'company_id' => $company['id'], 'company_name' => $company['company_name'], 'company_user_id' => $company['user_id'], 'company_user_name' => $company['master_name'], 'company_user_phone' => $company['master_phone'], 'rent_type' => $vehicleRent['rent_type'] ]); if($result['code'] == 1){ $carids = explode(',',$vehicleRent['car_ids']); $pro_data = []; foreach($carids as $k => $v){ $pro_data[$k]['company_id']=$company['id']; $pro_data[$k]['object_id']=$v; $pro_data[$k]['type']=1; $pro_data[$k]['create_time']=time(); } Db::name('company_property')->insertAll($pro_data); Db::name('vehicle_rent')->where('id',$vehicleRent['id'])->update(['status',2]); } } }catch (\Exception $e){ return false; } } } return json(['success' => true, 'msg' => '成功']); } /** * 资产回调 */ public function notifyProperty() { $parmas = Request()->post(); if ($parmas) { if (!isset($parmas['company_id']) || $parmas['company_id'] < 0) { return json(['success' => false, 'msg' => '公司id不能为空']); } if (!isset($parmas['object_id'])) { return json(['success' => false, 'msg' => '对象id不能为空']); } $data=[]; $object_id = explode(',',$parmas['object_id']); foreach($object_id as $k=>$v){ if($v>0){ $data[$k]['company_id']=$parmas['company_id']; $data[$k]['object_id']=$v; $data[$k]['type']=1; } } if (count($data)>0){ $res = CompanyProperty::insertAll($data); } if ($res) { return json(['success' => true, 'msg' => '成功']); } else { return json(['success' => false, 'msg' => '失败']); } } return json(['success' => false, 'msg' => '失败,没有参数']); } /** * 认证回调 */ public function notifyAuthentication() { $parmas = Request()->param(); Log::error('notifyAuthentication', $parmas); if ($parmas) { Company::where('id',$parmas['id'])->update(['is_authentication'=>1]); return json(['success' => true, 'msg' => '成功']); } return json(['success' => false, 'msg' => '失败,没有参数']); } }