Commit 925afddc by zhangyunjie

数据库

parent 5970a5f5
...@@ -207,8 +207,9 @@ ...@@ -207,8 +207,9 @@
A9D1B31B24F34C25000F4662 /* OffcnIMSocketManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B31A24F34C25000F4662 /* OffcnIMSocketManager.m */; }; A9D1B31B24F34C25000F4662 /* OffcnIMSocketManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B31A24F34C25000F4662 /* OffcnIMSocketManager.m */; };
A9D1B32224F50973000F4662 /* OffcnIMModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B32124F50973000F4662 /* OffcnIMModel.m */; }; A9D1B32224F50973000F4662 /* OffcnIMModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B32124F50973000F4662 /* OffcnIMModel.m */; };
A9D1B32E24F7BE7B000F4662 /* OffcnZYJTestDataStorageView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B32C24F7BE7B000F4662 /* OffcnZYJTestDataStorageView.m */; }; A9D1B32E24F7BE7B000F4662 /* OffcnZYJTestDataStorageView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B32C24F7BE7B000F4662 /* OffcnZYJTestDataStorageView.m */; };
A9D1B33624FE1652000F4662 /* oimcore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9D1B33424FE164C000F4662 /* oimcore.framework */; }; A9D1B33A24FE2DAC000F4662 /* oimcore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9D1B33824FE2DA7000F4662 /* oimcore.framework */; };
A9D1B33724FE1652000F4662 /* oimcore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A9D1B33424FE164C000F4662 /* oimcore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; A9D1B33B24FE2DAC000F4662 /* oimcore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A9D1B33824FE2DA7000F4662 /* oimcore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
A9D1B33E24FE3BE6000F4662 /* OffcnIMSqliteTestVC.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B33D24FE3BE6000F4662 /* OffcnIMSqliteTestVC.m */; };
B94FCB1053F8932068A11CC9 /* libPods-OffcnIMSDKiOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 49CE5E230A14D9B821170F61 /* libPods-OffcnIMSDKiOS.a */; }; B94FCB1053F8932068A11CC9 /* libPods-OffcnIMSDKiOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 49CE5E230A14D9B821170F61 /* libPods-OffcnIMSDKiOS.a */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
...@@ -219,7 +220,7 @@ ...@@ -219,7 +220,7 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
A9D1B33724FE1652000F4662 /* oimcore.framework in Embed Frameworks */, A9D1B33B24FE2DAC000F4662 /* oimcore.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -646,7 +647,9 @@ ...@@ -646,7 +647,9 @@
A9D1B32124F50973000F4662 /* OffcnIMModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OffcnIMModel.m; sourceTree = "<group>"; }; A9D1B32124F50973000F4662 /* OffcnIMModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OffcnIMModel.m; sourceTree = "<group>"; };
A9D1B32C24F7BE7B000F4662 /* OffcnZYJTestDataStorageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OffcnZYJTestDataStorageView.m; sourceTree = "<group>"; }; A9D1B32C24F7BE7B000F4662 /* OffcnZYJTestDataStorageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OffcnZYJTestDataStorageView.m; sourceTree = "<group>"; };
A9D1B32D24F7BE7B000F4662 /* OffcnZYJTestDataStorageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OffcnZYJTestDataStorageView.h; sourceTree = "<group>"; }; A9D1B32D24F7BE7B000F4662 /* OffcnZYJTestDataStorageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OffcnZYJTestDataStorageView.h; sourceTree = "<group>"; };
A9D1B33424FE164C000F4662 /* oimcore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = oimcore.framework; sourceTree = "<group>"; }; A9D1B33824FE2DA7000F4662 /* oimcore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = oimcore.framework; sourceTree = "<group>"; };
A9D1B33C24FE3BE6000F4662 /* OffcnIMSqliteTestVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OffcnIMSqliteTestVC.h; sourceTree = "<group>"; };
A9D1B33D24FE3BE6000F4662 /* OffcnIMSqliteTestVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OffcnIMSqliteTestVC.m; sourceTree = "<group>"; };
D7DCDED1DEE7F99F223D5C73 /* Pods-OffcnIMSDKiOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OffcnIMSDKiOS.release.xcconfig"; path = "Target Support Files/Pods-OffcnIMSDKiOS/Pods-OffcnIMSDKiOS.release.xcconfig"; sourceTree = "<group>"; }; D7DCDED1DEE7F99F223D5C73 /* Pods-OffcnIMSDKiOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OffcnIMSDKiOS.release.xcconfig"; path = "Target Support Files/Pods-OffcnIMSDKiOS/Pods-OffcnIMSDKiOS.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
...@@ -659,7 +662,7 @@ ...@@ -659,7 +662,7 @@
A96621F624EA84230024EB54 /* libsqlite3.tbd in Frameworks */, A96621F624EA84230024EB54 /* libsqlite3.tbd in Frameworks */,
A96621F524EA84160024EB54 /* libxml2.tbd in Frameworks */, A96621F524EA84160024EB54 /* libxml2.tbd in Frameworks */,
A96621EF24EA83A80024EB54 /* SystemConfiguration.framework in Frameworks */, A96621EF24EA83A80024EB54 /* SystemConfiguration.framework in Frameworks */,
A9D1B33624FE1652000F4662 /* oimcore.framework in Frameworks */, A9D1B33A24FE2DAC000F4662 /* oimcore.framework in Frameworks */,
A96621F124EA83B10024EB54 /* CoreTelephony.framework in Frameworks */, A96621F124EA83B10024EB54 /* CoreTelephony.framework in Frameworks */,
B94FCB1053F8932068A11CC9 /* libPods-OffcnIMSDKiOS.a in Frameworks */, B94FCB1053F8932068A11CC9 /* libPods-OffcnIMSDKiOS.a in Frameworks */,
); );
...@@ -698,7 +701,7 @@ ...@@ -698,7 +701,7 @@
A9661B4224EA64EE0024EB54 /* OffcnIMSDKiOS */ = { A9661B4224EA64EE0024EB54 /* OffcnIMSDKiOS */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A9D1B33424FE164C000F4662 /* oimcore.framework */, A9D1B33824FE2DA7000F4662 /* oimcore.framework */,
A9662CBF24ECD98B0024EB54 /* OffcnIMSDKiOS.entitlements */, A9662CBF24ECD98B0024EB54 /* OffcnIMSDKiOS.entitlements */,
A966274724EBA36A0024EB54 /* ExposedInterface-(外放接口) */, A966274724EBA36A0024EB54 /* ExposedInterface-(外放接口) */,
A9661FC824EA7AD10024EB54 /* Common-(宏) */, A9661FC824EA7AD10024EB54 /* Common-(宏) */,
...@@ -707,6 +710,8 @@ ...@@ -707,6 +710,8 @@
A9661B5E24EA72900024EB54 /* AppDelegate.m */, A9661B5E24EA72900024EB54 /* AppDelegate.m */,
A9661B5D24EA72900024EB54 /* ViewController.h */, A9661B5D24EA72900024EB54 /* ViewController.h */,
A9661B5F24EA72900024EB54 /* ViewController.mm */, A9661B5F24EA72900024EB54 /* ViewController.mm */,
A9D1B33C24FE3BE6000F4662 /* OffcnIMSqliteTestVC.h */,
A9D1B33D24FE3BE6000F4662 /* OffcnIMSqliteTestVC.m */,
A9D1B32D24F7BE7B000F4662 /* OffcnZYJTestDataStorageView.h */, A9D1B32D24F7BE7B000F4662 /* OffcnZYJTestDataStorageView.h */,
A9D1B32C24F7BE7B000F4662 /* OffcnZYJTestDataStorageView.m */, A9D1B32C24F7BE7B000F4662 /* OffcnZYJTestDataStorageView.m */,
A9661B6224EA729A0024EB54 /* Main.storyboard */, A9661B6224EA729A0024EB54 /* Main.storyboard */,
...@@ -1734,6 +1739,7 @@ ...@@ -1734,6 +1739,7 @@
A96621A324EA80A60024EB54 /* ZYJOSSLog.m in Sources */, A96621A324EA80A60024EB54 /* ZYJOSSLog.m in Sources */,
A96621D824EA80A60024EB54 /* ZYJMQTTCoreDataPersistence.m in Sources */, A96621D824EA80A60024EB54 /* ZYJMQTTCoreDataPersistence.m in Sources */,
A9661FE224EA7AD10024EB54 /* NSMutableAttributedString+SDSize.m in Sources */, A9661FE224EA7AD10024EB54 /* NSMutableAttributedString+SDSize.m in Sources */,
A9D1B33E24FE3BE6000F4662 /* OffcnIMSqliteTestVC.m in Sources */,
A966218F24EA80A60024EB54 /* ZYJMJRefreshAutoStateFooter.m in Sources */, A966218F24EA80A60024EB54 /* ZYJMJRefreshAutoStateFooter.m in Sources */,
A96621E824EA80A60024EB54 /* ZYJAFNetworkReachabilityManager.m in Sources */, A96621E824EA80A60024EB54 /* ZYJAFNetworkReachabilityManager.m in Sources */,
A96621A524EA80A60024EB54 /* ZYJOSSGetBucketInfoRequest.m in Sources */, A96621A524EA80A60024EB54 /* ZYJOSSGetBucketInfoRequest.m in Sources */,
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="上传图片/视频/文件"/> <state key="normal" title="上传图片/视频/文件"/>
<connections> <connections>
<action selector="uploadFile:" destination="BYZ-38-t0r" eventType="touchUpInside" id="f1e-t6-rq0"/> <action selector="uploadImage:" destination="BYZ-38-t0r" eventType="touchUpInside" id="eO0-RH-EOA"/>
</connections> </connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bxC-wQ-owS"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bxC-wQ-owS">
...@@ -156,6 +156,13 @@ ...@@ -156,6 +156,13 @@
<action selector="getImage:" destination="BYZ-38-t0r" eventType="touchUpInside" id="cbb-Dd-m3G"/> <action selector="getImage:" destination="BYZ-38-t0r" eventType="touchUpInside" id="cbb-Dd-m3G"/>
</connections> </connections>
</button> </button>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="01u-sn-4fM">
<rect key="frame" x="219" y="487" width="60" height="60"/>
<constraints>
<constraint firstAttribute="height" constant="60" id="ER0-mY-ms3"/>
<constraint firstAttribute="width" constant="60" id="vhI-Da-dhK"/>
</constraints>
</imageView>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="请输入消息内容" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="9C8-lY-VAg"> <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="请输入消息内容" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="9C8-lY-VAg">
<rect key="frame" x="143" y="273" width="217" height="34"/> <rect key="frame" x="143" y="273" width="217" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/> <fontDescription key="fontDescription" type="system" pointSize="14"/>
...@@ -179,13 +186,22 @@ ...@@ -179,13 +186,22 @@
<fontDescription key="fontDescription" type="system" pointSize="14"/> <fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/> <textInputTraits key="textInputTraits"/>
</textField> </textField>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="01u-sn-4fM"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8PJ-g2-nFJ">
<rect key="frame" x="219" y="487" width="60" height="60"/> <rect key="frame" x="15" y="522" width="62" height="30"/>
<constraints> <color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraint firstAttribute="height" constant="60" id="ER0-mY-ms3"/> <state key="normal" title="上传文件"/>
<constraint firstAttribute="width" constant="60" id="vhI-Da-dhK"/> <connections>
</constraints> <action selector="uploadFile:" destination="BYZ-38-t0r" eventType="touchUpInside" id="D5i-1H-mCc"/>
</imageView> </connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0ox-b2-eLv">
<rect key="frame" x="314" y="347" width="46" height="30"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="数据库"/>
<connections>
<segue destination="2by-9C-78c" kind="push" id="fvn-k7-WRW"/>
</connections>
</button>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
...@@ -219,8 +235,10 @@ ...@@ -219,8 +235,10 @@
<constraint firstItem="bxC-wQ-owS" firstAttribute="leading" secondItem="Cy1-S1-DPz" secondAttribute="trailing" constant="5" id="Rdx-7e-eh7"/> <constraint firstItem="bxC-wQ-owS" firstAttribute="leading" secondItem="Cy1-S1-DPz" secondAttribute="trailing" constant="5" id="Rdx-7e-eh7"/>
<constraint firstItem="8TM-yv-Un7" firstAttribute="top" secondItem="W7X-2X-xsv" secondAttribute="bottom" constant="5" id="TCv-SS-inh"/> <constraint firstItem="8TM-yv-Un7" firstAttribute="top" secondItem="W7X-2X-xsv" secondAttribute="bottom" constant="5" id="TCv-SS-inh"/>
<constraint firstItem="FOH-XA-D8x" firstAttribute="height" secondItem="dRe-f0-gnl" secondAttribute="height" id="TGa-pW-zYt"/> <constraint firstItem="FOH-XA-D8x" firstAttribute="height" secondItem="dRe-f0-gnl" secondAttribute="height" id="TGa-pW-zYt"/>
<constraint firstItem="8PJ-g2-nFJ" firstAttribute="top" secondItem="Cy1-S1-DPz" secondAttribute="bottom" constant="5" id="Tjy-h1-vZN"/>
<constraint firstItem="9C8-lY-VAg" firstAttribute="bottom" secondItem="TnX-iH-azN" secondAttribute="bottom" id="UMk-Jo-juB"/> <constraint firstItem="9C8-lY-VAg" firstAttribute="bottom" secondItem="TnX-iH-azN" secondAttribute="bottom" id="UMk-Jo-juB"/>
<constraint firstItem="TnX-iH-azN" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="15" id="UOK-BA-rIV"/> <constraint firstItem="TnX-iH-azN" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="15" id="UOK-BA-rIV"/>
<constraint firstItem="0ox-b2-eLv" firstAttribute="top" secondItem="9JE-Lz-Dma" secondAttribute="top" id="Wtn-mc-a6W"/>
<constraint firstItem="9C8-lY-VAg" firstAttribute="leading" secondItem="TnX-iH-azN" secondAttribute="trailing" constant="5" id="XgB-GO-lOM"/> <constraint firstItem="9C8-lY-VAg" firstAttribute="leading" secondItem="TnX-iH-azN" secondAttribute="trailing" constant="5" id="XgB-GO-lOM"/>
<constraint firstItem="Cy1-S1-DPz" firstAttribute="leading" secondItem="dRe-f0-gnl" secondAttribute="leading" id="Y9c-yU-8ZX"/> <constraint firstItem="Cy1-S1-DPz" firstAttribute="leading" secondItem="dRe-f0-gnl" secondAttribute="leading" id="Y9c-yU-8ZX"/>
<constraint firstAttribute="trailing" secondItem="HDM-va-7kG" secondAttribute="trailing" id="YX6-FQ-G4J"/> <constraint firstAttribute="trailing" secondItem="HDM-va-7kG" secondAttribute="trailing" id="YX6-FQ-G4J"/>
...@@ -229,6 +247,7 @@ ...@@ -229,6 +247,7 @@
<constraint firstItem="W7X-2X-xsv" firstAttribute="top" secondItem="so4-rI-aRi" secondAttribute="bottom" constant="5" id="dox-is-kXR"/> <constraint firstItem="W7X-2X-xsv" firstAttribute="top" secondItem="so4-rI-aRi" secondAttribute="bottom" constant="5" id="dox-is-kXR"/>
<constraint firstItem="2eb-Vp-qLt" firstAttribute="leading" secondItem="dRe-f0-gnl" secondAttribute="leading" constant="1" id="e0h-4k-Ucp"/> <constraint firstItem="2eb-Vp-qLt" firstAttribute="leading" secondItem="dRe-f0-gnl" secondAttribute="leading" constant="1" id="e0h-4k-Ucp"/>
<constraint firstItem="8TM-yv-Un7" firstAttribute="leading" secondItem="W7X-2X-xsv" secondAttribute="leading" id="eFf-tb-Hek"/> <constraint firstItem="8TM-yv-Un7" firstAttribute="leading" secondItem="W7X-2X-xsv" secondAttribute="leading" id="eFf-tb-Hek"/>
<constraint firstAttribute="trailing" secondItem="0ox-b2-eLv" secondAttribute="trailing" constant="15" id="eZI-Mq-JLV"/>
<constraint firstItem="9JE-Lz-Dma" firstAttribute="height" secondItem="TnX-iH-azN" secondAttribute="height" id="fRe-gX-tKo"/> <constraint firstItem="9JE-Lz-Dma" firstAttribute="height" secondItem="TnX-iH-azN" secondAttribute="height" id="fRe-gX-tKo"/>
<constraint firstItem="1dp-RW-FhV" firstAttribute="leading" secondItem="TnX-iH-azN" secondAttribute="leading" constant="1" id="gpR-z2-ljd"/> <constraint firstItem="1dp-RW-FhV" firstAttribute="leading" secondItem="TnX-iH-azN" secondAttribute="leading" constant="1" id="gpR-z2-ljd"/>
<constraint firstItem="uRU-q5-QzB" firstAttribute="leading" secondItem="m3k-LM-GSV" secondAttribute="trailing" constant="5" id="hRq-kb-fCs"/> <constraint firstItem="uRU-q5-QzB" firstAttribute="leading" secondItem="m3k-LM-GSV" secondAttribute="trailing" constant="5" id="hRq-kb-fCs"/>
...@@ -237,9 +256,12 @@ ...@@ -237,9 +256,12 @@
<constraint firstItem="9JE-Lz-Dma" firstAttribute="leading" secondItem="TnX-iH-azN" secondAttribute="leading" constant="1" id="kqV-nZ-dh4"/> <constraint firstItem="9JE-Lz-Dma" firstAttribute="leading" secondItem="TnX-iH-azN" secondAttribute="leading" constant="1" id="kqV-nZ-dh4"/>
<constraint firstItem="HDM-va-7kG" firstAttribute="top" secondItem="a21-3W-10n" secondAttribute="bottom" id="lS8-hA-rmu"/> <constraint firstItem="HDM-va-7kG" firstAttribute="top" secondItem="a21-3W-10n" secondAttribute="bottom" id="lS8-hA-rmu"/>
<constraint firstItem="7fD-Hf-Afy" firstAttribute="leading" secondItem="TnX-iH-azN" secondAttribute="leading" id="lea-oR-ecV"/> <constraint firstItem="7fD-Hf-Afy" firstAttribute="leading" secondItem="TnX-iH-azN" secondAttribute="leading" id="lea-oR-ecV"/>
<constraint firstItem="8PJ-g2-nFJ" firstAttribute="height" secondItem="Cy1-S1-DPz" secondAttribute="height" id="mu7-nm-jrq"/>
<constraint firstItem="m3k-LM-GSV" firstAttribute="height" secondItem="dRe-f0-gnl" secondAttribute="height" id="nTZ-4F-JJU"/> <constraint firstItem="m3k-LM-GSV" firstAttribute="height" secondItem="dRe-f0-gnl" secondAttribute="height" id="nTZ-4F-JJU"/>
<constraint firstItem="1dp-RW-FhV" firstAttribute="height" secondItem="TnX-iH-azN" secondAttribute="height" id="pCJ-es-iPl"/> <constraint firstItem="1dp-RW-FhV" firstAttribute="height" secondItem="TnX-iH-azN" secondAttribute="height" id="pCJ-es-iPl"/>
<constraint firstItem="8PJ-g2-nFJ" firstAttribute="leading" secondItem="Cy1-S1-DPz" secondAttribute="leading" id="qno-dF-byX"/>
<constraint firstItem="1dp-RW-FhV" firstAttribute="top" secondItem="TnX-iH-azN" secondAttribute="bottom" constant="5" id="ta0-ZL-iPP"/> <constraint firstItem="1dp-RW-FhV" firstAttribute="top" secondItem="TnX-iH-azN" secondAttribute="bottom" constant="5" id="ta0-ZL-iPP"/>
<constraint firstItem="0ox-b2-eLv" firstAttribute="height" secondItem="9JE-Lz-Dma" secondAttribute="height" id="tmo-3Y-Tcf"/>
<constraint firstItem="Vmx-zP-DRW" firstAttribute="height" secondItem="dRe-f0-gnl" secondAttribute="height" id="uLF-IL-l61"/> <constraint firstItem="Vmx-zP-DRW" firstAttribute="height" secondItem="dRe-f0-gnl" secondAttribute="height" id="uLF-IL-l61"/>
<constraint firstItem="Cy1-S1-DPz" firstAttribute="top" secondItem="m3k-LM-GSV" secondAttribute="bottom" constant="5" id="vHt-ft-Hyf"/> <constraint firstItem="Cy1-S1-DPz" firstAttribute="top" secondItem="m3k-LM-GSV" secondAttribute="bottom" constant="5" id="vHt-ft-Hyf"/>
<constraint firstItem="Vmx-zP-DRW" firstAttribute="leading" secondItem="dRe-f0-gnl" secondAttribute="trailing" constant="5" id="vfp-Yh-YD6"/> <constraint firstItem="Vmx-zP-DRW" firstAttribute="leading" secondItem="dRe-f0-gnl" secondAttribute="trailing" constant="5" id="vfp-Yh-YD6"/>
...@@ -264,5 +286,71 @@ ...@@ -264,5 +286,71 @@
</objects> </objects>
<point key="canvasLocation" x="132" y="133.5832083958021"/> <point key="canvasLocation" x="132" y="133.5832083958021"/>
</scene> </scene>
<!--OffcnIM Sqlite TestVC-->
<scene sceneID="hcv-uv-YGK">
<objects>
<viewController id="2by-9C-78c" customClass="OffcnIMSqliteTestVC" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="gRc-11-2rD"/>
<viewControllerLayoutGuide type="bottom" id="5Te-7X-gHr"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Lef-sG-R6x">
<rect key="frame" x="0.0" y="0.0" width="375" height="647"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hI0-jm-bPD">
<rect key="frame" x="15" y="20" width="62" height="30"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="删除记录"/>
<connections>
<action selector="deleteRecord:" destination="2by-9C-78c" eventType="touchUpInside" id="b1U-mz-kpN"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AOb-iX-raM">
<rect key="frame" x="15" y="55" width="62" height="30"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="删除表格"/>
<connections>
<action selector="deleteTable:" destination="2by-9C-78c" eventType="touchUpInside" id="6Rd-bU-31Z"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IOW-P1-885">
<rect key="frame" x="15" y="90" width="92" height="30"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="查询聊天列表"/>
<connections>
<action selector="queryChatList:" destination="2by-9C-78c" eventType="touchUpInside" id="B4E-F3-D8x"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="F7Q-um-fFq">
<rect key="frame" x="15" y="125" width="62" height="30"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="查询聊天"/>
<connections>
<action selector="queryChat:" destination="2by-9C-78c" eventType="touchUpInside" id="tyc-6A-ewd"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="F7Q-um-fFq" firstAttribute="height" secondItem="hI0-jm-bPD" secondAttribute="height" id="25O-Jc-7Qt"/>
<constraint firstItem="AOb-iX-raM" firstAttribute="height" secondItem="hI0-jm-bPD" secondAttribute="height" id="4Kb-uG-fJZ"/>
<constraint firstItem="F7Q-um-fFq" firstAttribute="top" secondItem="IOW-P1-885" secondAttribute="bottom" constant="5" id="8tT-WD-O7J"/>
<constraint firstItem="F7Q-um-fFq" firstAttribute="leading" secondItem="hI0-jm-bPD" secondAttribute="leading" id="Ho3-Xh-Brc"/>
<constraint firstItem="hI0-jm-bPD" firstAttribute="leading" secondItem="Lef-sG-R6x" secondAttribute="leading" constant="15" id="SBW-v4-A42"/>
<constraint firstItem="IOW-P1-885" firstAttribute="top" secondItem="AOb-iX-raM" secondAttribute="bottom" constant="5" id="UrS-kL-0Ws"/>
<constraint firstItem="AOb-iX-raM" firstAttribute="leading" secondItem="hI0-jm-bPD" secondAttribute="leading" id="Ytd-Ib-44I"/>
<constraint firstItem="AOb-iX-raM" firstAttribute="top" secondItem="hI0-jm-bPD" secondAttribute="bottom" constant="5" id="ePG-0i-oLK"/>
<constraint firstItem="IOW-P1-885" firstAttribute="leading" secondItem="hI0-jm-bPD" secondAttribute="leading" id="oiv-y2-5T1"/>
<constraint firstItem="IOW-P1-885" firstAttribute="height" secondItem="hI0-jm-bPD" secondAttribute="height" id="ptF-6e-E7L"/>
<constraint firstItem="hI0-jm-bPD" firstAttribute="top" secondItem="gRc-11-2rD" secondAttribute="bottom" constant="20" id="x9c-8T-gYq"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="U4W-nu-TVd"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="JTi-eC-dSM" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="898" y="135"/>
</scene>
</scenes> </scenes>
</document> </document>
// //
...@@ -221,6 +221,33 @@ static OffcnIMSDKiOS *liveTelecastSDK; ...@@ -221,6 +221,33 @@ static OffcnIMSDKiOS *liveTelecastSDK;
[dataDic setObjectOnSafe:[NSNumber numberWithLongLong:folderSize] forKey:@"size"]; [dataDic setObjectOnSafe:[NSNumber numberWithLongLong:folderSize] forKey:@"size"];
} }
OffcnIMMsgModel *MsgModel = [[OffcnIMMsgModel alloc] init];
OffcnIMBodyModel *BodyModel = [[OffcnIMBodyModel alloc] init];
BodyModel.msg_from = msg_fromID;
BodyModel.msg_to = msg_toID;
BodyModel.msg_type = msg_type;
BodyModel.tid = tidStr;
BodyModel.isSentSuccess = 0;
BodyModel.bymyself = 1;
BodyModel.isRead = 0;
if (msg_type == 1) {
MsgModel.msg = [dataDic objectForKeyOnSafe:@"msg"];
}else{
MsgModel.dur = [[dataDic objectForKeyOnSafe:@"dur"] longLongValue];
MsgModel.name = [dataDic objectForKeyOnSafe:@"name"];
MsgModel.md5 = [dataDic objectForKeyOnSafe:@"md5"];
MsgModel.url = [dataDic objectForKeyOnSafe:@"url"];
MsgModel.thumb_url = [dataDic objectForKeyOnSafe:@"thumb_url"];
MsgModel.cover_url = [dataDic objectForKeyOnSafe:@"cover_url"];
MsgModel.ext = [dataDic objectForKeyOnSafe:@"ext"];
MsgModel.w = [[dataDic objectForKeyOnSafe:@"w"] longLongValue];
MsgModel.h = [[dataDic objectForKeyOnSafe:@"h"] longLongValue];
MsgModel.size = [[dataDic objectForKeyOnSafe:@"size"] longLongValue];
}
BodyModel.msg = MsgModel;
[[OffcnIMZYJFMDBHandler sharedInstance] updateChatInfoIsSendStatusToFMDBWithModel:BodyModel isSuccess:nil];
[[OffcnIMZYJFMDBHandler sharedInstance] chatlistCacheInfo:BodyModel callback:nil];
[OffcnNetworkExecutor requestSendMsgWithMsg_fromID:msg_fromID msg_toID:msg_toID msg_type:msg_type tid:tidStr msg:dataDic Finished:^(BOOL success, OffcnIMSendMsgModel *sendMsgModel, BaseResponse *baseResponse) { [OffcnNetworkExecutor requestSendMsgWithMsg_fromID:msg_fromID msg_toID:msg_toID msg_type:msg_type tid:tidStr msg:dataDic Finished:^(BOOL success, OffcnIMSendMsgModel *sendMsgModel, BaseResponse *baseResponse) {
finished(success,sendMsgModel,baseResponse.errorMessage); finished(success,sendMsgModel,baseResponse.errorMessage);
......
// //
...@@ -49,8 +49,16 @@ static OffcnIMSocketManager *socketManager; ...@@ -49,8 +49,16 @@ static OffcnIMSocketManager *socketManager;
//建立连接 //建立连接
-(void)connectIMServerWithAccount_id:(NSString *)account_id token:(NSString *)token{ -(void)connectIMServerWithAccount_id:(NSString *)account_id token:(NSString *)token{
// connection_type = ["kcp,1281", "websocket,1280"] // kcp和websocket地址信息:
// tls = ["disable", "enable"] // server_ip : "39.102.42.185"
// server_port_websocket : 1280
// server_port_kcp:1281
//
// websocket + tls地址信息:
// server_ip : test-im.offcncloud.com
// server_port : 1279
// connection_type = ["kcp,1281", "websocket,1280"]
// tls = ["disable", "enable"]
self.msg_fromId = account_id; self.msg_fromId = account_id;
......
// //
...@@ -14,10 +14,11 @@ typedef NS_ENUM(NSInteger, UIClearStyle) { ...@@ -14,10 +14,11 @@ typedef NS_ENUM(NSInteger, UIClearStyle) {
UIClearStyleList = 3 //删除系统消息等 UIClearStyleList = 3 //删除系统消息等
}; };
typedef void (^getFMDBHistoryMessagesBlock)(NSArray *messagesArray); @class OffcnIMBodyModel;
typedef void (^getFMDBHistoryMessagesBlock)(NSArray<OffcnIMBodyModel *> *messagesArray);
typedef void (^callBackIsSuccess)(BOOL isSuccess); typedef void (^callBackIsSuccess)(BOOL isSuccess);
@class OffcnIMBodyModel;
@interface OffcnIMZYJFMDBHandler : NSObject @interface OffcnIMZYJFMDBHandler : NSObject
+ (OffcnIMZYJFMDBHandler *)sharedInstance; + (OffcnIMZYJFMDBHandler *)sharedInstance;
...@@ -38,9 +39,9 @@ typedef void (^callBackIsSuccess)(BOOL isSuccess); ...@@ -38,9 +39,9 @@ typedef void (^callBackIsSuccess)(BOOL isSuccess);
//删除表格 //删除表格
- (void)deleteDataTable; - (void)deleteDataTable;
//查询聊天记录(按时间戳倒叙排序) //查询聊天记录(按时间戳倒叙排序)
- (void)getChatInfoArrayWithFromUser:(NSString *)fromUser toUser:(NSString *)toUser limit:(NSString *)limit startIndex:(NSString *)startIndex callback:(getFMDBHistoryMessagesBlock)messagesBack; - (void)getChatRecordArrayWithFromUser:(NSString *)fromUser toUser:(NSString *)toUser limit:(NSString *)limit startIndex:(NSString *)startIndex callback:(getFMDBHistoryMessagesBlock)messagesBack;
//查询聊天列表 //查询聊天列表
- (void)getChatInfoAllDataArrayCallback:(getFMDBHistoryMessagesBlock)messagesBack; - (void)getChatListArrayCallback:(getFMDBHistoryMessagesBlock)messagesBack;
//消息内容 //消息内容
- (NSString *)lastMessage:(OffcnIMBodyModel *)messageModel; - (NSString *)lastMessage:(OffcnIMBodyModel *)messageModel;
@end @end
......
// //
...@@ -70,7 +70,7 @@ static OffcnIMZYJFMDBHandler *FMDBHandler; ...@@ -70,7 +70,7 @@ static OffcnIMZYJFMDBHandler *FMDBHandler;
[_database inDatabase:^(ZYJZYJFMDatabase *db) { [_database inDatabase:^(ZYJZYJFMDatabase *db) {
NSString *sqlStr = @"insert into chatinfo(msg_fromId,msg_toId,tid,session_id,msg_id,version,send_time,msg_seq,msg_scope,msg_type,msg,dur,name,md5,url,thumb_url,cover_url,ext,w,h,size,isSentSuccess,bymyself,isRead) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; NSString *sqlStr = @"insert into chatinfo(msg_fromId,msg_toId,tid,session_id,msg_id,version,send_time,msg_seq,msg_scope,msg_type,msg,dur,name,md5,url,thumb_url,cover_url,ext,w,h,size,isSentSuccess,bymyself,isRead) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
BOOL result = [db executeUpdate:sqlStr,chatModel.msg_from,chatModel.msg_to,chatModel.tid,chatModel.session_id,chatModel.msg_id,chatModel.version,chatModel.send_time,[NSNumber numberWithInteger:chatModel.msg_seq],[NSNumber numberWithInteger:chatModel.msg_scope],[NSNumber numberWithInteger:chatModel.msg_type],chatModel.msg.msg,chatModel.msg.dur,chatModel.msg.name,chatModel.msg.md5,chatModel.msg.url,chatModel.msg.thumb_url,chatModel.msg.cover_url,chatModel.msg.ext,chatModel.msg.w,chatModel.msg.h,chatModel.msg.size,[NSNumber numberWithInteger:chatModel.isSentSuccess],[NSNumber numberWithInteger:chatModel.bymyself],[NSNumber numberWithInteger:chatModel.isRead]]; BOOL result = [db executeUpdate:sqlStr,chatModel.msg_from,chatModel.msg_to,chatModel.tid,chatModel.session_id,chatModel.msg_id,chatModel.version,chatModel.send_time,[NSNumber numberWithInteger:chatModel.msg_seq],[NSNumber numberWithInteger:chatModel.msg_scope],[NSNumber numberWithInteger:chatModel.msg_type],chatModel.msg.msg,[NSNumber numberWithInteger:chatModel.msg.dur],chatModel.msg.name,chatModel.msg.md5,chatModel.msg.url,chatModel.msg.thumb_url,chatModel.msg.cover_url,chatModel.msg.ext,[NSNumber numberWithInteger:chatModel.msg.w],[NSNumber numberWithInteger:chatModel.msg.h],[NSNumber numberWithInteger:chatModel.msg.size],[NSNumber numberWithInteger:chatModel.isSentSuccess],[NSNumber numberWithInteger:chatModel.bymyself],[NSNumber numberWithInteger:chatModel.isRead]];
if (!result) { if (!result) {
NSLog(@"error when insert into database table"); NSLog(@"error when insert into database table");
...@@ -87,8 +87,9 @@ static OffcnIMZYJFMDBHandler *FMDBHandler; ...@@ -87,8 +87,9 @@ static OffcnIMZYJFMDBHandler *FMDBHandler;
} }
[_database inDatabase:^(ZYJZYJFMDatabase *db) { [_database inDatabase:^(ZYJZYJFMDatabase *db) {
NSString *sql = @"update chatinfo set isSentSuccess = ?,msg_id = ?,send_time = ?,session_id = ? where tid = ?"; NSString *sql = @"update chatinfo set isSentSuccess = ?,msg_id = ?,send_time = ?,session_id = ?,msg = ?,name = ?,md5 = ?,url = ?,thumb_url = ?,cover_url = ?,ext = ?,w = ?,h = ?,size = ?,dur = ? where tid = ?";
BOOL result = [db executeUpdate:sql,[NSNumber numberWithInteger:messageModel.isSentSuccess],messageModel.msg_id,messageModel.send_time,messageModel.session_id,messageModel.tid]; BOOL result = [db executeUpdate:sql,[NSNumber numberWithInteger:messageModel.isSentSuccess],messageModel.msg_id,messageModel.send_time,messageModel.session_id,messageModel.msg.msg,messageModel.msg.name,messageModel.msg.md5,messageModel.msg.url,messageModel.msg.thumb_url,messageModel.msg.cover_url,messageModel.msg.ext,[NSNumber numberWithInteger:messageModel.msg.w],[NSNumber numberWithInteger:messageModel.msg.h],[NSNumber numberWithInteger:messageModel.msg.size],[NSNumber numberWithInteger:messageModel.msg.dur],messageModel.tid];
if (!result) { if (!result) {
NSLog(@"error when insert into database table"); NSLog(@"error when insert into database table");
NSLog(@"%d",db.lastErrorCode); NSLog(@"%d",db.lastErrorCode);
...@@ -122,9 +123,9 @@ static OffcnIMZYJFMDBHandler *FMDBHandler; ...@@ -122,9 +123,9 @@ static OffcnIMZYJFMDBHandler *FMDBHandler;
BOOL result = NO; BOOL result = NO;
if (tmpDataArray.count) { if (tmpDataArray.count) {
NSString *sqlStr = @"update chatlist set lastmessage = ?,lastSendtime = ?,session_id = ? where tid = ? or msg_id = ?"; NSString *sqlStr = @"update chatlist set lastmessage = ?,lastSendtime = ?,session_id = ?,tid = ?,msg_id = ?,msg_type = ? where msg_fromId = ? and msg_toId = ?";
NSString *lastmessage = [self lastMessage:chatlistModel]; NSString *lastmessage = [self lastMessage:chatlistModel];
result = [db executeUpdate:sqlStr,lastmessage,chatlistModel.send_time,chatlistModel.session_id,chatlistModel.tid,chatlistModel.msg_id]; result = [db executeUpdate:sqlStr,lastmessage,chatlistModel.send_time,chatlistModel.session_id,chatlistModel.tid,chatlistModel.msg_id,[NSNumber numberWithInteger:chatlistModel.msg_type],chatlistModel.msg_from,chatlistModel.msg_to];
//不存在,插库 //不存在,插库
}else{ }else{
...@@ -276,7 +277,7 @@ static OffcnIMZYJFMDBHandler *FMDBHandler; ...@@ -276,7 +277,7 @@ static OffcnIMZYJFMDBHandler *FMDBHandler;
} }
//查询聊天记录(按时间戳倒叙排序) //查询聊天记录(按时间戳倒叙排序)
- (void)getChatInfoArrayWithFromUser:(NSString *)fromUser toUser:(NSString *)toUser limit:(NSString *)limit startIndex:(NSString *)startIndex callback:(getFMDBHistoryMessagesBlock)messagesBack{ - (void)getChatRecordArrayWithFromUser:(NSString *)fromUser toUser:(NSString *)toUser limit:(NSString *)limit startIndex:(NSString *)startIndex callback:(getFMDBHistoryMessagesBlock)messagesBack{
if (!_database) { if (!_database) {
getFMDBInstance(); getFMDBInstance();
} }
...@@ -303,16 +304,16 @@ static OffcnIMZYJFMDBHandler *FMDBHandler; ...@@ -303,16 +304,16 @@ static OffcnIMZYJFMDBHandler *FMDBHandler;
tmpModel.isRead = [rs intForColumn:@"isRead"]; tmpModel.isRead = [rs intForColumn:@"isRead"];
tmpContentModel.msg = [rs stringForColumn:@"msg"]; tmpContentModel.msg = [rs stringForColumn:@"msg"];
tmpContentModel.dur = [[rs stringForColumn:@"dur"] integerValue]; tmpContentModel.dur = [rs longLongIntForColumn:@"dur"];
tmpContentModel.name = [rs stringForColumn:@"name"]; tmpContentModel.name = [rs stringForColumn:@"name"];
tmpContentModel.md5 = [rs stringForColumn:@"md5"]; tmpContentModel.md5 = [rs stringForColumn:@"md5"];
tmpContentModel.url = [rs stringForColumn:@"url"]; tmpContentModel.url = [rs stringForColumn:@"url"];
tmpContentModel.thumb_url = [rs stringForColumn:@"thumb_url"]; tmpContentModel.thumb_url = [rs stringForColumn:@"thumb_url"];
tmpContentModel.cover_url = [rs stringForColumn:@"cover_url"]; tmpContentModel.cover_url = [rs stringForColumn:@"cover_url"];
tmpContentModel.ext = [rs stringForColumn:@"ext"]; tmpContentModel.ext = [rs stringForColumn:@"ext"];
tmpContentModel.w = [[rs stringForColumn:@"w"] integerValue]; tmpContentModel.w = [rs longLongIntForColumn:@"w"];
tmpContentModel.h = [[rs stringForColumn:@"h"] integerValue]; tmpContentModel.h = [rs longLongIntForColumn:@"h"];
tmpContentModel.size = [[rs stringForColumn:@"size"] integerValue]; tmpContentModel.size = [rs longLongIntForColumn:@"size"];
tmpModel.msg = tmpContentModel; tmpModel.msg = tmpContentModel;
[tmpArray addObject:tmpModel]; [tmpArray addObject:tmpModel];
} }
...@@ -327,7 +328,7 @@ static OffcnIMZYJFMDBHandler *FMDBHandler; ...@@ -327,7 +328,7 @@ static OffcnIMZYJFMDBHandler *FMDBHandler;
} }
//查询聊天列表 //查询聊天列表
- (void)getChatInfoAllDataArrayCallback:(getFMDBHistoryMessagesBlock)messagesBack{ - (void)getChatListArrayCallback:(getFMDBHistoryMessagesBlock)messagesBack{
if (!_database) { if (!_database) {
getFMDBInstance(); getFMDBInstance();
} }
......
//
// OffcnIMSqliteTestVC.h
// OffcnIMSDKiOS
//
// Created by vockey on 2020/9/1.
// Copyright © 2020 offcn. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface OffcnIMSqliteTestVC : UIViewController
@end
NS_ASSUME_NONNULL_END
//
// OffcnIMSqliteTestVC.m
// OffcnIMSDKiOS
//
// Created by vockey on 2020/9/1.
// Copyright © 2020 offcn. All rights reserved.
//
#import "OffcnIMSqliteTestVC.h"
#import "OffcnIMZYJFMDBHandler.h"
#import "OffcnIMModel.h"
#import "OffcnZYJTestDataStorageView.h"
@interface OffcnIMSqliteTestVC ()
@property (strong, nonatomic) NSString *fromId;
@property (strong, nonatomic) NSString *toId;
@property (assign, nonatomic) UIClearStyle clearStyle;
@end
@implementation OffcnIMSqliteTestVC
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"数据库";
self.fromId = @"ce0819db8391f1e7258a71cc9e2c3235";
self.toId = @"ceb7383519c5b6a1c8579553f01ad9c4";
self.clearStyle = UIClearStylePart;
}
//删除记录
- (IBAction)deleteRecord:(UIButton *)sender {
[[OffcnIMZYJFMDBHandler sharedInstance] deleteUserChatDataWithFromUser:self.fromId toUser:self.toId clearStyle:self.clearStyle callBack:^(BOOL isSuccess) {
}];
}
//删除表格
- (IBAction)deleteTable:(UIButton *)sender {
[[OffcnIMZYJFMDBHandler sharedInstance] deleteDataTable];
}
//查询聊天列表
- (IBAction)queryChatList:(UIButton *)sender {
[[OffcnIMZYJFMDBHandler sharedInstance] getChatListArrayCallback:^(NSArray<OffcnIMBodyModel *> *messagesArray) {
NSString *msg = @"";
for (int i=0; i<messagesArray.count; i++) {
OffcnIMBodyModel *model = messagesArray[i];
msg = [msg stringByAppendingString:[NSString stringWithFormat:@"msg_type:%ld,lastSendtime:%@,lastmessage:%@",(long)model.msg_type,model.lastSendtime,model.lastmessage]];
msg = [msg stringByAppendingString:@"\r\n"];
msg = [msg stringByAppendingString:@"\r\n"];
}
OffcnZYJTestDataStorageView *storageView = [[OffcnZYJTestDataStorageView alloc] initWithFrame:CGRectMake(0, 20, self.view.bounds.size.width, self.view.bounds.size.height-20)];
storageView.msg = msg;
[storageView showView];
}];
}
//查询聊天记录
- (IBAction)queryChat:(UIButton *)sender {
[[OffcnIMZYJFMDBHandler sharedInstance] getChatRecordArrayWithFromUser:self.fromId toUser:self.toId limit:@"20" startIndex:@"0" callback:^(NSArray<OffcnIMBodyModel *> *messagesArray) {
NSString *msg = @"";
for (int i=0; i<messagesArray.count; i++) {
OffcnIMBodyModel *model = messagesArray[i];
if (model.msg_type == 1) {
msg = [msg stringByAppendingString:model.msg.msg?model.msg.msg:@"nil"];
}else{
msg = [msg stringByAppendingString:model.msg.url?model.msg.url:@"nil"];
}
msg = [msg stringByAppendingString:@"\r\n"];
msg = [msg stringByAppendingString:@"\r\n"];
}
OffcnZYJTestDataStorageView *storageView = [[OffcnZYJTestDataStorageView alloc] initWithFrame:CGRectMake(0, 20, self.view.bounds.size.width, self.view.bounds.size.height-20)];
storageView.msg = msg;
[storageView showView];
}];
}
@end
// //
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
OffcnIMSendMsgModel *SendMsgModel = [OffcnIMSendMsgModel mj_ZYJobjectWithKeyValues:baseResponse.responseObject]; OffcnIMSendMsgModel *SendMsgModel = [OffcnIMSendMsgModel mj_ZYJobjectWithKeyValues:baseResponse.responseObject];
OffcnIMMsgModel *MsgModel = [[OffcnIMMsgModel alloc] init];
OffcnIMBodyModel *BodyModel = [[OffcnIMBodyModel alloc] init]; OffcnIMBodyModel *BodyModel = [[OffcnIMBodyModel alloc] init];
BodyModel.msg_from = msg_fromID; BodyModel.msg_from = msg_fromID;
BodyModel.msg_to = msg_toID; BodyModel.msg_to = msg_toID;
...@@ -59,6 +60,23 @@ ...@@ -59,6 +60,23 @@
BodyModel.session_id = SendMsgModel.session_id; BodyModel.session_id = SendMsgModel.session_id;
BodyModel.tid = SendMsgModel.tid; BodyModel.tid = SendMsgModel.tid;
BodyModel.isSentSuccess = 1; BodyModel.isSentSuccess = 1;
BodyModel.msg_type = msg_type;
if (msg_type == 1) {
MsgModel.msg = [msgDic objectForKeyOnSafe:@"msg"];
}else{
MsgModel.dur = [[msgDic objectForKeyOnSafe:@"dur"] longLongValue];
MsgModel.name = [msgDic objectForKeyOnSafe:@"name"];
MsgModel.md5 = [msgDic objectForKeyOnSafe:@"md5"];
MsgModel.url = [msgDic objectForKeyOnSafe:@"url"];
MsgModel.thumb_url = [msgDic objectForKeyOnSafe:@"thumb_url"];
MsgModel.cover_url = [msgDic objectForKeyOnSafe:@"cover_url"];
MsgModel.ext = [msgDic objectForKeyOnSafe:@"ext"];
MsgModel.w = [[msgDic objectForKeyOnSafe:@"w"] longLongValue];
MsgModel.h = [[msgDic objectForKeyOnSafe:@"h"] longLongValue];
MsgModel.size = [[msgDic objectForKeyOnSafe:@"size"] longLongValue];
}
BodyModel.msg = MsgModel;
[[OffcnIMZYJFMDBHandler sharedInstance] updateChatInfoIsSendStatusToFMDBWithModel:BodyModel isSuccess:nil]; [[OffcnIMZYJFMDBHandler sharedInstance] updateChatInfoIsSendStatusToFMDBWithModel:BodyModel isSuccess:nil];
[[OffcnIMZYJFMDBHandler sharedInstance] chatlistCacheInfo:BodyModel callback:nil]; [[OffcnIMZYJFMDBHandler sharedInstance] chatlistCacheInfo:BodyModel callback:nil];
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
}; };
[OffcnIMSocketManager defaultService].connectStatus = ^(OffcnIMConnectStatus status, NSString * _Nonnull errorMessage) { [OffcnIMSocketManager defaultService].connectStatus = ^(OffcnIMConnectStatus status, NSString * _Nonnull errorMessage) {
NSLog(@"收到连接状态---%@,code:%lu",errorMessage,(unsigned long)status); NSLog(@"收到连接状态---%@,code:%lu,%@",errorMessage,(unsigned long)status,[weakSelf getNowSSSTimeTimestamp]);
if (status == OffcnIMConnectStatusDisConnectOK) { if (status == OffcnIMConnectStatusDisConnectOK) {
errorMessage = @"断开连接成功"; errorMessage = @"断开连接成功";
}else if (status == OffcnIMConnectStatusSuccess){ }else if (status == OffcnIMConnectStatusSuccess){
...@@ -88,6 +88,20 @@ ...@@ -88,6 +88,20 @@
[weakSelf tipMessageWithTitle:@"收到连接状态" message:errorMessage]; [weakSelf tipMessageWithTitle:@"收到连接状态" message:errorMessage];
}; };
} }
//获取当前时间戳(以毫秒为单位)
-(NSString *)getNowSSSTimeTimestamp{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss SSS"]; //
NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[formatter setTimeZone:timeZone];
NSDate *datenow = [NSDate date];
// NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)([datenow timeIntervalSince1970]*1000)];
NSString *timeSp = [formatter stringFromDate:datenow];
return timeSp;
}
- (IBAction)disconnectAction:(UIButton *)sender { - (IBAction)disconnectAction:(UIButton *)sender {
//断开连接 //断开连接
...@@ -241,7 +255,7 @@ ...@@ -241,7 +255,7 @@
[self gotoImageLibrary]; [self gotoImageLibrary];
} }
- (IBAction)uploadFile:(UIButton *)sender { - (IBAction)uploadImage:(UIButton *)sender {
//上传 //上传
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
NSString *filePath = [self getImagePath:self.pickImage]; NSString *filePath = [self getImagePath:self.pickImage];
...@@ -254,6 +268,20 @@ ...@@ -254,6 +268,20 @@
} }
}]; }];
} }
- (IBAction)uploadFile:(UIButton *)sender {
NSString *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES).firstObject;
NSString *filePath = [path stringByAppendingPathComponent:@"ZYJFMDBIMChat.db"];
__weak typeof(self) weakSelf = self;
[[OffcnIMSDKiOS defaultService] sendMsgWithMsg_fromID:self.fromId msg_toID:self.toId msg_type:OffcnSDKMsgTypeFile text:nil filePath:filePath Finished:^(BOOL success, OffcnIMSendMsgModel *sendMsgModel, NSString *errorMessage) {
if (success) {
[weakSelf tipMessageWithTitle:@"上传成功" message:@""];
}else{
[weakSelf tipMessageWithTitle:@"上传失败" message:errorMessage];
}
}];
}
#pragma mark UIImagePickerControllerDelegate #pragma mark UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<UIImagePickerControllerInfoKey, id> *)info { - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<UIImagePickerControllerInfoKey, id> *)info {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment