✨作者主页 :IT毕设梦工厂✨
个人简介:曾从事计算机专业培训教学,擅长Java、Python、微信小程序、Golang、安卓Android等项目实战。接项目定制开发、代码讲解、答辩教学、文档编写、降重等。
文章目录
一、前言
全民健身运动的推广和体育产业的蓬勃发展,带动了体育用品市场的快速增长。根据国家体育总局发布的数据,中国体育产业总规模已超过数万亿元,体育用品消费成为推动体育产业发展的重要力量。然而,传统的体育用品销售模式存在诸多不便,如购物体验单一、商品信息获取不便捷、售后服务不到位等问题。随着电子商务的兴起,体育商城系统作为线上销售平台,以其便捷性、实时性受到消费者的青睐。但现有的体育商城系统在用户体验、商品管理、服务效率等方面仍有较大的提升空间。
现有的体育商城系统普遍存在一些问题,例如用户界面不够直观,导致消费者在查找和选择商品时体验不佳;商品分类和搜索功能不够准确,难以快速定位到消费者所需的产品;订单处理流程繁琐,缺乏自动化管理,影响了订单处理的速度;在线客服系统不够完善,响应时间长,无法及时解决消费者的问题;公告信息更新不够及时,导致消费者错过重要信息或活动。这些问题限制了体育商城系统的发展潜力,影响了消费者的购物体验。
本课题旨在设计并实现一个便捷、用户友好的体育商城系统,通过优化用户界面、增强商品分类和搜索功能、自动化订单处理流程、完善在线客服系统、实时更新公告信息等措施,提升消费者的购物体验和满意度。系统将采用先进的信息技术,如大数据分析、人工智能推荐算法等,以满足消费者个性化的购物需求和提供更加准确的服务。
在体育商城系统中,管理员负责用户信息的创建与管理、商品分类的设置与维护、体育用品的上架与信息更新、订单处理与物流跟踪、在线客服的响应与服务质量监管、以及商城公告的编辑与发布,确保商城运营的顺畅;学生用户则能够浏览丰富的体育用品、使用购物车功能进行商品选择、管理自己的订单状态、通过在线客服解决购物中的问题、及时获取商城的公告和促销信息,享受便捷的一站式购物体验。系统通过这些功能模块的整合,旨在为学生提供一个直观、互动性强的在线体育用品购物平台。
本课题的研究具有重要的理论意义和实际意义。从理论角度来看,它为电子商务领域提供了新的研究视角,即如何利用信息技术提升体育用品在线销售的效率和体验。从实际角度来看,体育商城系统的应用将有助于满足消费者对高品质体育用品的需求,推动体育产业的发展。同时,系统的推广应用还将为消费者提供更加便捷、个性化的购物渠道,提升消费者的生活质量,促进消费升级。此外,系统的成功实施也将为其他电子商务平台提供借鉴,推动整个电子商务行业的创新和发展。
二、开发环境
- 开发语言:Java/Python
- 数据库:MySQL
- 系统架构:B/S
- 后端:SpringBoot/SSM/Django/Flask
- 前端:Vue
三、系统界面展示
- 体育商城系统界面展示:
用户-查看体育用品:
用户-购物车管理:
用户-我的订单管理:
管理员-体育用品管理:
管理员-订单管理:
管理员-销售统计:
四、部分代码设计
- Java项目实战-代码参考:
java(贴上部分代码)
@Controller
public class ProductController extends BaseController{
@Resource(name = "categoryService")
private CategoryService categoryService;
@Resource(name = "productService")
private ProductService productService;
@Resource(name = "productImageService")
private ProductImageService productImageService;
@Resource(name = "propertyService")
private PropertyService propertyService;
@Resource(name = "propertyValueService")
private PropertyValueService propertyValueService;
@Resource(name = "lastIDService")
private LastIDService lastIDService;
//转到后台管理-产品页-ajax
@RequestMapping(value = "admin/product",method = RequestMethod.GET)
public String goToPage(HttpSession session, Map<String, Object> map) {
logger.info("获取产品分类列表");
List<Category> categoryList = categoryService.getList(null, null);
map.put("categoryList", categoryList);
logger.info("获取前10条产品列表");
PageUtil pageUtil = new PageUtil(0, 10);
List<Product> productList = productService.getList(null, null, null, pageUtil);
map.put("productList", productList);
logger.info("获取产品总数量");
Integer productCount = productService.getTotal(null, null);
map.put("productCount", productCount);
logger.info("获取分页信息");
pageUtil.setTotal(productCount);
map.put("pageUtil", pageUtil);
logger.info("转到后台管理-产品页-ajax方式");
return "admin/productManagePage";
}
//转到后台管理-产品详情页-ajax
@RequestMapping(value="admin/product/{pid}",method = RequestMethod.GET)
public String goToDetailsPage(HttpSession session, Map<String, Object> map, @PathVariable Integer pid/* 产品ID */) {
logger.info("获取product_id为{}的产品信息",pid);
Product product = productService.get(pid);
Integer product_id =product.getProduct_id();
logger.info("获取产品预览图片信息");
List<ProductImage> singleProductImageList = productImageService.getList(product_id, (byte) 0, null);
product.setSingleProductImageList(singleProductImageList);
logger.info("获取产品详情图片信息");
List<ProductImage> detailsProductImageList = productImageService.getList(product_id, (byte) 1, null);
product.setDetailProductImageList(detailsProductImageList);
map.put("product",product);
logger.info("获取产品详情-属性值信息");
List<PropertyValue> propertyValueList = propertyValueService.getList(
new PropertyValue().setPropertyValue_product(product),null
);
logger.info("获取产品详情-分类信息对应的属性列表");
List<Property> propertyList = propertyService.getList(
new Property().setProperty_category(product.getProduct_category()),null
);
logger.info("属性列表和属性值列表信息合并");
for(Property property : propertyList){
for(PropertyValue propertyValue : propertyValueList){
if(property.getProperty_id().equals(propertyValue.getPropertyValue_property().getProperty_id())){
List<PropertyValue> property_value_item = new ArrayList<>(1);
property_value_item.add(propertyValue);
property.setPropertyValueList(property_value_item);
break;
}
}
}
map.put("propertyList",propertyList);
logger.info("获取分类列表");
List<Category> categoryList = categoryService.getList(null,null);
map.put("categoryList",categoryList);
logger.info("转到后台管理-产品详情页-ajax方式");
return "admin/include/productDetails";
}
//转到后台管理-产品添加页-ajax
@RequestMapping(value = "admin/product/new",method = RequestMethod.GET)
public String goToAddPage(HttpSession session,Map<String, Object> map){
logger.info("获取分类列表");
List<Category> categoryList = categoryService.getList(null,null);
map.put("categoryList",categoryList);
logger.info("获取第一个分类信息对应的属性列表");
List<Property> propertyList = propertyService.getList(
new Property().setProperty_category(categoryList.get(0)),null
);
map.put("propertyList",propertyList);
logger.info("转到后台管理-产品添加页-ajax方式");
return "admin/include/productDetails";
}
//添加产品信息-ajax.
@ResponseBody
@RequestMapping(value = "admin/product", method = RequestMethod.POST,produces = "application/json;charset=utf-8")
public String addProduct(@RequestParam String product_name/* 产品名称 */,
@RequestParam String product_title/* 产品标题 */,
@RequestParam Integer product_category_id/* 产品类型ID */,
@RequestParam Double product_sale_price/* 产品促销价 */,
@RequestParam Double product_price/* 产品原价 */,
@RequestParam Byte product_isEnabled/* 产品状态 */,
@RequestParam String propertyJson/* 产品属性JSON */,
@RequestParam(required = false) String[] productSingleImageList/*产品预览图片名称数组*/,
@RequestParam(required = false) String[] productDetailsImageList/*产品详情图片名称数组*/) {
JSONObject jsonObject = new JSONObject();
logger.info("整合产品信息");
Product product = new Product()
.setProduct_name(product_name)
.setProduct_title(product_title)
.setProduct_category(new Category().setCategory_id(product_category_id))
.setProduct_sale_price(product_sale_price)
.setProduct_price(product_price)
.setProduct_isEnabled(product_isEnabled)
.setProduct_create_date(new Date());
logger.info("添加产品信息");
boolean yn = productService.add(product);
if (!yn) {
logger.warn("产品添加失败!事务回滚");
jsonObject.put("success", false);
throw new RuntimeException();
}
int product_id = lastIDService.selectLastID();
logger.info("添加成功!,新增产品的ID值为:{}", product_id);
JSONObject object = JSON.parseObject(propertyJson);
Set<String> propertyIdSet = object.keySet();
if (propertyIdSet.size() > 0) {
logger.info("整合产品子信息-产品属性");
List<PropertyValue> propertyValueList = new ArrayList<>(5);
for (String key : propertyIdSet) {
String value = object.getString(key);
PropertyValue propertyValue = new PropertyValue()
.setPropertyValue_value(value)
.setPropertyValue_property(new Property().setProperty_id(Integer.valueOf(key)))
.setPropertyValue_product(new Product().setProduct_id(product_id));
propertyValueList.add(propertyValue);
}
logger.info("共有{}条产品属性数据", propertyValueList.size());
yn = propertyValueService.addList(propertyValueList);
if (yn) {
logger.info("产品属性添加成功!");
} else {
logger.warn("产品属性添加失败!事务回滚");
jsonObject.put("success", false);
throw new RuntimeException();
}
}
if (productSingleImageList != null && productSingleImageList.length > 0) {
logger.info("整合产品子信息-产品预览图片");
List<ProductImage> productImageList = new ArrayList<>(5);
for (String imageName : productSingleImageList) {
productImageList.add(new ProductImage()
.setProductImage_type((byte) 0)
.setProductImage_src(imageName.substring(imageName.lastIndexOf("/") + 1))
.setProductImage_product(new Product().setProduct_id(product_id))
);
}
logger.info("共有{}条产品预览图片数据", productImageList.size());
yn = productImageService.addList(productImageList);
if (yn) {
logger.info("产品预览图片添加成功!");
} else {
logger.warn("产品预览图片添加失败!事务回滚");
jsonObject.put("success", false);
throw new RuntimeException();
}
}
if (productDetailsImageList != null && productDetailsImageList.length > 0) {
logger.info("整合产品子信息-产品详情图片");
List<ProductImage> productImageList = new ArrayList<>(5);
for (String imageName : productDetailsImageList) {
productImageList.add(new ProductImage()
.setProductImage_type((byte) 1)
.setProductImage_src(imageName.substring(imageName.lastIndexOf("/") + 1))
.setProductImage_product(new Product().setProduct_id(product_id))
);
}
logger.info("共有{}条产品详情图片数据", productImageList.size());
yn = productImageService.addList(productImageList);
if (yn) {
logger.info("产品详情图片添加成功!");
} else {
logger.warn("产品详情图片添加失败!事务回滚");
jsonObject.put("success", false);
throw new RuntimeException();
}
}
logger.info("产品信息及其子信息添加成功!");
jsonObject.put("success", true);
jsonObject.put("product_id", product_id);
return jsonObject.toJSONString();
}
//更新产品信息-ajax
@ResponseBody
@RequestMapping(value = "admin/product/{product_id}", method = RequestMethod.PUT, produces = "application/json;charset=utf-8")
public String updateProduct(@RequestParam String product_name/* 产品名称 */,
@RequestParam String product_title/* 产品标题 */,
@RequestParam Integer product_category_id/* 产品类型ID */,
@RequestParam Double product_sale_price/* 产品促销价 */,
@RequestParam Double product_price/* 产品原价 */,
@RequestParam Byte product_isEnabled/* 产品状态 */,
@RequestParam String propertyAddJson/* 产品添加属性JSON */,
@RequestParam String propertyUpdateJson/* 产品更新属性JSON */,
@RequestParam(required = false) Integer[] propertyDeleteList/* 产品删除属性ID数组 */,
@RequestParam(required = false) String[] productSingleImageList/*产品预览图片名称数组*/,
@RequestParam(required = false) String[] productDetailsImageList/*产品详情图片名称数组*/,
@PathVariable("product_id") Integer product_id/* 产品ID */) {
JSONObject jsonObject = new JSONObject();
logger.info("整合产品信息");
Product product = new Product()
.setProduct_id(product_id)
.setProduct_name(product_name)
.setProduct_title(product_title)
.setProduct_category(new Category().setCategory_id(product_category_id))
.setProduct_sale_price(product_sale_price)
.setProduct_price(product_price)
.setProduct_isEnabled(product_isEnabled)
.setProduct_create_date(new Date());
logger.info("更新产品信息,产品ID值为:{}", product_id);
boolean yn = productService.update(product);
if (!yn) {
logger.info("产品信息更新失败!事务回滚");
jsonObject.put("success", false);
throw new RuntimeException();
}
logger.info("产品信息更新成功!");
JSONObject object = JSON.parseObject(propertyAddJson);
Set<String> propertyIdSet = object.keySet();
if (propertyIdSet.size() > 0) {
logger.info("整合产品子信息-需要添加的产品属性");
List<PropertyValue> propertyValueList = new ArrayList<>(5);
for (String key : propertyIdSet) {
String value = object.getString(key);
PropertyValue propertyValue = new PropertyValue()
.setPropertyValue_value(value)
.setPropertyValue_property(new Property().setProperty_id(Integer.valueOf(key)))
.setPropertyValue_product(product);
propertyValueList.add(propertyValue);
}
logger.info("共有{}条需要添加的产品属性数据", propertyValueList.size());
yn = propertyValueService.addList(propertyValueList);
if (yn) {
logger.info("产品属性添加成功!");
} else {
logger.warn("产品属性添加失败!事务回滚");
jsonObject.put("success", false);
throw new RuntimeException();
}
}
object = JSON.parseObject(propertyUpdateJson);
propertyIdSet = object.keySet();
if (propertyIdSet.size() > 0) {
logger.info("整合产品子信息-需要更新的产品属性");
List<PropertyValue> propertyValueList = new ArrayList<>(5);
for (String key : propertyIdSet) {
String value = object.getString(key);
PropertyValue propertyValue = new PropertyValue()
.setPropertyValue_value(value)
.setPropertyValue_id(Integer.valueOf(key));
propertyValueList.add(propertyValue);
}
logger.info("共有{}条需要更新的产品属性数据", propertyValueList.size());
for (int i = 0; i < propertyValueList.size(); i++) {
logger.info("正在更新第{}条,共{}条", i + 1, propertyValueList.size());
yn = propertyValueService.update(propertyValueList.get(i));
if (yn) {
logger.info("产品属性更新成功!");
} else {
logger.warn("产品属性更新失败!事务回滚");
jsonObject.put("success", false);
throw new RuntimeException();
}
}
}
if (propertyDeleteList != null && propertyDeleteList.length > 0) {
logger.info("整合产品子信息-需要删除的产品属性");
logger.info("共有{}条需要删除的产品属性数据", propertyDeleteList.length);
yn = propertyValueService.deleteList(propertyDeleteList);
if (yn) {
logger.info("产品属性删除成功!");
} else {
logger.warn("产品属性删除失败!事务回滚");
jsonObject.put("success", false);
throw new RuntimeException();
}
}
if (productSingleImageList != null && productSingleImageList.length > 0) {
logger.info("整合产品子信息-产品预览图片");
List<ProductImage> productImageList = new ArrayList<>(5);
for (String imageName : productSingleImageList) {
productImageList.add(new ProductImage()
.setProductImage_type((byte) 0)
.setProductImage_src(imageName.substring(imageName.lastIndexOf("/") + 1))
.setProductImage_product(product)
);
}
logger.info("共有{}条产品预览图片数据", productImageList.size());
yn = productImageService.addList(productImageList);
if (yn) {
logger.info("产品预览图片添加成功!");
} else {
logger.warn("产品预览图片添加失败!事务回滚");
jsonObject.put("success", false);
throw new RuntimeException();
}
}
if (productDetailsImageList != null && productDetailsImageList.length > 0) {
logger.info("整合产品子信息-产品详情图片");
List<ProductImage> productImageList = new ArrayList<>(5);
for (String imageName : productDetailsImageList) {
productImageList.add(new ProductImage()
.setProductImage_type((byte) 1)
.setProductImage_src(imageName.substring(imageName.lastIndexOf("/") + 1))
.setProductImage_product(product)
);
}
logger.info("共有{}条产品详情图片数据", productImageList.size());
yn = productImageService.addList(productImageList);
if (yn) {
logger.info("产品详情图片添加成功!");
} else {
logger.warn("产品详情图片添加失败!事务回滚");
jsonObject.put("success", false);
throw new RuntimeException();
}
}
jsonObject.put("success", true);
jsonObject.put("product_id", product_id);
return jsonObject.toJSONString();
}
//按条件查询产品-ajax
@ResponseBody
@RequestMapping(value = "admin/product/{index}/{count}", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
public String getProductBySearch(@RequestParam(required = false) String product_name/* 产品名称 */,
@RequestParam(required = false) Integer category_id/* 产品类型ID */,
@RequestParam(required = false) Double product_sale_price/* 产品促销价 */,
@RequestParam(required = false) Double product_price/* 产品原价 */,
@RequestParam(required = false) Byte[] product_isEnabled_array/* 产品状态数组 */,
@RequestParam(required = false) String orderBy/* 排序字段 */,
@RequestParam(required = false,defaultValue = "true") Boolean isDesc/* 是否倒序 */,
@PathVariable Integer index/* 页数 */,
@PathVariable Integer count/* 行数 */) throws UnsupportedEncodingException {
//移除不必要条件
if (product_isEnabled_array != null && (product_isEnabled_array.length <= 0 || product_isEnabled_array.length >=3)) {
product_isEnabled_array = null;
}
if (category_id != null && category_id == 0) {
category_id = null;
}
if (product_name != null) {
//如果为非空字符串则解决中文乱码:URLDecoder.decode(String,"UTF-8");
product_name = "".equals(product_name) ? null : URLDecoder.decode(product_name, "UTF-8");
}
if (orderBy != null && "".equals(orderBy)) {
orderBy = null;
}
//封装查询条件
Product product = new Product()
.setProduct_name(product_name)
.setProduct_category(new Category().setCategory_id(category_id))
.setProduct_price(product_price)
.setProduct_sale_price(product_sale_price);
OrderUtil orderUtil = null;
if (orderBy != null) {
logger.info("根据{}排序,是否倒序:{}",orderBy,isDesc);
orderUtil = new OrderUtil(orderBy, isDesc);
}
JSONObject object = new JSONObject();
logger.info("按条件获取第{}页的{}条产品", index + 1, count);
PageUtil pageUtil = new PageUtil(index, count);
List<Product> productList = productService.getList(product, product_isEnabled_array, orderUtil, pageUtil);
object.put("productList", JSONArray.parseArray(JSON.toJSONString(productList)));
logger.info("按条件获取产品总数量");
Integer productCount = productService.getTotal(product, product_isEnabled_array);
object.put("productCount", productCount);
logger.info("获取分页信息");
pageUtil.setTotal(productCount);
object.put("totalPage", pageUtil.getTotalPage());
object.put("pageUtil", pageUtil);
return object.toJSONString();
}
//按类型ID查询属性-ajax
@ResponseBody
@RequestMapping(value = "admin/property/type/{property_category_id}", method = RequestMethod.GET,produces = "application/json;charset=utf-8")
public String getPropertyByCategoryId(@PathVariable Integer property_category_id/* 属性所属类型ID*/){
//封装查询条件
Category category = new Category()
.setCategory_id(property_category_id);
JSONObject object = new JSONObject();
logger.info("按类型获取属性列表,类型ID:{}",property_category_id);
List<Property> propertyList = propertyService.getList(new Property().setProperty_category(category),null);
object.put("propertyList",JSONArray.parseArray(JSON.toJSONString(propertyList)));
return object.toJSONString();
}
//按ID删除产品图片并返回最新结果-ajax
@ResponseBody
@RequestMapping(value = "admin/productImage/{productImage_id}",method = RequestMethod.DELETE,produces = "application/json;charset=utf-8")
public String deleteProductImageById(@PathVariable Integer productImage_id/* 产品图片ID */){
JSONObject object = new JSONObject();
logger.info("获取productImage_id为{}的产品图片信息",productImage_id);
ProductImage productImage = productImageService.get(productImage_id);
logger.info("删除产品图片");
Boolean yn = productImageService.deleteList(new Integer[]{productImage_id});
if (yn) {
logger.info("删除图片成功!");
object.put("success", true);
} else {
logger.warn("删除图片失败!事务回滚");
object.put("success", false);
throw new RuntimeException();
}
return object.toJSONString();
}
//上传产品图片-ajax
@ResponseBody
@RequestMapping(value = "admin/uploadProductImage", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
public String uploadProductImage(@RequestParam MultipartFile file, @RequestParam String imageType, HttpSession session) {
String originalFileName = file.getOriginalFilename();
logger.info("获取图片原始文件名:{}", originalFileName);
String extension = originalFileName.substring(originalFileName.lastIndexOf('.'));
String filePath;
String fileName = UUID.randomUUID() + extension;
if ("single".equals(imageType)) {
filePath = session.getServletContext().getRealPath("/") + "res/images/item/productSinglePicture/" + fileName;
} else {
filePath = session.getServletContext().getRealPath("/") + "res/images/item/productDetailsPicture/" + fileName;
}
logger.info("文件上传路径:{}", filePath);
JSONObject object = new JSONObject();
try {
logger.info("文件上传中...");
file.transferTo(new File(filePath));
logger.info("文件上传完成");
object.put("success", true);
object.put("fileName", fileName);
} catch (IOException e) {
logger.warn("文件上传失败!");
e.printStackTrace();
object.put("success", false);
}
return object.toJSONString();
}
}
java(贴上部分代码)
@Controller
public class
OrderController extends BaseController{
@Resource(name="productOrderService")
private ProductOrderService productOrderService;
@Resource(name = "addressService")
private AddressService addressService;
@Resource(name="userService")
private UserService userService;
@Resource(name = "productOrderItemService")
private ProductOrderItemService productOrderItemService;
@Resource(name = "productService")
private ProductService productService;
@Resource(name = "productImageService")
private ProductImageService productImageService;
@Resource(name = "lastIDService")
private LastIDService lastIDService;
//转到后台管理-订单页-ajax
@RequestMapping(value = "admin/order", method = RequestMethod.GET)
public String goToPage(HttpSession session, Map<String, Object> map){
logger.info("获取前10条订单列表");
PageUtil pageUtil = new PageUtil(0, 10);
List<ProductOrder> productOrderList =
productOrderService.getList(
null,
null,
new OrderUtil("productOrder_id",
true), pageUtil);
map.put("productOrderList",productOrderList);
logger.info("获取订单总数量");
Integer productOrderCount = productOrderService.getTotal(null, null);
map.put("productOrderCount", productOrderCount);
logger.info("获取分页信息");
pageUtil.setTotal(productOrderCount);
map.put("pageUtil", pageUtil);
logger.info("转到后台管理-订单页-ajax方式");
return "admin/orderManagePage";
}
//转到后台管理-订单详情页-ajax
@RequestMapping(value = "admin/order/{oid}", method = RequestMethod.GET)
public String goToDetailsPage(HttpSession session, Map<String, Object> map, @PathVariable Integer oid/* 订单ID */) {
logger.info("获取order_id为{}的订单信息",oid);
ProductOrder order = productOrderService.get(oid);
logger.info("获取订单详情-地址信息");
Address address = addressService.get(order.getProductOrder_address().getAddress_areaId());
Stack<String> addressStack = new Stack<>();
//详细地址
addressStack.push(order.getProductOrder_detail_address());
//最后一级地址
addressStack.push(address.getAddress_name() + " ");
//如果不是第一级地址,循环拼接地址信息
while (!address.getAddress_areaId().equals(address.getAddress_regionId().getAddress_areaId())) {
address = addressService.get(address.getAddress_regionId().getAddress_areaId());
addressStack.push(address.getAddress_name() + " ");
}
StringBuilder builder = new StringBuilder();
while (!addressStack.empty()) {
builder.append(addressStack.pop());
}
logger.info("订单地址字符串:{}", builder);
order.setProductOrder_detail_address(builder.toString());
logger.info("获取订单详情-用户信息");
order.setProductOrder_user(userService.get(order.getProductOrder_user().getUser_id()));
logger.info("获取订单详情-订单项信息");
List<ProductOrderItem> productOrderItemList = productOrderItemService.getListByOrderId(oid, null);
if (productOrderItemList != null) {
logger.info("获取订单详情-订单项对应的产品信息");
for (ProductOrderItem productOrderItem : productOrderItemList) {
Integer productId = productOrderItem.getProductOrderItem_product().getProduct_id();
logger.info("获取产品ID为{}的产品信息", productId);
Product product = productService.get(productId);
if (product != null) {
logger.info("获取产品ID为{}的第一张预览图片信息", productId);
product.setSingleProductImageList(productImageService.getList(productId, (byte) 0, new PageUtil(0, 1)));
}
productOrderItem.setProductOrderItem_product(product);
}
}
order.setProductOrderItemList(productOrderItemList);
map.put("order", order);
logger.info("转到后台管理-订单详情页-ajax方式");
return "admin/include/orderDetails";
}
//更新订单信息-ajax
@ResponseBody
@RequestMapping(value = "admin/order/{order_id}", method = RequestMethod.PUT, produces = "application/json;charset=UTF-8")
public String updateOrder(@PathVariable("order_id") String order_id) {
JSONObject jsonObject = new JSONObject();
logger.info("整合订单信息");
ProductOrder productOrder = new ProductOrder()
.setProductOrder_id(Integer.valueOf(order_id))
.setProductOrder_status((byte) 2)
.setProductOrder_delivery_date(new Date());
logger.info("更新订单信息,订单ID值为:{}", order_id);
boolean yn = productOrderService.update(productOrder);
if (yn) {
logger.info("更新成功!");
jsonObject.put("success", true);
} else {
logger.info("更新失败!事务回滚");
jsonObject.put("success", false);
throw new RuntimeException();
}
jsonObject.put("order_id", order_id);
return jsonObject.toJSONString();
}
//按条件查询订单-ajax
@ResponseBody
@RequestMapping(value = "admin/order/{index}/{count}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public String getOrderBySearch(@RequestParam(required = false) String productOrder_code/* 订单号 */,
@RequestParam(required = false) String productOrder_post/* 订单邮政编码 */,
@RequestParam(required = false) Byte[] productOrder_status_array/* 订单状态数组 */,
@RequestParam(required = false) String orderBy/* 排序字段 */,
@RequestParam(required = false,defaultValue = "true") Boolean isDesc/* 是否倒序 */,
@PathVariable Integer index/* 页数 */,
@PathVariable Integer count/* 行数 */){
//移除不必要条件
if (productOrder_status_array != null && (productOrder_status_array.length <= 0 || productOrder_status_array.length >=5)) {
productOrder_status_array = null;
}
if (productOrder_code != null){
productOrder_code = "".equals(productOrder_code) ? null : productOrder_code;
}
if(productOrder_post != null){
productOrder_post = "".equals(productOrder_post) ? null : productOrder_post;
}
if (orderBy != null && "".equals(orderBy)) {
orderBy = null;
}
//封装查询条件
ProductOrder productOrder = new ProductOrder()
.setProductOrder_code(productOrder_code)
.setProductOrder_post(productOrder_post);
OrderUtil orderUtil = null;
if (orderBy != null) {
logger.info("根据{}排序,是否倒序:{}",orderBy,isDesc);
orderUtil = new OrderUtil(orderBy, isDesc);
} else {
orderUtil = new OrderUtil("productOrder_id",
true);
}
JSONObject object = new JSONObject();
logger.info("按条件获取第{}页的{}条订单", index + 1, count);
PageUtil pageUtil = new PageUtil(index, count);
List<ProductOrder> productOrderList = productOrderService.getList(productOrder, productOrder_status_array, orderUtil, pageUtil);
object.put("productOrderList", JSONArray.parseArray(JSON.toJSONString(productOrderList)));
logger.info("按条件获取订单总数量");
Integer productOrderCount = productOrderService.getTotal(productOrder, productOrder_status_array);
object.put("productOrderCount", productOrderCount);
logger.info("获取分页信息");
pageUtil.setTotal(productOrderCount);
object.put("totalPage", pageUtil.getTotalPage());
object.put("pageUtil", pageUtil);
return object.toJSONString();
}
}
- Python项目实战-代码参考:
java(贴上部分代码)
def index(request):
if request.method in ["GET", "POST"]:
msg = {"code": 200, "msg": "success", "data": []}
print("=================>index")
# allModels = apps.get_app_config('main').get_models()
# for m in allModels:
# print(m.__tablename__)
# print(dir(m))
# # for col in m._meta.fields:
# # print("col name============>",col.name)
# # print("col type============>",col.get_internal_type())
# print(allModels)
return JsonResponse(msg)
def test(request, p1):
if request.method in ["GET", "POST"]:
msg = {"code": 200, "msg": "success", "data": []}
print("=================>index ", p1)
return JsonResponse(msg)
def null(request,):
if request.method in ["GET", "POST"]:
msg = {"code": 200, "msg": "success", "data": []}
return JsonResponse(msg)
def check_suffix(filelName,path1):
try:
image_data = open(path1, "rb").read()
except:
image_data = "no file"
if '.js' in filelName:
return HttpResponse(image_data, content_type="application/javascript")
elif '.jpg' in filelName or '.jpeg' in filelName or '.png' in filelName or '.gif' in filelName:
return HttpResponse(image_data, content_type="image/png")
elif '.css' in filelName:
return HttpResponse(image_data, content_type="text/css")
elif '.ttf' in filelName or '.woff' in filelName:
return HttpResponse(image_data, content_type="application/octet-stream")
elif '.mp4' in filelName:
return HttpResponse(image_data, content_type="video/mp4")
elif '.mp3' in filelName:
return HttpResponse(image_data, content_type="audio/mp3")
elif '.csv' in filelName:
return HttpResponse(image_data, content_type="application/CSV")
elif '.doc' in filelName:
return HttpResponse(image_data, content_type="application/msword")
elif '.docx' in filelName:
return HttpResponse(image_data, content_type="application/vnd.openxmlformats-officedocument.wordprocessingml.document")
elif '.xls' in filelName:
return HttpResponse(image_data, content_type="application/vnd.ms-excel")
elif '.xlsx' in filelName:
return HttpResponse(image_data, content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
elif '.ppt' in filelName:
return HttpResponse(image_data, content_type="application/vnd.ms-powerpoint")
elif '.pptx' in filelName:
return HttpResponse(image_data, content_type="application/vnd.openxmlformats-officedocument.presentationml.presentation")
elif '.zip' in filelName:
return HttpResponse(image_data, content_type="application/x-zip-compressed")
elif '.rar' in filelName:
return HttpResponse(image_data, content_type="application/octet-stream")
else:
return HttpResponse(image_data, content_type="text/html")
def admin_lib2(request, p1, p2):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/admin/lib/", p1, p2)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p2:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p2:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p2 or '.woff' in p2:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p2:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p2:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def admin_lib3(request, p1, p2, p3):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/admin/lib/", p1, p2, p3)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p3:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p3 or '.jpeg' in p3 or '.png' in p3 or '.gif' in p3:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p3:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p3 or '.woff' in p3:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p3:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p3:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def admin_lib4(request, p1, p2, p3, p4):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/admin/lib/", p1, p2, p3, p4)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p4:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p4 or '.jpeg' in p4 or '.png' in p4 or '.gif' in p4:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p4:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p4 or '.woff' in p4:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p4:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p4:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def admin_page(request, p1):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/admin/page/", p1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p1:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p1:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p1 or '.woff' in p1:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p1:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p1:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def admin_page2(request, p1, p2):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/admin/page/", p1, p2)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p2:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p2:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p2 or '.woff' in p2:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p2:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p2:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def admin_pages(request, p1):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/admin/pages/", p1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p1:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p1:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p1 or '.woff' in p1:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p1:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p1:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def admin_pages2(request, p1, p2):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/admin/pages/", p1, p2)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p2:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p2:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p2 or '.woff' in p2:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p2:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p2:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def admin_file1(request, p1):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/admin/", p1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p1:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p1:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p1 or '.woff' in p1:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p1:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p1:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def admin_file2(request, p1, p2):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/admin/", p1, p2)
if not os.path.isfile(path1):
path1 = os.path.join(os.getcwd(), "templates/front/admin/dist/", p1, p2)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p2:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p2:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p2 or '.woff' in p2:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p2:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p2:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def admin_file3(request, p1, p2, p3):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/admin/", p1, p2, p3)
if not os.path.isfile(path1):
path1 = os.path.join(os.getcwd(), "templates/front/admin/dist/", p1, p2,p3)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p3:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p3 or '.jpeg' in p3 or '.png' in p3 or '.gif' in p3:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p3:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p3 or '.woff' in p3:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p3:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p3:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def admin_file4(request, p1, p2, p3, p4):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/admin/", p1, p2, p3, p4)
if not os.path.isfile(path1):
path1 = os.path.join(os.getcwd(), "templates/front/admin/dist/", p1, p2,p3,p4)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p4:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p4 or '.jpeg' in p4 or '.png' in p4 or '.gif' in p4:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p4:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p4 or '.woff' in p4:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p4:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p4:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def front_pages(request, p1):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/pages/", p1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p1:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p1:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p1 or '.woff' in p1:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p1:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p1:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def front_pages2(request, p1, p2):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/pages/", p1, p2)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p2:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p2:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p2 or '.woff' in p2:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p2:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p2:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def layui1(request, p1):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/layui/", p1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p1:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p1:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p1 or '.woff' in p1:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p1:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p1:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def layui2(request, p1, p2):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/layui/", p1, p2)
print("layui2 path1========================>",path1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p2:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p2:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p2 or '.woff' in p2:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p2:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p2:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def layui3(request, p1, p2, p3):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/layui/", p1, p2, p3)
print("layui3 path1========================>",path1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
#
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p3:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p3 or '.jpeg' in p3 or '.png' in p3 or '.gif' in p3:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p3:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p3 or '.woff' in p3:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p3:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p3:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def layui4(request, p1, p2, p3, p4):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/layui/", p1, p2, p3, p4)
print("layui4 path1========================>",path1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p4:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p4 or '.jpeg' in p4 or '.png' in p4 or '.gif' in p4:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p4:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p4 or '.woff' in p4:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p4:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p4:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def pages1(request, p1):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/pages/", p1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p1:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p1:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p1 or '.woff' in p1:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p1:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p1:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def pages2(request, p1, p2):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/pages/", p1, p2)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p2:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p2:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p2 or '.woff' in p2:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p2:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p2:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def front_file1(request, p1):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/", p1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p1:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p1:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p1 or '.woff' in p1:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p1:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p1:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def front_file2(request, p1, p2):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/", p1, p2)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p2:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p2:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p2 or '.woff' in p2:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p2:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p2:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def schema_front1(request, p1):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/", p1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p1:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p1:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p1 or '.woff' in p1:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p1:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p1:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def schema_front2(request, p1, p2):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/", p1, p2)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p2:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p2:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p2 or '.woff' in p2:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p2:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p2:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def schema_front3(request, p1, p2, p3):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/", p1, p2, p3)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p3:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p3 or '.jpeg' in p3 or '.png' in p3 or '.gif' in p3:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p3:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p3 or '.woff' in p3:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p3:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p3:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def schema_front4(request, p1, p2, p3, p4):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/", p1, p2, p3, p4)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p4:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p4 or '.jpeg' in p4 or '.png' in p4 or '.gif' in p4:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p4:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p4 or '.woff' in p4:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p4:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p4:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def assets1(request, p1):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/assets/", p1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p1:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p1:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p1 or '.woff' in p1:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p1:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p1:
# return HttpResponse(image_data, content_type="audio/mp3")
# elif '.map' in p1:
# return JsonResponse({})
# else:
# return HttpResponse(image_data, content_type="text/html")
def assets2(request, p1, p2):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/assets/", p1, p2)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p2:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p2:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p2 or '.woff' in p2:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p2:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p2:
# return HttpResponse(image_data, content_type="audio/mp3")
# elif '.map' in p2:
# return JsonResponse({})
# else:
# return HttpResponse(image_data, content_type="text/html")
def assets3(request, p1, p2, p3):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/assets/", p1, p2, p3)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p3:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p3 or '.jpeg' in p3 or '.png' in p3 or '.gif' in p3:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p3:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p3 or '.woff' in p3:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p3:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p3:
# return HttpResponse(image_data, content_type="audio/mp3")
# elif '.map' in p3:
# return JsonResponse({})
# else:
# return HttpResponse(image_data, content_type="text/html")
def assets4(request, p1, p2, p3, p4):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/assets/", p1, p2, p3, p4)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p4:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p4 or '.jpeg' in p4 or '.png' in p4 or '.gif' in p4:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p4:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p4 or '.woff' in p4:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p4:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p4:
# return HttpResponse(image_data, content_type="audio/mp3")
# elif '.map' in p4:
# return JsonResponse({})
# else:
# return HttpResponse(image_data, content_type="text/html")
def css1(request, p1):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/css/", p1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p1:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p1:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p1 or '.woff' in p1:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p1:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p1:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def js1(request, p1):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/js/", p1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p1:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p1:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p1 or '.woff' in p1:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p1:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p1:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def img1(request, p1):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/img/", p1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
# try:
# image_data = open(path1, "rb").read()
# except:
# image_data="no file"
# if '.js' in p1:
# return HttpResponse(image_data, content_type="application/javascript")
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
# return HttpResponse(image_data, content_type="image/png")
# elif '.css' in p1:
# return HttpResponse(image_data, content_type="text/css")
# elif '.ttf' in p1 or '.woff' in p1:
# return HttpResponse(image_data, content_type="application/octet-stream")
# elif '.mp4' in p1:
# return HttpResponse(image_data, content_type="video/mp4")
# elif '.mp3' in p1:
# return HttpResponse(image_data, content_type="audio/mp3")
# else:
# return HttpResponse(image_data, content_type="text/html")
def front_modules(request, p1):
if request.method in ["GET", "POST"]:
fullPath = request.get_full_path()
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
path1 = os.path.join(os.getcwd(), "templates/front/modules/", p1)
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
五、论文参考
- 计算机毕业设计选题推荐-体育商城系统-论文参考:
六、系统视频
- 体育商城系统-项目视频:
计算机毕业设计选题推荐-体育商城-Java/Python项目
结语
计算机毕业设计选题推荐-体育商城-Java/Python项目实战
大家可以帮忙点赞、收藏、关注、评论啦~
源码获取:⬇⬇⬇