建立连接时新增客户端language参数

This commit is contained in:
xiajun 2021-06-17 20:10:47 +08:00
parent c9e0d15bd1
commit 6baf846b4c
16 changed files with 75 additions and 11 deletions

View File

@ -18,6 +18,7 @@
<setting name="validation-enabled" value="true" />
<setting name="provider-name" value="Hibernate" />
<datasource-mapping>
<factory-entry name="cim-boot-server" />
<factory-entry name="entityManagerFactory" />
</datasource-mapping>
<naming-strategy-map />

View File

@ -9,10 +9,15 @@
<component name="ChangeListManager">
<list default="true" id="bed47126-03b3-4370-a6c1-08503492974f" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/cim-boot-server.iml" beforeDir="false" afterPath="$PROJECT_DIR$/cim-boot-server.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cim-boot-server.ipr" beforeDir="false" afterPath="$PROJECT_DIR$/cim-boot-server.ipr" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cim-boot-server.iws" beforeDir="false" afterPath="$PROJECT_DIR$/cim-boot-server.iws" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/farsunset/cim/component/handler/ClosedHandler.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/farsunset/cim/component/handler/ClosedHandler.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../cim-server-sdk/src/main/java/com/farsunset/cim/sdk/server/group/SessionGroup.java" beforeDir="false" afterPath="$PROJECT_DIR$/../cim-server-sdk/src/main/java/com/farsunset/cim/sdk/server/group/SessionGroup.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/libs/cim-server-sdk-netty-4.0.0.jar" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/farsunset/cim/component/handler/BindHandler.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/farsunset/cim/component/handler/BindHandler.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/farsunset/cim/entity/Session.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/farsunset/cim/entity/Session.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/i18n/messages.properties" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/i18n/messages.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/page/console/session/manage.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/page/console/session/manage.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/static/css/common.css" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/static/css/common.css" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/static/js/cim/cim.web.sdk.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/static/js/cim/cim.web.sdk.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../cim-server-sdk/src/main/java/com/farsunset/cim/sdk/server/constant/ChannelAttr.java" beforeDir="false" afterPath="$PROJECT_DIR$/../cim-server-sdk/src/main/java/com/farsunset/cim/sdk/server/constant/ChannelAttr.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -81,6 +86,9 @@
<recent name="$PROJECT_DIR$/src/main/java/com/farsunset/cim/component" />
<recent name="$PROJECT_DIR$/src/main/java/com/farsunset/cim/handler" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/libs" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="com.farsunset.cim.config" />
<recent name="com.farsunset.cim.mvc.controller.admin" />
@ -90,6 +98,17 @@
</key>
</component>
<component name="RunManager">
<configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
<option name="arquillianRunConfiguration">
<value>
<option name="containerStateName" value="" />
</value>
</option>
<option name="TEST_OBJECT" value="class" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="BootApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
<module name="cim-boot-server" />
<extension name="coverage">
@ -149,12 +168,24 @@
<workItem from="1621948445182" duration="764000" />
<workItem from="1621956423905" duration="116000" />
<workItem from="1622640308758" duration="60000" />
<workItem from="1623930030165" duration="975000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>

View File

@ -67,10 +67,12 @@ public class BindHandler implements CIMRequestHandler {
session.setDeviceName(body.get("deviceName"));
session.setAppVersion(body.get("appVersion"));
session.setOsVersion(body.get("osVersion"));
session.setLanguage(body.get("language"));
channel.attr(ChannelAttr.UID).set(uid);
channel.attr(ChannelAttr.CHANNEL).set(session.getChannel());
channel.attr(ChannelAttr.DEVICE_ID).set(session.getDeviceId());
channel.attr(ChannelAttr.LANGUAGE).set(session.getLanguage());
/*
*存储到数据库

View File

@ -97,6 +97,12 @@ public class Session implements Serializable {
@Column(name = "os_version")
private String osVersion;
/**
* 终端语言
*/
@Column(name = "language")
private String language;
/**
* 登录时间
*/
@ -230,6 +236,14 @@ public class Session implements Serializable {
this.location = location;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public int getState() {
return state;
}

View File

@ -32,6 +32,7 @@ module.common.headlogo = 头像
module.common.homepage = 主页
module.common.website = 网址
module.common.text = 文字
module.common.language = 语言
module.global.error.500.hint = 服务程序发生内部错误
module.global.error.400.hint = 请求参数类型不正确

View File

@ -48,13 +48,14 @@ function doSendMessage(){
<table style="width: 100%" class="utable">
<thead>
<tr class="tableHeader">
<th width="10%"><@spring.message 'module.console.cimsession.account'/></th>
<th width="10%"><@spring.message 'module.console.cimsession.nid'/></th>
<th width="10%"><@spring.message 'module.console.cimsession.channel'/></th>
<th width="20%"><@spring.message 'module.console.cimsession.deviceid'/></th>
<th width="20%"><@spring.message 'module.console.cimsession.device.name'/></th>
<th width="10%"><@spring.message 'module.console.cimsession.app.version'/></th>
<th width="10%"><@spring.message 'module.console.cimsession.os.version'/></th>
<th width="8%"><@spring.message 'module.console.cimsession.account'/></th>
<th width="8%"><@spring.message 'module.console.cimsession.nid'/></th>
<th width="8%"><@spring.message 'module.console.cimsession.channel'/></th>
<th width="15%"><@spring.message 'module.console.cimsession.deviceid'/></th>
<th width="15%"><@spring.message 'module.console.cimsession.device.name'/></th>
<th width="8%"><@spring.message 'module.console.cimsession.app.version'/></th>
<th width="8%"><@spring.message 'module.console.cimsession.os.version'/></th>
<th width="10%"><@spring.message 'module.common.language'/></th>
<th width="10%"><@spring.message 'module.console.cimsession.online.time'/></th>
<th width="10%"><@spring.message "module.common.operation"/></th>
</tr>
@ -69,6 +70,7 @@ function doSendMessage(){
<td>${cimsession.deviceName! }</td>
<td>${cimsession.appVersion! }</td>
<td>${cimsession.osVersion! }</td>
<td>${cimsession.language! }</td>
<td>
<@spring.messageArgs "module.console.cimsession.time.format",[((.now?long - cimsession.bindTime)/1000)?round?c] />
</td>

File diff suppressed because one or more lines are too long

View File

@ -63,6 +63,7 @@ CIMPushManager.bind = function (account) {
body.getDataMap().set("packageName", APP_PACKAGE);
body.getDataMap().set("deviceId", deviceId);
body.getDataMap().set("deviceName", browser.name);
body.getDataMap().set("language", navigator.language);
CIMPushManager.sendRequest(body);
};

View File

@ -63,6 +63,7 @@ CIMPushManager.bind = function (account) {
body.getDataMap().set("packageName", APP_PACKAGE);
body.getDataMap().set("deviceId", deviceId);
body.getDataMap().set("deviceName", browser.name);
body.getDataMap().set("language", navigator.language);
CIMPushManager.sendRequest(body);
};

0
cim-client-sdk/cim-android-sdk/cim-android-sdk.iml Executable file → Normal file
View File

View File

@ -28,11 +28,13 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.LocaleList;
import android.text.TextUtils;
import com.farsunset.cim.sdk.android.logger.CIMLogger;
import com.farsunset.cim.sdk.android.constant.CIMConstant;
import com.farsunset.cim.sdk.android.model.SentBody;
import java.util.Locale;
import java.util.UUID;
/**
@ -161,6 +163,7 @@ public class CIMPushManager {
sent.put("appVersion", getVersionName(context));
sent.put("osVersion", Build.VERSION.RELEASE);
sent.put("packageName", context.getPackageName());
sent.put("language", getLanguage());
sent.setTimestamp(System.currentTimeMillis());
sendRequest(context, sent);
}
@ -293,4 +296,10 @@ public class CIMPushManager {
return deviceId;
}
private static String getLanguage(){
Locale locale = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? LocaleList.getDefault().get(0) : Locale.getDefault();
return locale.getLanguage() + "-" + locale.getCountry();
}
}

View File

@ -9,4 +9,5 @@ public interface ChannelAttr {
AttributeKey<String> ID = AttributeKey.valueOf("id");
AttributeKey<String> DEVICE_ID = AttributeKey.valueOf("device_id");
AttributeKey<String> TAG = AttributeKey.valueOf("tag");
AttributeKey<String> LANGUAGE = AttributeKey.valueOf("language");
}

View File

@ -67,6 +67,7 @@ const onbindAccount = CIMPushManager.bindAccount = function (account) {
body.getDataMap().set("packageName", APP_PACKAGE);
body.getDataMap().set("deviceId", deviceId);
body.getDataMap().set("deviceName", browser.name);
body.getDataMap().set("language", navigator.language);
CIMPushManager.sendRequest(body);
};