34 lines
782 B
JavaScript
34 lines
782 B
JavaScript
import Taro from '@tarojs/taro'
|
|
import { BASE_URL } from '../constant'
|
|
|
|
// 解析短码(主要用于右上角按钮分享)
|
|
export const analysisShortCodeApi = (val) => {
|
|
// 解析短码
|
|
Taro.request({
|
|
url: `${BASE_URL}/v1/mall/shortCode`,
|
|
method: 'GET',
|
|
data: { md5_key: val },
|
|
success: (res) => {
|
|
if (res.data.code == 0) {
|
|
// 绑定上下级
|
|
bindParent(res.data.data.share_user_id)
|
|
}
|
|
},
|
|
})
|
|
}
|
|
|
|
// 绑定上下级
|
|
const bindParent = (share_user_id) => {
|
|
// 绑定上下级
|
|
Taro.request({
|
|
url: `${BASE_URL}/v1/mall/shortCode/bind`,
|
|
method: 'POST',
|
|
data: { share_user_id },
|
|
success: (res) => {
|
|
if (res.data.code == 0) {
|
|
// 绑定上下级
|
|
}
|
|
},
|
|
})
|
|
}
|