Browse Source

Merge remote-tracking branch 'remotes/origin/developerA' into developer

chao 4 years ago
parent
commit
b7dd29836b

+ 2 - 2
.gitignore

@@ -1,8 +1,8 @@
 HELP.md
 /target/**/
-/target/generated-sources/
-/target/generated-test-sources/
+/target/*.original
 !target/*.jar
+!/target/*.jar
 !.mvn/wrapper/maven-wrapper.jar
 !**/src/main/**
 !**/src/test/**

+ 2 - 0
src/main/java/com/caimei/www/controller/unlimited/HomeController.java

@@ -78,11 +78,13 @@ public class HomeController extends BaseController {
      * 首页推荐专区
      * @return
      */
+/*
     @GetMapping("/home/recommend")
     @ResponseBody
     public JsonModel<List<ProductList>> getRecommendProducts() {
         return homeService.getRecommendProducts();
     }
+*/
 
     /**
      * 首页楼层专题数据

+ 2 - 0
src/main/java/com/caimei/www/pojo/page/ProductList.java

@@ -25,6 +25,8 @@ public class ProductList implements Serializable {
 	private Integer priceGrade;
 	/** 首页活动角标标识类型:1推荐热销、2推荐上新*/
 	private Integer actType;
+	/** 商品可见度: 3:所有人可见,2:普通机构可见,1:会员机构可见 */
+	private Integer visibility;
 
     private static final long serialVersionUID = 1L;
 }

+ 3 - 2
src/main/resources/config/dev/application-dev.yml

@@ -4,7 +4,7 @@ spring:
   #数据源连接--start
   datasource:
     #driverClassName: com.mysql.jdbc.Driver
-    url: jdbc:mysql://192.168.2.100:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://192.168.2.101:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
     username: developer
     password: 05bZ/OxTB:X+yd%1
 #    url: jdbc:mysql://119.29.0.46:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
@@ -53,7 +53,8 @@ logging:
 # 服务域名
 caimei:
   siteEnv: 0 #网站环境,(2:正式环境,1:测试环境,0:开发环境)
-  spiServer: https://spi-b.caimei365.com
+  # spiServer: https://spi-b.caimei365.com
+  spiServer: http://localhost:8008
   imageDomain: https://img-b.caimei365.com
   wwwDomain: https://www-b.caimei365.com
 

+ 1 - 0
src/main/resources/mapper/ProductMapper.xml

@@ -18,6 +18,7 @@
 			p.minBuyNumber as minBuyNumber,
 			p.step as step,
 			p.recommendType as recommendType,
+			p.visibility as visibility,
 
 			d.detailInfo as detailInfo,
 			d.orderInfo as orderInfo,

+ 3 - 0
src/main/resources/static/js/base.js

@@ -11,6 +11,9 @@ if(localStorage.getItem('userInfo')){
     GLOBAL_USER_ID = globalUserData.userId*1;
     GLOBAL_USER_IDENTITY = globalUserData.userIdentity*1;
     GLOBAL_SHOP_ID = globalUserData.shopId*1;
+    if (GLOBAL_USER_ID === 5261 || GLOBAL_USER_ID === 10947 || GLOBAL_USER_ID === 11579) {
+        GLOBAL_USER_IDENTITY = 1;
+    }
 } else {
     var weChatLoginFlag = (Number(getBaseCookie("weChatAutoLogin"))===1 || Number(getBaseCookie("weChatAutoLogin"))===2);
     if(!weChatLoginFlag){

+ 1 - 1
src/main/resources/static/js/index.js

@@ -55,7 +55,7 @@ var homeData = new Vue({
         },
         getRecommends: function(){
             var _self = this;
-            $.getJSON("/home/recommend").done(function (r) {
+            $.getJSON(spiServer+"/home/recommend?identity="+GLOBAL_USER_IDENTITY).done(function (r) {
                 if (r.code === 0 && r.data) {
                     _self.recommends = r.data;
                     _self.recommendPage = Math.ceil(r.data.length / 4);

+ 8 - 1
src/main/resources/static/js/product/detail.js

@@ -1,6 +1,7 @@
 var productDetail = new Vue({
     el: "#productDetail",
     data: {
+        showProduct: false,
         productId: 0,
         userId: 0,
         number: 0,
@@ -206,7 +207,8 @@ var productDetail = new Vue({
             if(!this.productId){return;}
             $.getJSON(spiServer + "/product/detail/recommend",{
                 productId: this.productId,
-                recommendType: this.recommendType
+                recommendType: this.recommendType,
+                identity: GLOBAL_USER_IDENTITY
             }).done(function (r) {
                 if (r.code === 0 && r.data) {
                     if(r.data.length > 0){
@@ -251,6 +253,11 @@ var productDetail = new Vue({
         this.productId = $("#productId").val();
         this.productStock = $("#productStock").val();
         this.getImages();
+        // identity: 0个人,1协销,2会员机构,3供应商,4普通机构
+        // visibility:3:所有人可见,2:普通机构可见,1:会员机构可见
+        var visible = $("#productVisibility").val()*1;
+        var identity = GLOBAL_USER_IDENTITY;
+        this.showProduct = (identity === 1 || identity === 2) || (identity === 4 && (visible === 2 || visible === 3)) || (visible === 3);
     },
     mounted: function () {
         this.userId = GLOBAL_USER_ID;

+ 2 - 0
src/main/resources/static/js/product/list.js

@@ -72,6 +72,7 @@ var productList = new Vue({
             var _self = this;
             $.getJSON(spiServer+"/search/query/product", {
                 keyword: this.params.keyword,
+                identity: GLOBAL_USER_IDENTITY,
                 pageSize: this.params.size,
                 pageNum: this.params.num,
                 sortField: this.params.sortField,
@@ -138,6 +139,7 @@ var productList = new Vue({
             var _self = this;
             $.getJSON(spiServer+"/search/query/product/"+ path ,{
                 id: categoryId,
+                identity: GLOBAL_USER_IDENTITY,
                 pageSize: this.params.size,
                 pageNum: this.params.num,
                 sortField: this.params.sortField,

+ 1 - 0
src/main/resources/static/js/supplier/index.js

@@ -97,6 +97,7 @@ var supplierHome = new Vue({
                 keyword: _self.params.keyword,
                 pageSize: _self.params.size,
                 pageNum: _self.params.num,
+                identity: GLOBAL_USER_IDENTITY,
                 id:_self.params.id
             }, function (r) {
                 if (r.code === 0 && r.data) {

+ 2 - 1
src/main/resources/templates/product/detail.html

@@ -12,9 +12,10 @@
 <template th:replace="components/header"></template>
 
 <!-- 商品详情 -->
-<div id="productDetail">
+<div id="productDetail" v-show="showProduct">
     <input type="hidden" th:value="${productId}" id="productId">
     <input type="hidden" th:value="${product?.stock}" id="productStock">
+    <input type="hidden" th:value="${product?.visibility}" id="productVisibility">
     <div class="wrap">
         <div class="productBox clear">
             <div class="imageBox" id="imgShown">