Commit db20f6e08e9a5746e239ec12625799bbbc35c50c

Authored by yvan.ni
1 parent a7a94d21

分享成为下线的判读,分享人一定要是分销商、

首页分享的bug修复
pages/cart/cart2/cart2.js
@@ -1798,8 +1798,16 @@ Page({ @@ -1798,8 +1798,16 @@ Page({
1798 } 1798 }
1799 1799
1800 //老会员成为分销下线需要的参数 1800 //老会员成为分销下线需要的参数
1801 - if(getApp().globalData.first_leader){  
1802 - item.first_leader=parseInt(getApp().globalData.first_leader); 1801 + if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){
  1802 + //判断一下分享人是不是分享商
  1803 + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{
  1804 + if(res.data.code==0){
  1805 + var user= res.data.data;
  1806 + if(user.is_distribut==1){
  1807 + item.first_leader=parseInt(getApp().globalData.first_leader);
  1808 + }
  1809 + }
  1810 + })
1803 } 1811 }
1804 1812
1805 var goods={ 1813 var goods={
@@ -2002,8 +2010,16 @@ Page({ @@ -2002,8 +2010,16 @@ Page({
2002 item.order_prom_list=order_prom_list; 2010 item.order_prom_list=order_prom_list;
2003 2011
2004 //老会员成为分销下线需要的参数 2012 //老会员成为分销下线需要的参数
2005 - if(getApp().globalData.first_leader){  
2006 - item.first_leader=parseInt(getApp().globalData.first_leader); 2013 + if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){
  2014 + //判断一下分享人是不是分享商
  2015 + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{
  2016 + if(res.data.code==0){
  2017 + var user= res.data.data;
  2018 + if(user.is_distribut==1){
  2019 + item.first_leader=parseInt(getApp().globalData.first_leader);
  2020 + }
  2021 + }
  2022 + })
2007 } 2023 }
2008 2024
2009 2025
pages/cart/cart2_inte/cart2_inte.js
@@ -623,8 +623,16 @@ Page({ @@ -623,8 +623,16 @@ Page({
623 } 623 }
624 624
625 //老会员成为分销下线需要的参数 625 //老会员成为分销下线需要的参数
626 - if(getApp().globalData.first_leader){  
627 - item.first_leader=parseInt(getApp().globalData.first_leader); 626 + if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){
  627 + //判断一下分享人是不是分享商
  628 + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{
  629 + if(res.data.code==0){
  630 + var user= res.data.data;
  631 + if(user.is_distribut==1){
  632 + item.first_leader=parseInt(getApp().globalData.first_leader);
  633 + }
  634 + }
  635 + })
628 } 636 }
629 637
630 638
pages/cart/cart2_pt/cart2_pt.js
@@ -525,8 +525,16 @@ Page({ @@ -525,8 +525,16 @@ Page({
525 item.is_zsorder=th.data.kt_type+1; //开团类型 525 item.is_zsorder=th.data.kt_type+1; //开团类型
526 } 526 }
527 //老会员成为分销下线需要的参数 527 //老会员成为分销下线需要的参数
528 - if(getApp().globalData.first_leader){  
529 - item.first_leader= parseInt(getApp().globalData.first_leader); 528 + if(getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader){
  529 + //判断一下分享人是不是分享商
  530 + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{
  531 + if(res.data.code==0){
  532 + var user= res.data.data;
  533 + if(user.is_distribut==1){
  534 + item.first_leader=parseInt(getApp().globalData.first_leader);
  535 + }
  536 + }
  537 + })
530 } 538 }
531 539
532 if(th.data.qh!='') 540 if(th.data.qh!='')
pages/index/index/index.js
@@ -584,8 +584,10 @@ Page({ @@ -584,8 +584,10 @@ Page({
584 }, 584 },
585 onShareAppMessage: function(e) { 585 onShareAppMessage: function(e) {
586 var url="/pages/index/index/index"; 586 var url="/pages/index/index/index";
587 - if(getApp().globalData.user_id){  
588 - url+="&first_leader="+getApp().globalData.user_id; 587 + var userInfo=getApp().globalData.userInfo;
  588 + //是分销商才带
  589 + if(userInfo && userInfo['is_distribut']==1){
  590 + url+="?first_leader="+userInfo.user_id;
589 } 591 }
590 console.log("---首页---分享--"); 592 console.log("---首页---分享--");
591 console.log(url); 593 console.log(url);
pages/togoin/togoin.js
1 var t = require("../../utils/common.js"); 1 var t = require("../../utils/common.js");
2 -var app=getApp(); 2 +const app=getApp();
3 var os = app.globalData.setting; 3 var os = app.globalData.setting;
  4 +var regeneratorRuntime = require('../../utils/runtime.js');
4 5
5 Page({ 6 Page({
6 data: { 7 data: {
@@ -119,7 +120,7 @@ Page({ @@ -119,7 +120,7 @@ Page({
119 this.setData({show_bind:1}) 120 this.setData({show_bind:1})
120 }, 121 },
121 122
122 - save_the_data:function (r,e,sessionKey,openid) { 123 + save_the_data: async function (r,e,sessionKey,openid) {
123 var app=getApp(),a=app,th=this; 124 var app=getApp(),a=app,th=this;
124 var dd = { 125 var dd = {
125 oauth: "miniapp", 126 oauth: "miniapp",
@@ -135,7 +136,15 @@ Page({ @@ -135,7 +136,15 @@ Page({
135 }; 136 };
136 //--如果有邀请人的时候-- 137 //--如果有邀请人的时候--
137 if(th.data.first_leader){ 138 if(th.data.first_leader){
138 - dd.first_leader=th.data.first_leader; 139 + //判断一下分享人是不是分享商
  140 + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+th.data.first_leader,{}).then(res=>{
  141 + if(res.data.code==0){
  142 + var user= res.data.data;
  143 + if(user.is_distribut==1){
  144 + dd.first_leader=th.data.first_leader;
  145 + }
  146 + }
  147 + })
139 } 148 }
140 //-- 导购会员ID -- 149 //-- 导购会员ID --
141 if(getApp().globalData.guide_id){ 150 if(getApp().globalData.guide_id){