# shop **Repository Path**: Senix/shop ## Basic Information - **Project Name**: shop - **Description**: jjj - **Primary Language**: PHP - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2015-08-03 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README wechatshop ===== 依赖JDK7 安装maven,把local-maven-repo文件夹中内容复制到用户主目录下的.m2/repository目录下 sql/initdb.sql是数据库初始化SQL,导入mysql数据库中即可,使用的mysql5.6版本,如果要使用mysql5.5或之前的版本,请手动去除initdb.sql中所有DEFAULT CURRENT_TIMESTAMP和ON UPDATE CURRENT_TIMESTAMP 修改src/main/resources/resources.properties中数据库配置的url, driverClass, username, password,还有微信应用的信息,site.host填入服务器域名地址(带有http头) 执行mvn package打包应用,部署war包到tomcat或者其他java web容器中(比如tomcat) 在微信公众号设置中,接口地址填入:http://服务器域名/handle_wechat_oauth_code,appId,appSecret, token, aesKey都要和resources.properties文件中的一致 部署完成 后期如果有优化,可以将javascript和css文件合并部署,以及增加cache等,记住微信access-token并更新授权等,目前没有过早进行这些优化 因为微信公众号需要服务地址有域名且使用80端口,建议将本项目部署后,使用nginx反向代理,从而在80端口提供服务(如果用nginx代理,可能需要修改nginx请求大小限制,否则nginx默认不允许上传大图片) 为了开发时方便,可以直接运行mvcapp.mvc.Main类来启动内置jetty,这样开发时启动速度较快 使用了LESS来进行CSS的开发,开发时需要安装less(npm install -g less)来变异src/main/webapp/static/css目录下的css文件到css文件,推荐使用IDEA来开发,可以自动编译less到css 如果要修改界面主色调,修改src/main/webapp/static/css/main.less中的@bg-color和@ft-color变量的值,它们分别是主背景色调和对应的前景色调 如果出现wait_timeout等异常,这是因为mysql的设置不同导致的,请搜索mysql wait_timeout配置等,修改mysql的配置,具体可能和具体运维需要有关 下面的对于部署不是必要的,主要供开发者阅读 ##Install Project has various dependencies managed through Maven, NPM and Bower. Luckily they have all connected in Maven with frontend-maven-plugin. To install all dependencies and run tests run: ``` $ mvn install ``` This command builds the application with default dev profile. There are two profiles that build cycles include: `dev` (development) and `prod` (production). Each profile has its own build scenarios. To install with explicit profile run `mvn install -P dev|prod`. ####Build cycle for dev profile - Install Node and npm locally (If not installed). - Install Node dependencies. - npm runs `bower install` after dependency installation. See `package.json`. - Install Bower dependencies. - Run Javascript tests and code coverage tool. - Run Java tests with surefire. - Compile and build WAR file. ####Build cycle for prod profile Difference between dev and prod profiles is, Javascript files are **built** in prod profile unlike dev. After running Javascript tests all javascript files are minified, concatenated, revved and prepared to the production, thanks to the various Grunt plugins. Please see the `build` task in `Gruntfile.js`. All the other steps are applied here too. ##App Structure ``` src/ main/ java/ resources/ webapp/ - Web app source files static/js/ controllers/ - Angular controller files - each controller in one file (HomeCtrl -> home.js) directives/ - Angular directive files filters/ - Angular filter files services/ - Angular service and factory files app.js - Main Angular module css/ - Stylesheets views/ - Angular JS partial views test/ java/ - Java tests javascript/ spec/ - Javascript unit tests tests are placed into relevant subdirectory controllers/ directives/ filters/ services/ karma.conf.js - Karma configuration .bowerrc - Bower directory configuration bower.json - Bower configuration including dependencies Gruntfile.js - Grunt tasks configuration package.json - Node configuration including dependencies managed by npm pom.xml - Maven configuration ``` ##Run Project can be run with Jetty: ``` $ mvn jetty:run ``` ##Watch With watch and connect plugins of grunt, web app files (js, html) can be watched and reloaded simultaneously when a source fie is changed. To activate watching run the command below after running application. ``` $ grunt serve ```