Authored by 李奇

fixed:客服内调用profile model重写

@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 const orderModel = require('../../home/models/order'); 2 const orderModel = require('../../home/models/order');
3 const crypto = global.yoho.crypto; 3 const crypto = global.yoho.crypto;
4 const imApi = require('../models/im-api'); 4 const imApi = require('../models/im-api');
5 -const userApi = require('../../passport/models/auth-helper'); 5 +const userModel = require('../models/user');
6 const imModel = require('../models/im'); 6 const imModel = require('../models/im');
7 const helpers = global.yoho.helpers; 7 const helpers = global.yoho.helpers;
8 8
@@ -16,7 +16,7 @@ exports.appAdapter = (req, res, next) => { @@ -16,7 +16,7 @@ exports.appAdapter = (req, res, next) => {
16 exports.page = (req, res, next) => { 16 exports.page = (req, res, next) => {
17 let uid = req.user.uid || req.query.uid; 17 let uid = req.user.uid || req.query.uid;
18 18
19 - userApi.profile(req.user.uid) 19 + req.ctx(userModel).profile(req.user.uid)
20 .then(userinfo => { 20 .then(userinfo => {
21 userinfo = userinfo.data || {}; 21 userinfo = userinfo.data || {};
22 22
  1 +'use strict';
  2 +const api = global.yoho.API;
  3 +
  4 +class UserModel extends global.yoho.BaseModel {
  5 + constructor(ctx) {
  6 + super(ctx);
  7 + }
  8 +
  9 + profile(uid) {
  10 + let param = {
  11 + uid: uid,
  12 + method: 'app.passport.profile'
  13 + };
  14 +
  15 + return api.get('', param);
  16 + }
  17 +}
  18 +
  19 +module.exports = UserModel;
  20 +