How to use search_param method in wpt

Best JavaScript code snippet using wpt

client.js

Source:client.js Github

copy

Full Screen

1// pages/client/client.js2var util = require('../../utils/util.js')3//获取应用实例4var app = getApp()5var vm = null6//中介的navbar样式7var zj_navbar = [{8 value: "zj0",9 name: "我的报备"10}, {11 value: "zj1",12 name: "已报备"13}, {14 value: "zj2",15 name: "已到访"16}, {17 value: "zj3",18 name: "已成交"19}, {20 value: "zj4",21 name: "已签约"22}, {23 value: "zj5",24 name: "全款到账"25}, {26 value: "zj6",27 name: "可结算"28}, {29 value: "zj7",30 name: "已结算"31}];32//案场负责人的navbar样式33var ac_navbar = [{34 value: "ac0",35 name: "待接收"36}, {37 value: "ac1",38 name: "待到访"39}, {40 value: "ac2",41 name: "待成交"42}, {43 value: "ac3",44 name: "待签约"45}, {46 value: "ac4",47 name: "待全款到账"48}, {49 value: "ac5",50 name: "全款已到账"51}, {52 value: "ac6",53 name: "待确认"54}, {55 value: "ac7",56 name: "已确认"57}];58//搜索接口调用参数59var search_param = {60 page: 161}62var reload_flag = true; //重新加载楼盘数组标志63var set_role = "0"; //角色设定 0:中介 1:案场负责人64Page({65 /**66 * 页面的初始数据67 */68 data: {69 currentTab: 0, //当前点击的tab选项70 userInfo: {}, //用户缓存信息71 navbar: [], //顶部导航72 hidden: "", //页面隐藏73 no_view_hidden: "hidden", //未检索到数据的提示页面74 baobeis: [], //报备列表75 houses: [], //全部楼盘列表,用于选项值76 house: "", //选定的楼盘77 start_time: "", //开始日期78 end_time: "" //结束日期79 },80 /**81 * 生命周期函数--监听页面加载82 */83 onLoad: function(options) {84 vm = this;85 //加载全部楼盘86 vm.getHouseList(); //搜索楼盘87 vm.reloadPage(); //刷新页面88 },89 //设置头部导航条90 setNavTab: function(e) {91 //中介92 if (set_role == "0") {93 vm.setData({94 navbar: zj_navbar95 });96 }97 //置业顾问98 if (set_role == "1") {99 vm.setData({100 navbar: ac_navbar101 });102 }103 },104 //进行后台数据获取105 getDatasFromSrv: function(e) {106 console.log("set_role:" + set_role);107 //中介108 if (set_role == "0") {109 vm.getListForZJByStatus();110 }111 //置业顾问112 if (set_role == "1") {113 vm.getListForACByStatus();114 }115 },116 //获取中介维度的报备列表117 getListForZJByStatus: function(e) {118 util.getListForZJByStatus(search_param, function(res) {119 console.log("getListForZJByStatus res:" + JSON.stringify(res))120 var baobeis_arr = [];121 if (!reload_flag) { //如果不是重新加载,设置houses_arr为现有的vm.data.houses122 baobeis_arr = vm.data.baobeis;123 }124 reload_flag = false;125 var msgObj = res.data.ret.data;126 console.log("msgObj.length length:" + msgObj.length);127 for (var i = 0; i < msgObj.length; i++) {128 msgObj[i] = util.setBaobeiInfo(msgObj[i]);129 baobeis_arr.push(msgObj[i]);130 }131 console.log("after set msgObj:" + JSON.stringify(msgObj));132 vm.setData({133 baobeis: baobeis_arr134 });135 //是否展示未找到楼盘的提示136 if (vm.data.baobeis.length == 0) {137 vm.setData({138 no_view_hidden: ""139 })140 } else {141 vm.setData({142 no_view_hidden: "hidden"143 })144 }145 search_param.page = search_param.page + 1; //页面增加146 wx.stopPullDownRefresh();147 }, function(res) {})148 },149 //获取案场负责人维度的报备列表150 getListForACByStatus: function(e) {151 util.getListForACByStatus(search_param, function(res) {152 console.log("getListForZJByStatus res:" + JSON.stringify(res))153 var baobeis_arr = [];154 if (!reload_flag) { //如果不是重新加载,设置houses_arr为现有的vm.data.houses155 baobeis_arr = vm.data.baobeis;156 }157 reload_flag = false;158 var msgObj = res.data.ret.data;159 console.log("msgObj.length length:" + msgObj.length);160 for (var i = 0; i < msgObj.length; i++) {161 msgObj[i] = util.setBaobeiInfo(msgObj[i]);162 baobeis_arr.push(msgObj[i]);163 }164 console.log("after set msgObj:" + JSON.stringify(msgObj));165 vm.setData({166 baobeis: baobeis_arr167 });168 //是否展示未找到楼盘的提示169 if (vm.data.baobeis.length == 0) {170 vm.setData({171 no_view_hidden: ""172 })173 } else {174 vm.setData({175 no_view_hidden: "hidden"176 })177 }178 search_param.page = search_param.page + 1; //页面增加179 wx.stopPullDownRefresh();180 }, function(res) {})181 },182 //获取楼盘列表183 getHouseList: function() {184 util.house_getListByCon({185 "level": "0",186 "page_size": 100187 }, function(res) {188 console.log("getHouseList res:" + JSON.stringify(res))189 var msgObj = res.data.ret.data190 console.log("msgObj.length length:" + msgObj.length);191 vm.setData({192 houses: msgObj193 });194 })195 },196 //选择楼盘197 setHouseOption: function(e) {198 console.log("setHouseOption e:" + JSON.stringify(e))199 var id = e.detail.value;200 var houses = vm.data.houses201 vm.setData({202 house: houses[id]203 })204 //进行报备信息检索205 search_param.house_id = vm.data.house.id;206 reload_flag = true;207 search_param.page = 1;208 console.log("setHouseOption search_param:" + JSON.stringify(search_param));209 vm.getDatasFromSrv();210 },211 //选择开始时间212 setStartTime: function(e) {213 console.log("setStartTime e:" + JSON.stringify(e))214 vm.setData({215 start_time: e.detail.value216 })217 search_param.start_time = vm.data.start_time;218 reload_flag = true;219 search_param.page = 1;220 vm.getDatasFromSrv();221 },222 //选择结束时间223 setEndTime: function(e) {224 console.log("setEndTime e:" + JSON.stringify(e))225 vm.setData({226 end_time: e.detail.value227 })228 search_param.end_time = vm.data.end_time;229 reload_flag = true;230 search_param.page = 1;231 vm.getDatasFromSrv();232 },233 /**234 * 生命周期函数--监听页面初次渲染完成235 */236 onReady: function() {237 },238 /**239 * 生命周期函数--监听页面显示240 */241 onShow: function() {242 },243 // 点击标题切换当前页时改变样式244 switchNav: function(e) {245 console.log('switchNav e:' + JSON.stringify(e));246 search_param.page = 1;247 var cur = e.currentTarget.dataset.current;248 if (vm.data.current_tab == cur) {249 return false;250 } else {251 this.setData({252 currentTab: cur253 })254 //中介255 if (set_role == "0") {256 switch (cur) {257 case 0: //我的报备258 delete search_param.baobei_status;259 delete search_param.can_jiesuan_status;260 delete search_param.pay_zhongjie_status;261 break;262 case 1: //已报备263 search_param.baobei_status = "0";264 delete search_param.can_jiesuan_status;265 delete search_param.pay_zhongjie_status;266 break;267 case 2: //已到访268 search_param.baobei_status = "1";269 delete search_param.can_jiesuan_status;270 delete search_param.pay_zhongjie_status;271 break;272 case 3: //已成交273 search_param.baobei_status = "2";274 delete search_param.can_jiesuan_status;275 delete search_param.pay_zhongjie_status;276 break;277 case 4: //已签约278 search_param.baobei_status = "3";279 delete search_param.can_jiesuan_status;280 delete search_param.pay_zhongjie_status;281 break;282 case 5: //全款到账283 search_param.baobei_status = "4";284 delete search_param.can_jiesuan_status;285 delete search_param.pay_zhongjie_status;286 break;287 case 6: //可结算288 search_param.can_jiesuan_status = "1";289 delete search_param.baobei_status;290 delete search_param.pay_zhongjie_status;291 break;292 case 7: //已结算293 search_param.pay_zhongjie_status = "1";294 delete search_param.baobei_status;295 delete search_param.can_jiesuan_status;296 break;297 }298 }299 //案场负责人300 if (set_role == "1") {301 switch (cur) {302 case 0: //待接收303 delete search_param.baobei_status;304 delete search_param.can_jiesuan_status;305 delete search_param.pay_zhongjie_status;306 break;307 case 1: //待到访308 search_param.baobei_status = "0";309 delete search_param.can_jiesuan_status;310 delete search_param.pay_zhongjie_status;311 break;312 case 2: //待成交313 search_param.baobei_status = "1";314 delete search_param.can_jiesuan_status;315 delete search_param.pay_zhongjie_status;316 break;317 case 3: //待签约318 search_param.baobei_status = "2";319 delete search_param.can_jiesuan_status;320 delete search_param.pay_zhongjie_status;321 break;322 case 4: //待全款到账323 search_param.baobei_status = "3";324 delete search_param.can_jiesuan_status;325 delete search_param.pay_zhongjie_status;326 break;327 case 5: //全款已到账328 search_param.baobei_status = "4";329 delete search_param.can_jiesuan_status;330 delete search_param.pay_zhongjie_status;331 break;332 case 6: //待确认333 search_param.can_jiesuan_status = "0";334 delete search_param.baobei_status;335 delete search_param.pay_zhongjie_status;336 break;337 case 7: //已确认338 search_param.can_jiesuan_status = "1";339 delete search_param.baobei_status;340 delete search_param.can_jiesuan_status;341 break;342 }343 }344 reload_flag = true;345 search_param.page = 1;346 vm.getDatasFromSrv();347 }348 },349 //点击进行报备操作350 clickBaobeiOpt: function(e) {351 console.log("clickBaobeiOpt e:" + JSON.stringify(e));352 var id = e.currentTarget.dataset.id;353 var baobei_status = e.currentTarget.dataset.baobeistatus;354 //中介只允许操作到访前的状态355 if (set_role == "0" && baobei_status != "0") {356 util.showModal("提示信息", "中介只允许操作已报备状态的记录", function(ret) {}, function(ret) {});357 return;358 }359 var param = {360 id: id,361 set_role: set_role362 }363 wx.navigateTo({364 url: '/pages/client/baobeiOpt/baobeiOpt?jsonStr=' + JSON.stringify(param),365 })366 },367 /**368 * 生命周期函数--监听页面隐藏369 */370 onHide: function() {371 },372 /**373 * 生命周期函数--监听页面卸载374 */375 onUnload: function() {376 },377 /**378 * 页面相关事件处理函数--监听用户下拉动作379 */380 onPullDownRefresh: function() {381 // set_role = null;382 vm.reloadPage();383 },384 //重新加载数据和页面-用于页面onLoad和下拉刷新的场景385 reloadPage: function(e) {386 vm.setData({387 house: "", //选定的楼盘388 start_time: "", //开始日期389 end_time: "", //结束日期390 currentTab: 0, //设置当前的tab为第一个391 userInfo: util.getLocalUserInfo() //设置用户缓存392 })393 394 //兼容案场负责人切换身份,set_role初始化为null,这样首次加载等场景即初始化set_role395 if (util.judgeIsAnyNullStr(set_role)) {396 set_role = vm.data.userInfo.role; //设定用户角色397 }398 vm.setNavTab(); //设置导航tab399 search_param = {400 page: 1401 }402 reload_flag = true;403 vm.getDatasFromSrv();404 },405 //案场负责人切换角色406 clickSwitchRole: function(e) {407 console.log("clickSwitchRole e:" + JSON.stringify(e));408 //如果set_role为1,则切换为0409 if (set_role == "0") {410 util.showModal("切换身份", "切换为案场负责人", function(ret) {411 set_role = "1";412 vm.reloadPage();413 }, null)414 } else {415 util.showModal("切换身份", "切换为中介", function(ret) {416 set_role = "0";417 vm.reloadPage();418 }, null)419 }420 },421 //清空参数422 clearParam: function() {423 reload_flag = true;424 search_param = {425 page: 1,426 }427 vm.setData({428 search_word: "",429 house: "", //选定的楼盘430 start_time: "", //开始日期431 end_time: "" //结束日期432 })433 },434 /**435 * 页面上拉触底事件的处理函数436 */437 onReachBottom: function() {438 console.log("onReachBottom search_param:" + JSON.stringify(search_param));439 vm.getDatasFromSrv(); //加载更多的报备信息440 },441 /**442 * 用户点击右上角分享443 */444 onShareAppMessage: function() {445 }...

Full Screen

Full Screen

selHouse.js

Source:selHouse.js Github

copy

Full Screen

1// pages/baobei/selHouse/selHouse.js2var util = require('../../../utils/util.js')3var app = getApp()4var vm = null5//搜索接口调用参数6var search_param = {7 page: 1,8 level: '1'9}10var reload_flag = true; //重新加载楼盘数组标志11Page({12 /**13 * 页面的初始数据14 */15 data: {16 systemInfo: {}, //系统信息17 houses: [], //楼盘列表信息18 area_text: "全部区域",19 type_text: "全部类型",20 label_text: "全部标签",21 no_view_hidden: "hidden",22 search_word: "",23 },24 /**25 * 生命周期函数--监听页面加载26 */27 onLoad: function(options) {28 vm = this;29 search_param = {30 page: 1,31 level: '1'32 }33 },34 /**35 * 生命周期函数--监听页面初次渲染完成36 */37 onReady: function() {38 },39 /**40 * 生命周期函数--监听页面显示41 */42 onShow: function() {43 vm = this44 //初始化sysInfo45 app.getSystemInfo(function(res) {46 console.log("getSystemInfo:" + JSON.stringify(res));47 vm.setData({48 systemInfo: res49 })50 })51 util.showLoading('加载中...');52 vm.getHouseList(); //搜索楼盘53 vm.getSearchOptions(); //获取搜索楼盘选项54 },55 //获取楼盘列表56 getHouseList: function() {57 util.house_getListByCon(search_param, function(res) {58 console.log("getHouseList res:" + JSON.stringify(res))59 var houses_arr = [];60 if (!reload_flag) { //如果不是重新加载,设置houses_arr为现有的vm.data.houses61 houses_arr = vm.data.houses;62 }63 reload_flag = false;64 var msgObj = res.data.ret.data;65 console.log("msgObj.length length:" + msgObj.length);66 for (var i = 0; i < msgObj.length; i++) {67 houses_arr.push(msgObj[i]);68 }69 vm.setData({70 houses: houses_arr71 });72 search_param.page = search_param.page + 1; //页面增加73 wx.stopPullDownRefresh();74 //是否展示未找到楼盘的提示75 if (vm.data.houses.length == 0) {76 vm.setData({77 no_view_hidden: ""78 })79 } else {80 vm.setData({81 no_view_hidden: "hidden"82 })83 }84 search_param.page = search_param.page + 1; //页面增加85 wx.stopPullDownRefresh();86 })87 },88 //获取楼盘搜索选项89 getSearchOptions: function() {90 util.getHouseOptions({}, function(ret) {91 // console.log("getSearchOptions" + JSON.stringify(ret))92 var area_option = ret.data.ret.area93 var type_option = ret.data.ret.type94 var label_option = ret.data.ret.label95 area_option.unshift({96 name: "全部区域"97 })98 type_option.unshift({99 name: "全部类型"100 })101 label_option.unshift({102 name: "全部标签"103 })104 vm.setData({105 area_option: area_option,106 type_option: type_option,107 label_option: label_option,108 })109 })110 },111 //根据区域搜索112 setAreaOption: function(e) {113 reload_flag = true;114 search_param.page = 1;115 console.log('picker发送选择改变,携带值为', e.detail.value)116 var id = e.detail.value;117 var area_option = vm.data.area_option118 if (id == 0) {119 delete search_param.area_id;120 } else {121 search_param.area_id = area_option[id].id;122 }123 vm.setData({124 area_text: area_option[id].name125 })126 console.log("search_param:" + JSON.stringify(search_param));127 util.showLoading('加载中...');128 vm.getHouseList();129 },130 //根据类型搜索131 setTypeOption: function(e) {132 reload_flag = true;133 search_param.page = 1;134 console.log('setTypeOption e:', e.detail.value)135 var id = e.detail.value;136 var type_option = vm.data.type_option137 if (id == 0) {138 delete search_param.type_id;139 } else {140 search_param.type_id = type_option[id].id;141 }142 vm.setData({143 type_text: type_option[id].name144 })145 console.log("search_param:" + JSON.stringify(search_param));146 util.showLoading('加载中...');147 vm.getHouseList();148 },149 //根据价格进行搜索150 setPriceOption: function(e) {151 reload_flag = true;152 search_param.page = 1;153 console.log('setPriceOption e:', e.detail.value)154 var id = e.detail.value;155 var price_option = vm.data.price_option156 if (id == 0) {157 delete search_param.price_min;158 delete search_param.price_max;159 } else {160 search_param.price_min = price_option[id].price_min;161 search_param.price_max = price_option[id].price_max;162 }163 console.log("search_param:" + JSON.stringify(search_param));164 util.showLoading('加载中...');165 vm.getHouseList();166 },167 //根据标签搜索168 setLabelOption: function(e) {169 reload_flag = true;170 search_param.page = 1;171 console.log('setLabelOption e:', e.detail.value)172 var id = e.detail.value;173 var label_option = vm.data.label_option174 if (id == 0) {175 delete search_param.label_id;176 } else {177 search_param.label_id = label_option[id].id;178 }179 vm.setData({180 label_text: label_option[id].name181 })182 console.log("search_param:" + JSON.stringify(search_param));183 util.showLoading('加载中...');184 vm.getHouseList();185 },186 // 根据楼盘id获取房源信息187 clickHouse: function(e) {188 console.log("clickHouse e:" + JSON.stringify(e))189 util.isNeedNavigateToSetMyInfoPage()190 var house_id = JSON.stringify(e.currentTarget.dataset.house_id)191 wx.navigateTo({192 url: '/pages/baobei/baobei?house_id=' + house_id193 })194 },195 //输入楼盘名称196 inputSearchWord: function(e) {197 console.log("inputRealName e:" + JSON.stringify(e));198 this.setData({199 search_word: e.detail.value200 })201 },202 //点击搜索,跳转到搜索页面203 clickSearch: function() {204 search_param.search_word = vm.data.search_word;205 search_param.page = 1;206 reload_flag = true;207 vm.getHouseList();208 },209 //选中楼盘210 selHouse: function(e) {211 console.log("selHouse e:" + JSON.stringify(e))212 var house = {213 title: e.currentTarget.dataset.housename,214 id: e.currentTarget.dataset.houseid,215 }216 var pages = getCurrentPages()217 var prePage = pages[pages.length - 2]218 prePage.setData({219 house: house220 })221 util.navigateBack(1);222 },223 //清空参数224 clearParam: function() {225 reload_flag = true;226 search_param = {227 page: 1,228 level: "1 "229 }230 vm.setData({231 search_word: "",232 area_text: "全部区域",233 type_text: "全部类型",234 label_text: "全部标签",235 })236 },237 /**238 * 生命周期函数--监听页面隐藏239 */240 onHide: function() {241 },242 /**243 * 生命周期函数--监听页面卸载244 */245 onUnload: function() {246 },247 /**248 * 页面相关事件处理函数--监听用户下拉动作249 */250 onPullDownRefresh: function() {251 vm.clearParam();252 vm.getHouseList(); //搜索楼盘253 },254 /**255 * 页面上拉触底事件的处理函数256 */257 onReachBottom: function() {258 console.log("onReachBottom page:" + search_param.page);259 vm.getHouseList(); //搜索楼盘260 },261 /**262 * 用户点击右上角分享263 */264 onShareAppMessage: function() {265 }...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1const express = require("express");2const app = express();3app.use(express.json());4const url = require("url");5const sls = require("serverless-http");6//Fetching model7const companyDetails = require("./model/companyDetails");8const orderDetails = require("./model/orderDetails");9//Database connection information10const db = require("./database");11//Making connection with the database12db.authenticate()13 .then(() => console.log("Connected To Database..."))14 .catch((err) => console.log("Error", err));15//Fetching details of all companies (R)16app.get("/listcompanies", async (req, res) => {17 await companyDetails18 .findAll()19 .then((result) => {20 res.status(200).json(result);21 })22 .catch((err) => {23 res.status(400).json(err);24 });25});26//Fetching details of a company (R)27app.get("/getcompany", async (req, res) => {28 const custom_url = new URL(29 req.protocol + "://" + req.get("host") + req.originalUrl30 );31 const search_param = custom_url.searchParams;32 if (JSON.stringify(req.query) === "{}") {33 res.status(404).json({34 message: "Please enter proper parameter",35 });36 } else if (37 search_param.has("cid") === false ||38 search_param.has("type") === false39 ) {40 res.status(404).json({41 message: "Please enter proper parameter",42 });43 } else if (req.query.cid === "" || req.query.type === "") {44 res.status(404).json({45 message: "Please enter proper parameter",46 });47 } else {48 await companyDetails49 .findOne({ where: { C_ID: req.query.cid, Type: req.query.type } })50 .then((result) => {51 res.status(200).json(result);52 })53 .catch((err) => {54 res.status(400).json(err);55 });56 }57});58//Fetching details of all oreders (R)59app.get("/listorders", async (req, res) => {60 await orderDetails61 .findAll()62 .then((result) => {63 res.status(200).json(result);64 })65 .catch((err) => {66 res.status(400).json(err);67 });68});69//Adding a new company (C)70app.post("/addcompany", async (req, res) => {71 const custom_url = new URL(72 req.protocol + "://" + req.get("host") + req.originalUrl73 );74 const search_param = custom_url.searchParams;75 if (JSON.stringify(req.query) === "{}") {76 res.status(404).json({77 message: "Please enter proper parameter",78 });79 } else if (80 search_param.has("cid") === false ||81 search_param.has("cname") === false ||82 search_param.has("type") === false ||83 search_param.has("price") === false ||84 search_param.has("driver") === false85 ) {86 res.status(404).json({87 message: "Please enter proper parameter",88 });89 } else if (90 req.query.cid === "" ||91 req.query.cname === "" ||92 req.query.type === "" ||93 req.query.price === "" ||94 req.query.driver === ""95 ) {96 res.status(404).json({97 message: "Please enter proper parameter",98 });99 } else {100 await companyDetails101 .create({102 C_ID: req.query.cid,103 C_Name: req.query.cname,104 Type: req.query.type,105 Price: req.query.price,106 Driver: req.query.driver,107 })108 .then((result) => {109 res.status(200).json({110 message: "New Company Added Successfully",111 });112 })113 .catch((err) => {114 res.status(400).json(err);115 });116 }117});118//Adding a new order (C)119app.post("/addorder", async (req, res) => {120 const custom_url = new URL(121 req.protocol + "://" + req.get("host") + req.originalUrl122 );123 const search_param = custom_url.searchParams;124 if (JSON.stringify(req.query) === "{}") {125 res.status(404).json({126 message: "Please enter proper parameter",127 });128 } else if (129 search_param.has("oid") === false ||130 search_param.has("username") === false ||131 search_param.has("email") === false ||132 search_param.has("address") === false ||133 search_param.has("cid") === false ||134 search_param.has("type") === false135 ) {136 res.status(404).json({137 message: "Please enter proper parameter",138 });139 } else if (140 req.query.oid === "" ||141 req.query.username === "" ||142 req.query.email === "" ||143 req.query.address === "" ||144 req.query.cid === "" ||145 req.query.type === ""146 ) {147 res.status(404).json({148 message: "Please enter proper parameter",149 });150 } else {151 await orderDetails152 .create({153 O_ID: req.query.oid,154 Username: req.query.username,155 Email: req.query.email,156 Address: req.query.address,157 C_ID: req.query.cid,158 Type: req.query.type,159 })160 .then((result) => {161 res.status(200).json({162 message: "New Order Added Successfully",163 });164 })165 .catch((err) => {166 res.status(400).json(err);167 });168 }169});170//Edit driver and rate of service (U)171app.post("/editcompany", async (req, res) => {172 const custom_url = new URL(173 req.protocol + "://" + req.get("host") + req.originalUrl174 );175 const search_param = custom_url.searchParams;176 if (JSON.stringify(req.query) === "{}") {177 res.status(404).json({178 message: "Please enter proper parameter",179 });180 } else if (181 search_param.has("cid") === false ||182 search_param.has("type") === false ||183 search_param.has("price") === false ||184 search_param.has("driver") === false185 ) {186 res.status(404).json({187 message: "Please enter proper parameter",188 });189 } else if (190 req.query.cid === "" ||191 req.query.type === "" ||192 req.query.price === "" ||193 req.query.driver === ""194 ) {195 res.status(404).json({196 message: "Please enter proper parameter",197 });198 } else {199 await companyDetails200 .update(201 {202 Price: req.query.price,203 Driver: req.query.driver,204 },205 {206 where: { C_ID: req.query.cid, Type: req.query.type },207 }208 )209 .then((result) => {210 if (result[0] === 1) {211 res.status(200).json({212 message: "Company Edited Successfully",213 });214 } else {215 res.status(400).json({216 message: "No such value exist",217 });218 }219 })220 .catch((err) => {221 res.status(400).json(err);222 });223 }224});225//Edit driver (U)226app.post("/editdriver", async (req, res) => {227 const custom_url = new URL(228 req.protocol + "://" + req.get("host") + req.originalUrl229 );230 const search_param = custom_url.searchParams;231 if (JSON.stringify(req.query) === "{}") {232 res.status(404).json({233 message: "Please enter proper parameter",234 });235 } else if (236 search_param.has("cid") === false ||237 search_param.has("type") === false ||238 search_param.has("driver") === false239 ) {240 res.status(404).json({241 message: "Please enter proper parameter",242 });243 } else if (244 req.query.cid === "" ||245 req.query.type === "" ||246 req.query.driver === ""247 ) {248 res.status(404).json({249 message: "Please enter proper parameter",250 });251 } else {252 await companyDetails253 .update(254 {255 Driver: req.query.driver,256 },257 {258 where: { C_ID: req.query.cid, Type: req.query.type },259 }260 )261 .then((result) => {262 if (result[0] === 1) {263 res.status(200).json({264 message: "Driver Edited Successfully",265 });266 } else {267 res.status(400).json({268 message: "No such value exist",269 });270 }271 })272 .catch((err) => {273 res.status(400).json(err);274 });275 }276});277//app.listen(3000, () => console.log(`Listening to port 3000...`));...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var options = {host: 'www.webpagetest.org'};3var wpt = new WebPageTest('www.webpagetest.org');4wpt.getLocations(function(err, data) {5 if (err) {6 console.log(err);7 } else {8 console.log(data);9 }10});11wpt.getTesters(function(err, data) {12 if (err) {13 console.log(err);14 } else {15 console.log(data);16 }17});18wpt.getTestStatus('170516_1A_1a5b6c5a6a1a8a8e2b2c3b3a2a3a3a3', function(err, data) {19 if (err) {20 console.log(err);21 } else {22 console.log(data);23 }24});25wpt.getTestResults('170516_1A_1a5b6c5a6a1a8a8e2b2c3b3a2a3a3a3', function(err, data) {26 if (err) {27 console.log(err);28 } else {29 console.log(data);30 }31});32wpt.getTestResults('170516_1A_1a5b6c5a6a1a8a8e2b2c3b3a2a3a3a3', { requests: true }, function(err, data) {33 if (err) {34 console.log(err);35 } else {36 console.log(data);37 }38});39wpt.getTestResults('170516_1A_1a5b6c5a6a1a8a8e2b2c3b3a2a3a3a3', { requests: true, breakDown: true, pageSpeed: true }, function(err, data) {40 if (err) {41 console.log(err);42 } else {43 console.log(data);44 }45});46wpt.getTestResults('170516_1A_1a5b6c5a6a1a8a8e2b2c3b3a2a3a3a3', { requests: true, breakDown: true, pageSpeed: true, video: true }, function(err, data) {47 if (err) {48 console.log(err);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var wp = wptools.page('Albert Einstein');3wp.get(function(err, resp) {4 console.log(resp);5});6var wptools = require('wptools');7var wp = wptools.page('Albert Einstein');8wp.get(function(err, resp) {9 console.log(resp);10});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var webpagetest = new wpt('API_KEY');3webpagetest.search_tests('test', function(err, data) {4 console.log(data);5});6var wpt = require('webpagetest');7var webpagetest = new wpt('API_KEY');8webpagetest.search_tests('test', function(err, data) {9 console.log(data);10});11var wpt = require('webpagetest');12var webpagetest = new wpt('API_KEY');13webpagetest.search_tests('test', function(err, data) {14 console.log(data);15});16var wpt = require('webpagetest');17var webpagetest = new wpt('API_KEY');18webpagetest.search_tests('test', function(err, data) {19 console.log(data);20});21var wpt = require('webpagetest');22var webpagetest = new wpt('API_KEY');23webpagetest.search_tests('test', function(err, data) {24 console.log(data);25});26var wpt = require('webpagetest');27var webpagetest = new wpt('API_KEY');28webpagetest.search_tests('test', function(err, data) {29 console.log(data);30});31var wpt = require('webpagetest');32var webpagetest = new wpt('API_KEY');33webpagetest.search_tests('test', function(err, data) {34 console.log(data);35});36var wpt = require('webpagetest');37var webpagetest = new wpt('API_KEY');38webpagetest.search_tests('test', function(err, data) {39 console.log(data);40});41var wpt = require('webpagetest');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var search = new wptools.search('Barack Obama');3search.get(function(err, response) {4 console.log(response);5});6var wptools = require('wptools');7var search = new wptools.search('Barack Obama');8search.get(function(err, response) {9 console.log(response);10});11var wptools = require('wptools');12var search = new wptools.search('Barack Obama');13search.get(function(err, response) {14 console.log(response);15});16var wptools = require('wptools');17var search = new wptools.search('Barack Obama');18search.get(function(err, response) {19 console.log(response);20});21var wptools = require('wptools');22var search = new wptools.search('Barack Obama');23search.get(function(err, response) {24 console.log(response);25});26var wptools = require('wptools');27var search = new wptools.search('Barack Obama');28search.get(function(err, response) {29 console.log(response);30});

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful