Commit 98980f7a by 任晓松

register

parent 23ff18fc
......@@ -16,6 +16,7 @@ class AppUserPinByUserNameCache extends CacheBase {
async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
var actionBody = val.actionBody;
var appInfo = val.appInfo;
var uapp_id = appInfo.uapp_id;
var channelUserId = actionBody.channelUserId ? actionBody.channelUserId : actionBody.userName;
var uUserName = actionBody.userName ? actionBody.userName : actionBody.channelUserId;
var uPassword = actionBody.userName ? actionBody.userName : actionBody.channelUserId;//uPassword
......@@ -29,7 +30,7 @@ class AppUserPinByUserNameCache extends CacheBase {
userInfo.userpin = actionBody.userpin;
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);
if (uUserInfo.status != 0 && uUserInfo.status != 2000) {
return uUserInfo;
......
......@@ -194,25 +194,24 @@ class OpPlatformUtils {
"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);
if (reqApiAccessKey.status != 0) {
return reqApiAccessKey;
}
var param = {
userName: userName,
channel_userid: userName,
channel_username: userName,
password: password || settings.defaultPassWord,
mobile: mobile
mobile: mobile,
uapp_id:uapp_id
}
//按照访问token
var restResult = await this.restClient.execPostWithAK(
param,
this.registerUrl, reqApiAccessKey.data.accessKey);
if (restResult.status != 0 || !restResult.data) {
return system.getResultFail(restResult.status, restResult.msg);
}
return system.getResultSuccess(restResult.data);
// var restResult = await this.restClient.execPostWithAK(
// param,
// this.registerUrl, reqApiAccessKey.data.accessKey);
let restResult = await this.appuserDao.create(param)
return system.getResultSuccess(restResult);
}
/**
......
var childproc = require('child_process');
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const settings = require("../../config/settings")
const axios = require('axios')
class ExecClient {
constructor() {
......@@ -42,6 +44,13 @@ class ExecClient {
return cmd;
}
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);
var result = await this.exec(cmd);
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