“仙乡”微信商城开发与设计

2019-12-04 04:11张素芹王鑫
价值工程 2019年31期

张素芹 王鑫

摘要:随着微信用户量快速增长,微信公众号稳定的商城构建衔接越发重要,尤其是面对从公众号带来的大量引流,网站要考虑其运行能力、反应速度、数据承载量等問题。本文研究的“仙乡”微信商城,从商城网站的构建及搭载公众号的思路出发,以大流量负荷下网页稳定为基础,采用String构架,数据库选择MySQL,可以达到应对多用户多数据的情况。

Abstract: With the rapid growth of WeChat users, the stable construction of the WeChat public account is becoming more and more important, especially in the face of massive drainage from the public number. The website should consider its operational capabilities, response speed, and data carrying capacity. The "Xianxiang" WeChat Mall researched in this paper starts from the construction of the mall website and the idea of carrying the public number. Based on the stability of the webpage under the heavy traffic load, the String framework is used, and the database selects MySQL, which can cope with the situation of multi-user and multi-data.

关键词:轻量级String结构;MVC结构优化;MySQL;JAVA Eclipse

Key words: lightweight String structure;MVC structure optimization;MySQL;JAVA Eclipse

中图分类号:TP311                                       文献标识码:A                                  文章编号:1006-4311(2019)31-0214-02

0  引言

“仙乡”商城利用高度灵活的轻量级框架Spring,在Eclipse中利用Java语言开发,HTML进行页面静态布局,数据库采用MYSQL。在过程中实现了商城会员登录、联系客服、添加商品、商品分类、查询物流、退款等。本文主要介绍实现过程中的优化。

1  Spring框架结构

1.1 结构组成

Spring容器提供了IOC(控制反转)来创建与维护对象的方式,处理对象当中的依赖关系。与此同时,提供了AOP(面向切面编程方式)功能,声明式事务控制处理(原子性 一致性 持久性 隔离性)。对JDBC进行了轻量级的封装,提供了MVC设计模式的解决方案(Spring MVC)。Spring作为轻量级组件,可以将其部分组件单独使用。见图1和表1。

1.2 框架联系

Spring核心容器通过控制反转(IOC),通过容器来控制对象的创建及维护,对象中成员变量的创建及维护。反转是将对象的控制权转移给容器处理,是为了获得更好的扩展性和可维护性。

对象创建及维护方式:

public class Con{

private Waiter Waiter;

public Waiter getWaiter() {

return Waiter;

}

public void setWaiter(Waiter waiter) {

this.Waiter = waiter;

}

}

public class Waiter{

private String waiterName;

public String getWaiterName() {

return waiterName;

}

public void setWaiterName(String waiterName) {