|
@@ -53,7 +53,14 @@ class YunjiuyeService extends Service {
|
|
|
return result.suid;
|
|
|
}
|
|
|
|
|
|
- // 用户与云就业关联
|
|
|
+ /**
|
|
|
+ * 用户与云就业关联
|
|
|
+ * @param {string} type 用户角色
|
|
|
+ * @param {string} mobile 电话
|
|
|
+ * @param {string} code 身份编码
|
|
|
+ * @param {string} org 云就业的组织机构编码
|
|
|
+ * @param {string} ytype 云就业角色类型
|
|
|
+ */
|
|
|
async userBind({ type, mobile, code, org, ytype }) {
|
|
|
assert(mobile, '登录账户不能为空');
|
|
|
assert(type, '用户角色不能为空');
|
|
@@ -89,9 +96,17 @@ class YunjiuyeService extends Service {
|
|
|
const yjycModel = this.ctx.model.Yjyconnect;
|
|
|
const obj = { ycode: code, yorg: org, suid: ObjectId(res._id).toString(), ytype };
|
|
|
const isHas = await yjycModel.count({ suid: obj.suid });
|
|
|
- if (isHas > 0) throw new BusinessError(ErrorCode.DATA_EXISTED, '账户已绑定,无需再次绑定');
|
|
|
- await yjycModel.create(obj);
|
|
|
- return obj.suid;
|
|
|
+ if (process.env.NODE_ENV === 'development') {
|
|
|
+ if (isHas > 0) return obj.suid;
|
|
|
+ else {
|
|
|
+ await yjycModel.create(obj);
|
|
|
+ return obj.suid;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (isHas > 0) throw new BusinessError(ErrorCode.DATA_EXISTED, '账户已绑定,无需再次绑定');
|
|
|
+ await yjycModel.create(obj);
|
|
|
+ return obj.suid;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 用户id获取用户信息,登录获取token返回
|