Authored by ccbikai(👎🏻🍜)

领取有货币

  1 +'use strict';
  2 +const coinModel = require('../models/coin');
  3 +
  4 +exports.sendCoin = (req, res, next) => {
  5 + // let data = {
  6 + // code: 403
  7 + // };
  8 +
  9 + // if (!req.query.token) {
  10 + // data.message = "参数错误!"
  11 + // return res.jsonp(data);
  12 + // }
  13 +
  14 + let uid = req.user.uid;
  15 +
  16 + if (req.query.app) {
  17 + uid = req.query.app.uid;
  18 + }
  19 +
  20 + // if (!uid) {
  21 + // data.code = 401;
  22 + // data.message = "未登录";
  23 + // return res.jsonp(data);
  24 + // }
  25 +
  26 + coinModel.sendCoin({
  27 + token: req.query.token,
  28 + uid: uid
  29 + }).then((result) => {
  30 + console.log(result)
  31 + res.jsonp(result);
  32 + }).catch(next);
  33 +};
  1 +/**
  2 + * 领取有货币
  3 + */
  4 +
  5 +const api = global.yoho.API;
  6 +
  7 +module.exports = {
  8 + sendCoin: function(params) {
  9 + return api.get('', Object.assign({
  10 + method: 'app.activity.receviceYohoCoin'
  11 + }, params));
  12 + }
  13 +}
@@ -16,6 +16,7 @@ const live = require(`${cRoot}/live`); @@ -16,6 +16,7 @@ const live = require(`${cRoot}/live`);
16 const invite = require(`${cRoot}/invite`); 16 const invite = require(`${cRoot}/invite`);
17 const vipDay = require(`${cRoot}/vipDay`); 17 const vipDay = require(`${cRoot}/vipDay`);
18 const market = require(`${cRoot}/market`); 18 const market = require(`${cRoot}/market`);
  19 +const coin = require(`${cRoot}/coin`);
19 20
20 // routers 21 // routers
21 22
@@ -75,6 +76,6 @@ router.post('/vip-day/signin.json', vipDay.beforeIn, vipDay.signin); @@ -75,6 +76,6 @@ router.post('/vip-day/signin.json', vipDay.beforeIn, vipDay.signin);
75 router.post('/vip-day/msg/save.json', vipDay.beforeIn, vipDay.saveMsg); 76 router.post('/vip-day/msg/save.json', vipDay.beforeIn, vipDay.saveMsg);
76 router.get('/vip-day/msg/fetch.json', vipDay.fetchMsg); 77 router.get('/vip-day/msg/fetch.json', vipDay.fetchMsg);
77 78
78 - 79 +router.get('/coin/sendCoin', coin.sendCoin);
79 80
80 module.exports = router; 81 module.exports = router;
@@ -16,7 +16,7 @@ module.exports = { @@ -16,7 +16,7 @@ module.exports = {
16 siteUrl: '//m.yohobuy.com', 16 siteUrl: '//m.yohobuy.com',
17 assetUrl: '//localhost:5001', 17 assetUrl: '//localhost:5001',
18 domains: { 18 domains: {
19 - api: 'http://api-test1.yohops.com:9999/', 19 + api: 'http://dev-api.yohops.com:9999/',
20 service: 'http://service-test1.yohops.com:9999/', 20 service: 'http://service-test1.yohops.com:9999/',
21 liveApi: 'http://testapi.live.yohops.com:9999/', 21 liveApi: 'http://testapi.live.yohops.com:9999/',
22 singleApi: 'http://api-test1.yohops.com:9999/' 22 singleApi: 'http://api-test1.yohops.com:9999/'