def vendoredit(): name = request.json.get("name") company = request.json.get("company") address = request.json.get("address") phone = request.json.get("phone") fax = request.json.get("fax") star = request.json.get("star") pic = request.json.get("pic") basicinfo = entities.Basicinfo(company, address, phone, fax, star, pic) result = vendor_edit(name, basicinfo) response = entities.ResponseClass(True, "", "null") response.msg = result[1] response.isSuccess = result[0] resp_dict = utility.class_2_dict(response) result = json.dumps(resp_dict, sort_keys=True, indent=4, separators=(',', ':'), ensure_ascii=False).encode('utf8') return result
def uploadpdf(): name = request.form.get("name") productId = request.form.get("productId") file = request.files["file"] filename = "" if request.method == 'POST': if file and allowed_file(file.filename): filename = name filename += "_" filename += productId filename += ".pdf" file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) pdf_path = "wink.net.cn:8000/pdf/" + filename result = enter_pdf(name, productId, pdf_path) response = entities.ResponseClass(True, "", "null") response.msg = result[1] response.isSuccess = result[0] response.data = result[2] resp_dict = utility.class_2_dict(response) result = json.dumps(resp_dict, sort_keys=True, indent=4, separators=(',', ':'), ensure_ascii=False).encode('utf8') return result
def homestore(): query = home_store() response = entities.ResponseClass(True, "", "null") response.isSuccess = query[0] response.msg = query[1] response.data = query[2] resp_dict = utility.class_2_dict(response) result = json.dumps(resp_dict, sort_keys=True, indent=4, separators=(',', ':'), ensure_ascii=False).encode('utf8') return result
def vendortotalinfo(): name_get = request.args.get('name') result = vendor_total_info(name_get) response = entities.ResponseClass(True, "", "null") response.isSuccess = result[0] response.msg = result[1] response.data = result[2] resp_dict = utility.class_2_dict(response) result = json.dumps(resp_dict, sort_keys=True, indent=4, separators=(',', ':'), ensure_ascii=False).encode('utf8') return result
def per_commodity(): id_get = request.args.get('id') result = commodity_detail(id_get) response = entities.ResponseClass(True, "", "null") response.isSuccess = result[0] response.msg = result[1] response.data = result[2] resp_dict = utility.class_2_dict(response) result = json.dumps(resp_dict, sort_keys=True, indent=4, separators=(',', ':'), ensure_ascii=False).encode('utf8') return result
def getspecpdf(): company_name_get = request.args.get('companyName') productId_get = request.args.get('productId') result = get_spec(company_name_get, productId_get) response = entities.ResponseClass(True, "", "null") response.isSuccess = result[0] response.msg = result[1] response.data = result[2] resp_dict = utility.class_2_dict(response) result = json.dumps(resp_dict, sort_keys=True, indent=4, separators=(',', ':'), ensure_ascii=False).encode('utf8') return result
def deleteproduct(): name = request.json.get("name") productId = request.json.get("productId") result = delete_product(name, productId) response = entities.ResponseClass(True, "", "null") response.msg = result[1] response.isSuccess = result[0] response.data = result[2] resp_dict = utility.class_2_dict(response) result = json.dumps(resp_dict, sort_keys=True, indent=4, separators=(',', ':'), ensure_ascii=False).encode('utf8') return result
def perprovide(): name_get = request.args.get('name') productId_get = request.args.get('productId') company_name = db_link.vendor_name2company_name(name_get) result = per_commoditys(company_name, productId_get) response = entities.ResponseClass(True, "", "null") response.isSuccess = result[0] response.msg = result[1] response.data = result[2] resp_dict = utility.class_2_dict(response) result = json.dumps(resp_dict, sort_keys=True, indent=4, separators=(',', ':'), ensure_ascii=False).encode('utf8') return result
def login(): number = request.json.get("number") password = request.json.get("password") identity = request.json.get("identity") result = login_process(number, password, identity) response = entities.ResponseClass(True, "", "null") response.msg = result[0] response.isSuccess = result[1] response.data = result[2] resp_dict = utility.class_2_dict(response) result = json.dumps(resp_dict, sort_keys=True, indent=4, separators=(',', ':'), ensure_ascii=False).encode('utf8') return result
def enterspec(): name = request.json.get("name") url = request.json.get("url") productId = request.json.get("productId") detail = request.json.get("detail") result = enter_spec(name, productId, detail, url) response = entities.ResponseClass(True, "", "null") response.msg = result[1] response.isSuccess = result[0] resp_dict = utility.class_2_dict(response) result = json.dumps(resp_dict, sort_keys=True, indent=4, separators=(',', ':'), ensure_ascii=False).encode('utf8') return result
def register(): username = request.json.get("username") password = request.json.get("password") number = request.json.get("number") identity = request.json.get("identity") user = entities.User(username, number, password) result = register_process(user, identity) response = entities.ResponseClass(True, "", "null") response.msg = result[0] response.isSuccess = result[1] resp_dict = utility.class_2_dict(response) result = json.dumps(resp_dict, sort_keys=True, indent=4, separators=(',', ':'), ensure_ascii=False).encode('utf8') return result