public function actionCheckmin() { $key = Yii::app()->request->getParam('key'); $result = RPCClient::call('ReserveService_checkmin', array('key' => $key)); echo json_encode($result); die; }
public function actionGetChildAdminArea() { //检查参数 if (!isset($_POST["areaCode"]) || empty($_POST["areaCode"])) { $this->renderPartial('//common/areaselect'); exit; } //参数 $areaCode = $_POST['areaCode']; $areaCodeHead = rtrim($areaCode, '0'); $areaCodeLike = ''; $hasChildren = '1'; //是否是直辖市 if (in_array($areaCodeHead, array('11', '12', '31', '50'))) { $areaCodeLike = $areaCodeHead . '%'; $hasChildren = '0'; } else { if (strlen($areaCodeHead) == 2) { $areaCodeLike = $areaCodeHead . '%00'; } else { if (strlen($areaCodeHead) == 4) { $areaCodeLike = $areaCodeHead . '%'; } } } //区域信息 $arealist = RPCClient::call('CommonService_queryAdminAreas', array('areaCode' => $areaCode)); //显示列表 $this->renderPartial('areaselect', array('areas' => $arealist, 'hasChildren' => $hasChildren)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { // var_dump($_POST);die; $model = new EpcPartTemp('create'); $action = 'epc/part'; $isPost = false; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); $EpcPartTemp = Yii::app()->request->getparam('EpcPartTemp'); $EpcPartTempedit = Yii::app()->request->getparam('EpcPartTempedit'); // var_dump($EpcPartTemp);die; if (isset($EpcPartTemp)) { $url = $_POST['purl']; $isPost = true; $model->attributes = $EpcPartTemp; $model->ModelID = $EpcPartTemp['modelId']; $model->GroupIG = $EpcPartTemp['groupId']; $model->MainGroupID = $EpcPartTemp['mainGroupId']; $model->OrganId = Yii::app()->user->getOrganID(); $model->UserId = Yii::app()->user->id; $model->CreateTime = time(); $model->UpdateTime = time(); if ($EpcPartTemp['mainGroupId'] === null) { $model->MainGroupID = $EpcPartTempedit['mainGroupId']; $model->ModelID = $EpcPartTempedit['modelId']; $model->GroupIG = $EpcPartTempedit['groupId']; } $imageUploadFile = CUploadedFile::getInstance($model, 'picture'); if ($imageUploadFile !== null) { // only do if file is really uploaded $imageFileExt = $imageUploadFile->extensionName; $save_path = dirname(Yii::app()->basePath) . '/upload/' . $action . '/'; if (!file_exists($save_path)) { mkdir($save_path, 0777, true); } $ymd = date("Ymd"); $save_path .= $ymd . '/'; if (!file_exists($save_path)) { mkdir($save_path, 0777, true); } $img_prefix = date("YmdHis") . '_' . rand(10000, 99999); $imageFileName = $img_prefix . '.' . $imageFileExt; $model->picture = $imageFileName; $model->picturePath = 'upload/' . $action . '/' . $ymd; $save_path .= $imageFileName; } // 获取epc车型信息 $modelId = $model->ModelID; $modelInfo = RPCClient::call('VehicleService_queryEpcModelInfo', array('ModelID' => $modelId)); if ($modelInfo) { $model->ModelName = $modelInfo['ModelName']; } // 获取主组信息 $mainGroupId = $model->MainGroupID; $mainGroupInfo = RPCClient::call('PartsService_queryGroupInfo', array('GroupIG' => $mainGroupId)); if ($mainGroupInfo) { $model->MainGroupName = $mainGroupInfo['Name']; } // var_dump($model->attributes);die; // 获取子组信息 $groupId = $model->GroupIG; $groupInfo = RPCClient::call('PartsService_queryGroupInfo', array('GroupIG' => $groupId)); if ($groupInfo) { $model->GroupName = $groupInfo['Name']; } if ($model->save()) { if ($imageUploadFile !== null) { // validate to save file $imageUploadFile->saveAs($save_path); } //Yii::app()->user->setFlash('success', "提交成功"); echo 'success'; //header("location:".$purl); Yii::app()->end(); } } // } // 获取参数 if ($isPost) { $partId = $model->PartID; $groupId = $model->GroupIG; } else { $partId = Yii::app()->request->getParam('ep_pt'); $groupId = Yii::app()->request->getParam('ep_gp'); } // 查询epc信息 $epcInfo = $this->_queryEpcInfo($partId, $groupId); // 初始赋值 if (!$isPost && $epcInfo && $epcInfo['epcPart']) { //$model->attributes = $epcInfo['epcPart']; $parts = $epcInfo['epcPart']; //var_dump($model->attributes);die; $model->PartID = $parts['partId']; $model->Name = $parts['name']; $model->Oeno = $parts['oeno']; $model->Amount = $parts['amount']; //$model->Name=$parts['jpno']; $model->Price = $parts['price']; $model->PicturePath = $parts['picture']; $model->MarkNo = $parts['markNo']; $model->Note = $parts['note']; $model->Specification = $parts['specification']; $model->Beginyear = $parts['beginyear']; $model->Endyear = $parts['endyear']; $model->ApplicableModel = $parts['applicableModel']; $model->MainGroupID = $parts['groupId']; } //Yii::app()->clientScript->scriptMap['jquery.js'] = false; //Yii::app()->clientScript->scriptMap['jquery.min.js'] = false; $action = array(); if (Yii::app()->request->getParam('ep_pt')) { $action = array('action' => 'edit'); } $this->renderPartial('_form', array_merge(array('model' => $model, 'action' => Yii::app()->createUrl('jpdata/epcPartTemp/create')), $epcInfo, $action), false, false); }
public function actionSearchgoods() { $code = Yii::app()->request->getParam('code'); $GoodsData = RPCClient::call('ReserveService_getGoodsData', array('code' => $code, 'rows' => 1000)); return $this->renderPartial('goodsdialog', array('goodsdata' => $GoodsData)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { //var_dump($_POST);die; $EpcGroupTemp = Yii::app()->request->getParam("EpcGroupTemp"); $model = new EpcGroupTemp('create'); $action = 'epc/group'; $isPost = false; // Uncomment the following line if AJAX validation is needed //$this->performAjaxValidation($model); if (isset($_POST['EpcGroupTemp'])) { $isPost = true; $model->attributes = $EpcGroupTemp; $model->ModelID = $EpcGroupTemp['modelId']; // 校验表单 // if ($model->validate()) { // file handling $imageUploadFile = CUploadedFile::getInstance($model, 'picture'); if ($imageUploadFile !== null) { // only do if file is really uploaded $imageFileExt = $imageUploadFile->extensionName; $save_path = dirname(Yii::app()->basePath) . '/upload/' . $action . '/'; if (!file_exists($save_path)) { mkdir($save_path, 0777, true); } $ymd = date("Ymd"); $save_path .= $ymd . '/'; if (!file_exists($save_path)) { mkdir($save_path, 0777, true); } $img_prefix = date("YmdHis") . '_' . rand(10000, 99999); $imageFileName = $img_prefix . '.' . $imageFileExt; $model->picture = $imageFileName; $model->picturePath = 'upload/' . $action . '/' . $ymd; $save_path .= $imageFileName; } // 获取epc车型信息 $modelId = $model->ModelID; $modelInfo = RPCClient::call('VehicleService_queryEpcModelInfo', array('modelId' => $modelId)); if ($modelInfo) { $model->ModelName = $modelInfo['modelName']; } // 获取主组信息 $groupId = $model->GroupPid; $groupInfo = RPCClient::call('PartsService_queryGroupInfo', array('groupId' => $groupId)); if ($groupInfo) { $model->GroupPname = $groupInfo['name']; } if ($model->save()) { if ($imageUploadFile !== null) { // validate to save file $imageUploadFile->saveAs($save_path); } echo 'success'; die; } // 获取参数 if ($isPost) { $modelId = $model->ModelID; } else { $modelId = Yii::app()->request->getParam('ep_ml'); } // 获取epc车型信息 $modelInfo = array(); if ($modelId) { $modelInfo = RPCClient::call('VehicleService_queryEpcModelInfo', array('modelId' => $modelId)); } Yii::app()->clientScript->scriptMap['jquery.js'] = false; Yii::app()->clientScript->scriptMap['jquery.min.js'] = false; echo $this->renderPartial('_form', array('model' => $model, 'action' => Yii::app()->createUrl('jpdata/epcGroupTemp/create'), 'epcModel' => $modelInfo), false, true); } }
public function actionDeletequotation() { if (Yii::app()->request->isAjaxRequest) { $Quoid = Yii::app()->request->getParam('quoID'); $inquiryID = Yii::app()->request->getParam('InquiryID'); $result = RPCClient::call('InquiryorderService_exchangestatus', array('status' => 4, 'quoID' => $Quoid)); // 修改询价单状态 InquiryorderService::changeinquirystatus($inquiryID, '4'); if ($result == 1) { //更改报价单待确认状态为已处理 $organID = Yii::app()->user->getOrganID(); $sql = 'update pap_remind_business set HandleStatus=2 where HandleID=' . $Quoid . ' and OrganID=' . $organID; Yii::app()->papdb->createCommand($sql)->execute(); echo json_encode(array('success' => true, 'message' => '已拒绝')); } else { echo json_encode(array('success' => false, 'message' => '修改失败')); } } }
public function actionAddorder() { $IDs = Yii::app()->request->getParam('cartIDs'); $purchase = Yii::app()->request->getParam('purchase'); //使用优惠券ID $usecouponID = Yii::app()->request->getParam('usecouponID'); $lottid = Yii::app()->request->getParam("lott"); $PromoID = Yii::app()->request->getParam('PromoID'); if (!$IDs) { $this->redirect('/pap/home/index'); } $cartIDs = str_replace(' ', '', $IDs); $cartIdAtrr = explode(",", $cartIDs); if (!$cartIdAtrr) { $this->redirect(array('/pap/home/index')); } //获取支付方式 $payment = Yii::app()->request->getParam("payment"); if (!$payment) { $this->redirect(array('/pap/home/index')); } //获取商品信息 if ($purchase) { $cartsGoods = BuyGoodsService::getpurchase($cartIdAtrr, $payment); } else { $cartsGoods = BuyGoodsService::getcart($cartIdAtrr, $payment); } if (!$cartsGoods || count($cartsGoods) == 0) { $this->redirect(array('/pap/home/index')); } //获取收货地址,物流input name值 $ShipLogis = Yii::app()->request->getParam("logistics"); $addressID = Yii::app()->request->getParam("addr"); if (!$addressID) { $this->redirect(array('/pap/home/index')); } $ship = $this->getShip($addressID); if (!$ship) { $this->redirect(array('/pap/home/index')); } //生成订单 if ($purchase) { $orderIdStr = RPCClient::call('BuyGoodsService_createorderFromPurchase', array('purchaseGoods' => $cartsGoods, 'payment' => $payment, 'ShipLogis' => $ShipLogis, 'ship' => $ship)); } else { $orderIdStr = RPCClient::call('BuyGoodsService_createorder', array('cartsGoods' => $cartsGoods, 'payment' => $payment, 'ShipLogis' => $ShipLogis, 'ship' => $ship, 'usecouponID' => $usecouponID)); } if ($orderIdStr && $lottid && $PromoID) { $this->redirect(array("payment", "id" => $orderIdStr, 'lottid' => $lottid, 'promoid' => $PromoID)); } $this->redirect(array("payment", "id" => $orderIdStr)); }
/** * GOODS配件查询-查询车型 * @param make 车型Id * @param series 车系Id * @param year 年款 * @return [{"modelId":"",'name':""},{"modelId":"",'name':""}] */ public function actionGoodsModels() { //检查参数 $make = Yii::app()->request->getParam('make'); $series = Yii::app()->request->getParam('series'); $year = Yii::app()->request->getParam('year'); if (!$make || !series) { echo json_encode(array()); Yii::app()->end(); } $goodsModels = RPCClient::call('VehicleService_queryGoodsModels', array('make' => $make, 'series' => $series, 'year' => $year)); echo json_encode($goodsModels); }
/** * 养护周期查询-查询前市场车型养护知识 */ public function actionQueryFrontVehicleMaintenance() { //检查参数 if (!isset($_POST['vehicleID']) || empty($_POST['vehicleID'])) { exit; } $vehicleID = $_POST['vehicleID']; //前市场车辆养护周期查询日志参数 $userID = Yii::app()->user->id; //车型参数信息 $vehicleModel = RPCClient::call('VehicleService_queryMtcVehicleDetail', array('vehicleMtcID' => $vehicleID)); //车型保养周期知识信息 $maintenanceModel = RPCClient::call('MaintenanceService_queryFrontVehicleMaintenanceinfo', array('vehicleID' => $vehicleID)); //车型保养项目信息 $maintenanceItemModel = RPCClient::call('MaintenanceService_queryFrontVehicleMaintenanceIteminfo', array('vehicleID' => $vehicleID)); //车辆保养项目展示结果计算 $maintenceHead = array(); $maintenceLeft = array(); $maintenceBody = array(); if ($maintenanceModel && $maintenanceItemModel && count($maintenanceItemModel) > 0) { //表格头部 $firstMileage = $maintenanceModel['FirstMileage']; $firstPeriod = $maintenanceModel['FirstPeriod']; $maintenceHead[0]['content'] = $firstMileage . "km/<br />" . $firstPeriod . "个月"; $maintenceHead[0]['mileage'] = $firstMileage; $maintenceHead[0]['period'] = $firstPeriod; $secondMileage = $maintenanceModel['SecondMileage']; $secondPeriod = $maintenanceModel['SecondPeriod']; $intervalMileage = $maintenanceModel['IntervalMileage']; $intervalPeriod = $maintenanceModel['IntervalPeriod']; $mileageCount = $secondMileage; $periodCount = $secondPeriod; $headNum = 1; while ($mileageCount <= 200000 && $periodCount <= 120) { $maintenceHead[$headNum]['content'] = $mileageCount . "km/<br />" . $periodCount . "个月"; $maintenceHead[$headNum]['mileage'] = $mileageCount; $maintenceHead[$headNum]['period'] = $periodCount; $mileageCount += $intervalMileage; $periodCount += $intervalPeriod; $headNum++; } //表格中部 for ($i = 0; $i < count($maintenanceItemModel); $i++) { $maintenceLeft[] = $maintenanceItemModel[$i]['ItemName']; $mileage = $maintenanceItemModel[$i]['Mileage']; $period = $maintenanceItemModel[$i]['Period']; $desc = $maintenanceItemModel[$i]['Desc']; $inFirst = $maintenanceItemModel[$i]['InFirst']; $inSecond = $maintenanceItemModel[$i]['InSecond']; if ($inFirst == '1') { $maintenceBody[$i][0] = $desc; } if ($inSecond == '1') { $maintenceBody[$i][1] = $desc; } for ($j = 2; $j < count($maintenceHead); $j++) { if (empty($mileage) || empty($period)) { $maintenceBody[$i][$j] = ""; } else { if ($maintenceHead[$j]['mileage'] % $mileage == 0 || $maintenceHead[$j]['period'] % $period == 0) { $maintenceBody[$i][$j] = $desc; } else { $maintenceBody[$i][$j] = ""; } } } } //组合数据 $maintenanceItem = array('head' => $maintenceHead, 'left' => $maintenceLeft, 'body' => $maintenceBody); } //车型易损件更换知识信息 $wearpartModel = RPCClient::call('MaintenanceService_queryFrontVehicleWearpartinfo', array('vehicleID' => $vehicleID)); //养护周期查询日志 $logmantenanceinfo = array('vehicleID' => $vehicleID, 'userID' => $userID); try { $url = Yii::app()->controller->getRoute(); //把ID转换成对应的车型主组,子组 $params['main'] = D::querymainlog($vehicleID); //插入mongo日志 $oper = F::getoperation($url, $info == '前市场车型查询', $params); } catch (Exception $ex) { } RPCClient::call('LogService_logUserQueryMaintenance', $logmantenanceinfo); //返回信息数组 $model = array('vehicleID' => $vehicleID, 'vehicle' => $vehicleModel, 'maintenanceModel' => $maintenanceModel, 'maintenanceItem' => $maintenanceItem, 'wearpartModel' => $wearpartModel); //返回页面 $this->renderPartial('info', $model); }
public function actionAddpartsdialog() { if (!Yii::app()->request->isAjaxRequest) { exit; } $RecordID = Yii::app()->request->getParam('id'); $CarID = Yii::app()->request->getParam('CarID'); $data = array(); if (!empty($RecordID)) { $data = RPCClient::call('SupportService_getServiceDataByServiceIDList', array('ServiceID' => $RecordID)); } $item = RPCClient::call('SupportService_getMaintenanceItemData'); return $this->renderPartial('addparts', array('data' => $data, 'item' => $item, 'RecordID' => $RecordID, 'CarID' => $CarID)); }
public function actionViewquo() { $params['quoid'] = Yii::app()->request->getParam('quoid'); $sql = 'select * from pap_quotation where QuoID=' . $params['quoid']; $aps = InquiryorderService::excutesql(array('sql' => $sql, 'db' => 'pap')); if ($aps && $aps[0]['InquiryID'] > 0) { //获取询价单信息 $inquiryorder_id = $aps[0]['InquiryID']; $inquiryinfo = RPCClient::call('InquiryorderService_getinquirybyid', $inquiryorder_id); $inquiryimgs = RPCClient::call('InquiryorderService_getinquiryimgs', $inquiryorder_id); $sql_files = 'select * from pap_inquiry_category where InquiryID=' . $inquiryorder_id; $categpry = Yii::app()->papdb->createCommand($sql_files)->queryAll(); if (!empty($categpry)) { $datacate = new CArrayDataProvider($categpry, array('pagination' => array('pageSize' => count($categpry)))); } else { $datacate = ''; } $res; if ($inquiryinfo['Make']) { $paramas['Make'] = $inquiryinfo['Make']; $paramas['Car'] = $inquiryinfo['Car']; $paramas['Year'] = $inquiryinfo['Year']; $paramas['Model'] = $inquiryinfo['Model']; $res = InquiryService::getcarmodel($paramas); } } //获取地址 $addr = InquiryorderService::getaddressid($aps[0]['ServiceID']); $address = InquiryorderService::dataproviderpage($addr); //获取经销商最小交易额 $miniprice = 0; $sql_findmini = 'select MinTurnover from pap_order_min_turnover where OrganID=' . $aps[0]['DealerID']; $lms_results = InquiryorderService::excutesql(array('sql' => $sql_findmini, 'db' => 'pap')); if ($lms_results && $lms_results[0]['MinTurnover']) { $miniprice = $lms_results[0]['MinTurnover']; } //获取经销商信息 $sql2 = 'select OrganName,Phone from jpd_organ where ID=' . $aps[0]['DealerID']; $dealer = InquiryorderService::excutesql(array('sql' => $sql2, 'db' => 'jpd')); $params['sid'] = Yii::app()->user->getOrganID(); $params['type'] = 5; $result = QuotationService::getschemelists($params); $schinfo = $result['schinfo']; $quoinfo = $result['quoinfo']; $model = new JpdReceiveAddress(); $discount; if ($aps) { $sql_finddiscount = 'select * from pap_order_discount where OrderType=2 '; //询报价折扣率一样 $discount = InquiryorderService::excutesql(array('sql' => $sql_finddiscount, 'db' => 'pap')); if ($discount) { $discount[0]['OrderAlipay'] = $discount[0]['OrderAlipay'] ? $discount[0]['OrderAlipay'] . '%' : ''; $discount[0]['OrderLogis'] = $discount[0]['OrderLogis'] ? $discount[0]['OrderLogis'] . '%' : ''; } } //如果报价单已确认,查询订单ID $goodsdata; $sumtotal = 0; if (!empty($aps) && $aps[0]['OrderID']) { $sql_find_sum = 'select GoodsAmount from pap_order where ID=' . $aps[0]['OrderID']; $sum = Yii::app()->papdb->createCommand($sql_find_sum)->queryRow(); $sumtotal = $sum['GoodsAmount']; $sql_find_goods = 'select * from pap_order_goods where OrderID=' . $aps[0]['OrderID']; $goodsinfo = Yii::app()->papdb->createCommand($sql_find_goods)->queryAll(); $rearray; $partlevel = Yii::app()->getParams()->PartsLevel; $totals = 0; foreach ($goodsinfo as $key => $value) { //插入配件档次 $pat_sql = 'select PartsLevel from pap_goods where ID=' . $value['GoodsID']; $final = Yii::app()->papdb->createCommand($pat_sql)->queryRow(); $value['PL'] = $partlevel[$final['PartsLevel']]; $value['GoodsOE'] = '<div style="width: 120px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="' . $value['GoodsOE'] . '" >' . $value['GoodsOE'] . '</div>'; //self::getmaxlength($value['GoodsOE'], 8, true); $value['rowNo'] = $key + 1; $value['GoodsName'] = '<div href="javascript:void(0);" goodsid="' . $value['GoodsID'] . '" orderid="' . $value['OrderID'] . '" version="' . $value['Version'] . '" class="quottion_goods_href" title="' . $value['GoodsName'] . '" style="width: 100px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;cursor:pointer;">' . $value['GoodsName'] . '</div>'; $value['GoodsNum'] = '<div href="javascript:void(0);" goodsid="' . $value['GoodsID'] . '" orderid="' . $value['OrderID'] . '" version="' . $value['Version'] . '" class="quottion_goods_href" title="' . $value['GoodsNum'] . '" style="width: 80px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;cursor:pointer;">' . $value['GoodsNum'] . '</div>'; $rearray[$key] = $value; } $goodsdata = new CArrayDataProvider($rearray, array('pagination' => array('pageSize' => count($rearray)))); } $this->render('quodetails', array('inquiryinfo' => $inquiryinfo, 'res' => $res, 'imsgs' => $inquiryimgs, 'category' => $datacate ? $datacate : '', 'dealer' => $dealer ? $dealer : array(), 'schinfo' => $schinfo, 'quoinfo' => $quoinfo, 'address' => $address, 'model' => $model, 'discount' => $discount ? $discount[0] : $discount, 'mini' => $miniprice, 'goodsdata' => $goodsdata ? $goodsdata : '', 'sumtotal' => $sumtotal)); }
/** * 依据配件名称搜索配件 */ public function actionSearchPartsByPartname() { if (!isset($_POST['partname']) && empty($_POST['partname'])) { Yii::app()->end(); } if (!isset($_POST['modelId']) || empty($_POST['modelId'])) { Yii::app()->end(); } $partname = $_POST['partname']; $modelId = $_POST['modelId']; //查询配件 $partslist = RPCClient::call('PartsService_queryPartsByPartname', array('partname' => $partname, 'modelId' => $modelId)); try { $url = Yii::app()->controller->getRoute(); //把ID转换成对应的车型主组,子组 $params['partsname'] = D::querypvnamelog($partname, $modelId); //插入mongo日志 $oper = F::getoperation($url, $info == null, $params); } catch (Exception $ex) { } //返回结果 $this->renderPartial('partnameresult', array('parts' => $partslist)); }
/** * * @param type $seriesId * @return type */ public static function queryGoodsYearModels($seriesId) { if (!isset($seriesId)) { return array(); } $result = RPCClient::call('VehicleService_queryGoodsYearModels', $seriesId); return $result; }