Permalink
Browse files

first commit

  • Loading branch information...
1 parent 1191986 commit 8e57e8c76bf53d5b29bc6c9848353c2e7cbd0524 @kaven276 committed May 28, 2012
View
@@ -0,0 +1 @@
+node_sms
View
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="LanguageInjectionConfiguration">
+ <injection language="CSS" injector-id="xml">
+ <display-name>form</display-name>
+ <place><![CDATA[xmlTag().withLocalName(string().equalTo("form")).withNamespace(string().equalTo("http://www.w3.org/1999/html"))]]></place>
+ </injection>
+ </component>
+</project>
+
View
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
- <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
+ <file url="file://$PROJECT_DIR$/lib/test.js" charset="UTF-8" />
+ </component>
</project>
View
@@ -1,54 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
- <component name="JavaScriptLibraryMappings">
- <file url="PROJECT" libraries="{Node.js v0.6.2 Core Library}" />
- <excludedPredefinedLibrary name="AJAX" />
- <excludedPredefinedLibrary name="DHTML" />
- <excludedPredefinedLibrary name="DOM Core" />
- <excludedPredefinedLibrary name="DOM Events" />
- <excludedPredefinedLibrary name="DOM Traversal And Range" />
- <excludedPredefinedLibrary name="DOM XPath" />
- <excludedPredefinedLibrary name="EcmaScript L5" />
- <excludedPredefinedLibrary name="EcmaScript for XML" />
- <excludedPredefinedLibrary name="HTML 5" />
- <excludedPredefinedLibrary name="WebGL" />
- </component>
- <component name="ProjectInspectionProfilesVisibleTreeState">
- <entry key="Project Default">
- <profile-state>
- <expanded-state>
- <State>
- <id />
- </State>
- </expanded-state>
- <selected-state>
- <State>
- <id>CSS</id>
- </State>
- </selected-state>
- </profile-state>
- </entry>
- </component>
<component name="ProjectResources">
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
</component>
<component name="ProjectRootManager" version="2" />
- <component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false">
- <option name="USER" value="" />
- <option name="PASSWORD" value="" />
- <option name="mySSHConnectionTimeout" value="30000" />
- <option name="mySSHReadTimeout" value="30000" />
- <option name="LAST_MERGED_REVISION" />
- <option name="MERGE_DRY_RUN" value="false" />
- <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
- <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
- <option name="IGNORE_SPACES_IN_MERGE" value="false" />
- <option name="DETECT_NESTED_COPIES" value="true" />
- <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
- <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
- <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
- <option name="FORCE_UPDATE" value="false" />
- <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
- </component>
</project>
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -4,4 +4,8 @@ using node to implement the telecommunication industry's SGIP/SMPP protocol for
How oracle send request to this NodeJS SMS proxy module.
====
-dsdsddfdf扥扥扥扥扥送扥冬粉东方斯扥冬粉
+
+
+ The node_sms module SP will convert a SMG for SP as a local API call, you can use
+
+ SP.send(new Submit([tele number ...], content), function(err, sendMsg, respMsg) );
View
@@ -0,0 +1,130 @@
+-- may one content send by both end user and sp+gid+, that case, it must use two record for them
+-- 0x system function, total=9
+-- 1xx, big and import gid/org/enterprise, total=100, manual assigned
+-- 2xxx - 9xxx, other gids, total = 8000, automatically assigned
+
+-- Create table
+create table SMS_CONTENT_T
+(
+ CID NUMBER(16) not null,
+ ENCODE VARCHAR2(30),
+ CONTENT VARCHAR2(2000) not null,
+ SENDER VARCHAR2(11),
+ PAYER varchar2(11),
+ INSERT_TIME DATE default sysdate not null,
+ TAR_COUNT NUMBER(6)
+);
+
+-- Add comments to the columns
+comment on column SMS_CONTENT_T.CID
+ is 'SMS content index ID';
+
+comment on column SMS_CONTENT_T.ENCODE
+ is 'maybe unicode or special charset, or binary encoded with base64 encoding';
+
+comment on column SMS_CONTENT_T.CONTENT
+ is 'SMS content, may have :1 :2 placeholder';
+
+comment on column SMS_CONTENT_T.SENDER
+ is 'sender: for SMPP, from mobile user number; for SGIP SP, trailing number after SP number';
+
+comment on column SMS_CONTENT_T.PAYER
+ is 'for SGIP submit, specify who pay for the bill, 0 for free, null for SMPP';
+
+comment on column SMS_CONTENT_T.TAR_COUNT
+ is 'number of target numbers';
+
+-- Create/Recreate primary, unique and foreign key constraints
+alter table SMS_CONTENT_T
+ add constraint PK_SMS_CONTENT primary key (CID)
+;
+
+-- Create/Recreate indexes
+create index IX_SMS_SENDER on SMS_CONTENT_T (SENDER)
+ compress;
+
+create index IX_SMS_PAYER on SMS_CONTENT_T (nullif(PAYER,'0'))
+ compress;
+
+
+Create table SP_SMS_T
+(
+ SRC_NODE_ID NUMBER(10),
+ CMD_TIME DATE,
+ CMD_SEQ NUMBER(10),
+ target VARCHAR2(24),
+ CID NUMBER(16),
+ SUBSTITUTES VARCHAR2(100),
+ BYTES NUMBER(4),
+ REPORT_FLAG CHAR(1),
+ DISPOSAL_STS CHAR(1) default 'W',
+ RET_CODE NUMBER,
+ STATUS_TIME DATE,
+ reply varchar2(254)
+);
+-- Add comments to the table
+comment on table SP_SMS_T
+ is 'SP SMS send pool';
+-- Add comments to the columns
+comment on column SP_SMS_T.SRC_NODE_ID
+ is 'SP NODE ID for SGIP';
+comment on column SP_SMS_T.CMD_TIME
+ is 'SMS create time';
+comment on column SP_SMS_T.CMD_SEQ
+ is 'SMS sequence for SGIP';
+
+comment on column SP_SMS_T.target
+ is 'target user number';
+comment on column SP_SMS_T.CID
+ is 'content index ID';
+comment on column SP_SMS_T.SUBSTITUTES
+ is 'substitude values';
+comment on column SP_SMS_T.BYTES
+ is 'bytes of SMS content';
+comment on column SP_SMS_T.REPORT_FLAG
+ is 'if report needed, Y,N,null(default as N)';
+
+comment on column SP_SMS_T.DISPOSAL_STS
+ is 'W waiting, Q queue for flow control, S reach SMG, 0 final failure, 1 final success';
+comment on column SP_SMS_T.RET_CODE
+ is 'return code from SMG';
+comment on column SP_SMS_T.STATUS_TIME
+ is 'time of status update';
+comment on column SP_SMS_T.REPLY
+ is 'user replay if it have';
+
+
+-- Create/Recreate primary, unique and foreign key constraints
+alter table SP_SMS_T
+ add constraint PK_SP_SMS primary key (SRC_NODE_ID,CMD_TIME,CMD_SEQ,target)
+ ;
+alter table SP_SMS_T
+ add constraint FK_SP_SMS_CID foreign key (CID)
+ references SMS_CONTENT_T (CID) on delete cascade;
+
+
+-- Create sequence
+create sequence S_CID
+minvalue 1
+maxvalue 9999999999999999
+start with 1
+increment by 1
+cache 10;
+
+
+-- Create sequence
+create sequence s_sp_zx
+minvalue 0
+maxvalue 4294967295
+start with 0
+increment by 1
+cycle
+nocache;
+
+create sequence s_sp_hy
+minvalue 0
+maxvalue 4294967295
+start with 0
+increment by 1
+cycle
+nocache;
View
@@ -1,29 +1,85 @@
-module.exports = {
- SPNumber : 'text:21',
- ChangeNumber : 'text:21',
- UserCount : 'integer:1',
- UserNumber : 'texts:21',
- CorpId : 'text:5',
- ServiceType : 'text:10',
+var bUnitText = (process.argv[1] === __filename);
+
+var Attrs = module.exports = {
+ srcNodeID : 'integer:4',
+ cmdTime : 'integer:4',
+ cmdSeq : 'integer:4',
+ AgentFlag : 'integer:1',
+ AreaCode : 'text:4', // 号段所在地区长途区号
+ ChargeNumber : 'text:21',
+ Code : 'text:5', // SP企业代码或号段所在地区长途区号, 左对齐,剩余部分填’\0’
+ CorpId : 'text:5', // 企业代码,取值范围0-99999
+ Count : 'integer:1',
+ ErrCode : 'integer:1', // 当State=2时为错误码值,否则为0 // todo : type info
+ ExpireTime : 'text:16',
FeeType : 'integer:1',
FeeValue : 'text:6',
GivenValue : 'text:6',
- AgentFlag : 'integer:1',
+ LoginName : 'text:16',
+ LoginPassword : 'text:16',
+ LoginUser : 'text:16', // SMG的登录用户名
+ LoginType : 'integer:1',
+ Mark : 'text:10', // SP业务代码或手机用户类型。当Type为1时,可表示SP业务代码,该字段为空则不考虑业务代码;当Type为2时,表示手机用户类型;
+ MessageCoding : 'integer:1',
+ MessageContent : 'text:0',
+ MessageLength : 'integer:4',
+ MessageType : 'integer:1',
MorelatetoMTFlag : 'integer:1',
+ NewAreaCode : 'text:4', // 号段所在地区长途区号
+ NewSMGId : 'text:6', // SP所在SMG的节点编号
+ NewSPNumber : 'text:21', // SP的新接入号码
+ NewServiceTag : 'text:10', // 业务代码,该字段为空时不考虑服务特征串
+ NewTeleSeg : 'text:7', // 手机号码段
+ NewTeleType : 'text:1', // 用户类型;0:签约用户,1:如意通
+ NodeId : 'text:6', // todo
+ Number : 'text:21', // 左对齐,剩余部分填’\0’
+ OldSMGId : 'text:6', // SP所在SMG的节点编号
+ OldSPNumber : 'text:21', // SP的原接入号码
+ OldServiceTag : 'text:10', // 业务代码,该字段为空时不考虑服务特征串
+ OldTeleSeg : 'text:7', // 手机号码段
+ OldTeleType : 'text:1', // 用户类型;0:签约用户,1:如意通
+ Password : 'text:16', // SMG的登录密码
Priority : 'integer:1',
- ExpireTime : 'text:16',
- ScheduleTime : 'text:16',
+ ReceiveTime : 'text:12',
ReportFlag : 'integer:1',
- TP_pid : 'integer:1',
- TP_udhi : 'integer:1',
- MessageCoding : 'integer:1',
- MessageType : 'integer:1',
- MessageLength : 'integer:4',
- MessageContent : 'text:any',
+ ReportType : 'integer:1', // 0:对先前一条Submit命令的状态报告; 1:对先前一条前转Deliver命令的状态报告
Reserve : 'text:8',
- UserName : 'text:16',
- Password : 'text:16',
Result : 'integer:1',
+ QueryType : 'integer:1', // QueryRoute操作的请求类型
+ ScheduleTime : 'text:16',
+ SendTime : 'text:12',
+ ServiceTag : 'text:10', // 业务代码,该字段为空时不考虑服务特征串
+ ServiceType : 'text:10',
+ SMGId : 'text:6', // SP所在SMG的节点编号
+ SMGIP : 'integer:4', // SMG IP地址号
+ SPNumber : 'text:21',
+ State : 'integer:1', // 0:发送成功; 1:等待发送; 2:发送失败
Status : 'integer:1',
- UserCondition : 'integer:1'
+ SubmitSequenceNumber : 'integer:12',
+ TeleSeg : 'text:7', // 手机号码段
+ TeleType : 'text:1', // 用户类型;0:签约用户,1:如意通
+ TP_pid : 'integer:1',
+ TP_udhi : 'integer:1',
+ Type : 'integer:1', // QueryRoute 的类型
+ UserCondition : 'integer:1',
+ UserCount : 'integer:1',
+ UserName : 'text:16',
+ UserNumber : 'text:21'
};
+
+// use class for efficiency
+function Attr(name, pair){
+ this.name = name;
+ this.datatype = pair[0];
+ this.length = parseInt(pair[1]);
+}
+
+// convert strings to instances of Attr class
+for (var n in Attrs) {
+ var pair = Attrs[n].split(':');
+ Attrs[n] = new Attr(n, pair);
+}
+
+if (bUnitText) {
+ console.log(module.exports);
+}
Oops, something went wrong.

0 comments on commit 8e57e8c

Please sign in to comment.