|
|
@@ -319,19 +319,40 @@ class UserModel extends BaseModel {
|
|
|
* @return {version}
|
|
|
*/
|
|
|
async getVersionFromUpgrade(ssoId, compilationId){
|
|
|
- let version = '纵横公路养护造价(云版)';//'纵横公路养护造价(免费云版)'; 2019-03-28 需求修改,听说不知道多久的以后还会改回来--勿删!!!!!
|
|
|
- /*let userData = await this.findDataBySsoId(ssoId);
|
|
|
- if (userData.upgrade_list !== undefined) {
|
|
|
- let compilationInfo = userData.upgrade_list.find(function (item) {
|
|
|
- return item.compilationID === compilationId;
|
|
|
- });
|
|
|
- if (compilationInfo !== undefined && compilationInfo.isUpgrade === true) {
|
|
|
- version = '纵横公路养护造价(专业云版)';
|
|
|
- }
|
|
|
- }*/
|
|
|
+ let version = '纵横公路养护云造价(免费公用版)';//'纵横公路养护造价(免费云版)'; 2019-03-28 需求修改,听说不知道多久的以后还会改回来--勿删!!!!!
|
|
|
+ let userData = await this.findDataBySsoId(ssoId);
|
|
|
+ if (userData.upgrade_list !== undefined) {
|
|
|
+ let compilationInfo = userData.upgrade_list.find(function (item) {
|
|
|
+ return item.compilationID === compilationId;
|
|
|
+ });
|
|
|
+ if (compilationInfo !== undefined && compilationInfo.isUpgrade === true) {
|
|
|
+ version = '纵横公路养护云造价(专业版)';
|
|
|
+ }
|
|
|
+ }
|
|
|
return version;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 判断用户是免费版还是专业版用户
|
|
|
+ */
|
|
|
+ async isFree(ssoId, compilationId) {
|
|
|
+ const userData = await this.findDataBySsoId(ssoId);
|
|
|
+ if (!userData) {
|
|
|
+ throw '不存在此用户';
|
|
|
+ }
|
|
|
+ const upgrade_list = userData.upgrade_list;
|
|
|
+ let free = true;
|
|
|
+ if (upgrade_list && upgrade_list.length > 0) {
|
|
|
+ const upgrade = upgrade_list.find(function (item) {
|
|
|
+ return item.compilationID === compilationId && item.isUpgrade === true;
|
|
|
+ });
|
|
|
+ if (upgrade) {
|
|
|
+ free = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return free
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
export default UserModel;
|