Commit 98980f7a by 任晓松

register

parent 23ff18fc
...@@ -16,6 +16,7 @@ class AppUserPinByUserNameCache extends CacheBase { ...@@ -16,6 +16,7 @@ class AppUserPinByUserNameCache extends CacheBase {
async buildCacheVal(cachekey, inputkey, val, ex, ...items) { async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
var actionBody = val.actionBody; var actionBody = val.actionBody;
var appInfo = val.appInfo; var appInfo = val.appInfo;
var uapp_id = appInfo.uapp_id;
var channelUserId = actionBody.channelUserId ? actionBody.channelUserId : actionBody.userName; var channelUserId = actionBody.channelUserId ? actionBody.channelUserId : actionBody.userName;
var uUserName = actionBody.userName ? actionBody.userName : actionBody.channelUserId; var uUserName = actionBody.userName ? actionBody.userName : actionBody.channelUserId;
var uPassword = actionBody.userName ? actionBody.userName : actionBody.channelUserId;//uPassword var uPassword = actionBody.userName ? actionBody.userName : actionBody.channelUserId;//uPassword
...@@ -29,7 +30,7 @@ class AppUserPinByUserNameCache extends CacheBase { ...@@ -29,7 +30,7 @@ class AppUserPinByUserNameCache extends CacheBase {
userInfo.userpin = actionBody.userpin; userInfo.userpin = actionBody.userpin;
return system.getResultSuccess(userInfo); return system.getResultSuccess(userInfo);
} }
var uUserInfo = await this.opPlatformUtils.register(uUserName, uPassword, mobile, var uUserInfo = await this.opPlatformUtils.register(uapp_id,uUserName, uPassword, mobile,
appInfo.uapp_key, appInfo.uapp_secret); appInfo.uapp_key, appInfo.uapp_secret);
if (uUserInfo.status != 0 && uUserInfo.status != 2000) { if (uUserInfo.status != 0 && uUserInfo.status != 2000) {
return uUserInfo; return uUserInfo;
......
...@@ -194,25 +194,24 @@ class OpPlatformUtils { ...@@ -194,25 +194,24 @@ class OpPlatformUtils {
"requestid": "5362bf6f941e4f92961a61068f05cd7f" "requestid": "5362bf6f941e4f92961a61068f05cd7f"
} }
*/ */
async register(userName, password, mobile, appKey, secret) { async register(uapp_id,userName, password, mobile, appKey, secret) {
var reqApiAccessKey = await this.getReqApiAccessKey(appKey, secret); var reqApiAccessKey = await this.getReqApiAccessKey(appKey, secret);
if (reqApiAccessKey.status != 0) { if (reqApiAccessKey.status != 0) {
return reqApiAccessKey; return reqApiAccessKey;
} }
var param = { var param = {
userName: userName, channel_userid: userName,
channel_username: userName,
password: password || settings.defaultPassWord, password: password || settings.defaultPassWord,
mobile: mobile mobile: mobile,
uapp_id:uapp_id
} }
//按照访问token //按照访问token
var restResult = await this.restClient.execPostWithAK( // var restResult = await this.restClient.execPostWithAK(
param, // param,
this.registerUrl, reqApiAccessKey.data.accessKey); // this.registerUrl, reqApiAccessKey.data.accessKey);
let restResult = await this.appuserDao.create(param)
if (restResult.status != 0 || !restResult.data) { return system.getResultSuccess(restResult);
return system.getResultFail(restResult.status, restResult.msg);
}
return system.getResultSuccess(restResult.data);
} }
/** /**
......
var childproc = require('child_process'); var childproc = require('child_process');
const util = require('util'); const util = require('util');
const exec = util.promisify(require('child_process').exec); const exec = util.promisify(require('child_process').exec);
const settings = require("../../config/settings")
const axios = require('axios')
class ExecClient { class ExecClient {
constructor() { constructor() {
...@@ -42,6 +44,13 @@ class ExecClient { ...@@ -42,6 +44,13 @@ class ExecClient {
return cmd; return cmd;
} }
async execPost(subData, url) { async execPost(subData, url) {
if(settings.env == 'dev'){
const rs = await axios.post(url,subData);
const ret ={
stdout:JSON.stringify(rs.data)
}
return ret;
}
let cmd = this.FetchPostCmd(subData, url); let cmd = this.FetchPostCmd(subData, url);
var result = await this.exec(cmd); var result = await this.exec(cmd);
return result; return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment