updated 代码优化
This commit is contained in:
parent
b9415abcb7
commit
59ea91a07f
@ -11,7 +11,11 @@ import {cacheData} from './cache.js';
|
|||||||
|
|
||||||
// 获得最简
|
// 获得最简
|
||||||
let getOptimal = function(options){
|
let getOptimal = function(options){
|
||||||
let {from,to,sex} = options;
|
let {
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
sex
|
||||||
|
} = options;
|
||||||
let from_chain = options['from'].split(',');
|
let from_chain = options['from'].split(',');
|
||||||
let to_chain = options['to'].split(',');
|
let to_chain = options['to'].split(',');
|
||||||
for(let i=0;i<from_chain.length&&i<to_chain.length;i++){
|
for(let i=0;i<from_chain.length&&i<to_chain.length;i++){
|
||||||
@ -168,7 +172,11 @@ export function getSelectors(str){
|
|||||||
|
|
||||||
// 合并选择器,查找两个对象之间的关系
|
// 合并选择器,查找两个对象之间的关系
|
||||||
export function mergeSelector(param){
|
export function mergeSelector(param){
|
||||||
let {from:from_selector,to:to_selector,sex:my_sex} = param;
|
let {
|
||||||
|
from:from_selector,
|
||||||
|
to:to_selector,
|
||||||
|
sex:my_sex
|
||||||
|
} = param;
|
||||||
if(my_sex<0){
|
if(my_sex<0){
|
||||||
let to_sex = -1;
|
let to_sex = -1;
|
||||||
let from_sex = -1;
|
let from_sex = -1;
|
||||||
@ -214,15 +222,16 @@ export function mergeSelector(param){
|
|||||||
isOptimal = true;
|
isOptimal = true;
|
||||||
}
|
}
|
||||||
if(isOptimal){
|
if(isOptimal){
|
||||||
let ops = getOptimal({
|
({
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
sex:my_sex
|
||||||
|
} = getOptimal({
|
||||||
'from':from,
|
'from':from,
|
||||||
'to':to,
|
'to':to,
|
||||||
'sex':my_sex,
|
'sex':my_sex,
|
||||||
'optimal':param.optimal
|
'optimal':param.optimal
|
||||||
});
|
}));
|
||||||
from = ops['from'];
|
|
||||||
to = ops['to'];
|
|
||||||
my_sex = ops['sex'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let to_rids = to?reverseId(to,my_sex):[''];
|
let to_rids = to?reverseId(to,my_sex):[''];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user