123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613 |
- import util from './util'
- import config from './config'
- let lastClick = {
- url: '',
- time: 0
- }
- let api = {
-
-
- getMpRedInfo() {
- return util.ajax({
- method: 'post',
- url: '/mp/red/info',
- data: {
- HideLoading: true
- }
- })
- },
-
-
- FavoriteRewardGet (data) {
- return util.ajax({
- method: 'post',
- url: '/favorite/reward/get',
- data
- })
- },
-
-
- getPlayIndex(data) {
- return util.ajax({
- method: 'post',
- url: '/play/index',
- data
- })
- },
-
-
- getTagGameList(data) {
- return util.ajax({
- method: 'post',
- url: '/tag/game/list',
- data
- })
- },
-
-
- getFindGameList(data) {
- return util.ajax({
- method: 'post',
- url: '/find/game/list',
- data
- })
- },
-
-
- getRpGameList(data) {
- return util.ajax({
- method: 'post',
- url: '/rp/game/list',
- data
- })
- },
-
-
- getShareIncomeRank (data) {
- return util.ajax({
- method: 'post',
- url: '/share/income/rank',
- data: {
- type: config.mpType === 'gd' ? 'itg' : 'rp',
- HideLoading: true,
- ...data
- }
- })
- },
-
-
- getSignIncome (data) {
- let t = new Date().getTime()
- if (lastClick.url === '/sign/income/add' && t - lastClick.time < 500) {
- lastClick.time = t
- util.fastClickTips()
- return Promise.resolve('')
- }
- lastClick.url = '/sign/income/add'
- lastClick.time = t
- return util.ajax({
- method: 'post',
- url: '/sign/income/add',
- data
- })
- },
-
-
- getShareIncome () {
- let t = new Date().getTime()
- if (lastClick.url === '/share/income/get' && t - lastClick.time < 500) {
- lastClick.time = t
- util.fastClickTips()
- return Promise.resolve('')
- }
- lastClick.url = '/share/income/get'
- lastClick.time = t
- return util.ajax({
- method: 'post',
- url: '/share/income/get'
- })
- },
-
-
- getPlayIncome() {
- let t = new Date().getTime()
- if (lastClick.url === '/play/income/get' && t - lastClick.time < 500) {
- lastClick.time = t
- util.fastClickTips()
- return Promise.resolve('')
- }
- lastClick.url = '/play/income/get'
- lastClick.time = t
- return util.ajax({
- method: 'post',
- url: '/play/income/get'
- })
- },
-
-
- getGameIncome (data) {
- let t = new Date().getTime()
- if (lastClick.url === '/game/income/get' && t - lastClick.time < 500) {
- lastClick.time = t
- util.fastClickTips()
- return Promise.resolve('')
- }
- lastClick.url = '/game/income/get'
- lastClick.time = t
- return util.ajax({
- method: 'post',
- url: '/game/income/get',
- data
- })
- },
-
-
- getShareGameDetail (data) {
- return util.ajax({
- method: 'post',
- url: '/share/game/detail',
- data
- })
- },
-
-
- addComment(data) {
- return util.ajax({
- method: 'post',
- url: '/game/comment/add',
- data
- })
- },
-
-
- getCommentIndex(data) {
- return util.ajax({
- method: 'post',
- url: '/home/comment/index',
- data
- })
- },
-
-
- getMyGameCommentList(data) {
- return util.ajax({
- method: 'post',
- url: '/game/comment/mylist',
- data
- })
- },
-
-
- getGmaeCommentList(data) {
- return util.ajax({
- method: 'post',
- url: '/game/comment/list',
- data
- })
- },
-
- getBlackList (data) {
- return util.ajax({
- url: '/player/game/list',
- data
- })
- },
-
-
- getGamePlayList(data) {
- return util.ajax({
- method: 'post',
- url: '/mem/game/playlist',
- data
- })
- },
-
-
- getGameDetail(data) {
- return util.ajax({
- method: 'post',
- url: '/game/detail',
- data
- })
- },
-
-
- getWithdrawTips(data) {
- return util.ajax({
- method: 'post',
- url: '/help/withdraw/tips',
- data
- })
- },
-
-
- gethelpTipsText(data) {
- return util.ajax({
- method: 'post',
- url: '/help/makemoney/tips',
- data
- })
- },
-
-
- getMemIncomeList(data) {
- return util.ajax({
- method: 'post',
- url: '/team/mem/income/list',
- data
- })
- },
-
-
- memIncomeRank(data) {
- return util.ajax({
- method: 'post',
- url: '/team/income/rank/list',
- data: {
- type: config.mpType === 'gd' ? 'itg' : 'rp',
- ...data
- }
- })
- },
-
-
- menLogin (data) {
- console.log('menLogin api', data)
- return util.ajax({
- method: 'post',
- url: '/mp/wx/login',
- data
- })
- },
-
-
- updateUserInfo (data) {
- return util.ajax({
- method: 'post',
- url: '/mp/wx/updateinfo',
- data
- }).then(res => {
- let userInfo = wx.getStorageSync('userInfo')
- userInfo.user_token = res.data.user_token
- wx.setStorageSync('userInfo', userInfo)
- return res
- })
- },
-
-
- getUserInfo (data) {
- console.log('正在获取用户信息...')
- return new Promise((resolve, reject) => {
- util.ajax({
- method: 'post',
- url: '/mp/wx/getuserinfo',
- data
- }).then(res => {
- console.log(res)
- if (res.code === 200) {
- console.log('获取信息成功', res)
-
- getApp().globalData.userInfo = res.data;
- getApp().globalData.auth = res.data.auth
- getApp().globalData.PageCallback = true;
- ['total_amount', 'withdraw_amount', 'balance'].forEach((item, ids) => {
- getApp().globalData.userInfo[item] = getApp().globalData.userInfo[item].toFixed(2)
- })
- console.log('设置 globalData.userInfo 成功', 'token', wx.getStorageSync('userInfo').user_token)
- resolve(res)
- } else {
- console.log(`获取信息失败 错误码${res.code}`)
- resolve(res)
- }
- }).catch(err => {
- console.log('api.js getUserInfo 错误', err)
- })
- })
- },
-
-
- getSlideList (data) {
- return util.ajax({
- method: 'post',
- url: '/game/slide/list',
- data
- })
- },
-
-
- getGameList (data) {
- return util.ajax({
- method: 'post',
- url: '/game/list',
- data
- })
- },
-
-
- getMemGameList (data) {
- return util.ajax({
- method: 'post',
- url: '/mem/game/list',
- data
- })
- },
-
-
- addMemGame (data) {
- return util.ajax({
- method: 'post',
- url: '/mem/game/add',
- data
- })
- },
-
-
- delMemGame (data) {
- return util.ajax({
- method: 'post',
- url: '/mem/game/cancel',
- data
- })
- },
-
-
- getHomeInfo (data) {
- return util.ajax({
- method: 'post',
- url: '/homepage/info',
- data
- })
- },
-
-
- setHomeInfo (data) {
- return util.ajax({
- method: 'post',
- url: '/homepage/update',
- data
- })
- },
-
-
- getHomeBgList (data) {
- return util.ajax({
- method: 'post',
- url: '/homepage/background/list',
- data
- })
- },
-
-
- updateBgImg (data) {
- return util.ajax({
- method: 'post',
- url: '/bgimg/update',
- data
- })
- },
-
-
- getVisitorList (data) {
- return util.ajax({
- method: 'post',
- url: '/homepage/visitor/list',
- data
- })
- },
-
-
- getWithdrawList (data) {
- return util.ajax({
- method: 'post',
- url: '/financial/withdraw/list',
- data
- })
- },
-
-
- getIncomeList (data) {
- return util.ajax({
- method: 'post',
- url: '/financial/income/list',
- data
- })
- },
-
-
- getIncomeRankList (data) {
- return util.ajax({
- method: 'post',
- url: '/financial/income/rank/list',
- data: {
- type: config.mpType === 'gd' ? 'itg' : 'rp',
- ...data
- }
- })
- },
-
-
- getMemberList (data) {
- return util.ajax({
- method: 'post',
- url: '/team/mem/list',
- data
- })
- },
-
-
- getHelpList (data) {
- return util.ajax({
- method: 'post',
- url: '/help/fqa/list',
- data
- })
- },
-
-
- openGame (data) {
- let t = new Date().getTime()
- if (lastClick.url === '/game/open' && t - lastClick.time < 500) {
- lastClick.time = t
- util.fastClickTips()
- return Promise.resolve('')
- }
- lastClick.url = '/game/open'
- lastClick.time = t
- return util.ajax({
- method: 'post',
- url: '/game/open',
- data: {
- ...data,
- HideLoading: true,
- HideToast: true
- }
- })
- },
-
-
- startGame (data) {
- return util.ajax({
- method: 'post',
- url: '/game/start',
- data: {
- ...data,
- HideLoading: true,
- HideToast: true
- }
- })
- },
-
-
- getStartup () {
- return util.ajax({
- url: '/mp/startup',
- data: {
- HideToast: true
- }
- })
- },
-
-
- getLotteryDetail () {
- return util.ajax({
- method: 'post',
- url: '/lottery/detail'
- })
- },
-
-
- drawLottery(data) {
- return util.ajax({
- method: 'post',
- url: '/lottery/draw',
- data
- })
- },
-
-
-
- getShareInfo(options) {
- return util.ajax({
- url: '/mp/share/detail',
- mini: true,
- data: {
- ...options.data,
- HideLoading: true
- }
- })
- },
-
-
- getPayInfo (options) {
- return util.ajax({
- method: 'post',
- url: '/mp/pay/info',
- mini: true,
- ...options
- })
- },
-
-
- payCheck (options) {
- return util.ajax({
- method: 'post',
- url: '/mp/check/pay',
- mini: true,
- ...options
- }).then(res => {
- let opts = JSON.parse(res.data.token)
- return new Promise((resolve, reject) => {
- wx.requestPayment({
- ...opts,
- success(res) {
- resolve(res)
- },
- fail(res) {
- reject(res)
- }
- })
- })
- })
- }
- }
- module.exports = api
|