Authored by 郭成尧

userModel-ctx

... ... @@ -273,9 +273,9 @@ class BuyNowController {
}
co(function* () {
let userData = yield userModel.queryProfile(uid);
let userData = yield req.ctx(userModel).queryProfile(uid);
let mobile = _.get(userData, 'data.mobile', '');
let addresslist = yield userModel.addressTextData(uid);
let addresslist = yield req.ctx(userModel).addressTextData(uid);
let returnData = orderModel.processInvoiceData(orderInfo, mobile, addresslist);
let headerData = headerModel.setNav({
invoiceNotice: '发票须知',
... ...
... ... @@ -77,7 +77,7 @@ exports.orderEnsure = (req, res, next) => {
let allPromise = [
orderPromise,
userModel.queryProfile(uid),
req.ctx(userModel).queryProfile(uid),
addressModel.addressData(uid)
];
... ... @@ -424,9 +424,9 @@ exports.invoiceInfo = (req, res, next) => {
}
co(function* () {
let userData = yield userModel.queryProfile(uid);
let userData = yield req.ctx(userModel).queryProfile(uid);
let mobile = _.get(userData, 'data.mobile', '');
let addresslist = yield userModel.addressTextData(uid);
let addresslist = yield req.ctx(userModel).addressTextData(uid);
let returnData = orderModel.processInvoiceData(orderInfo, mobile, addresslist);
let headerData = headerModel.setNav({
invoiceNotice: '发票须知',
... ...
'use strict';
const api = global.yoho.API;
class userModel extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
/**
* 获取用户信息
* doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/addUserprofile.md
* @param uid 用户id
* @return
*/
queryProfile(uid) {
let params = {
method: 'app.passport.profile',
uid
};
/**
* 获取用户信息
* doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/addUserprofile.md
* @param uid 用户id
* @return
*/
exports.queryProfile = (uid) => {
let params = {
method: 'app.passport.profile',
uid
};
let options = {
cache: true
};
let options = {
cache: true
};
return this.get({data: params, param: options});
}
return api.get('', params, options);
};
addressTextData(uid) {
return this.get({data: {
method: 'app.address.get',
uid: uid
}});
}
}
exports.addressTextData = (uid) => {
return api.get('', {
method: 'app.address.get',
uid: uid
});
};
module.exports = userModel;
... ...