diff --git a/api/user.js b/api/user.js index 3fbb5ef..26093e2 100644 --- a/api/user.js +++ b/api/user.js @@ -5,7 +5,7 @@ import Cache from "@/utils/cache.js" /** * 获取用户信息 - * + * */ export function getUserInfo(){ return request.get('user'); @@ -13,7 +13,7 @@ export function getUserInfo(){ /** * 设置用户分享 - * + * */ export function userShare(){ return request.post('user/share'); @@ -83,7 +83,7 @@ export function postSignUser(sign) { /** * 获取签到配置 - * + * */ export function getSignConfig(){ return request.get('user/sign/config') @@ -107,7 +107,7 @@ export function setSignIntegral(){ /** * 签到列表(年月) * @param object data - * + * */ export function getSignMonthList(data){ return request.get('user/sign/month',data) @@ -115,7 +115,7 @@ export function getSignMonthList(data){ /** * 活动状态 - * + * */ export function userActivity(){ return request.get('user/activity'); @@ -136,7 +136,7 @@ export function getRecordApi(q) { } /* - * 提现总金额 + * 提现总金额 * */ export function getCountApi() { return request.get("extract/totalMoney"); @@ -151,7 +151,7 @@ export function getIntegralList(q) { /** * 获取分销海报图片 - * + * */ export function spreadBanner(data){ return request.get('user/spread/banner',data); @@ -167,7 +167,7 @@ export function spreadPeople(data){ } /** - * + * * 推广佣金/提现总和 * @param int type */ @@ -184,7 +184,7 @@ export function getSpreadInfo() { /** - * + * * 推广订单 * @param object data */ @@ -216,7 +216,7 @@ export function extractCash(data){ /** * 提现银行/提现最低金额 - * + * */ export function extractBank(){ return request.get('extract/bank'); @@ -224,7 +224,7 @@ export function extractBank(){ /** * 会员等级列表 - * + * */ export function userLevelGrade(){ return request.get('user/level/grade'); @@ -240,14 +240,14 @@ export function userLevelTask(id){ /** * 检查用户是否可以成为会员 - * + * */ export function userLevelDetection(){ return request.get('user/level/detection'); } /** - * + * * 地址列表 * @param object data */ @@ -274,7 +274,7 @@ export function editAddress(data){ /** * 删除地址 * @param int id - * + * */ export function delAddress(id){ return request.post('address/del',{id:id}) @@ -282,7 +282,7 @@ export function delAddress(id){ /** * 获取单个地址 - * @param int id + * @param int id */ export function getAddressDetail(id){ return request.get('address/detail/'+id); @@ -304,7 +304,7 @@ export function getLogout() { } /** * 小程序充值 - * + * */ export function rechargeRoutine(data){ return request.post('recharge/routine',data) @@ -339,7 +339,7 @@ export function alipayFull(data) { /** * 获取默认地址 - * + * */ export function getAddressDefault(){ return request.get('address/default'); @@ -382,7 +382,7 @@ export function spread(puid) return request.get("user/bindSpread?spreadPid="+ puid); } /** -// * 静默绑定推广人 +// * 静默绑定渠道 // * @param {Object} channelId // */ export function channel(channelId) @@ -392,7 +392,7 @@ export function channel(channelId) /** * 当前用户在佣金排行第几名 - * + * */ export function brokerageRankNumber(data) { @@ -401,7 +401,7 @@ export function brokerageRankNumber(data) /** * 会员等级经验值; - * + * */ export function getlevelInfo() { @@ -410,7 +410,7 @@ export function getlevelInfo() /** * 经验值明细; - * + * */ export function getlevelExpList(data) { @@ -419,7 +419,7 @@ export function getlevelExpList(data) /** * 经验值明细; - * + * */ export function getuserDalance() { @@ -447,7 +447,7 @@ export function computeUser(){ /** * 账单记录; - * + * */ export function getBillList(data) { @@ -480,4 +480,4 @@ export function spreadPeoCount() { */ export function copyrightApi(){ return request.get(`copyright/info`,{},{noAuth:true}); -} \ No newline at end of file +} diff --git a/libs/wechat.js b/libs/wechat.js index c4a9e74..c238da6 100644 --- a/libs/wechat.js +++ b/libs/wechat.js @@ -217,7 +217,7 @@ class AuthWechat { */ auth(code) { return new Promise((resolve, reject) => { - wechatAuth(code, Cache.get('spread')) + wechatAuth(code, Cache.get('spread'),Cache.get('channelId')) .then(({ data }) => { diff --git a/manifest.json b/manifest.json index 8ecc5b1..85c8645 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name" : "先享后付", - "appid" : "__UNI__C7D69AA", //wxb74514b47a2f29d4 wx46c3a73d8c4f7051 __UNI__EB8A7B + "appid" : "__UNI__E7B7107", //wxb74514b47a2f29d4 wx46c3a73d8c4f7051 __UNI__EB8A7B "description" : "crmeb商城", "versionName" : "2.1", "versionCode" : 2, @@ -219,8 +219,7 @@ "async" : { "timeout" : 200000 }, - "title" : "先享后付", - "template" : "template.html" + "title" : "先享后付" }, "plus" : { "statusbar" : { diff --git a/utils/index.js b/utils/index.js index 18af2cc..af345df 100644 --- a/utils/index.js +++ b/utils/index.js @@ -1,6 +1,6 @@ -import { spread } from "@/api/user"; +import { spread,channel } from "@/api/user"; import Cache from "@/utils/cache"; import { getCity } from '@/api/api.js'; @@ -11,7 +11,7 @@ import { getCity } from '@/api/api.js'; export function silenceBindingSpread() { //#ifdef H5 let puid = Cache.get('spread'); - //#endif + //#endif //#ifdef MP || APP-PLUS let puid = getApp().globalData.spread; //#endif @@ -25,7 +25,7 @@ export function silenceBindingSpread() { //#ifdef H5 Cache.clear("spread"); //#endif - + //#ifdef MP || APP-PLUS getApp().globalData.spread = 0; //#endif @@ -35,6 +35,37 @@ export function silenceBindingSpread() { } } +/** + * 静默授权绑定渠道,使用在已经登录后扫描了别人的推广二维码 + * @param {Object} puid + */ +export function silenceBindingChannelId() { + //#ifdef H5 + let puid = Cache.get('channelId'); + //#endif + //#ifdef MP || APP-PLUS + let puid = getApp().globalData.channelId; + //#endif + + puid = parseInt(puid); + if (Number.isNaN(puid)) { + puid = 0; + } + if (puid) { + channel(puid).then(res => {}).catch(res => { + //#ifdef H5 + Cache.clear("channelId"); + //#endif + + //#ifdef MP || APP-PLUS + getApp().globalData.channelId = 0; + //#endif + }); + } else { + Cache.set('channelId', 0); + } +} + export function isWeixin() { return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1; }