Commit 028b90f4 by jscat

nyx weapp: 功能更新

1. 添加二维码验证流程
parent eaa46ddb
{ {
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
"pages/key/matchTest/matchTest", "pages/key/matchTest/matchTest",
"pages/my/my-points/my-points", "pages/my/my-points/my-points",
"pages/my/user/user", "pages/my/user/user",
"pages/my/myposts/myposts",
"pages/logs/logs", "pages/logs/logs",
"pages/post/post", "pages/post/post",
"pages/post/edit/edit", "pages/post/edit/edit",
......
//config.js API全局域名配置 //config.js API全局域名配置
//config.js API全局域名配置 //config.js API全局域名配置
var prod = 0; //阿里云服务器生产版本 var prod = 0; //阿里云服务器生产版本
var local = 1; //本地java测试,需要启动java 后台 var local = 0; //本地java测试,需要启动java 后台
var test = 0; //阿里云服务器测试版本 var test = 1; //阿里云服务器测试版本
var debug = 0; //是否打印调试信息 var debug = 0; //是否打印调试信息
var host_key = "https://fun.hisuhong.com"; var host_key = "https://fun.hisuhong.com";
...@@ -45,7 +45,9 @@ var config={ ...@@ -45,7 +45,9 @@ var config={
userinfo_query_url: host_key + "/api/nyx/userinfo/query", userinfo_query_url: host_key + "/api/nyx/userinfo/query",
notes_query_url: host_key + "/api/nyx/post/query", notes_query_url: host_key + "/api/nyx/post/query",
activity_query_url: host_key + "/api/nyx/activity/query", activity_query_url: host_key + "/api/nyx/activity/query",
points_query_url: host_key + "/api/nyx/match/point/query", match_query_url: host_key + "/api/nyx/match/query",
match_query_by_id_url: host_key + "/api/nyx/match/query/id",
match_query_then_update_url: host_key + "/api/nyx/match/queryThenUpdate/id",
bonus_query_url: host_key + "/api/nyx/match/bonus/query/id", bonus_query_url: host_key + "/api/nyx/match/bonus/query/id",
socket_url: socket_url, socket_url: socket_url,
oss_token_url: host_key + "/api/nyx/oss/getToken", oss_token_url: host_key + "/api/nyx/oss/getToken",
......
// pages/activity/activity.js // pages/activity/activity.js
...@@ -365,10 +365,40 @@ Page({ ...@@ -365,10 +365,40 @@ Page({
- 答题时间create_datetime: 2020/07/30 12:00:00 - 答题时间create_datetime: 2020/07/30 12:00:00
- 更新时间update_datetime: 2020/07/30 12:00:00 - 更新时间update_datetime: 2020/07/30 12:00:00
- 积分时效状态(有效|无效)(暂不实现) - 积分时效状态(有效|无效)(暂不实现)
2. 扫码流程 2. 扫码流程; javaapp只负责获取数据; weapp负责解析数据
1) 扫码获取记录id,发给服务器后台, 1) 扫码获取记录id,发给服务器后台,
如果 存在 && 未使用,则置为 "已使用",同时返回"成功" msg:
否则返回"失败" - "成功", 如果 存在 && 未使用,则置为 "已使用", match_id && match_status='01'
{
"resultCode": "200",
"totalCount": 1,
"resultMsg": "OK",
"data": [
{
"matchId": "mid_002",
"matchStatus": "01",
}
]
}
- "失败, 已使用二维码", 如果 存在 && 已使用, match_id && match_status='00'
{
"resultCode": "200",
"totalCount": 1,
"resultMsg": "OK",
"data": [
{
"matchId": "mid_001",
"matchStatus": "00",
}
]
}
- "失败, 无效二维码", 未查询到 !match_id
{
"resultCode": "200",
"totalCount": 0,
"resultMsg": "OK",
"data": []
}
*/ */
getQRCode: function(){ getQRCode: function(){
var _this = this; var _this = this;
...@@ -376,13 +406,52 @@ Page({ ...@@ -376,13 +406,52 @@ Page({
wx.scanCode({ //扫描API wx.scanCode({ //扫描API
success: function(res){ success: function(res){
console.log(res); //输出回调信息 console.log(res); //输出回调信息
_this.setData({ _this.checkQRCode(res.result)
qRCodeMsg: res.result }
}); })
},
checkQRCode(qrcode_string){
var _this = this;
var strUrl = config.match_query_then_update_url + "?matchId="+qrcode_string
config.debug == 1?console.log("===checkQRCode strUrl "+strUrl):""
wx.request({
url: strUrl,
method: 'GET',
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) {
if ( res.data.resultCode == 200 ) {
//表示query成功
console.log("qrcode查询成功");
//得到matchId
var matchList = res.data.data;
var title = ""
if(matchList.length == 0)
{
title = "失败, 无效二维码"
}
else if( matchList[0].matchStatus == '00' )
{
title = "失败,已使用二维码"
}
else if( matchList[0].matchStatus == '01' )
{
title = "成功扫码"
}
wx.showToast({ wx.showToast({
title: '成功', title: title,
duration: 2000 duration: 3000
}) })
}
},
fail : function(res)
{
console.log("failed")
} }
}) })
}, },
......
// pages/my/rank/rank.js // pages/my/rank/rank.js
...@@ -181,7 +181,7 @@ Page({ ...@@ -181,7 +181,7 @@ Page({
getPoints: function (scrollType, pageNum, pageCount, memberStatus) { getPoints: function (scrollType, pageNum, pageCount, memberStatus) {
var _this = this; var _this = this;
var query_url = '&matchStatus='+memberStatus var query_url = '&matchStatus='+memberStatus
var strUrl = config.points_query_url + "?pageCount=" + pageCount var strUrl = config.match_query_url + "?pageCount=" + pageCount
+ "&pageNum=" + pageNum + query_url + "&pageNum=" + pageNum + query_url
config.debug == 1 ? console.log("===strUrl is: \"" + strUrl + "\"") : "" config.debug == 1 ? console.log("===strUrl is: \"" + strUrl + "\"") : ""
wx.request({ wx.request({
...@@ -230,7 +230,6 @@ Page({ ...@@ -230,7 +230,6 @@ Page({
var _this = this; var _this = this;
var query_url = '?matchId='+matchId var query_url = '?matchId='+matchId
var strUrl = config.bonus_query_url + query_url var strUrl = config.bonus_query_url + query_url
config.debug == 1 ? console.log("===strUrl is: \"" + strUrl + "\"") : "" config.debug == 1 ? console.log("===strUrl is: \"" + strUrl + "\"") : ""
wx.request({ wx.request({
......
{ {
{ {
"description": "项目配置文件。", "description": "项目配置文件。",
"setting": { "setting": {
"urlCheck": false, "urlCheck": true,
"es6": true, "es6": true,
"postcss": true, "postcss": true,
"minified": true, "minified": true,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论