|
|
package com.yohoufo.order.common;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
public enum InviterType {
|
|
|
STORED_SELLER(1, "UFO", "入驻商家"),
|
|
|
CLASS_B_AGENT(2, "NB", "一级代理");
|
...
|
...
|
@@ -10,6 +12,13 @@ public enum InviterType { |
|
|
|
|
|
private String name;
|
|
|
|
|
|
// 邀请码数字部分
|
|
|
private String value;
|
|
|
|
|
|
public void setValue(String value) {
|
|
|
this.value = value;
|
|
|
}
|
|
|
|
|
|
public int getType() {
|
|
|
return type;
|
|
|
}
|
...
|
...
|
@@ -36,7 +45,7 @@ public enum InviterType { |
|
|
public static InviterType getInviteType(String inputInviteCode){
|
|
|
InviterType inviterType = null;
|
|
|
for (InviterType item : values()){
|
|
|
if (inputInviteCode.startsWith(item.getAlphabet())){
|
|
|
if (StringUtils.startsWithIgnoreCase(inputInviteCode, item.getAlphabet())){
|
|
|
inviterType = item;
|
|
|
break;
|
|
|
}
|
...
|
...
|
@@ -46,8 +55,9 @@ public enum InviterType { |
|
|
return null;
|
|
|
}
|
|
|
|
|
|
String digit = inputInviteCode.replaceFirst(inviterType.getAlphabet(),"");
|
|
|
String digit = StringUtils.removeStartIgnoreCase(inputInviteCode, inviterType.getAlphabet());
|
|
|
if (digit.matches("\\d+")){
|
|
|
inviterType.setValue(digit);
|
|
|
return inviterType;
|
|
|
}
|
|
|
|
...
|
...
|
|