mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 22:39:18 +08:00
Compare commits
1565 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 134087c672 | |||
| 91a2406827 | |||
| f82f9567c2 | |||
| 0a2951c2eb | |||
| 5601212f58 | |||
| 3451d22460 | |||
| 0d5dc6bdd8 | |||
| 87e6aedb74 | |||
| 9b5bd47760 | |||
| 007065b40e | |||
| 2e52867df4 | |||
| c5eb8a3f9b | |||
| cacde08e99 | |||
| 9443ed5d49 | |||
| e3c702aca1 | |||
| 7fbdff391c | |||
| 92cb2e7eab | |||
| 04136d5b9d | |||
| fd256a6c28 | |||
| e64b8841c5 | |||
| 52ae2c3655 | |||
| f1b5f56294 | |||
| ed3b62480c | |||
| 365d282119 | |||
| 56d0c574f9 | |||
| 573937e1e5 | |||
| 3892883470 | |||
| d1049b8022 | |||
| 8e3f090ffe | |||
| 903c39206f | |||
| 29dbb36961 | |||
| 20851f2a96 | |||
| 7bbf2b200b | |||
| e9ac9faa49 | |||
| a15e644a51 | |||
| 479679a1c6 | |||
| a50001364f | |||
| 7ea7dffd4a | |||
| 5ea620a4cd | |||
| 4e11c7a9e2 | |||
| 9503766a68 | |||
| 6b29d54b50 | |||
| 19bbd9b528 | |||
| 28721c7d20 | |||
| 7dbf0a3594 | |||
| e2f7dd67a2 | |||
| 3f455199eb | |||
| 24f2ffe82d | |||
| 86c5d694e5 | |||
| 8c963c669b | |||
| d058cacb38 | |||
| c3cb5f20d9 | |||
| abb9ebaf76 | |||
| 167ebd6975 | |||
| 66d248ec8e | |||
| 966cb24911 | |||
| 98821c95b6 | |||
| ceaa0b61eb | |||
| 89aef130a5 | |||
| 57d96b85f1 | |||
| dd4817a65a | |||
| b3dcff2d76 | |||
| 8d3d41831d | |||
| 066a7041d8 | |||
| 50df9bdf4e | |||
| eab9e4ab92 | |||
| 56cf46a3a4 | |||
| 90442e3e39 | |||
| 02c594d4ec | |||
| 8c82f811cb | |||
| dbc2713495 | |||
| 89ac29a019 | |||
| 96d3ae86cc | |||
| 071a7fa629 | |||
| 0a44a8e78a | |||
| 59743ef071 | |||
| 077482d759 | |||
| 7e6e214f08 | |||
| b6634d26d1 | |||
| 5e51eebe8a | |||
| 310997f978 | |||
| b67643ed95 | |||
| 1b1f4464ee | |||
| 1111cf48f3 | |||
| 41833712f0 | |||
| f9a26e9195 | |||
| ea76f20825 | |||
| 1a6a0d3592 | |||
| 0d2c0e91c8 | |||
| bc2a7b902e | |||
| 2e7e278ba4 | |||
| 06915f5dc3 | |||
| 7cbd840060 | |||
| cc8301cc6e | |||
| a9603f44f4 | |||
| 04ee5269fe | |||
| afa93aaf9e | |||
| d74bea25aa | |||
| 1af78c9bcb | |||
| 9f7cc1ae69 | |||
| f4f6ea681e | |||
| 21051900f9 | |||
| f96e12a8b3 | |||
| eef47017a3 | |||
| 4315d9dfbb | |||
| d7961bf226 | |||
| 7dbc8a4253 | |||
| 1aee41e7e7 | |||
| f4cdbe985e | |||
| 8a0c112072 | |||
| 16641f0494 | |||
| 5965dcd029 | |||
| e45ef5c49a | |||
| 9a1682ebaf | |||
| 9eed6ce197 | |||
| d3279694b7 | |||
| 8fe6231ebc | |||
| 6f0860d954 | |||
| 1e62ddce73 | |||
| 956d745034 | |||
| ccc69ac2d0 | |||
| 68365aa3b7 | |||
| a0581618a4 | |||
| cfcccd0240 | |||
| 926de3fa94 | |||
| 38ded2c43d | |||
| f324bb603d | |||
| d190616d34 | |||
| d7884f89f5 | |||
| d8ce122254 | |||
| 9c1ca78fed | |||
| 31c123a09b | |||
| 0e93295cdf | |||
| 5e7eda6781 | |||
| f31179bb9a | |||
| 805b7705b2 | |||
| ae649a0e31 | |||
| d797d7b47a | |||
| 7308d0f9c6 | |||
| 2ab1f3749c | |||
| 52199fb5d3 | |||
| ad497b7386 | |||
| 257e98edb2 | |||
| 5be23220e4 | |||
| 25310d5e88 | |||
| 4bc9da3910 | |||
| 6dfba3c7b8 | |||
| 034201a45b | |||
| d43b9fc6c1 | |||
| 94ec584dc3 | |||
| 043188ab5e | |||
| 2cbffb96fd | |||
| 50f7057f68 | |||
| f3b083cafd | |||
| d881ab5fea | |||
| 464200e693 | |||
| 9ae84a69be | |||
| 47184ca01e | |||
| 39d4d01814 | |||
| 5419478c48 | |||
| 52d8ab5389 | |||
| 7d6701780c | |||
| dbc055efb4 | |||
| f9c2b4c28e | |||
| 7c90baf7bf | |||
| 67807a3aa7 | |||
| dca39d6eae | |||
| 768d139789 | |||
| af612e4b92 | |||
| ef23fba147 | |||
| 5f813c6f70 | |||
| c171728749 | |||
| 85c0e1f330 | |||
| 8269e61163 | |||
| ae6c09aae2 | |||
| 9619584de5 | |||
| dad40d60b3 | |||
| 9216a085cf | |||
| f232ffb5cc | |||
| 952033f409 | |||
| dc10c7e3e7 | |||
| a84c8bd273 | |||
| 2d3d351e26 | |||
| e375188889 | |||
| 5860f1fa7a | |||
| 6a149c74d1 | |||
| 6ae71dba4f | |||
| 659cc7f1c6 | |||
| a6a80a8b93 | |||
| 722ada3f0e | |||
| aeb479641f | |||
| 8a471a5455 | |||
| c8207b479e | |||
| fdaf4380fa | |||
| 89d228e605 | |||
| 556ed8413f | |||
| e95f09191a | |||
| fa02c20e1c | |||
| f51a074f86 | |||
| 915539ca0f | |||
| 26353fd28f | |||
| 0aa19ed1b0 | |||
| 843a9cedaf | |||
| c9b25f73d3 | |||
| df7d2b54bd | |||
| 5cb907b0f1 | |||
| 832f9c042d | |||
| eaa416c394 | |||
| 16645bc568 | |||
| 25f9e28230 | |||
| 1687b70bde | |||
| d49ceef637 | |||
| da573ac573 | |||
| 743eaab9f6 | |||
| 202811f3c6 | |||
| 6250603440 | |||
| 650c7a3ae0 | |||
| 42d75decb0 | |||
| 55f6aa9ff8 | |||
| 0e77caa329 | |||
| da0e73fe11 | |||
| fc5ab3572e | |||
| 891738747a | |||
| 1c52e731e1 | |||
| ee615fbadf | |||
| 2ede9ef8ed | |||
| dbcfcafdfc | |||
| 7d63c82ddd | |||
| 1d4dc81e55 | |||
| ceca0f095b | |||
| 793996e047 | |||
| ab76d46007 | |||
| ed1e22bac5 | |||
| e57ce28d2b | |||
| 2b596e226a | |||
| c46f574aa8 | |||
| 9b4890a99f | |||
| 3f129513bb | |||
| 698490b936 | |||
| c8bf95578c | |||
| 064132833c | |||
| 60f8f93a02 | |||
| 7b08d98647 | |||
| 11e619d1b3 | |||
| 4f184a6723 | |||
| 5fd91e808a | |||
| 0dfa224aeb | |||
| 32565dd188 | |||
| 96f09c45f5 | |||
| d2474c8a72 | |||
| 9eb0dd5e70 | |||
| bbdcb34ab6 | |||
| 6525d63459 | |||
| 0babf89aa5 | |||
| 317e6f81bb | |||
| ae684d6d39 | |||
| d9710ac244 | |||
| dff7a28094 | |||
| da18950b3d | |||
| 6055ce9b6b | |||
| bd14739a9e | |||
| 843cbe4f80 | |||
| f650e73d5c | |||
| d1293dd047 | |||
| 715e8a5000 | |||
| a7a69008d8 | |||
| 553b56d094 | |||
| fec57c4ed7 | |||
| b46f106a91 | |||
| 0214419446 | |||
| d587d14f86 | |||
| a115151616 | |||
| 26771ee7d0 | |||
| 731263638b | |||
| a4f69351ce | |||
| fa5f234a38 | |||
| 5d2c981368 | |||
| 4a55842724 | |||
| e9655ed05e | |||
| ed7d2bbdd7 | |||
| 276328e0fd | |||
| 1bcd091330 | |||
| 536d7e2957 | |||
| 55e774344a | |||
| 7d0c8b0c5f | |||
| 88c4cff50c | |||
| cfe01bb820 | |||
| 4f1bd4e509 | |||
| 88544a89b7 | |||
| a87e41eecd | |||
| e52639d1d4 | |||
| 0463f5e83d | |||
| eb90314b38 | |||
| 6ce1d60ebb | |||
| 5fa62c9fbd | |||
| ef93a1f42e | |||
| 5f42748e1b | |||
| 269df23851 | |||
| c40dc64bd0 | |||
| 2b150e3c1c | |||
| f7c17ac7e7 | |||
| 3f2638efaf | |||
| f106664952 | |||
| afe8dcc1ff | |||
| 8f1e439381 | |||
| 4418d031e1 | |||
| f3fc452904 | |||
| 89f40fe3de | |||
| f8962beca6 | |||
| dae1569f0e | |||
| dd76c268c5 | |||
| 52c52f23d3 | |||
| 3adcb9f164 | |||
| 0f1a061afe | |||
| 95705cc95a | |||
| 07b652c1d4 | |||
| eac137a9a9 | |||
| 6ec65965a4 | |||
| 290ae774e0 | |||
| 31e12f682d | |||
| ae52f85502 | |||
| fcda79eb3c | |||
| 385f371c06 | |||
| 6efb1a6705 | |||
| 4695ef3208 | |||
| 34e8b79e7e | |||
| 3639f943bf | |||
| d373369649 | |||
| 9106e70b37 | |||
| 4678189ed4 | |||
| 78298e1284 | |||
| 34c091f232 | |||
| 064b650fac | |||
| f8b4cbcc13 | |||
| 2f9c8dbb33 | |||
| 8bd5db431b | |||
| 5754510d7a | |||
| 797e2fea1e | |||
| 538656fcc7 | |||
| 0f66fa528d | |||
| 1a42f6dded | |||
| 4efdd342d6 | |||
| f15684a562 | |||
| 78dfba8771 | |||
| e428e186f0 | |||
| ebf07eddfb | |||
| d3abc44976 | |||
| dc7c10014d | |||
| 5e2e8f91c7 | |||
| e5a314bb3a | |||
| 9d3882d5b9 | |||
| a647007a0f | |||
| e04a4908cf | |||
| cfe0272022 | |||
| 2e3b55d9e8 | |||
| 6b8ebe11de | |||
| 1fffd36054 | |||
| 2b25fea86c | |||
| 409a8311b1 | |||
| 6996c008d0 | |||
| 64fa52452c | |||
| 16d33b1c1f | |||
| 0a260a67d5 | |||
| 1aacd3cb23 | |||
| 5af3ba9db6 | |||
| 14bfd78f63 | |||
| febc672e6e | |||
| a18dcfce9e | |||
| 48410c428a | |||
| da1df91f49 | |||
| b2df6e6d41 | |||
| 8315c61240 | |||
| 1ff7ebb04a | |||
| ab914f4621 | |||
| 51ef00e0f2 | |||
| 2b4df5be16 | |||
| f98da25fda | |||
| 4c305b7cc0 | |||
| 5c979a532f | |||
| fcf2427878 | |||
| 31e923fc67 | |||
| 1c2ebb8c5d | |||
| 29e75a4851 | |||
| 3765661a4e | |||
| 628984c09d | |||
| a630653d88 | |||
| e693b908be | |||
| f36b2433a0 | |||
| 47af0d0356 | |||
| d4c587c668 | |||
| dda453975b | |||
| c28801ff27 | |||
| 4e609ebc33 | |||
| 1257e96d5e | |||
| 122a3ab4ce | |||
| 136cb43cd1 | |||
| ad8086d2b6 | |||
| d00641a73c | |||
| 197be51047 | |||
| 53c40a87b2 | |||
| b304c13034 | |||
| cb895d17ff | |||
| f0dd3aada3 | |||
| 2d055c8d8d | |||
| aad4482a78 | |||
| d71536ab86 | |||
| fe25d52082 | |||
| 0441662e0c | |||
| 0f40bc4cce | |||
| 13e9c20be0 | |||
| 17bab31b18 | |||
| 26f11fabb7 | |||
| b892749c75 | |||
| 810b08c50d | |||
| fc71a757dd | |||
| 6c324414b1 | |||
| d7283b92ac | |||
| d67fdbc24e | |||
| 1edaf15220 | |||
| 38bd2bd011 | |||
| da4ac6d709 | |||
| 9e16629d69 | |||
| 0aefab34f1 | |||
| 05b4ddfd46 | |||
| 74f2d6bea6 | |||
| 5392c9fd38 | |||
| cd8e12c747 | |||
| 591b292fbf | |||
| 3610525c88 | |||
| 1db3ecca22 | |||
| 0168ef4014 | |||
| 25450a4182 | |||
| 8cc6b048fd | |||
| cf094a2048 | |||
| 10881c8f5b | |||
| 23c6c8b331 | |||
| cf8a437361 | |||
| 653c0faa18 | |||
| b108e5bf45 | |||
| 5e5597ef19 | |||
| edb5cb4ee5 | |||
| 3b81108738 | |||
| 110f5e02f4 | |||
| a4a7ce51ad | |||
| 08a7dbe319 | |||
| 0b9e6d52b4 | |||
| ecf0a4f299 | |||
| d3fe5cdf34 | |||
| d3d5c11675 | |||
| ae30b4359f | |||
| bda1b0a304 | |||
| 839f3e52ef | |||
| a85f6b8287 | |||
| fe9f86b432 | |||
| c0a3bdcf99 | |||
| 94125fa5dd | |||
| a77971ae13 | |||
| e7f153a5e5 | |||
| 8cd39861f8 | |||
| dcff407670 | |||
| 3b453dea13 | |||
| 9981b8f16c | |||
| da4663aa83 | |||
| 3895bbc801 | |||
| 7285e2b2c9 | |||
| e9bf26e0ca | |||
| ec0319d256 | |||
| 1bfefbd083 | |||
| 8967343079 | |||
| b3ba06aecb | |||
| 8cdcd7105a | |||
| cc6d8d28b5 | |||
| b55e13dbeb | |||
| bbe8c46df9 | |||
| 16a56457ed | |||
| a4c0728e28 | |||
| d6907f3f3a | |||
| 3f126be081 | |||
| cbf0b3c05e | |||
| 0f0470b93c | |||
| d104c6dbf4 | |||
| a8705be6ee | |||
| f54ba4b018 | |||
| 884b410dce | |||
| e5945fa720 | |||
| b155a9908b | |||
| d67e4a3491 | |||
| 97d0ab1b75 | |||
| f5befcc95f | |||
| ab047944b6 | |||
| ce5f927a8d | |||
| dcb777d6ea | |||
| decf728d91 | |||
| 098f8a52f7 | |||
| 1eeb7f8303 | |||
| 4b7177101a | |||
| 73cf3eb869 | |||
| b4da35a0ab | |||
| e3d92c27e8 | |||
| 8addb49012 | |||
| ac1e557c46 | |||
| d1651b54ec | |||
| f61dbdccec | |||
| 9beff11125 | |||
| d8c0a82411 | |||
| 2add9a02f9 | |||
| 2910a6effd | |||
| 5621a651a1 | |||
| c83e816bda | |||
| 948e5a2dde | |||
| 94cd17909d | |||
| bcfa3efef7 | |||
| bf87eb68e2 | |||
| a84298de86 | |||
| ee47c6d727 | |||
| ef5bd95620 | |||
| b36703fc47 | |||
| b2112ca8b9 | |||
| 7952545f0d | |||
| c997fbafb0 | |||
| 60c8d3b832 | |||
| 778c1852b8 | |||
| 08cc287dff | |||
| 17b7ef80ba | |||
| a4532cb834 | |||
| dc2bc7fbf7 | |||
| d37dd66ec5 | |||
| 79bbeea7f0 | |||
| 5b56de784d | |||
| 620dd0be78 | |||
| 7267fd080e | |||
| 2d8e03cc69 | |||
| b797492dbd | |||
| eb41d8b16d | |||
| d791aa2e4f | |||
| f969841464 | |||
| 93d63508dc | |||
| 84e7935971 | |||
| 730bedf0a5 | |||
| 0ed223ef01 | |||
| fc677ca0e9 | |||
| c02f95c2fc | |||
| 76b5affaaa | |||
| 72c7cc2c67 | |||
| 13b9749e8f | |||
| 3f76521bfe | |||
| 837cf10e36 | |||
| e8fe7cc853 | |||
| 5db96847fc | |||
| 746b01f8ca | |||
| eb2218c220 | |||
| 657ec411c3 | |||
| 9895806d23 | |||
| 5957e4b264 | |||
| c544c4d6b5 | |||
| 061af3f827 | |||
| 4d8708a5ee | |||
| 9eb1870196 | |||
| e961a44511 | |||
| c16a35ec8c | |||
| 841566a5d1 | |||
| 4a822c5920 | |||
| ce554fc442 | |||
| e9a515ac34 | |||
| b14b53329c | |||
| b8641258d6 | |||
| 6022aff965 | |||
| 18eaae80ec | |||
| a4e41462c7 | |||
| f8bed154ce | |||
| 8ee3f7ab66 | |||
| 77c7efbe89 | |||
| 8d78ef5946 | |||
| 4571a3b50b | |||
| b48197c8aa | |||
| bb45c0c34b | |||
| 25c316165e | |||
| 1246f3aa21 | |||
| 49cd31fd41 | |||
| 94e6380485 | |||
| 36b5315075 | |||
| c66ccfeda2 | |||
| ae0cfe1575 | |||
| 79ff36d49a | |||
| d6742812c8 | |||
| 13dc721cb0 | |||
| 57967835bd | |||
| db9913c725 | |||
| c3e3f4e947 | |||
| f33937bc5d | |||
| c176a5b80a | |||
| e2db8c07af | |||
| c224892609 | |||
| f5ed9d93c3 | |||
| 88145694ce | |||
| d58f7fd089 | |||
| c32b53b3c0 | |||
| 9dfef527a3 | |||
| df51c8b9a4 | |||
| 499c4a27d3 | |||
| bfe08acfec | |||
| ffae976e11 | |||
| ced8eb419f | |||
| 0ab2eaa630 | |||
| d385f555dd | |||
| 268e5cbdb1 | |||
| 247649ec34 | |||
| 2ada6d969d | |||
| a4d2740f24 | |||
| df7266cc75 | |||
| 3255b73a44 | |||
| 305e81bef1 | |||
| 84cc6e9140 | |||
| b8d95f4b31 | |||
| c0f7d02f44 | |||
| 7fc6b61f21 | |||
| ed3a1296d8 | |||
| 66c62d8875 | |||
| 7d1b06471f | |||
| b7309cdda8 | |||
| 6ffc12ef97 | |||
| 79b2d39305 | |||
| b3525ea6a5 | |||
| b5ceec4883 | |||
| 4287082f4b | |||
| e3a8d12d4b | |||
| ce15c26b59 | |||
| 48940272ae | |||
| 8c64538207 | |||
| 0460033281 | |||
| 8240cb9c0f | |||
| e385f054df | |||
| 03ae935756 | |||
| d196f455cb | |||
| 50bb13b7cd | |||
| 652afd6b57 | |||
| d1cb176b31 | |||
| 767131a117 | |||
| f0dadcef70 | |||
| 1f20024b91 | |||
| f5c7197dda | |||
| cb497fe720 | |||
| bef0e40db8 | |||
| 24073b20ab | |||
| 64d83d9048 | |||
| 5c0b06f27d | |||
| b09e2c11eb | |||
| 8c119a76d1 | |||
| 04a9788bc0 | |||
| 883e7f96ee | |||
| d276be9594 | |||
| 2fc6b0a8cb | |||
| 9f295d8399 | |||
| 024f454702 | |||
| 821ad4de2e | |||
| b864f9c6a9 | |||
| 31e0a8a88b | |||
| be3d2b6552 | |||
| e2eb546069 | |||
| b2ae3b4fee | |||
| 5b9e5f904b | |||
| 7d1843f485 | |||
| f1e2704407 | |||
| 17b4a0525d | |||
| 5cdba3c00a | |||
| 79b5551ec1 | |||
| ac840323be | |||
| c2e7863ca0 | |||
| 01b065b3c2 | |||
| 55907a9a05 | |||
| 6e9dcdbb50 | |||
| 0265ea45b2 | |||
| ccb7e41434 | |||
| 38317c5497 | |||
| 9f62de0420 | |||
| e8e4af7286 | |||
| 2c5d30a0ff | |||
| eb27db2232 | |||
| adb6337a27 | |||
| 624bb0a7e5 | |||
| 757829d286 | |||
| c5f055718a | |||
| a12c8f4dbc | |||
| f072afa6ef | |||
| 686d77dcc1 | |||
| 7da227cdfa | |||
| abcfaa05e2 | |||
| aa144b0439 | |||
| 15329a97fe | |||
| 223b2678b4 | |||
| 930923e330 | |||
| 8fe929d8ab | |||
| e12207fc73 | |||
| ef05949e5a | |||
| a2f7edcbcd | |||
| 7f80638928 | |||
| 222d6cdca1 | |||
| aa733542e3 | |||
| 2b142baf19 | |||
| 78bfd1ff64 | |||
| 7ea1309146 | |||
| a7be7a3e7a | |||
| a14fd303fc | |||
| b632a991b9 | |||
| 06aae24dad | |||
| 3bf04802e4 | |||
| 6f79e63b3f | |||
| 67cfdedcc4 | |||
| f0c6295cff | |||
| 6c5629a0d7 | |||
| 06726758d2 | |||
| 866c7d4f2f | |||
| 17695927d5 | |||
| ea8638c843 | |||
| 0fbc1095be | |||
| b914e8388d | |||
| 31911a40c0 | |||
| 00a2a23190 | |||
| 5f25e605d3 | |||
| d4f81f086c | |||
| e048813c43 | |||
| 1186f2fb14 | |||
| a2cdf6559d | |||
| 9d6d74ce98 | |||
| dbc7023c00 | |||
| 6fd84dba8f | |||
| e444a52b6a | |||
| d431a81cf0 | |||
| dcb03a2250 | |||
| 8d6e016e48 | |||
| f067af664e | |||
| 6355e4e3bc | |||
| e2f9c18a27 | |||
| cc93dba508 | |||
| b1f270c082 | |||
| d086de8103 | |||
| 523ca2f7fc | |||
| a2888b009d | |||
| 143e2908ad | |||
| 98542bd5d5 | |||
| ee0a71de1b | |||
| 9f8cb6ca34 | |||
| 759fb8a802 | |||
| ab06eaeca8 | |||
| 267b3a9547 | |||
| 0b49ecfc12 | |||
| 23b03919e6 | |||
| 4f165f3b27 | |||
| 967a4c7748 | |||
| 03c23f0fda | |||
| 44bad0146c | |||
| d92d6e84d0 | |||
| 355b64fda4 | |||
| c1632f8e65 | |||
| 1fa16bd8dd | |||
| 0ac531674c | |||
| 18a61061e1 | |||
| b0e349212d | |||
| 9913e67928 | |||
| 888c837cdd | |||
| 0e03fb6393 | |||
| 317fed304c | |||
| 681cf349e6 | |||
| 313cf858f0 | |||
| fa94fd075f | |||
| 3433d211a5 | |||
| dcda3c7329 | |||
| d2563063d1 | |||
| 9557baf22a | |||
| c7b1d4514f | |||
| 09cd8bcb99 | |||
| 3046d63ad4 | |||
| de9c2d3d85 | |||
| 2454c50380 | |||
| e2f8156a4d | |||
| 6ea6a61e90 | |||
| b978b6756e | |||
| cbae83106b | |||
| 424f854145 | |||
| faf72705cb | |||
| 381e72f1ef | |||
| 91fe549c25 | |||
| a472da9ea6 | |||
| 20c7fe81dc | |||
| 3ef445eb2e | |||
| 4afc38523d | |||
| 15616e8d07 | |||
| 2534921af9 | |||
| 0206198f55 | |||
| 3c8c402f10 | |||
| 098dae9640 | |||
| 42c38de3e2 | |||
| be10e6a9de | |||
| 6b5fb81e01 | |||
| bb5991b111 | |||
| 8f261970e9 | |||
| 093a8f18ef | |||
| 9c19b5b785 | |||
| 35958ca3a2 | |||
| 3bc2e97e8b | |||
| eb7ff77461 | |||
| d36f4cf6f8 | |||
| f373669f02 | |||
| 37596589a7 | |||
| 3e90426d8e | |||
| 35a184827a | |||
| 2edd3c5614 | |||
| cec5a6ceeb | |||
| dc6b0b4dde | |||
| 3ecc1816be | |||
| 9a90c2e568 | |||
| ab747d0338 | |||
| 8753f91a4a | |||
| f8af109821 | |||
| a1a7900254 | |||
| 804eb6c076 | |||
| f4f3ff0eda | |||
| 03c0b1ea91 | |||
| 38535bde84 | |||
| 17e1fa54cf | |||
| a4f5dd9d89 | |||
| 6269902140 | |||
| b964e424b2 | |||
| 73665f62b3 | |||
| 3fca780132 | |||
| b5e01dcb5e | |||
| f180b89a9c | |||
| 98a903e60c | |||
| c20cc8fb18 | |||
| 99f5c4e12f | |||
| 17759f9a98 | |||
| 6c0e96213f | |||
| 2c89d80a27 | |||
| e314fd4a0a | |||
| affbe9f5a9 | |||
| 7a423eb6e1 | |||
| 7137924baa | |||
| c998bce34f | |||
| f5d4397f0b | |||
| 608b166b32 | |||
| 472cda8315 | |||
| 7a78e5d869 | |||
| 8effca3a7c | |||
| fab52b6a56 | |||
| e98ef5f5f2 | |||
| 7aa84607c8 | |||
| 928fc374c7 | |||
| 4ea8cb5903 | |||
| db6acacf2e | |||
| 59aa71b3b8 | |||
| ccfa487493 | |||
| 9fcc41aeff | |||
| d9a4fa3f49 | |||
| 6c821dc42a | |||
| d58e34ed3d | |||
| ff37d1cb02 | |||
| dcf119ae59 | |||
| 1338cf875a | |||
| ed3e299e0b | |||
| f85645a78a | |||
| e412abd017 | |||
| 1efa654e7d | |||
| 00b58068dc | |||
| 7be5208daf | |||
| 7ad555a41b | |||
| 872f70a418 | |||
| c37d2e78d2 | |||
| b606d066fc | |||
| d4608eec26 | |||
| 0bc8e231ad | |||
| 2dab5e4a78 | |||
| c6aa37851d | |||
| 31bd106ffd | |||
| 74cea2b41c | |||
| 46f9a00b75 | |||
| 450d8c21cf | |||
| 2073bc77c8 | |||
| b6a5501f71 | |||
| e27b98cdc1 | |||
| 8af500462f | |||
| 30fc4c28b7 | |||
| 74b582369a | |||
| c9ab2b507b | |||
| 2b479319c1 | |||
| 3a3ac012bb | |||
| 00265a7e8e | |||
| 0dafb50223 | |||
| ac9620c253 | |||
| 6e226b165c | |||
| 6226f65e20 | |||
| 7de29c29e9 | |||
| deed6c7bbe | |||
| c234e2ca3d | |||
| 19bffa288d | |||
| 9303096430 | |||
| 98d5f5ee3e | |||
| ba16fceeb8 | |||
| c49b5f78bf | |||
| 446688d5b2 | |||
| e2cacd9c4b | |||
| d5c9e08888 | |||
| ab0ead4e05 | |||
| 9a267db583 | |||
| fb15cbef90 | |||
| 97e5d9f610 | |||
| 305ee394b1 | |||
| a251d521a1 | |||
| b5065cb52f | |||
| dca16e83d3 | |||
| c5256fe2cb | |||
| 1b93ba5355 | |||
| fd7171f5a4 | |||
| 685fc1a37b | |||
| a738c93163 | |||
| 4ac863fa6a | |||
| fed369ad5d | |||
| f2c91d015e | |||
| e122349f9e | |||
| bb07c3ab45 | |||
| 65a4b38ee5 | |||
| bbc3f5c19a | |||
| 0b4ba548a5 | |||
| 747b963bd4 | |||
| 32b9820725 | |||
| b217fede87 | |||
| a9ce8a3b2e | |||
| 7914e7bc14 | |||
| ed8716510b | |||
| efd2ae59f5 | |||
| 1923d0b809 | |||
| 99f6752590 | |||
| 131746f94e | |||
| f0ed6973c8 | |||
| 2cf070a26c | |||
| 3c68ecb7f1 | |||
| 243f5fcda4 | |||
| e22b7f36ce | |||
| 308ea15763 | |||
| e26f9c58fa | |||
| 4ca758174e | |||
| bf8e35e168 | |||
| 2a3265ed71 | |||
| 3a06617a7d | |||
| d75eb456dc | |||
| 8ed0f8ec73 | |||
| 185e0dce6e | |||
| d9e74a78f0 | |||
| 700483dd48 | |||
| 1c80b820cb | |||
| 59e5cfb04d | |||
| b06550e2cb | |||
| ca4bf13569 | |||
| eae3a50435 | |||
| de2956ec3c | |||
| a2e62c9fb5 | |||
| e7fdc318f1 | |||
| 62dd559b7c | |||
| 4a631753a0 | |||
| b696984655 | |||
| f1dbec122a | |||
| 47cb54461f | |||
| 91e03f7cfd | |||
| c0314d95c9 | |||
| 8e17b3ff51 | |||
| b932a659b6 | |||
| 80b2ed19e0 | |||
| 88000926f4 | |||
| 12245fefed | |||
| 8eebd5fb9a | |||
| c5b0e31d36 | |||
| 5c5e828cc6 | |||
| ecb11cf927 | |||
| 485241d080 | |||
| 8701f8868c | |||
| e68086e149 | |||
| 16a2d80801 | |||
| d5e5659a2c | |||
| 3c2e8dcf87 | |||
| 03320e8644 | |||
| 40ae6ccf2f | |||
| bcbade3729 | |||
| 58a6f9cae3 | |||
| bf154eb8c3 | |||
| 766b6e9fef | |||
| d89a41d4c7 | |||
| d24a7d7b22 | |||
| 57a746fc21 | |||
| 2c1bd41fba | |||
| 6260cf24cc | |||
| 88d4a670d4 | |||
| ea0b6c5ee5 | |||
| 20f61042fc | |||
| 2751a967e8 | |||
| 93057870a7 | |||
| 6b98c3fed5 | |||
| eb63ed926d | |||
| b72787f5bb | |||
| 0793b2ab38 | |||
| 604ed3e3e1 | |||
| 0aefbc2c7d | |||
| eb1fa90788 | |||
| 65f02e5139 | |||
| bbfe65a905 | |||
| 59468eb162 | |||
| 1889a283ee | |||
| 0655b2021d | |||
| a1b8c9b6fd | |||
| c4a60bc6f6 | |||
| eb7037eea8 | |||
| 7546083cd5 | |||
| 74ee36f43a | |||
| f8c3e4d66f | |||
| 6db8d9a38a | |||
| 61145a2d03 | |||
| 4a9410742a | |||
| db78e4ef03 | |||
| 7b0eb4e79d | |||
| 17f6b8eb2a | |||
| 37c40d7dda | |||
| 1a2aa876e3 | |||
| 39822f323f | |||
| 338acfba75 | |||
| 490f4f36f1 | |||
| 69c46f684f | |||
| 1626406557 | |||
| f662defcf9 | |||
| 8f07f8e9e1 | |||
| 7e44f7f110 | |||
| b211a66e99 | |||
| 0bdb066820 | |||
| 4ee84e10fd | |||
| ab706f4076 | |||
| bd7266653f | |||
| 08f968dced | |||
| 9f9ebd838a | |||
| a03f89fb68 | |||
| 51146a4ed5 | |||
| 80301f2cb2 | |||
| 9a9f26c435 | |||
| eebe9cbd5f | |||
| 503d43b552 | |||
| b3077fc15d | |||
| fdc462d071 | |||
| f44a26da3c | |||
| d12d03fd5e | |||
| 51ee2df755 | |||
| a89bb33015 | |||
| 7659cca8ba | |||
| f754e951f7 | |||
| e2905d01ac | |||
| 9d691f2452 | |||
| a426c8bb26 | |||
| bc8b1722b0 | |||
| ac31c612b3 | |||
| 03c3eea54e | |||
| bccaf16343 | |||
| 30df45ef2e | |||
| 6500ba48a7 | |||
| 03b35721a2 | |||
| 14327d4462 | |||
| 1b968903e2 | |||
| b719e95e6e | |||
| 318eb2f47d | |||
| 010f24e5c3 | |||
| db9762c5b2 | |||
| d1ebcde725 | |||
| 545f9cad2d | |||
| 3247d84b6b | |||
| e73f0a916a | |||
| 150af5ff8b | |||
| 1659ab146d | |||
| 86e17d38d4 | |||
| 1809c59f25 | |||
| 4eb9661730 | |||
| 4acbe4b31a | |||
| df17dd749f | |||
| 20e5a88e56 | |||
| 0a939a5b91 | |||
| 6ad7c30a18 | |||
| e6bfc60139 | |||
| c866baa4eb | |||
| 91303acdbe | |||
| 1273af4b1b | |||
| e682b408f3 | |||
| 0a0c206998 | |||
| 44ffd98d0c | |||
| 53ec93c8f8 | |||
| f779ed7628 | |||
| f2fdb74f23 | |||
| 4ba87e3349 | |||
| 7abee90992 | |||
| 159a9e00c8 | |||
| 9c62f38345 | |||
| 1443f5f997 | |||
| 17d8a124cd | |||
| 5cd565306e | |||
| 67010e20d7 | |||
| 704604f6fe | |||
| e687f56c7f | |||
| ff85575e98 | |||
| 26be25c218 | |||
| d3d5e0cbfb | |||
| 4796bf632c | |||
| 5eef365baf | |||
| 937ff63af9 | |||
| 33211bfb27 | |||
| a243da8b1e | |||
| 62e605a443 | |||
| 2bdaaa5a33 | |||
| bcad3c1ced | |||
| b865f5d6e7 | |||
| 00664822ec | |||
| 4594c15de7 | |||
| 2b6ec1672c | |||
| d44d5711cb | |||
| 54cb13ba62 | |||
| c32f5dd951 | |||
| 2e6c42c8ac | |||
| 5757b86d39 | |||
| 9df4a79827 | |||
| 071dd46a4c | |||
| 030d619910 | |||
| c56fd399c1 | |||
| 31c954db0e | |||
| cb6a040c4d | |||
| 51c3a753a9 | |||
| c28c592c80 | |||
| fc07f851f7 | |||
| ab4a5e6719 | |||
| 88e9dd54b2 | |||
| f53f34559a | |||
| 3e5d9a394f | |||
| 3f287eb148 | |||
| dfe854a236 | |||
| 3854c7bba2 | |||
| 01c066419d | |||
| 040b1d9bc8 | |||
| 6c4acbad68 | |||
| b5c11ece57 | |||
| 50696d2e88 | |||
| e7661fd4be | |||
| 957e11eff0 | |||
| bd6e8d093a | |||
| f7b5a86a09 | |||
| 97fd107f47 | |||
| fc688dca99 | |||
| fe3bd2a1f1 | |||
| 3625befc0b | |||
| 6e6508aafd | |||
| 3a8a0a541e | |||
| 650495306f | |||
| 5664c34790 | |||
| b1c66997ca | |||
| 114ffd4667 | |||
| ad1770ec95 | |||
| 5f22402761 | |||
| c11094a11e | |||
| 6873bf384e | |||
| 42242daf9b | |||
| 1f96b960ab | |||
| f6b30ed0c6 | |||
| c59dc129a8 | |||
| 472c1a9e3e | |||
| 24fe8ab4a4 | |||
| 453c6f05bd | |||
| 248de7f1f2 | |||
| 3bbf84861e | |||
| 0dac9044a5 | |||
| a981d1082a | |||
| 803d0c2ae2 | |||
| 06e44cc649 | |||
| fd01e5c263 | |||
| ecc47dcfbb | |||
| b6e06dfdc2 | |||
| eb630b23ae | |||
| eae7a48991 | |||
| 9436c836e6 | |||
| 7c64239b36 | |||
| 80ba371296 | |||
| 6787563efe | |||
| 9def85f9ba | |||
| 6d55f35404 | |||
| 1902c37924 | |||
| 02b5ff38a4 | |||
| f076a927c9 | |||
| 6184eaa30e | |||
| a42b72e9ce | |||
| f4dcae722c | |||
| bbcb3e9403 | |||
| 3d690b7c72 | |||
| b4ab2c69ae | |||
| 4a7f406edb | |||
| 9e18bcaeb8 | |||
| 9abfe233bc | |||
| 3267958541 | |||
| af5ee45206 | |||
| 300b72b9b8 | |||
| 42af55a740 | |||
| 3c1e6d0e5c | |||
| edf7df368e | |||
| cde38e012f | |||
| bef4f0c4e2 | |||
| bf081dce32 | |||
| 0bb3cb4aab | |||
| 0d5132f710 | |||
| cad147faf8 | |||
| cc405b83e2 | |||
| c65f5b7279 | |||
| c216340120 | |||
| ff5cbc490e | |||
| 27cba5ba31 | |||
| 9976b8132f | |||
| dbc5bd96f3 | |||
| 9489ab862b | |||
| 1bb634bc6f | |||
| 07b5c7fef4 | |||
| 4a7cfab543 | |||
| 426ef5cb88 | |||
| 5b86412407 | |||
| 4f8fcd2d3d | |||
| 16c40aa51c | |||
| 6449c4a53d | |||
| d670356388 | |||
| fb4c8549dc | |||
| 42dc5c1f0f | |||
| 659c3bc1cf | |||
| f5684f2c45 | |||
| 1d2d2b1c9c | |||
| bc06ba54b9 | |||
| 1b6e223456 | |||
| 9e4a2168c0 | |||
| 46aa26a444 | |||
| 4d01aa3006 | |||
| 2c308af615 | |||
| caf4ab60cd | |||
| 4a8d37bde1 | |||
| 3289dd8419 | |||
| 13473eeb4d | |||
| 4264cd8830 | |||
| edcc215774 | |||
| 3085fffb49 | |||
| 81a6e4b46c | |||
| e0d612c92f | |||
| fadbb91287 | |||
| 72146c08ae | |||
| 0c7cb274b4 | |||
| a08c499c95 | |||
| a879bbce59 | |||
| f11f8b3e0e | |||
| 7842545627 | |||
| 2a0f8f5ce3 | |||
| 4ae3ad7abd | |||
| a16025ca95 | |||
| fdefe09187 | |||
| 06370a763c | |||
| 691e2580e5 | |||
| f40369d061 | |||
| 046c523880 | |||
| b3b7ae26cf | |||
| 49424b8b56 | |||
| 68ff4a52dc | |||
| 07c932e9e6 | |||
| cbe3abeab0 | |||
| 3d5e3ce6cf | |||
| 4efdabc1ff | |||
| 8ca495ec50 | |||
| 69aba02c9a | |||
| 42225dd35e | |||
| ad4c9fcc83 | |||
| ef4d0c3c42 | |||
| 59cc45eaab | |||
| f64c40e91f | |||
| 46d7d30089 | |||
| 48f15bb71c | |||
| ac70b1d11b | |||
| d720082644 | |||
| 1f45b642e9 | |||
| 83228d8aa6 | |||
| 34f1e50f90 | |||
| b0c518a0d6 | |||
| aa673a3a5c | |||
| 40d58f6bc2 | |||
| 7604b24ffc | |||
| a47c0c91a3 | |||
| 0232f52281 | |||
| 08eba71c8a | |||
| 577a9249d1 | |||
| ea6461bd0a | |||
| f58c94146a | |||
| 6efe13d142 | |||
| 0a8fdc6cc8 | |||
| b91b298174 | |||
| f87038622b | |||
| 8b077848bb | |||
| 2945e6f8bf | |||
| 0f760dc388 | |||
| 5a9b5db99b | |||
| 6ba51fb338 | |||
| 146aa497f9 | |||
| e7bc82d152 | |||
| 26f8172b1a | |||
| 634584400a | |||
| 7d6be79ba8 | |||
| cef208f6ef | |||
| f4921d1317 | |||
| 7f1a74b576 | |||
| 3dc11777c6 | |||
| b536165910 | |||
| 7c7aa9e7a7 | |||
| 2b03b57b5c | |||
| 77c6120014 | |||
| b82ff7b88d | |||
| a16a75230c | |||
| 0e27b302bc | |||
| c369ab9b1c | |||
| bb267ccae7 | |||
| efe24658a4 | |||
| 5cdf9e7551 | |||
| 4390302384 | |||
| dab00e7fb2 | |||
| 929c5e7a5b | |||
| d600042110 | |||
| 0a58e7433e | |||
| 5639c985df | |||
| 9fbfbfb23b | |||
| ecd2f0e2bf | |||
| 60418276bd | |||
| 170392f0bc | |||
| 6744745152 | |||
| 009ae6a235 | |||
| bf5f72c00b | |||
| 84aca5b9e1 | |||
| 6164266870 | |||
| cc9df9c586 | |||
| 29a268d476 | |||
| 18d7aab703 | |||
| 373e6b6c8e | |||
| 71fab4f6be | |||
| de55c14a16 | |||
| e8517e954d | |||
| 78281fc82c | |||
| bc260fffde | |||
| db00a08bdc | |||
| 85cf7f26ce | |||
| acca147ff2 | |||
| d53da0e422 | |||
| 11eaaab72d | |||
| 475e64fc5b | |||
| 1bd8154ac4 | |||
| d2fa0e7852 | |||
| f2b324abc2 | |||
| d2225dd841 | |||
| 8d26aa86b9 | |||
| 7e937d7d29 | |||
| fe4b534b78 | |||
| d0a65c7c68 | |||
| 416f87f4bb | |||
| 7eeb67be28 | |||
| 7ed6ee5075 | |||
| d3c8215e15 | |||
| 30bc6c274e | |||
| ecb1068f0b | |||
| f6eef21b45 | |||
| 1aeff25316 | |||
| 6de569537f | |||
| 764bc3fead | |||
| a89d617532 | |||
| fef33795d0 | |||
| d2c04b761d | |||
| c5828aba91 | |||
| 1286f9dcb6 | |||
| 391e525fc5 | |||
| afc32b1cfa | |||
| 0797181967 | |||
| 14c5e631ff | |||
| 5cdb039c33 | |||
| a11c4fcb58 | |||
| c67a937d40 | |||
| 03fa7137b9 | |||
| e95400988e | |||
| 942c9c6a63 | |||
| 6c45665fde | |||
| d92ac8f588 | |||
| 169665da32 | |||
| c4d80b4844 | |||
| 7827749453 | |||
| 5e78697a69 | |||
| a0e6a78496 | |||
| af99a93536 | |||
| e9ea117985 | |||
| b9ddb0140f | |||
| dae70371d1 | |||
| 228cbb4082 | |||
| 679c913f3a | |||
| 03fb7947c3 | |||
| c39f5a27b2 | |||
| dbdb516f3c | |||
| c1a97b7356 | |||
| a6d8f7ea24 | |||
| 574c7600e0 | |||
| d1c0205d77 | |||
| 13c29d2c1e | |||
| dc1a0f050e | |||
| e252a00d55 | |||
| 5bedbb7c7d | |||
| e510418152 | |||
| 8197ae6aa7 | |||
| 9d619d520d | |||
| 46605479e9 | |||
| 6d20eddd43 | |||
| c1ee2a0adb | |||
| 9d29d49ada | |||
| e7b95892ff | |||
| 4bf5c77374 | |||
| df4a75f4b0 | |||
| 4bdb4cbbb5 | |||
| 4cdcdee8e4 | |||
| e6c36411cb | |||
| a4788a95af | |||
| b5de638c0b | |||
| c1a210313e | |||
| ab0ed67f81 | |||
| 5d54d5b7d6 | |||
| 1d09ffa529 | |||
| eef9d15aaa | |||
| 8034ddc413 | |||
| e75adb165a | |||
| 09ce0d5285 | |||
| cc1ad41e94 | |||
| 8a38646bc5 | |||
| a2b65f52f6 | |||
| c16d8da784 | |||
| a55582a018 | |||
| ea6d472002 | |||
| 3dc4290f2a | |||
| 6c43f75f9f | |||
| e0c6972bed | |||
| 1ab3e04cba | |||
| 1b8f664c8a | |||
| 25adfe5b28 | |||
| 7637b2bec2 | |||
| 6b3d984ca6 | |||
| da5bfe32af | |||
| cfab49a7dd | |||
| f93d22ae22 | |||
| 91b9e50fd0 | |||
| 1b457b0be6 | |||
| d77894c8fe | |||
| 366f7621fa | |||
| 984bc37e29 | |||
| 604de144b9 | |||
| 5dddaeb6e5 | |||
| 7790686a84 | |||
| 60950f056b | |||
| ef07634e09 | |||
| f70a20f740 | |||
| c1cda2d536 | |||
| 2b03e7aea8 | |||
| 58cea3e947 | |||
| f02fb7ba15 | |||
| fbafcd0cbc | |||
| bf09c88e6e | |||
| cb8f7e0ddb | |||
| f63aa33082 | |||
| 7bdf6717e1 | |||
| 2fc2801ad4 | |||
| 2bb6061a44 | |||
| a0e3488af0 | |||
| 8fef1f975a | |||
| 17fad47ca1 | |||
| b0aa168c9a | |||
| 367888968b | |||
| 11c65e6b90 | |||
| e9699ed8cc | |||
| 812362338e | |||
| b7ff0cf2a2 | |||
| fa21ae6161 | |||
| fb815c0be0 | |||
| 27c6a187a2 | |||
| 852d3b9f48 | |||
| 10884b8175 | |||
| 5f37414fee | |||
| e95644ada2 | |||
| ab4aee93c1 | |||
| 5df94a03fe | |||
| ab9f3a1635 | |||
| 110c43b97a | |||
| e0a86a8016 | |||
| 9e7f3b83c4 | |||
| 011960b159 | |||
| d23a3cedef | |||
| b782b539a5 | |||
| 2930e49d61 | |||
| 45777e6047 | |||
| 204b27ca5d | |||
| dde8f427af | |||
| 1db0966675 | |||
| b4c16002ff | |||
| ca23c76426 | |||
| 0c50815944 | |||
| 185f3c05fb | |||
| bde88ecc79 | |||
| 38e5b1f853 | |||
| 83fffe717e | |||
| 8757faf965 | |||
| 9b61fb1f85 | |||
| 16a6465453 | |||
| 1d3f05c22b | |||
| 470bdb6efb | |||
| fa53530055 | |||
| 02d0b4c99b | |||
| ca9ac35eb5 | |||
| cb68f83451 | |||
| 972675d4da | |||
| 347b1dd31c | |||
| d34e729e32 | |||
| 4954dcead8 | |||
| a2f3677784 | |||
| fb22b8bba5 | |||
| c0ca3569fd | |||
| bae5042eea | |||
| a5f831e81e | |||
| 6cb6c60eba | |||
| d4098180b6 | |||
| 9bec4b2713 | |||
| 82b899f883 | |||
| 69daec4f86 | |||
| e5d348140c | |||
| 8ba136e0a3 | |||
| 63f48a3c4c | |||
| e9d10bc012 | |||
| 96be2e6262 | |||
| 91fa230016 | |||
| d4b33a1342 | |||
| 8d08bc7fd1 | |||
| 7c08249e08 | |||
| 4f5fff96e0 | |||
| cf6379283b | |||
| 9659638f0c | |||
| 433fef9992 | |||
| d60039454a | |||
| d90b31c5df | |||
| 965dac5ff9 | |||
| 564f77bcdc | |||
| 6136ac4116 | |||
| bba84b4d11 | |||
| b52317f56b | |||
| 98f2806be6 | |||
| ebf7a1d40d | |||
| 0ce164079e | |||
| 3693d2e93d | |||
| d3a38963ae | |||
| 9ab9ae0408 | |||
| 0abb4a82b1 | |||
| 94a579e7d3 | |||
| 9d132d7f92 | |||
| 0315abc0df | |||
| 24e04f1303 | |||
| 51c2f845d8 | |||
| edc81534c4 | |||
| b10ba999cd | |||
| 12d10ce8b5 | |||
| c4554cb4e9 | |||
| 0e575a9366 | |||
| 13efbf5f98 |
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: "\U0001F41E Bug"
|
||||
about: File a bug/issue
|
||||
title: "[BUG] <title>"
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Note: Please search to see if an issue already exists for the bug you encountered.
|
||||
-->
|
||||
|
||||
### Environment:
|
||||
<!-- linux? windows? or Mac?
|
||||
Example:
|
||||
- OS: Ubuntu 20.04 -->
|
||||
|
||||
### Physical Memory Capacity:
|
||||
<!-- 8G or above is better -->
|
||||
|
||||
### Docker Image:
|
||||
<!-- Did you pull the docker image before execute docker images -->
|
||||
|
||||
### Code Version:
|
||||
<!-- Did you pull code from github? Make sure the code is up to date-->
|
||||
|
||||
### Component installation:
|
||||
<!-- Has etcd, mysql, mongodb, redis or Kafka been installed on the server before Open-IM-Server deployment-->
|
||||
|
||||
|
||||
### Log File:
|
||||
<!-- view log file(logs/openIM.log) content. -->
|
||||
|
||||
|
||||
### screenshot:
|
||||
<!---->
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
name: Deployment issues
|
||||
about: Deployment issues
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
If you are deploying OpenIM for the first time
|
||||
|
||||
|
||||
|
||||
```
|
||||
git clone https://github.com/OpenIMSDK/Open-IM-Server.git --recursive
|
||||
```
|
||||
|
||||
screenshot here
|
||||
|
||||
```
|
||||
cd Open-IM-Server/script ; chmod +x *.sh ; ./env_check.sh
|
||||
```
|
||||
|
||||
screenshot here
|
||||
|
||||
```
|
||||
cd .. ; docker-compose up -d
|
||||
```
|
||||
|
||||
screenshot here
|
||||
|
||||
```
|
||||
cd script ; ./docker_check_service.sh
|
||||
```
|
||||
|
||||
screenshot here
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: 'update '
|
||||
about: update docker image
|
||||
title: update docker image
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
cd Open-IM-Server ; docker-compose down
|
||||
```
|
||||
|
||||
screenshot here
|
||||
|
||||
```
|
||||
git pull
|
||||
```
|
||||
|
||||
screenshot here
|
||||
|
||||
```
|
||||
docker-compose pull
|
||||
```
|
||||
|
||||
screenshot here
|
||||
|
||||
```
|
||||
chmod +x script/*.sh ; docker-compose up -d
|
||||
```
|
||||
|
||||
screenshot here
|
||||
|
||||
```
|
||||
cd script ; ./docker_check_service.sh
|
||||
```
|
||||
|
||||
screenshot here
|
||||
@@ -7,6 +7,7 @@ out-test
|
||||
.github
|
||||
.idea
|
||||
|
||||
|
||||
deploy/open_im_demo
|
||||
deploy/open_im_api
|
||||
deploy/open_im_msg_gateway
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Open-IM-Server
|
||||

|
||||
|
||||

|
||||
|
||||
@@ -92,6 +93,7 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server
|
||||
4. Start docker-compose with one click(Docker automatically pulls all images)
|
||||
|
||||
```
|
||||
cd Open-IM-Server
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
@@ -99,6 +101,7 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server
|
||||
|
||||
```
|
||||
./docker_check_service.sh
|
||||
./check_all.sh
|
||||
```
|
||||
|
||||

|
||||
|
||||
+1
-1
Submodule cmd/Open-IM-SDK-Core updated: 1c6c7af539...588c9bb77b
+116
-19
@@ -7,27 +7,45 @@ import (
|
||||
"Open_IM/internal/api/friend"
|
||||
"Open_IM/internal/api/group"
|
||||
"Open_IM/internal/api/manage"
|
||||
"Open_IM/internal/api/office"
|
||||
"Open_IM/internal/api/organization"
|
||||
apiThird "Open_IM/internal/api/third"
|
||||
"Open_IM/internal/api/user"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/utils"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
//"syscall"
|
||||
"Open_IM/pkg/common/constant"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.NewPrivateLog(constant.LogFileName)
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
f, _ := os.Create("../logs/api.log")
|
||||
gin.DefaultWriter = io.MultiWriter(f)
|
||||
gin.SetMode(gin.DebugMode)
|
||||
r := gin.Default()
|
||||
r.Use(utils.CorsHandler())
|
||||
|
||||
log.Info("load config: ", config.Config)
|
||||
// user routing group, which handles user registration and login services
|
||||
userRouterGroup := r.Group("/user")
|
||||
{
|
||||
userRouterGroup.POST("/update_user_info", user.UpdateUserInfo) //1
|
||||
userRouterGroup.POST("/get_users_info", user.GetUsersInfo) //1
|
||||
userRouterGroup.POST("/get_self_user_info", user.GetSelfUserInfo) //1
|
||||
userRouterGroup.POST("/update_user_info", user.UpdateUserInfo) //1
|
||||
userRouterGroup.POST("/set_global_msg_recv_opt", user.SetGlobalRecvMessageOpt)
|
||||
userRouterGroup.POST("/get_users_info", user.GetUsersInfo) //1
|
||||
userRouterGroup.POST("/get_self_user_info", user.GetSelfUserInfo) //1
|
||||
userRouterGroup.POST("/get_users_online_status", user.GetUsersOnlineStatus) //1
|
||||
userRouterGroup.POST("/get_users_info_from_cache", user.GetUsersInfoFromCache)
|
||||
userRouterGroup.POST("/get_user_friend_from_cache", user.GetFriendIDListFromCache)
|
||||
userRouterGroup.POST("/get_black_list_from_cache", user.GetBlackIDListFromCache)
|
||||
}
|
||||
//friend routing group
|
||||
friendRouterGroup := r.Group("/friend")
|
||||
@@ -53,31 +71,51 @@ func main() {
|
||||
{
|
||||
groupRouterGroup.POST("/create_group", group.CreateGroup) //1
|
||||
groupRouterGroup.POST("/set_group_info", group.SetGroupInfo) //1
|
||||
groupRouterGroup.POST("join_group", group.JoinGroup) //1
|
||||
groupRouterGroup.POST("/join_group", group.JoinGroup) //1
|
||||
groupRouterGroup.POST("/quit_group", group.QuitGroup) //1
|
||||
groupRouterGroup.POST("/group_application_response", group.ApplicationGroupResponse) //1
|
||||
groupRouterGroup.POST("/transfer_group", group.TransferGroupOwner) //1
|
||||
groupRouterGroup.POST("/get_recv_group_applicationList", group.GetRecvGroupApplicationList) //1
|
||||
groupRouterGroup.POST("/get_user_req_group_applicationList", group.GetUserReqGroupApplicationList)
|
||||
groupRouterGroup.POST("/get_groups_info", group.GetGroupsInfo) //1
|
||||
groupRouterGroup.POST("/kick_group", group.KickGroupMember) //1
|
||||
groupRouterGroup.POST("/get_group_member_list", group.GetGroupMemberList) //no use
|
||||
groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMemberList) //1
|
||||
groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1
|
||||
groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1
|
||||
groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList) //1
|
||||
groupRouterGroup.POST("/get_groups_info", group.GetGroupsInfo) //1
|
||||
groupRouterGroup.POST("/kick_group", group.KickGroupMember) //1
|
||||
groupRouterGroup.POST("/get_group_member_list", group.GetGroupMemberList) //no use
|
||||
groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMemberList) //1
|
||||
groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1
|
||||
groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1
|
||||
groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList)
|
||||
groupRouterGroup.POST("/dismiss_group", group.DismissGroup) //
|
||||
groupRouterGroup.POST("/mute_group_member", group.MuteGroupMember)
|
||||
groupRouterGroup.POST("/cancel_mute_group_member", group.CancelMuteGroupMember) //MuteGroup
|
||||
groupRouterGroup.POST("/mute_group", group.MuteGroup)
|
||||
groupRouterGroup.POST("/cancel_mute_group", group.CancelMuteGroup)
|
||||
groupRouterGroup.POST("/set_group_member_nickname", group.SetGroupMemberNickname)
|
||||
groupRouterGroup.POST("/set_group_member_info", group.SetGroupMemberInfo)
|
||||
}
|
||||
superGroupRouterGroup := r.Group("/super_group")
|
||||
{
|
||||
superGroupRouterGroup.POST("/get_joined_group_list", group.GetJoinedSuperGroupList)
|
||||
superGroupRouterGroup.POST("/get_groups_info", group.GetSuperGroupsInfo)
|
||||
}
|
||||
//certificate
|
||||
authRouterGroup := r.Group("/auth")
|
||||
{
|
||||
authRouterGroup.POST("/user_register", apiAuth.UserRegister) //1
|
||||
authRouterGroup.POST("/user_token", apiAuth.UserToken) //1
|
||||
authRouterGroup.POST("/parse_token", apiAuth.ParseToken) //1
|
||||
authRouterGroup.POST("/force_logout", apiAuth.ForceLogout) //1
|
||||
}
|
||||
//Third service
|
||||
thirdGroup := r.Group("/third")
|
||||
{
|
||||
thirdGroup.POST("/tencent_cloud_storage_credential", apiThird.TencentCloudStorageCredential)
|
||||
thirdGroup.POST("/ali_oss_credential", apiThird.AliOSSCredential)
|
||||
thirdGroup.POST("/minio_storage_credential", apiThird.MinioStorageCredential)
|
||||
thirdGroup.POST("/minio_upload", apiThird.MinioUploadFile)
|
||||
thirdGroup.POST("/upload_update_app", apiThird.UploadUpdateApp)
|
||||
thirdGroup.POST("/get_download_url", apiThird.GetDownloadURL)
|
||||
thirdGroup.POST("/get_rtc_invitation_info", apiThird.GetRTCInvitationInfo)
|
||||
thirdGroup.POST("/get_rtc_invitation_start_app", apiThird.GetRTCInvitationInfoStartApp)
|
||||
}
|
||||
//Message
|
||||
chatGroup := r.Group("/msg")
|
||||
@@ -85,26 +123,85 @@ func main() {
|
||||
chatGroup.POST("/newest_seq", apiChat.GetSeq)
|
||||
chatGroup.POST("/send_msg", apiChat.SendMsg)
|
||||
chatGroup.POST("/pull_msg_by_seq", apiChat.PullMsgBySeqList)
|
||||
chatGroup.POST("/del_msg", apiChat.DelMsg)
|
||||
chatGroup.POST("/clear_msg", apiChat.ClearMsg)
|
||||
}
|
||||
//Manager
|
||||
managementGroup := r.Group("/manager")
|
||||
{
|
||||
managementGroup.POST("/delete_user", manage.DeleteUser) //1
|
||||
managementGroup.POST("/send_msg", manage.ManagementSendMsg)
|
||||
managementGroup.POST("/batch_send_msg", manage.ManagementBatchSendMsg)
|
||||
managementGroup.POST("/get_all_users_uid", manage.GetAllUsersUid) //1
|
||||
managementGroup.POST("/account_check", manage.AccountCheck) //1
|
||||
managementGroup.POST("/get_users_online_status", manage.GetUsersOnlineStatus) //1
|
||||
}
|
||||
//Conversation
|
||||
conversationGroup := r.Group("/conversation")
|
||||
{
|
||||
conversationGroup.POST("/set_receive_message_opt", conversation.SetReceiveMessageOpt) //1
|
||||
conversationGroup.POST("/get_receive_message_opt", conversation.GetReceiveMessageOpt) //1
|
||||
conversationGroup.POST("/get_all_conversation_message_opt", conversation.GetAllConversationMessageOpt) //1
|
||||
{ //1
|
||||
conversationGroup.POST("/get_all_conversations", conversation.GetAllConversations)
|
||||
conversationGroup.POST("/get_conversation", conversation.GetConversation)
|
||||
conversationGroup.POST("/get_conversations", conversation.GetConversations)
|
||||
conversationGroup.POST("/set_conversation", conversation.SetConversation)
|
||||
conversationGroup.POST("/batch_set_conversation", conversation.BatchSetConversations)
|
||||
conversationGroup.POST("/set_recv_msg_opt", conversation.SetRecvMsgOpt)
|
||||
conversationGroup.POST("/modify_conversation_field", conversation.ModifyConversationField)
|
||||
}
|
||||
apiThird.MinioInit()
|
||||
log.NewPrivateLog("api")
|
||||
ginPort := flag.Int("port", 10000, "get ginServerPort from cmd,default 10000 as port")
|
||||
// office
|
||||
officeGroup := r.Group("/office")
|
||||
{
|
||||
officeGroup.POST("/get_user_tags", office.GetUserTags)
|
||||
officeGroup.POST("/get_user_tag_by_id", office.GetUserTagByID)
|
||||
officeGroup.POST("/create_tag", office.CreateTag)
|
||||
officeGroup.POST("/delete_tag", office.DeleteTag)
|
||||
officeGroup.POST("/set_tag", office.SetTag)
|
||||
officeGroup.POST("/send_msg_to_tag", office.SendMsg2Tag)
|
||||
officeGroup.POST("/get_send_tag_log", office.GetTagSendLogs)
|
||||
|
||||
officeGroup.POST("/create_one_work_moment", office.CreateOneWorkMoment)
|
||||
officeGroup.POST("/delete_one_work_moment", office.DeleteOneWorkMoment)
|
||||
officeGroup.POST("/like_one_work_moment", office.LikeOneWorkMoment)
|
||||
officeGroup.POST("/comment_one_work_moment", office.CommentOneWorkMoment)
|
||||
officeGroup.POST("/get_work_moment_by_id", office.GetWorkMomentByID)
|
||||
officeGroup.POST("/get_user_work_moments", office.GetUserWorkMoments)
|
||||
officeGroup.POST("/get_user_friend_work_moments", office.GetUserFriendWorkMoments)
|
||||
officeGroup.POST("/set_user_work_moments_level", office.SetUserWorkMomentsLevel)
|
||||
officeGroup.POST("/delete_comment", office.DeleteComment)
|
||||
}
|
||||
|
||||
organizationGroup := r.Group("/organization")
|
||||
{
|
||||
organizationGroup.POST("/create_department", organization.CreateDepartment)
|
||||
organizationGroup.POST("/update_department", organization.UpdateDepartment)
|
||||
organizationGroup.POST("/get_sub_department", organization.GetSubDepartment)
|
||||
organizationGroup.POST("/delete_department", organization.DeleteDepartment)
|
||||
organizationGroup.POST("/get_all_department", organization.GetAllDepartment)
|
||||
|
||||
organizationGroup.POST("/create_organization_user", organization.CreateOrganizationUser)
|
||||
organizationGroup.POST("/update_organization_user", organization.UpdateOrganizationUser)
|
||||
organizationGroup.POST("/delete_organization_user", organization.DeleteOrganizationUser)
|
||||
|
||||
organizationGroup.POST("/create_department_member", organization.CreateDepartmentMember)
|
||||
organizationGroup.POST("/get_user_in_department", organization.GetUserInDepartment)
|
||||
organizationGroup.POST("/update_user_in_department", organization.UpdateUserInDepartment)
|
||||
|
||||
organizationGroup.POST("/get_department_member", organization.GetDepartmentMember)
|
||||
organizationGroup.POST("/delete_user_in_department", organization.DeleteUserInDepartment)
|
||||
|
||||
}
|
||||
|
||||
go apiThird.MinioInit()
|
||||
defaultPorts := config.Config.Api.GinPort
|
||||
ginPort := flag.Int("port", defaultPorts[0], "get ginServerPort from cmd,default 10002 as port")
|
||||
flag.Parse()
|
||||
r.Run(":" + strconv.Itoa(*ginPort))
|
||||
address := "0.0.0.0:" + strconv.Itoa(*ginPort)
|
||||
if config.Config.Api.ListenIP != "" {
|
||||
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
|
||||
}
|
||||
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
|
||||
fmt.Println("start api server, address: ", address)
|
||||
err := r.Run(address)
|
||||
if err != nil {
|
||||
log.Error("", "run failed ", *ginPort, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,11 @@ package main
|
||||
import (
|
||||
"Open_IM/internal/cms_api"
|
||||
"Open_IM/pkg/utils"
|
||||
"flag"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"Open_IM/pkg/common/config"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -11,5 +15,14 @@ func main() {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
router := cms_api.NewGinRouter()
|
||||
router.Use(utils.CorsHandler())
|
||||
router.Run(":" + "8000")
|
||||
defaultPorts := config.Config.CmsApi.GinPort
|
||||
ginPort := flag.Int("port", defaultPorts[0], "get ginServerPort from cmd,default 10006 as port")
|
||||
flag.Parse()
|
||||
address := "0.0.0.0:" + strconv.Itoa(*ginPort)
|
||||
if config.Config.Api.ListenIP != "" {
|
||||
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
|
||||
}
|
||||
address = config.Config.CmsApi.ListenIP + ":" + strconv.Itoa(*ginPort)
|
||||
fmt.Println("start cms api server, address: ", address)
|
||||
router.Run(address)
|
||||
}
|
||||
|
||||
@@ -2,20 +2,29 @@ package main
|
||||
|
||||
import (
|
||||
"Open_IM/internal/demo/register"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/utils"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/log"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.NewPrivateLog(constant.LogFileName)
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
f, _ := os.Create("../logs/api.log")
|
||||
gin.DefaultWriter = io.MultiWriter(f)
|
||||
|
||||
r := gin.Default()
|
||||
r.Use(utils.CorsHandler())
|
||||
|
||||
authRouterGroup := r.Group("/auth")
|
||||
authRouterGroup := r.Group("/demo")
|
||||
{
|
||||
authRouterGroup.POST("/code", register.SendVerificationCode)
|
||||
authRouterGroup.POST("/verify", register.Verify)
|
||||
@@ -23,8 +32,18 @@ func main() {
|
||||
authRouterGroup.POST("/login", register.Login)
|
||||
authRouterGroup.POST("/reset_password", register.ResetPassword)
|
||||
}
|
||||
log.NewPrivateLog("demo")
|
||||
ginPort := flag.Int("port", 42233, "get ginServerPort from cmd,default 42233 as port")
|
||||
defaultPorts := config.Config.Demo.Port
|
||||
ginPort := flag.Int("port", defaultPorts[0], "get ginServerPort from cmd,default 42233 as port")
|
||||
flag.Parse()
|
||||
r.Run(":" + strconv.Itoa(*ginPort))
|
||||
fmt.Println("start demo api server, port: ", *ginPort)
|
||||
address := "0.0.0.0:" + strconv.Itoa(*ginPort)
|
||||
if config.Config.Api.ListenIP != "" {
|
||||
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
|
||||
}
|
||||
address = config.Config.CmsApi.ListenIP + ":" + strconv.Itoa(*ginPort)
|
||||
fmt.Println("start demo api server address: ", address)
|
||||
err := r.Run(address)
|
||||
if err != nil {
|
||||
log.Error("", "run failed ", *ginPort, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,24 @@ package main
|
||||
|
||||
import (
|
||||
"Open_IM/internal/msg_gateway/gate"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/log"
|
||||
"flag"
|
||||
"fmt"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcPort := flag.Int("rpc_port", 10400, "rpc listening port")
|
||||
wsPort := flag.Int("ws_port", 17778, "ws listening port")
|
||||
log.NewPrivateLog(constant.LogFileName)
|
||||
defaultRpcPorts := config.Config.RpcPort.OpenImMessageGatewayPort
|
||||
defaultWsPorts := config.Config.LongConnSvr.WebsocketPort
|
||||
rpcPort := flag.Int("rpc_port", defaultRpcPorts[0], "rpc listening port")
|
||||
wsPort := flag.Int("ws_port", defaultWsPorts[0], "ws listening port")
|
||||
flag.Parse()
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
fmt.Println("start rpc/msg_gateway server, port: ", *rpcPort, *wsPort)
|
||||
gate.Init(*rpcPort, *wsPort)
|
||||
gate.Run()
|
||||
wg.Wait()
|
||||
|
||||
@@ -2,13 +2,18 @@ package main
|
||||
|
||||
import (
|
||||
"Open_IM/internal/msg_transfer/logic"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/log"
|
||||
"fmt"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
log.NewPrivateLog(constant.LogFileName)
|
||||
logic.Init()
|
||||
fmt.Println("start msg_transfer server")
|
||||
logic.Run()
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
@@ -2,15 +2,22 @@ package main
|
||||
|
||||
import (
|
||||
"Open_IM/internal/push/logic"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/log"
|
||||
"flag"
|
||||
"fmt"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcPort := flag.Int("port", 10700, "rpc listening port")
|
||||
defaultPorts := config.Config.RpcPort.OpenImPushPort
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
|
||||
flag.Parse()
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
log.NewPrivateLog(constant.LogFileName)
|
||||
fmt.Println("start push rpc server, port: ", *rpcPort)
|
||||
logic.Init(*rpcPort)
|
||||
logic.Run()
|
||||
wg.Wait()
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
commonDB "Open_IM/pkg/common/db"
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.NewPrivateLog("timer")
|
||||
//for {
|
||||
// fmt.Println("start delete mongodb expired record")
|
||||
// timeUnixBegin := time.Now().Unix()
|
||||
// count, _ := db.DB.MgoUserCount()
|
||||
// fmt.Println("mongodb record count: ", count)
|
||||
// for i := 0; i < count; i++ {
|
||||
// time.Sleep(1 * time.Millisecond)
|
||||
// uid, _ := db.DB.MgoSkipUID(i)
|
||||
// fmt.Println("operate uid: ", uid)
|
||||
// err := db.DB.DelUserChat(uid)
|
||||
// if err != nil {
|
||||
// fmt.Println("operate uid failed: ", uid, err.Error())
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// timeUnixEnd := time.Now().Unix()
|
||||
// costTime := timeUnixEnd - timeUnixBegin
|
||||
// if costTime > int64(config.Config.Mongo.DBRetainChatRecords*24*3600) {
|
||||
// continue
|
||||
// } else {
|
||||
// sleepTime := 0
|
||||
// if int64(config.Config.Mongo.DBRetainChatRecords*24*3600)-costTime > 24*3600 {
|
||||
// sleepTime = 24 * 3600
|
||||
// } else {
|
||||
// sleepTime = config.Config.Mongo.DBRetainChatRecords*24*3600 - int(costTime)
|
||||
// }
|
||||
// fmt.Println("sleep: ", sleepTime)
|
||||
// time.Sleep(time.Duration(sleepTime) * time.Second)
|
||||
// }
|
||||
//}
|
||||
for {
|
||||
uidList, err := im_mysql_model.SelectAllUserID()
|
||||
if err != nil {
|
||||
//log.NewError("999999", err.Error())
|
||||
} else {
|
||||
for _, v := range uidList {
|
||||
minSeq, err := commonDB.DB.GetMinSeqFromMongo(v)
|
||||
if err != nil {
|
||||
//log.NewError("999999", "get user minSeq err", err.Error(), v)
|
||||
continue
|
||||
} else {
|
||||
err := commonDB.DB.SetUserMinSeq(v, minSeq)
|
||||
if err != nil {
|
||||
//log.NewError("999999", "set user minSeq err", err.Error(), v)
|
||||
}
|
||||
}
|
||||
time.Sleep(time.Duration(100) * time.Millisecond)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,13 +2,16 @@ package main
|
||||
|
||||
import (
|
||||
rpcMessageCMS "Open_IM/internal/rpc/admin_cms"
|
||||
"Open_IM/pkg/common/config"
|
||||
"flag"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcPort := flag.Int("port", 11000, "rpc listening port")
|
||||
defaultPorts := config.Config.RpcPort.OpenImAdminCmsPort
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
|
||||
flag.Parse()
|
||||
fmt.Println("start cms rpc server, port: ", *rpcPort)
|
||||
rpcServer := rpcMessageCMS.NewAdminCMSServer(*rpcPort)
|
||||
rpcServer.Run()
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,16 @@ package main
|
||||
|
||||
import (
|
||||
rpcAuth "Open_IM/internal/rpc/auth"
|
||||
"Open_IM/pkg/common/config"
|
||||
"flag"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcPort := flag.Int("port", 10600, "RpcToken default listen port 10800")
|
||||
defaultPorts := config.Config.RpcPort.OpenImAuthPort
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "RpcToken default listen port 10800")
|
||||
flag.Parse()
|
||||
fmt.Println("start auth rpc server, port: ", *rpcPort)
|
||||
rpcServer := rpcAuth.NewRpcAuthServer(*rpcPort)
|
||||
rpcServer.Run()
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_timer_task
|
||||
BIN_DIR=../../bin/
|
||||
BINARY_NAME=open_im_cache
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
all: gotool build
|
||||
|
||||
@@ -22,4 +22,3 @@ install:
|
||||
clean:
|
||||
@if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
rpcCache "Open_IM/internal/rpc/cache"
|
||||
"Open_IM/pkg/common/config"
|
||||
"flag"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
defaultPorts := config.Config.RpcPort.OpenImCachePort
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "RpcToken default listen port 10800")
|
||||
flag.Parse()
|
||||
fmt.Println("start auth rpc server, port: ", *rpcPort)
|
||||
rpcServer := rpcCache.NewCacheServer(*rpcPort)
|
||||
rpcServer.Run()
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_conversation
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
all: gotool build
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
|
||||
gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
@if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
rpcConversation "Open_IM/internal/rpc/conversation"
|
||||
"Open_IM/pkg/common/config"
|
||||
"flag"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
defaultPorts := config.Config.RpcPort.OpenImConversationPort
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "RpcConversation default listen port 11300")
|
||||
flag.Parse()
|
||||
fmt.Println("start conversation rpc server, port: ", *rpcPort)
|
||||
rpcServer := rpcConversation.NewRpcConversationServer(*rpcPort)
|
||||
rpcServer.Run()
|
||||
|
||||
}
|
||||
@@ -2,13 +2,16 @@ package main
|
||||
|
||||
import (
|
||||
"Open_IM/internal/rpc/friend"
|
||||
"Open_IM/pkg/common/config"
|
||||
"flag"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
rpcPort := flag.Int("port", 10200, "get RpcFriendPort from cmd,default 12000 as port")
|
||||
defaultPorts := config.Config.RpcPort.OpenImFriendPort
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "get RpcFriendPort from cmd,default 12000 as port")
|
||||
flag.Parse()
|
||||
fmt.Println("start friend rpc server, port: ", *rpcPort)
|
||||
rpcServer := friend.NewFriendServer(*rpcPort)
|
||||
rpcServer.Run()
|
||||
}
|
||||
|
||||
@@ -2,12 +2,16 @@ package main
|
||||
|
||||
import (
|
||||
"Open_IM/internal/rpc/group"
|
||||
"Open_IM/pkg/common/config"
|
||||
"flag"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcPort := flag.Int("port", 10500, "get RpcGroupPort from cmd,default 16000 as port")
|
||||
defaultPorts := config.Config.RpcPort.OpenImGroupPort
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "get RpcGroupPort from cmd,default 16000 as port")
|
||||
flag.Parse()
|
||||
fmt.Println("start group rpc server, port: ", *rpcPort)
|
||||
rpcServer := group.NewGroupServer(*rpcPort)
|
||||
rpcServer.Run()
|
||||
}
|
||||
|
||||
@@ -2,12 +2,16 @@ package main
|
||||
|
||||
import (
|
||||
rpcMessageCMS "Open_IM/internal/rpc/message_cms"
|
||||
"Open_IM/pkg/common/config"
|
||||
"flag"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcPort := flag.Int("port", 10900, "rpc listening port")
|
||||
defaultPorts := config.Config.RpcPort.OpenImMessageCmsPort[0]
|
||||
rpcPort := flag.Int("port", defaultPorts, "rpc listening port")
|
||||
flag.Parse()
|
||||
fmt.Println("start msg cms rpc server, port: ", *rpcPort)
|
||||
rpcServer := rpcMessageCMS.NewMessageCMSServer(*rpcPort)
|
||||
rpcServer.Run()
|
||||
}
|
||||
|
||||
@@ -2,12 +2,16 @@ package main
|
||||
|
||||
import (
|
||||
rpcChat "Open_IM/internal/rpc/msg"
|
||||
"Open_IM/pkg/common/config"
|
||||
"flag"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcPort := flag.Int("port", 10300, "rpc listening port")
|
||||
defaultPorts := config.Config.RpcPort.OpenImMessagePort
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
|
||||
flag.Parse()
|
||||
fmt.Println("start msg rpc server, port: ", *rpcPort)
|
||||
rpcServer := rpcChat.NewRpcChatServer(*rpcPort)
|
||||
rpcServer.Run()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_office
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
all: gotool build
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
|
||||
gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
@if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
|
||||
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
rpc "Open_IM/internal/rpc/office"
|
||||
"Open_IM/pkg/common/config"
|
||||
"flag"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
defaultPorts := config.Config.RpcPort.OpenImOfficePort
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
|
||||
flag.Parse()
|
||||
fmt.Println("start office rpc server, port: ", *rpcPort)
|
||||
rpcServer := rpc.NewOfficeServer(*rpcPort)
|
||||
rpcServer.Run()
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
.PHONY: all build run gotool install clean help
|
||||
|
||||
BINARY_NAME=open_im_organization
|
||||
BIN_DIR=../../../bin/
|
||||
|
||||
all: gotool build
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
|
||||
|
||||
run:
|
||||
@go run ./
|
||||
|
||||
gotool:
|
||||
go fmt ./
|
||||
go vet ./
|
||||
|
||||
install:
|
||||
make build
|
||||
mv ${BINARY_NAME} ${BIN_DIR}
|
||||
|
||||
clean:
|
||||
@if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"Open_IM/internal/rpc/organization"
|
||||
"Open_IM/pkg/common/config"
|
||||
"flag"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
defaultPorts := config.Config.RpcPort.OpenImOrganizationPort
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "get RpcOrganizationPort from cmd,default 11200 as port")
|
||||
flag.Parse()
|
||||
fmt.Println("start organization rpc server, port: ", *rpcPort)
|
||||
rpcServer := organization.NewServer(*rpcPort)
|
||||
rpcServer.Run()
|
||||
}
|
||||
@@ -2,12 +2,16 @@ package main
|
||||
|
||||
import (
|
||||
"Open_IM/internal/rpc/statistics"
|
||||
"Open_IM/pkg/common/config"
|
||||
"flag"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcPort := flag.Int("port", 10800, "rpc listening port")
|
||||
defaultPorts := config.Config.RpcPort.OpenImStatisticsPort
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
|
||||
flag.Parse()
|
||||
fmt.Println("start statistics rpc server, port: ", *rpcPort)
|
||||
rpcServer := statistics.NewStatisticsServer(*rpcPort)
|
||||
rpcServer.Run()
|
||||
}
|
||||
|
||||
@@ -2,12 +2,16 @@ package main
|
||||
|
||||
import (
|
||||
"Open_IM/internal/rpc/user"
|
||||
"Open_IM/pkg/common/config"
|
||||
"flag"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rpcPort := flag.Int("port", 10100, "rpc listening port")
|
||||
defaultPorts := config.Config.RpcPort.OpenImUserPort
|
||||
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
|
||||
flag.Parse()
|
||||
fmt.Println("start user rpc server, port: ", *rpcPort)
|
||||
rpcServer := user.NewUserServer(*rpcPort)
|
||||
rpcServer.Run()
|
||||
}
|
||||
|
||||
+245
-37
@@ -1,12 +1,15 @@
|
||||
# The class cannot be named by Pascal or camel case.
|
||||
# The class cannot be named by Pascal or camel case.
|
||||
# If it is not used, the corresponding structure will not be set,
|
||||
# and it will not be read naturally.
|
||||
serverversion: 2.0.0
|
||||
#---------------Infrastructure configuration---------------------#
|
||||
etcd:
|
||||
etcdSchema: openIM #默认即可
|
||||
etcdSchema: openim #默认即可
|
||||
etcdAddr: [ 127.0.0.1:2379 ] #单机部署时,默认即可
|
||||
|
||||
k8sMod: false #开启k8s模式 使用pod里面环境变量请求services调用服务 而并非etcd
|
||||
|
||||
mysql:
|
||||
dbMysqlAddress: [ 127.0.0.1:13306 ] #mysql地址 目前仅支持单机,默认即可
|
||||
dbMysqlUserName: root #mysql用户名,建议修改
|
||||
@@ -19,32 +22,41 @@ mysql:
|
||||
dbMaxLifeTime: 120
|
||||
|
||||
mongo:
|
||||
dbAddress: [ 127.0.0.1:37017 ] #redis地址 目前仅支持单机,默认即可
|
||||
dbUri: ""#当dbUri值不为空则直接使用该值
|
||||
dbAddress: 127.0.0.1:37017 #单机时为mongo地址,使用分片集群时,为mongos地址 默认即可
|
||||
dbDirect: false
|
||||
dbTimeout: 10
|
||||
dbTimeout: 60
|
||||
dbDatabase: openIM #mongo db 默认即可
|
||||
dbSource: admin
|
||||
dbUserName: #mongo用户名,建议先不设置
|
||||
dbPassword: #mongo密码,建议先不设置
|
||||
dbMaxPoolSize: 20
|
||||
dbMaxPoolSize: 100
|
||||
dbRetainChatRecords: 3650 #mongo保存离线消息时间(天),根据需求修改
|
||||
|
||||
redis:
|
||||
dbAddress: 127.0.0.1:16379 #redis地址 目前仅支持单机,默认即可
|
||||
dbAddress: [ 127.0.0.1:16379 ] #redis地址 单机时,填写一个地址即可,使用redis集群时候,填写集群中多个节点地址(主从地址都可以填写,增加容灾能力),默认即可
|
||||
dbMaxIdle: 128
|
||||
dbMaxActive: 0
|
||||
dbIdleTimeout: 120
|
||||
dbPassWord: openIM #redis密码 建议修改
|
||||
enableCluster: false #如果外部redis以集群方式启动,需要打开此开关
|
||||
|
||||
kafka:
|
||||
ws2mschat:
|
||||
addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可
|
||||
topic: "ws2ms_chat"
|
||||
ws2mschatoffline:
|
||||
addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可
|
||||
topic: "ws2ms_chat_offline"
|
||||
msgtomongo:
|
||||
addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可
|
||||
topic: "msg_to_mongo"
|
||||
ms2pschat:
|
||||
addr: [ 127.0.0.1:9092 ] #kafka配置,默认即可
|
||||
topic: "ms2ps_chat"
|
||||
consumergroupid:
|
||||
msgToMongo: mongo
|
||||
msgToTransfer: mongo
|
||||
msgToMongo: mongo_ex
|
||||
msgToMySql: mysql
|
||||
msgToPush: push
|
||||
|
||||
@@ -58,6 +70,11 @@ kafka:
|
||||
#如果是单机模式,用0.0.0.0或者不填,默认即可
|
||||
serverip: 0.0.0.0
|
||||
|
||||
rpcRegisterIP: 127.0.0.1
|
||||
listenIP: 0.0.0.0
|
||||
|
||||
|
||||
|
||||
# endpoints 内部组件间访问的端点host名称,访问时,可以内部直接访问 host:port 来访问
|
||||
endpoints:
|
||||
api: openim_api
|
||||
@@ -72,40 +89,62 @@ endpoints:
|
||||
rpc_statistic: openim_rpc_statistic
|
||||
rpc_admin_cms: openim_rpc_admin_cms
|
||||
rpc_message_cms: openim_rpc_admin_cms
|
||||
rpc_office: openim_rpc_office
|
||||
|
||||
api:
|
||||
openImApiPort: [ 10000 ] #api服务端口,默认即可,需要开放此端口或做nginx转发
|
||||
openImApiPort: [ 10002 ] #api服务端口,默认即可,需要开放此端口或做nginx转发
|
||||
listenIP: 0.0.0.0
|
||||
cmsapi:
|
||||
openImCmsApiPort: [ 8000 ] #管理后台api服务端口,默认即可,需要开放此端口或做nginx转发
|
||||
openImCmsApiPort: [ 10006 ] #管理后台api服务端口,默认即可,需要开放此端口或做nginx转发
|
||||
listenIP: 0.0.0.0
|
||||
sdk:
|
||||
openImSdkWsPort: [ 30000 ] #jssdk服务端口,默认即可,项目中使用jssdk才需开放此端口或做nginx转发
|
||||
|
||||
openImSdkWsPort: [ 10003 ] #jssdk服务端口,默认即可,项目中使用jssdk才需开放此端口或做nginx转发
|
||||
dataDir: [ ../db/sdk/ ]
|
||||
#对象存储服务,以下配置二选一,目前支持两种,腾讯云和minio,二者配置好其中一种即可(如果使用minio参考https://doc.rentsoft.cn/#/qa/minio搭建minio服务器)
|
||||
credential: #腾讯cos,发送图片、视频、文件时需要,请自行申请后替换,必须修改
|
||||
tencent:
|
||||
appID: 1302656840
|
||||
region: ap-chengdu
|
||||
bucket: echat-1302656840
|
||||
secretID: AKIDGNYVChzIQinu7QEgtNp0hnNgqcV8vZTC
|
||||
secretKey: kz15vW83qM6dBUWIq681eBZA0c0vlIbe
|
||||
minio: #MinIO 发送图片、视频、文件时需要,请自行申请后替换,必须修改。 客户端初始化时相应改动
|
||||
bucket: openim
|
||||
secretID: AKIDGNYVChzIQinu7QEgtNp0hnNgqcV8vZTC1
|
||||
secretKey: kz15vW83qM6dBUWIq681eBZA0c0vlIbe1
|
||||
minio: #MinIO 发送图片、视频、文件时需要,请自行申请后替换,必须修改。 客户端初始化InitSDK,中 object_storage参数为minio
|
||||
bucket: openim # 存储内容桶
|
||||
appBucket: app # 存储app的桶
|
||||
location: us-east-1
|
||||
endpoint: http://127.0.0.1:9000
|
||||
endpoint: http://127.0.0.1:10005 #minio外网ip 这个ip是给客户端访问的
|
||||
endpointInner: http://127.0.0.1:10005 #minio内网地址 如果im server 可以通过内网访问到 minio就可以填写
|
||||
endpointInnerEnable: true #是否启用minio内网地址 启用可以让桶初始化,IM server连接minio走内网地址访问
|
||||
accessKeyID: user12345
|
||||
secretAccessKey: key12345
|
||||
ali: # ali oss
|
||||
regionID: "oss-cn-beijing"
|
||||
accessKeyID: ""
|
||||
accessKeySecret: ""
|
||||
stsEndpoint: "sts.cn-beijing.aliyun.com"
|
||||
ossEndpoint: "oss-cn-beijing.aliyuncs.com"
|
||||
bucket: "bucket1"
|
||||
finalHost: "http://bucket1.oss-cn-beijing.aliyuncs.com"
|
||||
stsDurationSeconds: 3600
|
||||
OssRoleArn: "acs:ram::xxx:role/xxx"
|
||||
|
||||
|
||||
|
||||
rpcport: #rpc服务端口 默认即可
|
||||
openImUserPort: [ 10100 ]
|
||||
openImFriendPort: [ 10200 ]
|
||||
openImOfflineMessagePort: [ 10300 ]
|
||||
openImOnlineRelayPort: [ 10400 ]
|
||||
openImGroupPort: [ 10500 ]
|
||||
openImAuthPort: [ 10600 ]
|
||||
openImPushPort: [ 10700 ]
|
||||
openImStatisticsPort: [ 10800 ]
|
||||
openImMessageCmsPort: [ 10900 ]
|
||||
openImAdminCmsPort: [ 11000 ]
|
||||
openImUserPort: [ 10110 ]
|
||||
openImFriendPort: [ 10120 ]
|
||||
openImMessagePort: [ 10130 ]
|
||||
openImMessageGatewayPort: [ 10140 ]
|
||||
openImGroupPort: [ 10150 ]
|
||||
openImAuthPort: [ 10160 ]
|
||||
openImPushPort: [ 10170 ]
|
||||
openImStatisticsPort: [ 10180 ]
|
||||
openImMessageCmsPort: [ 10190 ]
|
||||
openImAdminCmsPort: [ 10200 ]
|
||||
openImOfficePort: [ 10210 ]
|
||||
openImOrganizationPort: [ 10220 ]
|
||||
openImConversationPort: [ 10230 ]
|
||||
openImCachePort: [10240]
|
||||
c2c:
|
||||
callbackBeforeSendMsg:
|
||||
switch: false
|
||||
@@ -124,10 +163,14 @@ rpcregistername: #rpc注册服务名,默认即可
|
||||
openImOnlineMessageRelayName: OnlineMessageRelay
|
||||
openImGroupName: Group
|
||||
openImAuthName: Auth
|
||||
OpenImStatisticsName: Statistics
|
||||
OpenImMessageCMSName: MessageCMS
|
||||
openImStatisticsName: Statistics
|
||||
openImMessageCMSName: MessageCMS
|
||||
openImAdminCMSName: AdminCMS
|
||||
|
||||
openImOfficeName: Office
|
||||
openImOrganizationName: Organization
|
||||
openImConversationName: Conversation
|
||||
openImCacheName: Cache
|
||||
openImRealTimeCommName: RealTimeComm
|
||||
log:
|
||||
storageLocation: ../logs/
|
||||
rotationTime: 24
|
||||
@@ -145,11 +188,12 @@ modulename: #日志文件按模块命名,默认即可
|
||||
pushName: push
|
||||
|
||||
longconnsvr:
|
||||
openImWsPort: [ 17778 ] # ws服务端口,默认即可,要开放此端口或做nginx转发
|
||||
openImWsPort: [ 10001 ] # ws服务端口,默认即可,要开放此端口或做nginx转发
|
||||
websocketMaxConnNum: 10000
|
||||
websocketMaxMsgLen: 4096
|
||||
websocketTimeOut: 10
|
||||
|
||||
## 推送只能开启一个 enable代表开启
|
||||
push:
|
||||
tpns: #腾讯推送,暂未测试 暂不要使用
|
||||
ios:
|
||||
@@ -158,26 +202,51 @@ push:
|
||||
android:
|
||||
accessID: 111
|
||||
secretKey: 111
|
||||
enable: false
|
||||
jpns: #极光推送 在极光后台申请后,修改以下四项,必须修改
|
||||
appKey: cf47465a368f24c659608e7e
|
||||
masterSecret: 02204efe3f3832947a236ee5
|
||||
pushUrl: "https://api.jpush.cn/v3/push"
|
||||
pushIntent: "intent:#Intent;component=io.openim.app.enterprisechat/io.openim.app.enterprisechat.MainActivity;end"
|
||||
enable: true
|
||||
getui: #个推推送,暂未测试 暂不要使用
|
||||
pushUrl: "https://restapi.getui.com/v2/$appId"
|
||||
masterSecret: ""
|
||||
appKey: ""
|
||||
intent: ""
|
||||
enable: false
|
||||
|
||||
|
||||
|
||||
manager:
|
||||
#app管理员userID和对应的secret 建议修改。 用于管理后台登录,也可以用户管理后台对应的api
|
||||
appManagerUid: [ "openIM123456","openIM654321", "openIM333", "openIMAdmin"]
|
||||
secrets: [ "openIM1","openIM2", "openIM333", "openIMAdmin"]
|
||||
appSysNotificationName: "系统通知"
|
||||
|
||||
secret: tuoyun
|
||||
# 多端互踢策略
|
||||
# 1:多平台登录:Android、iOS、Windows、Mac 每种平台只能一个在线,web端可以多个同时在线
|
||||
multiloginpolicy: 1
|
||||
|
||||
#chat log insert to db
|
||||
chatpersistencemysql: true
|
||||
#可靠性存储
|
||||
reliablestorage: false
|
||||
#消息缓存时间
|
||||
msgCacheTimeout: 86400
|
||||
#群聊已读开启
|
||||
groupMessageHasReadReceiptEnable: true
|
||||
#单聊已读开启
|
||||
singleMessageHasReadReceiptEnable: true
|
||||
|
||||
#token config
|
||||
tokenpolicy:
|
||||
accessSecret: "open_im_server" #token生成相关,默认即可
|
||||
# Token effective time day as a unit
|
||||
accessExpire: 3650 #token过期时间(天) 默认即可
|
||||
messageverify:
|
||||
friendVerify: false
|
||||
|
||||
# c2c:
|
||||
# callbackBeforeSendMsg:
|
||||
@@ -197,25 +266,34 @@ callback:
|
||||
# callback url 需要自行更换callback url
|
||||
callbackUrl : "http://127.0.0.1:8080/callback"
|
||||
# 开启关闭操作前后回调的配置
|
||||
callbackbeforeSendSingleMsg:
|
||||
callbackBeforeSendSingleMsg:
|
||||
enable: false # 回调是否启用
|
||||
callbackTimeOut: 2 # 回调超时时间
|
||||
CallbackFailedContinue: true # 回调超时是否继续执行代码
|
||||
callbackFailedContinue: true # 回调超时是否继续执行代码
|
||||
callbackAfterSendSingleMsg:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackBeforeSendGroupMsg:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
CallbackFailedContinue: true
|
||||
callbackFailedContinue: true
|
||||
callbackAfterSendGroupMsg:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackWordFilter:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
CallbackFailedContinue: true
|
||||
|
||||
callbackFailedContinue: true
|
||||
callbackUserOnline:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackUserOffline:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackOfflinePush:
|
||||
enable: false
|
||||
callbackTimeOut: 2
|
||||
callbackFailedContinue: true # 回调超时是否继续离线推送
|
||||
|
||||
notification:
|
||||
groupCreated:
|
||||
@@ -338,6 +416,95 @@ notification:
|
||||
defaultTips:
|
||||
tips: "entered the group" # group info changed by xx
|
||||
|
||||
groupDismissed:
|
||||
conversation:
|
||||
reliabilityLevel: 3
|
||||
unreadCount: true
|
||||
offlinePush:
|
||||
switch: false
|
||||
title: "groupDismissed title"
|
||||
desc: "groupDismissed desc"
|
||||
ext: "groupDismissed ext"
|
||||
defaultTips:
|
||||
tips: "group dismissed"
|
||||
|
||||
|
||||
groupMuted:
|
||||
conversation:
|
||||
reliabilityLevel: 3
|
||||
unreadCount: true
|
||||
offlinePush:
|
||||
switch: false
|
||||
title: "groupMuted title"
|
||||
desc: "groupMuted desc"
|
||||
ext: "groupMuted ext"
|
||||
defaultTips:
|
||||
tips: "group Muted"
|
||||
|
||||
groupCancelMuted:
|
||||
conversation:
|
||||
reliabilityLevel: 3
|
||||
unreadCount: true
|
||||
offlinePush:
|
||||
switch: false
|
||||
title: "groupCancelMuted title"
|
||||
desc: "groupCancelMuted desc"
|
||||
ext: "groupCancelMuted ext"
|
||||
defaultTips:
|
||||
tips: "group Cancel Muted"
|
||||
|
||||
|
||||
groupMemberMuted:
|
||||
conversation:
|
||||
reliabilityLevel: 3
|
||||
unreadCount: true
|
||||
offlinePush:
|
||||
switch: false
|
||||
title: "groupMemberMuted title"
|
||||
desc: "groupMemberMuted desc"
|
||||
ext: "groupMemberMuted ext"
|
||||
defaultTips:
|
||||
tips: "group Member Muted"
|
||||
|
||||
groupMemberCancelMuted:
|
||||
conversation:
|
||||
reliabilityLevel: 3
|
||||
unreadCount: true
|
||||
offlinePush:
|
||||
switch: false
|
||||
title: "groupMemberCancelMuted title"
|
||||
desc: "groupMemberCancelMuted desc"
|
||||
ext: "groupMemberCancelMuted ext"
|
||||
defaultTips:
|
||||
tips: "group Member Cancel Muted"
|
||||
|
||||
groupMemberInfoSet:
|
||||
conversation:
|
||||
reliabilityLevel: 2
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
switch: false
|
||||
title: "groupMemberInfoSet title"
|
||||
desc: "groupMemberInfoSet desc"
|
||||
ext: "groupMemberInfoSet ext"
|
||||
defaultTips:
|
||||
tips: "group member info set"
|
||||
|
||||
|
||||
organizationChanged:
|
||||
conversation:
|
||||
reliabilityLevel: 2
|
||||
unreadCount: false
|
||||
offlinePush:
|
||||
switch: false
|
||||
title: "organizationChanged title"
|
||||
desc: "organizationChanged desc"
|
||||
ext: "organizationChanged ext"
|
||||
defaultTips:
|
||||
tips: "organization changed"
|
||||
|
||||
|
||||
|
||||
#############################friend#################################
|
||||
|
||||
friendApplicationAdded:
|
||||
@@ -473,15 +640,54 @@ notification:
|
||||
defaultTips:
|
||||
tips: "conversation opt update"
|
||||
|
||||
conversationSetPrivate:
|
||||
conversation:
|
||||
reliabilityLevel: 3
|
||||
unreadCount: true
|
||||
offlinePush:
|
||||
switch: true
|
||||
title: "burn after reading"
|
||||
desc: "burn after reading"
|
||||
ext: "burn after reading"
|
||||
defaultTips:
|
||||
openTips: "burn after reading was opened"
|
||||
closeTips: "burn after reading was closed"
|
||||
|
||||
###################workMoments################
|
||||
workMomentsNotification:
|
||||
conversation:
|
||||
reliabilityLevel: 2
|
||||
unreadCount: true
|
||||
offlinePush:
|
||||
switch: true
|
||||
title: "burn after reading"
|
||||
desc: "burn after reading"
|
||||
ext: "burn after reading"
|
||||
defaultTips:
|
||||
openTips: "burn after reading was opened"
|
||||
closeTips: "burn after reading was closed"
|
||||
|
||||
###################organization################
|
||||
joinDepartmentNotification:
|
||||
conversation:
|
||||
reliabilityLevel: 3
|
||||
unreadCount: true
|
||||
offlinePush:
|
||||
switch: false
|
||||
title: "welcome user join department"
|
||||
desc: "welcome user join department"
|
||||
ext: "welcome user join department"
|
||||
defaultTips:
|
||||
tips: "welcome user join department"
|
||||
|
||||
#---------------demo configuration---------------------#
|
||||
#The following configuration items are applied to openIM Demo configuration
|
||||
#是否启动demo,如果自身没有账号体系,设置为true
|
||||
demoswitch: true
|
||||
demo:
|
||||
listenIP: 0.0.0.0
|
||||
#demo对外服务端口,默认即可,需要开放此端口或做nginx转发
|
||||
openImDemoPort: [ 42233 ]
|
||||
openImDemoPort: [ 10004 ]
|
||||
alismsverify: #阿里云短信配置,在阿里云申请成功后修改以下四项,必须修改
|
||||
accessKeyId: LTAI5tJPkn4HuuePdiLdGqe7
|
||||
accessKeySecret: 4n9OJ7ZCVN1U6KeHDAtOyNeVZcjOuV
|
||||
@@ -496,6 +702,8 @@ demo:
|
||||
senderAuthorizationCode: "gxyausfoevlzbfag"
|
||||
smtpAddr: "smtp.qq.com"
|
||||
smtpPort: 25 #需开放此端口 出口方向
|
||||
testDepartMentID: 001
|
||||
imAPIURL: http://127.0.0.1:10002
|
||||
|
||||
|
||||
|
||||
rtc:
|
||||
signalTimeout: 35
|
||||
|
||||
@@ -19,6 +19,7 @@ mysql:
|
||||
dbMaxLifeTime: 120
|
||||
|
||||
mongo:
|
||||
dbUri: ""#当dbUri值不为空则直接使用该值
|
||||
dbAddress: [ openim_mongo:27017 ]
|
||||
dbDirect: false
|
||||
dbTimeout: 10
|
||||
|
||||
@@ -6,6 +6,7 @@ ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_api $WORKDIR/main
|
||||
COPY ./start_api.sh $$WORKDIR
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
@@ -13,4 +14,4 @@ RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
||||
CMD ./start_api.sh
|
||||
@@ -0,0 +1,20 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CMDDIR $WORKDIR/cmd
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_admin_cms $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config", "/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $CMDDIR
|
||||
CMD ./main
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: admin-cms-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: admin-cms # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: admin-cms # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: admin-cms
|
||||
image: openim/admin_cms:v2.0.10k
|
||||
# imagePullPolicy: Always #每次启动都重新拉取镜像
|
||||
ports:
|
||||
- containerPort: 10200
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CMDDIR $WORKDIR/cmd
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_api $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $CMDDIR
|
||||
CMD ./main
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: api-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: api # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: api # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: api
|
||||
image: openim/api:v2.0.10k
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10002
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: api
|
||||
spec:
|
||||
ports:
|
||||
- name: api-port
|
||||
protocol: TCP
|
||||
port: 10002
|
||||
targetPort: 10002
|
||||
selector:
|
||||
app: api
|
||||
type: NodePort
|
||||
@@ -0,0 +1,18 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_auth $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: auth-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: auth # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: auth # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: auth
|
||||
image: openim/auth:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10160
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -0,0 +1,30 @@
|
||||
#/bin/sh
|
||||
source ./path_info.cfg
|
||||
|
||||
# images version
|
||||
version=v2.0.10k
|
||||
git pull
|
||||
cd ../script/; ./build_all_service.sh
|
||||
cd ../deploy_k8s/
|
||||
|
||||
for i in ${service[*]}
|
||||
do
|
||||
mv ../bin/open_im_${i} ./${i}/
|
||||
done
|
||||
|
||||
echo "move success"
|
||||
|
||||
echo "start to build images"
|
||||
|
||||
for i in ${service[*]}
|
||||
do
|
||||
echo "start to build images" $i
|
||||
cd $i
|
||||
image="openim/${i}:$version"
|
||||
docker build -t $image . -f ./${i}.Dockerfile
|
||||
echo "build ${dockerfile} success"
|
||||
docker push $image
|
||||
echo "push ${image} success "
|
||||
cd ..
|
||||
done
|
||||
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_cache $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: cache-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cache # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cache # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: cache
|
||||
image: openim/cache:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10240
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -0,0 +1,17 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_cms_api $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: cms-api-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cms-api # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cms-api # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: cms-api
|
||||
image: openim/cms_api:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10006
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: cms-api
|
||||
spec:
|
||||
ports:
|
||||
- name: cms-api-port
|
||||
protocol: TCP
|
||||
port: 10006
|
||||
targetPort: 10006
|
||||
selector:
|
||||
app: cms-api
|
||||
type: NodePort
|
||||
@@ -0,0 +1,17 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_conversation $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: conversation-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: conversation # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: conversation # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: conversation
|
||||
image: openim/conversation:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10230
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_demo $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: demo-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: demo # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: demo # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: demo
|
||||
image: openim/demo:v2.0.10k
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10004
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: demo
|
||||
spec:
|
||||
ports:
|
||||
- name: demo
|
||||
protocol: TCP
|
||||
port: 10004
|
||||
targetPort: 10004
|
||||
selector:
|
||||
app: demo
|
||||
type: NodePort
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: friend-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: friend # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: friend # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: friend
|
||||
image: openim/friend:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10120
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_friend $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: group-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: group # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: group # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: group
|
||||
image: openim/group:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10150
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -0,0 +1,18 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_group $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,101 @@
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: "nginx"
|
||||
nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
|
||||
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
|
||||
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
|
||||
name: sdk-server-ingress
|
||||
spec:
|
||||
rules:
|
||||
- host: sdk-server.openim.xxx.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: sdk-server
|
||||
port:
|
||||
number: 10003
|
||||
path: /
|
||||
pathType: Prefix
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: "nginx"
|
||||
nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
|
||||
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
|
||||
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
|
||||
name: msg-gateway-ingress
|
||||
spec:
|
||||
rules:
|
||||
- host: msg-gateway.openim.xxx.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: msg-gateway
|
||||
port:
|
||||
number: 10001
|
||||
path: /
|
||||
pathType: Prefix
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: "nginx"
|
||||
name: api-ingress
|
||||
spec:
|
||||
rules:
|
||||
- host: api.openim.xxx.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: api
|
||||
port:
|
||||
number: 10002
|
||||
path: /
|
||||
pathType: Prefix
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: "nginx"
|
||||
name: demo-ingress
|
||||
spec:
|
||||
rules:
|
||||
- host: demo.openim.xxx.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: demo
|
||||
port:
|
||||
number: 10004
|
||||
path: /
|
||||
pathType: Prefix
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: "nginx"
|
||||
name: cms-api-ingress
|
||||
spec:
|
||||
rules:
|
||||
- host: cms-api.openim.xxx.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: cms-api
|
||||
port:
|
||||
number: 10006
|
||||
path: /
|
||||
pathType: Prefix
|
||||
@@ -0,0 +1,38 @@
|
||||
#### openIM k8s部署文档
|
||||
### 1. 修改配置文件
|
||||
在Open-IM-SERVER目录下修改config/config.yaml配置文件, 将MySQL, Kafka, MongoDB等配置修改。
|
||||
使用demo需要修改demo/imAPIURL地址 让demo能请求到im的api
|
||||
|
||||
### 2. 项目根目录创建im configMap到k8s openim namespace
|
||||
kubectl create namespace openim
|
||||
kubectl -n openim create configmap config --from-file=config/config.yaml
|
||||
openim 为im项目的namespace, 可选
|
||||
查看configmap
|
||||
kubectl -n openim get configmap
|
||||
|
||||
### 3(可选). 修改每个deployment.yml
|
||||
kubectl get nodes
|
||||
kubectl label node k8s-node1 role=kube-Node
|
||||
应需要调度的node打上标签
|
||||
nodeSelector:
|
||||
node: kube-Node
|
||||
创建资源清单时添加上nodeSelector属性对应即可
|
||||
修改每种服务数量,建议至少每种2个rpc。
|
||||
如果修改了config/config.yaml某些配置比如端口,同时需要修改对应deployment端口和ingress端口
|
||||
|
||||
|
||||
### 4. 修改ingress.yaml配置文件
|
||||
需要安装ingress controller 这里使用的是ingress-nginx 其他ingress需要修改配置文件
|
||||
进行域名修改等操作
|
||||
|
||||
### 5. 执行./kubectl_start.sh脚本
|
||||
chmod +x ./kubectl_start.sh ./kubectl_stop.sh
|
||||
./kubectl_start.sh
|
||||
kubectl -n openim apply -f ingress.yaml
|
||||
kubectl 启动所有deployment,services,ingress
|
||||
|
||||
### 6. 查看k8s deployment service ingress状态
|
||||
kubectl -n openim get services
|
||||
kubectl -n openim get deployment
|
||||
kubectl -n openim get ingress
|
||||
kubectl -n openim get pods
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source ./path_info.cfg
|
||||
|
||||
#mkdir -p /db/sdk #path for jssdk sqlite
|
||||
|
||||
for i in ${service[*]}
|
||||
do
|
||||
kubectl -n openim apply -f ./${i}/deployment.yaml
|
||||
done
|
||||
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
service=(
|
||||
#api service file
|
||||
api
|
||||
cms-api
|
||||
#rpc service file
|
||||
user
|
||||
friend
|
||||
group
|
||||
auth
|
||||
admin-cms
|
||||
message-cms
|
||||
statistics
|
||||
office
|
||||
organization
|
||||
conversation
|
||||
cache
|
||||
msg-gateway
|
||||
msg-transfer
|
||||
msg
|
||||
push
|
||||
sdk-server
|
||||
demo
|
||||
)
|
||||
|
||||
for i in ${service[*]}
|
||||
do
|
||||
kubectl -n openim delete deployment "${i}-deployment"
|
||||
done
|
||||
|
||||
kubectl -n openim delete service api
|
||||
kubectl -n openim delete service cms-api
|
||||
kubectl -n openim delete service sdk-server
|
||||
kubectl -n openim delete service msg-gateway
|
||||
kubectl -n openim delete service demo
|
||||
|
||||
echo done
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: message-cms-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: message-cms # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: message-cms # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: message-cms
|
||||
image: openim/message_cms:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10190
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -0,0 +1,18 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_message_cms $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: msg-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: msg # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: msg # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: msg
|
||||
image: openim/msg:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10130
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -0,0 +1,19 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_msg $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: msg-gateway-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: msg-gateway # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: msg-gateway # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: msg-gateway
|
||||
image: openim/msg_gateway:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- name: rpc-port
|
||||
containerPort: 10140
|
||||
- name: ws-port
|
||||
containerPort: 10001
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: msg-gateway
|
||||
spec:
|
||||
ports:
|
||||
- name: msg-gateway-port
|
||||
protocol: TCP
|
||||
port: 10001
|
||||
targetPort: ws-port
|
||||
selector:
|
||||
app: msg-gateway
|
||||
type: NodePort
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_msg_gateway $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: msg-transfer-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: msg-transfer # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: msg-transfer # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: msg-transfer
|
||||
image: openim/msg_transfer:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -0,0 +1,18 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_msg_transfer $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: office-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: office # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: office # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: office
|
||||
image: openim/office:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10210
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -0,0 +1,18 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_office $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: organization-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: organization # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: organization # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: organization
|
||||
image: openim/organization:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10220
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -0,0 +1,19 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_organization $WORKDIR/cmd/main
|
||||
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,24 @@
|
||||
#/bin/sh
|
||||
service=(
|
||||
#api service file
|
||||
api
|
||||
cms_api
|
||||
#rpc service file
|
||||
user
|
||||
friend
|
||||
group
|
||||
auth
|
||||
admin_cms
|
||||
message_cms
|
||||
statistics
|
||||
office
|
||||
organization
|
||||
conversation
|
||||
cache
|
||||
msg_gateway
|
||||
msg_transfer
|
||||
msg
|
||||
push
|
||||
sdk_server
|
||||
demo
|
||||
)
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: push-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: push # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: push # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: push
|
||||
image: openim/push:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10170
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -0,0 +1,19 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_push $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sdk-server-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sdk-server # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sdk-server # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: sdk-server
|
||||
image: openim/sdk_server:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10003
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
- name: local-db
|
||||
mountPath: /db/sdk
|
||||
command: ["/Open-IM-Server/main"]
|
||||
args: ["-openIM_api_port", "10002", "-openIM_ws_port", "10001", "-sdk_ws_port", "10003", "-openIM_log_level", "6"]
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
- name: local-db
|
||||
hostPath:
|
||||
path: /db/sdk
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: sdk-server
|
||||
spec:
|
||||
ports:
|
||||
- name: sdk-server-port
|
||||
protocol: TCP
|
||||
port: 10003
|
||||
targetPort: 10003
|
||||
selector:
|
||||
app: sdk-server
|
||||
type: NodePort
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_sdk_server $WORKDIR/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script","/Open-IM-Server/db/sdk"]
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: statistics-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: statistics # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: statistics # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: statistics
|
||||
image: openim/statistics:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 10180
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -0,0 +1,18 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_statistics $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: user-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: user # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: user # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: user
|
||||
image: openim/user:v2.0.10k
|
||||
# imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
@@ -0,0 +1,18 @@
|
||||
FROM ubuntu
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /Open-IM-Server
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_user $WORKDIR/cmd/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
|
||||
chmod +x $WORKDIR/cmd/main
|
||||
|
||||
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./cmd/main
|
||||
+9
-3
@@ -32,6 +32,7 @@ services:
|
||||
# - MONGO_INITDB_ROOT_USERNAME=openIM
|
||||
# - MONGO_INITDB_ROOT_PASSWORD=openIM
|
||||
|
||||
|
||||
#TZ: Asia/Shanghai
|
||||
restart: always
|
||||
|
||||
@@ -68,12 +69,17 @@ services:
|
||||
image: wurstmeister/kafka
|
||||
container_name: kafka
|
||||
restart: always
|
||||
ports:
|
||||
- 9093:9093
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
KAFKA_BROKER_ID: 0
|
||||
KAFKA_ZOOKEEPER_CONNECT: 127.0.0.1:2181
|
||||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://127.0.0.1:9092
|
||||
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
|
||||
KAFKA_CREATE_TOPICS: "ws2ms_chat:8:1,ms2ps_chat:8:1,msg_to_mongo:8:1"
|
||||
KAFKA_ADVERTISED_LISTENERS: INSIDE://127.0.0.1:9092,OUTSIDE://103.116.45.174:9093
|
||||
KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://:9093
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT"
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
|
||||
network_mode: "host"
|
||||
depends_on:
|
||||
- zookeeper
|
||||
@@ -93,7 +99,7 @@ services:
|
||||
command: /usr/local/bin/etcd --name etcd0 --data-dir /etcd-data --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-advertise-peer-urls http://0.0.0.0:2380 --initial-cluster etcd0=http://0.0.0.0:2380 --initial-cluster-token tkn --initial-cluster-state new
|
||||
|
||||
open_im_server:
|
||||
image: openim/open_im_server:v2.0.2
|
||||
image: openim/open_im_server:v2.1.0
|
||||
container_name: open_im_server
|
||||
volumes:
|
||||
- ./logs:/Open-IM-Server/logs
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 208 KiB After Width: | Height: | Size: 144 KiB |
@@ -3,25 +3,21 @@ module Open_IM
|
||||
go 1.15
|
||||
|
||||
require (
|
||||
github.com/Shopify/sarama v1.19.0
|
||||
github.com/Shopify/toxiproxy v2.1.4+incompatible // indirect
|
||||
github.com/Shopify/sarama v1.32.0
|
||||
github.com/alibabacloud-go/darabonba-openapi v0.1.11
|
||||
github.com/alibabacloud-go/dysmsapi-20170525/v2 v2.0.8
|
||||
github.com/alibabacloud-go/sts-20150401 v1.1.0
|
||||
github.com/alibabacloud-go/tea v1.1.17
|
||||
github.com/antonfisher/nested-logrus-formatter v1.3.0
|
||||
github.com/bwmarrin/snowflake v0.3.0
|
||||
github.com/eapache/go-resiliency v1.2.0 // indirect
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
|
||||
github.com/eapache/queue v1.1.0 // indirect
|
||||
github.com/fatih/structs v1.1.0
|
||||
github.com/frankban/quicktest v1.14.0 // indirect
|
||||
github.com/garyburd/redigo v1.6.2
|
||||
github.com/gin-gonic/gin v1.7.0
|
||||
github.com/go-playground/validator/v10 v10.4.1
|
||||
github.com/go-redis/redis/v8 v8.11.5
|
||||
github.com/go-sql-driver/mysql v1.6.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2
|
||||
github.com/golang-jwt/jwt/v4 v4.1.0
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/jinzhu/copier v0.3.4
|
||||
github.com/jinzhu/gorm v1.9.16
|
||||
@@ -35,26 +31,24 @@ require (
|
||||
github.com/mitchellh/mapstructure v1.4.2
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
|
||||
github.com/olivere/elastic/v7 v7.0.23
|
||||
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
||||
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/spf13/viper v1.9.0
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
|
||||
go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698
|
||||
go.etcd.io/etcd/api/v3 v3.5.4
|
||||
go.etcd.io/etcd/client/v3 v3.5.4
|
||||
go.mongodb.org/mongo-driver v1.8.3
|
||||
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb
|
||||
golang.org/x/net v0.0.0-20210917221730-978cfadd31cf
|
||||
google.golang.org/grpc v1.40.0
|
||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd
|
||||
google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71 // indirect
|
||||
google.golang.org/grpc v1.45.0
|
||||
google.golang.org/protobuf v1.27.1
|
||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
||||
gopkg.in/ini.v1 v1.66.2 // indirect
|
||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||
sigs.k8s.io/yaml v1.2.0 // indirect
|
||||
)
|
||||
|
||||
replace google.golang.org/grpc => google.golang.org/grpc v1.29.1
|
||||
replace github.com/Shopify/sarama => github.com/Shopify/sarama v1.29.0
|
||||
|
||||
+113
-17
@@ -4,11 +4,13 @@ import (
|
||||
api "Open_IM/pkg/base_info"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
rpc "Open_IM/pkg/proto/auth"
|
||||
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/fatih/structs"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -17,14 +19,16 @@ import (
|
||||
func UserRegister(c *gin.Context) {
|
||||
params := api.UserRegisterReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
errMsg := " BindJSON failed " + err.Error()
|
||||
log.NewError("0", errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
if params.Secret != config.Config.Secret {
|
||||
log.NewError(params.OperationID, "params.Secret != config.Config.Secret", params.Secret, config.Config.Secret)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "not authorized"})
|
||||
errMsg := " params.Secret != config.Config.Secret "
|
||||
log.NewError(params.OperationID, errMsg, params.Secret, config.Config.Secret)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
req := &rpc.UserRegisterReq{UserInfo: &open_im_sdk.UserInfo{}}
|
||||
@@ -32,20 +36,34 @@ func UserRegister(c *gin.Context) {
|
||||
//copier.Copy(req.UserInfo, ¶ms)
|
||||
req.OperationID = params.OperationID
|
||||
log.NewInfo(req.OperationID, "UserRegister args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + " getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewAuthClient(etcdConn)
|
||||
reply, err := client.UserRegister(context.Background(), req)
|
||||
if err != nil || reply.CommonResp.ErrCode != 0 {
|
||||
log.NewError(req.OperationID, "UserRegister failed ", err, reply.CommonResp.ErrCode)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": reply.CommonResp.ErrMsg})
|
||||
if err != nil {
|
||||
errMsg := req.OperationID + " " + "UserRegister failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
if reply.CommonResp.ErrCode != 0 {
|
||||
errMsg := req.OperationID + " " + " UserRegister failed " + reply.CommonResp.ErrMsg + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
pbDataToken := &rpc.UserTokenReq{Platform: params.Platform, FromUserID: params.UserID, OperationID: params.OperationID}
|
||||
replyToken, err := client.UserToken(context.Background(), pbDataToken)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "UserToken failed ", err.Error(), pbDataToken)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
errMsg := req.OperationID + " " + " client.UserToken failed " + err.Error() + pbDataToken.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
resp := api.UserRegisterResp{CommResp: api.CommResp{ErrCode: replyToken.CommonResp.ErrCode, ErrMsg: replyToken.CommonResp.ErrMsg},
|
||||
@@ -58,28 +76,106 @@ func UserRegister(c *gin.Context) {
|
||||
func UserToken(c *gin.Context) {
|
||||
params := api.UserTokenReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
errMsg := " BindJSON failed " + err.Error()
|
||||
log.NewError("0", errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
if params.Secret != config.Config.Secret {
|
||||
errMsg := params.OperationID + " params.Secret != config.Config.Secret "
|
||||
log.NewError(params.OperationID, "params.Secret != config.Config.Secret", params.Secret, config.Config.Secret)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "not authorized"})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
req := &rpc.UserTokenReq{Platform: params.Platform, FromUserID: params.UserID, OperationID: params.OperationID}
|
||||
log.NewInfo(req.OperationID, "UserToken args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + " getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewAuthClient(etcdConn)
|
||||
reply, err := client.UserToken(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "UserToken failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
errMsg := req.OperationID + " UserToken failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
resp := api.UserTokenResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg},
|
||||
UserToken: api.UserTokenInfo{UserID: req.FromUserID, Token: reply.Token, ExpiredTime: reply.ExpiredTime}}
|
||||
log.NewInfo(req.OperationID, "UserRegister return ", resp)
|
||||
log.NewInfo(req.OperationID, "UserToken return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func ParseToken(c *gin.Context) {
|
||||
params := api.ParseTokenReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
errMsg := " BindJSON failed " + err.Error()
|
||||
log.NewError("0", errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var expireTime int64
|
||||
ok, _, errInfo, expireTime = token_verify.GetUserIDFromTokenExpireTime(c.Request.Header.Get("token"), params.OperationID)
|
||||
if !ok {
|
||||
errMsg := params.OperationID + " " + "GetUserIDFromTokenExpireTime failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(params.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
resp := api.ParseTokenResp{CommResp: api.CommResp{ErrCode: 0, ErrMsg: ""}, ExpireTime: api.ExpireTime{ExpireTimeSeconds: uint32(expireTime)}}
|
||||
resp.Data = structs.Map(&resp.ExpireTime)
|
||||
log.NewInfo(params.OperationID, "ParseToken return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func ForceLogout(c *gin.Context) {
|
||||
params := api.ForceLogoutReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
errMsg := " BindJSON failed " + err.Error()
|
||||
log.NewError("0", errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
req := &rpc.ForceLogoutReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "ForceLogout args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + " getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewAuthClient(etcdConn)
|
||||
reply, err := client.ForceLogout(context.Background(), req)
|
||||
if err != nil {
|
||||
errMsg := req.OperationID + " UserToken failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
resp := api.ForceLogoutResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}}
|
||||
log.NewInfo(params.OperationID, utils.GetSelfFuncName(), " return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package apiChat
|
||||
|
||||
import (
|
||||
api "Open_IM/pkg/base_info"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
rpc "Open_IM/pkg/proto/chat"
|
||||
pbCommon "Open_IM/pkg/proto/sdk_ws"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func DelMsg(c *gin.Context) {
|
||||
var (
|
||||
req api.DelMsgReq
|
||||
resp api.DelMsgResp
|
||||
reqPb pbCommon.DelMsgListReq
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req:", req)
|
||||
if err := utils.CopyStructFields(&reqPb, &req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error())
|
||||
}
|
||||
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, req.OperationID)
|
||||
if grpcConn == nil {
|
||||
errMsg := req.OperationID + " getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
msgClient := rpc.NewChatClient(grpcConn)
|
||||
respPb, err := msgClient.DelMsgList(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "DelMsgList failed", err.Error(), reqPb)
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": constant.ErrServer.ErrCode, "errMsg": constant.ErrServer.ErrMsg + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.ErrCode = respPb.ErrCode
|
||||
resp.ErrMsg = respPb.ErrMsg
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func ClearMsg(c *gin.Context) {
|
||||
params := api.CleanUpMsgReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
//
|
||||
req := &rpc.ClearMsgReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + " getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewChatClient(etcdConn)
|
||||
RpcResp, err := client.ClearMsg(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, " CleanUpMsg failed ", err.Error(), req.String(), RpcResp.ErrMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": RpcResp.ErrMsg})
|
||||
return
|
||||
}
|
||||
|
||||
resp := api.CleanUpMsgResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
@@ -5,7 +5,8 @@ import (
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbMsg "Open_IM/pkg/proto/chat"
|
||||
pbChat "Open_IM/pkg/proto/chat"
|
||||
sdk_ws "Open_IM/pkg/proto/sdk_ws"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
@@ -31,15 +32,18 @@ func GetSeq(c *gin.Context) {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
|
||||
return
|
||||
}
|
||||
pbData := pbMsg.GetMaxAndMinSeqReq{}
|
||||
pbData := sdk_ws.GetMaxAndMinSeqReq{}
|
||||
pbData.UserID = params.SendID
|
||||
pbData.OperationID = params.OperationID
|
||||
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
||||
|
||||
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, pbData.OperationID)
|
||||
if grpcConn == nil {
|
||||
log.ErrorByKv("get grpcConn err", pbData.OperationID, "args", params)
|
||||
errMsg := pbData.OperationID + " getcdv3.GetConn == nil"
|
||||
log.NewError(pbData.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
msgClient := pbMsg.NewChatClient(grpcConn)
|
||||
|
||||
msgClient := pbChat.NewChatClient(grpcConn)
|
||||
reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData)
|
||||
if err != nil {
|
||||
log.NewError(params.OperationID, "UserGetSeq rpc failed, ", params, err.Error())
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
"Open_IM/pkg/proto/chat"
|
||||
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
@@ -39,7 +40,10 @@ func PullMsgBySeqList(c *gin.Context) {
|
||||
|
||||
token := c.Request.Header.Get("token")
|
||||
if ok, err := token_verify.VerifyToken(token, params.SendID); !ok {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
|
||||
if err != nil {
|
||||
log.NewError(params.OperationID, utils.GetSelfFuncName(), err.Error(), token, params.SendID)
|
||||
}
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||
return
|
||||
}
|
||||
pbData := open_im_sdk.PullMessageBySeqListReq{}
|
||||
@@ -47,14 +51,20 @@ func PullMsgBySeqList(c *gin.Context) {
|
||||
pbData.OperationID = params.OperationID
|
||||
pbData.SeqList = params.SeqList
|
||||
|
||||
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
||||
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, pbData.OperationID)
|
||||
if grpcConn == nil {
|
||||
errMsg := pbData.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(pbData.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
msgClient := pbChat.NewChatClient(grpcConn)
|
||||
reply, err := msgClient.PullMessageBySeqList(context.Background(), &pbData)
|
||||
if err != nil {
|
||||
log.ErrorByKv("PullMessageBySeqList error", pbData.OperationID, "err", err.Error())
|
||||
log.Error(pbData.OperationID, "PullMessageBySeqList error", err.Error())
|
||||
return
|
||||
}
|
||||
log.InfoByKv("rpc call success to PullMessageBySeqList", pbData.OperationID, "ReplyArgs", reply.String(), len(reply.List))
|
||||
log.NewInfo(pbData.OperationID, "rpc call success to PullMessageBySeqList", reply.String(), len(reply.List))
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errCode": reply.ErrCode,
|
||||
"errMsg": reply.ErrMsg,
|
||||
|
||||
@@ -62,18 +62,22 @@ func SendMsg(c *gin.Context) {
|
||||
params := paramsUserSendMsg{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
log.ErrorByKv("json unmarshal err", "", "err", err.Error(), "data", c.PostForm("data"))
|
||||
log.Error("0", "BindJSON failed ", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
token := c.Request.Header.Get("token")
|
||||
|
||||
log.InfoByKv("api call success to sendMsgReq", params.OperationID, "Parameters", params)
|
||||
|
||||
log.NewInfo(params.OperationID, "api call success to sendMsgReq", params)
|
||||
pbData := newUserSendMsgReq(token, ¶ms)
|
||||
log.Info("", "", "api SendMsg call start..., [data: %s]", pbData.String())
|
||||
log.Info(params.OperationID, "", "api SendMsg call start..., [data: %s]", pbData.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, params.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := params.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(params.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbChat.NewChatClient(etcdConn)
|
||||
|
||||
log.Info("", "", "api SendMsg call, api call rpc...")
|
||||
@@ -84,7 +88,7 @@ func SendMsg(c *gin.Context) {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "SendMsg rpc failed, " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.Info("", "", "api SendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String())
|
||||
log.Info(params.OperationID, "", "api SendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String())
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errCode": reply.ErrCode,
|
||||
|
||||
@@ -4,10 +4,9 @@ import (
|
||||
api "Open_IM/pkg/base_info"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
"Open_IM/pkg/proto/user"
|
||||
rpc "Open_IM/pkg/proto/user"
|
||||
pbConversation "Open_IM/pkg/proto/conversation"
|
||||
pbUser "Open_IM/pkg/proto/user"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -15,111 +14,279 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func GetAllConversationMessageOpt(c *gin.Context) {
|
||||
params := api.GetAllConversationMessageOptReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
func SetConversation(c *gin.Context) {
|
||||
var (
|
||||
req api.SetConversationReq
|
||||
resp api.SetConversationResp
|
||||
reqPb pbUser.SetConversationReq
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.GetAllConversationMsgOptReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed or not set token in header"})
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
reqPb.Conversation = &pbUser.Conversation{}
|
||||
err := utils.CopyStructFields(&reqPb, req)
|
||||
err = utils.CopyStructFields(reqPb.Conversation, req.Conversation)
|
||||
if err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(params.OperationID, "GetAllConversationMessageOpt args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||
client := user.NewUserClient(etcdConn)
|
||||
RpcResp, err := client.GetAllConversationMsgOpt(context.Background(), req)
|
||||
client := pbUser.NewUserClient(etcdConn)
|
||||
respPb, err := client.SetConversation(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(params.OperationID, "GetAllConversationMsgOpt rpc failed, ", req, err.Error())
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetConversation rpc failed, ", reqPb.String(), err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()})
|
||||
return
|
||||
}
|
||||
optResult := make([]*api.OptResult, 0)
|
||||
for _, v := range RpcResp.ConversationOptResultList {
|
||||
temp := new(api.OptResult)
|
||||
temp.ConversationID = v.ConversationID
|
||||
temp.Result = &v.Result
|
||||
optResult = append(optResult, temp)
|
||||
}
|
||||
resp := api.GetAllConversationMessageOptResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, ConversationOptResultList: optResult}
|
||||
log.NewInfo(req.OperationID, "GetAllConversationMsgOpt api return: ", resp)
|
||||
resp.ErrMsg = respPb.CommonResp.ErrMsg
|
||||
resp.ErrCode = respPb.CommonResp.ErrCode
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetReceiveMessageOpt(c *gin.Context) {
|
||||
params := api.GetReceiveMessageOptReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
func ModifyConversationField(c *gin.Context) {
|
||||
var (
|
||||
req api.ModifyConversationFieldReq
|
||||
resp api.ModifyConversationFieldResp
|
||||
reqPb pbConversation.ModifyConversationFieldReq
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.GetReceiveMessageOptReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
log.NewInfo(params.OperationID, "GetReceiveMessageOpt args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||
client := user.NewUserClient(etcdConn)
|
||||
RpcResp, err := client.GetReceiveMessageOpt(context.Background(), req)
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
reqPb.Conversation = &pbConversation.Conversation{}
|
||||
err := utils.CopyStructFields(&reqPb, req)
|
||||
err = utils.CopyStructFields(reqPb.Conversation, req.Conversation)
|
||||
if err != nil {
|
||||
log.NewError(params.OperationID, "GetReceiveMessageOpt rpc failed, ", req, err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetReceiveMessageOpt rpc failed, " + err.Error()})
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
optResult := make([]*api.OptResult, 0)
|
||||
for _, v := range RpcResp.ConversationOptResultList {
|
||||
temp := new(api.OptResult)
|
||||
temp.ConversationID = v.ConversationID
|
||||
temp.Result = &v.Result
|
||||
optResult = append(optResult, temp)
|
||||
client := pbConversation.NewConversationClient(etcdConn)
|
||||
respPb, err := client.ModifyConversationField(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetConversation rpc failed, ", reqPb.String(), err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()})
|
||||
return
|
||||
}
|
||||
resp := api.GetReceiveMessageOptResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, ConversationOptResultList: optResult}
|
||||
log.NewInfo(req.OperationID, "GetReceiveMessageOpt api return: ", resp)
|
||||
resp.ErrMsg = respPb.CommonResp.ErrMsg
|
||||
resp.ErrCode = respPb.CommonResp.ErrCode
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func BatchSetConversations(c *gin.Context) {
|
||||
var (
|
||||
req api.BatchSetConversationsReq
|
||||
resp api.BatchSetConversationsResp
|
||||
reqPb pbUser.BatchSetConversationsReq
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbUser.NewUserClient(etcdConn)
|
||||
respPb, err := client.BatchSetConversations(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetConversation rpc failed, ", reqPb.String(), err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp.Data, respPb); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
resp.ErrMsg = respPb.CommonResp.ErrMsg
|
||||
resp.ErrCode = respPb.CommonResp.ErrCode
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetAllConversations(c *gin.Context) {
|
||||
var (
|
||||
req api.GetAllConversationsReq
|
||||
resp api.GetAllConversationsResp
|
||||
reqPb pbUser.GetAllConversationsReq
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbUser.NewUserClient(etcdConn)
|
||||
respPb, err := client.GetAllConversations(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetConversation rpc failed, ", reqPb.String(), err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.ErrMsg = respPb.CommonResp.ErrMsg
|
||||
resp.ErrCode = respPb.CommonResp.ErrCode
|
||||
if err := utils.CopyStructFields(&resp.Conversations, respPb.Conversations); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed, ", err.Error())
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetConversation(c *gin.Context) {
|
||||
var (
|
||||
req api.GetConversationReq
|
||||
resp api.GetConversationResp
|
||||
reqPb pbUser.GetConversationReq
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbUser.NewUserClient(etcdConn)
|
||||
respPb, err := client.GetConversation(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetConversation rpc failed, ", reqPb.String(), err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.ErrMsg = respPb.CommonResp.ErrMsg
|
||||
resp.ErrCode = respPb.CommonResp.ErrCode
|
||||
if err := utils.CopyStructFields(&resp.Conversation, respPb.Conversation); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetConversations(c *gin.Context) {
|
||||
var (
|
||||
req api.GetConversationsReq
|
||||
resp api.GetConversationsResp
|
||||
reqPb pbUser.GetConversationsReq
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbUser.NewUserClient(etcdConn)
|
||||
respPb, err := client.GetConversations(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetConversation rpc failed, ", reqPb.String(), err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.ErrMsg = respPb.CommonResp.ErrMsg
|
||||
resp.ErrCode = respPb.CommonResp.ErrCode
|
||||
if err := utils.CopyStructFields(&resp.Conversations, respPb.Conversations); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func SetRecvMsgOpt(c *gin.Context) {
|
||||
var (
|
||||
req api.SetRecvMsgOptReq
|
||||
resp api.SetRecvMsgOptResp
|
||||
reqPb pbUser.SetRecvMsgOptReq
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbUser.NewUserClient(etcdConn)
|
||||
respPb, err := client.SetRecvMsgOpt(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetRecvMsgOpt rpc failed, ", reqPb.String(), err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.ErrMsg = respPb.CommonResp.ErrMsg
|
||||
resp.ErrCode = respPb.CommonResp.ErrCode
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
//Deprecated
|
||||
func SetReceiveMessageOpt(c *gin.Context) {
|
||||
params := api.SetReceiveMessageOptReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError(params.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.SetReceiveMessageOptReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
return
|
||||
}
|
||||
log.NewInfo(params.OperationID, "SetReceiveMessageOpt args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||
client := user.NewUserClient(etcdConn)
|
||||
RpcResp, err := client.SetReceiveMessageOpt(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(params.OperationID, "SetReceiveMessageOpt rpc failed, ", req, err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "SetReceiveMessageOpt rpc failed, " + err.Error()})
|
||||
return
|
||||
}
|
||||
optResult := make([]*api.OptResult, 0)
|
||||
for _, v := range RpcResp.ConversationOptResultList {
|
||||
temp := new(api.OptResult)
|
||||
temp.ConversationID = v.ConversationID
|
||||
temp.Result = &v.Result
|
||||
optResult = append(optResult, temp)
|
||||
}
|
||||
resp := api.SetReceiveMessageOptResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, ConversationOptResultList: optResult}
|
||||
log.NewInfo(req.OperationID, "SetReceiveMessageOpt api return: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
|
||||
}
|
||||
|
||||
//Deprecated
|
||||
func GetReceiveMessageOpt(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
//Deprecated
|
||||
func GetAllConversationMessageOpt(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
+161
-83
@@ -26,15 +26,17 @@ func AddBlack(c *gin.Context) {
|
||||
req := &rpc.AddBlacklistReq{CommID: &rpc.CommID{}}
|
||||
utils.CopyStructFields(req.CommID, ¶ms)
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(params.OperationID, "AddBlacklist args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID)
|
||||
client := rpc.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.AddBlacklist(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -57,15 +59,24 @@ func ImportFriend(c *gin.Context) {
|
||||
req := &rpc.ImportFriendReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "ImportFriend args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, "ImportFriend args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := rpc.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.ImportFriend(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -96,16 +107,26 @@ func AddFriend(c *gin.Context) {
|
||||
req := &rpc.AddFriendReq{CommID: &rpc.CommID{}}
|
||||
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
||||
req.ReqMsg = params.ReqMsg
|
||||
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "AddFriend args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.AddFriend(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -130,17 +151,28 @@ func AddFriendResponse(c *gin.Context) {
|
||||
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
||||
req.HandleMsg = params.HandleMsg
|
||||
req.HandleResult = params.Flag
|
||||
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
client := rpc.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.AddFriendResponse(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -163,16 +195,26 @@ func DeleteFriend(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.DeleteFriendReq{CommID: &rpc.CommID{}}
|
||||
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
||||
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "DeleteFriend args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.DeleteFriend(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -195,16 +237,26 @@ func GetBlacklist(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.GetBlacklistReq{CommID: &rpc.CommID{}}
|
||||
utils.CopyStructFields(req.CommID, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "GetBlacklist args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.GetBlacklist(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -234,16 +286,26 @@ func SetFriendRemark(c *gin.Context) {
|
||||
req := &rpc.SetFriendRemarkReq{CommID: &rpc.CommID{}}
|
||||
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
||||
req.Remark = params.Remark
|
||||
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "SetFriendComment args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.SetFriendRemark(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -266,16 +328,26 @@ func RemoveBlack(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.RemoveBlacklistReq{CommID: &rpc.CommID{}}
|
||||
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
||||
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "RemoveBlacklist args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
client := rpc.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.RemoveBlacklist(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -297,16 +369,26 @@ func IsFriend(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.IsFriendReq{CommID: &rpc.CommID{}}
|
||||
utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend)
|
||||
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "IsFriend args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.IsFriend(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -321,40 +403,6 @@ func IsFriend(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
//
|
||||
//func GetFriendsInfo(c *gin.Context) {
|
||||
// params := api.GetFriendsInfoReq{}
|
||||
// if err := c.BindJSON(¶ms); err != nil {
|
||||
// log.NewError("0", "BindJSON failed ", err.Error())
|
||||
// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
// return
|
||||
// }
|
||||
// req := &rpc.GetFriendsInfoReq{}
|
||||
// utils.CopyStructFields(req.CommID, params)
|
||||
// var ok bool
|
||||
// ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
// if !ok {
|
||||
// log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
// return
|
||||
// }
|
||||
// log.NewInfo(req.CommID.OperationID, "GetFriendsInfo args ", req.String())
|
||||
//
|
||||
// etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
// client := rpc.NewFriendClient(etcdConn)
|
||||
// RpcResp, err := client.GetFriendsInfo(context.Background(), req)
|
||||
// if err != nil {
|
||||
// log.NewError(req.CommID.OperationID, "GetFriendsInfo failed ", err.Error(), req.String())
|
||||
// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call search friend rpc server failed"})
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// resp := api.GetFriendsInfoResp{CommResp:api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
// utils.CopyStructFields(&resp, RpcResp)
|
||||
// c.JSON(http.StatusOK, resp)
|
||||
// log.NewInfo(req.CommID.OperationID, "GetFriendsInfo api return ", resp)
|
||||
//}
|
||||
|
||||
func GetFriendList(c *gin.Context) {
|
||||
params := api.GetFriendListReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -364,16 +412,26 @@ func GetFriendList(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.GetFriendListReq{CommID: &rpc.CommID{}}
|
||||
utils.CopyStructFields(req.CommID, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "GetFriendList args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.GetFriendList(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -398,16 +456,26 @@ func GetFriendApplyList(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.GetFriendApplyListReq{CommID: &rpc.CommID{}}
|
||||
utils.CopyStructFields(req.CommID, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "GetFriendApplyList args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewFriendClient(etcdConn)
|
||||
|
||||
RpcResp, err := client.GetFriendApplyList(context.Background(), req)
|
||||
@@ -432,16 +500,26 @@ func GetSelfFriendApplyList(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.GetSelfApplyListReq{CommID: &rpc.CommID{}}
|
||||
utils.CopyStructFields(req.CommID, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.CommID.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.CommID.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.CommID.OperationID, "GetSelfApplyList args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewFriendClient(etcdConn)
|
||||
RpcResp, err := client.GetSelfApplyList(context.Background(), req)
|
||||
if err != nil {
|
||||
|
||||
+512
-56
@@ -10,6 +10,7 @@ import (
|
||||
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/golang/protobuf/ptypes/wrappers"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
@@ -29,17 +30,26 @@ func KickGroupMember(c *gin.Context) {
|
||||
|
||||
req := &rpc.KickGroupMemberReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "KickGroupMember args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
RpcResp, err := client.KickGroupMember(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -71,17 +81,26 @@ func GetGroupMembersInfo(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.GetGroupMembersInfoReq{}
|
||||
utils.CopyStructFields(req, params)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
//c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
api.SetErrCodeMsg(c, http.StatusInternalServerError)
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "GetGroupMembersInfo args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
|
||||
RpcResp, err := client.GetGroupMembersInfo(context.Background(), req)
|
||||
@@ -106,16 +125,26 @@ func GetGroupMemberList(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.GetGroupMemberListReq{}
|
||||
utils.CopyStructFields(req, params)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "GetGroupMemberList args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
|
||||
RpcResp, err := client.GetGroupMemberList(context.Background(), req)
|
||||
@@ -141,16 +170,26 @@ func GetGroupAllMemberList(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.GetGroupAllMemberReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "GetGroupAllMember args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
RpcResp, err := client.GetGroupAllMember(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -174,16 +213,26 @@ func GetJoinedGroupList(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.GetJoinedGroupListReq{}
|
||||
utils.CopyStructFields(req, params)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "GetJoinedGroupList args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
RpcResp, err := client.GetJoinedGroupList(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -207,16 +256,26 @@ func InviteUserToGroup(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.InviteUserToGroupReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "InviteUserToGroup args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
RpcResp, err := client.InviteUserToGroup(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -252,18 +311,29 @@ func CreateGroup(c *gin.Context) {
|
||||
for _, v := range params.MemberList {
|
||||
req.InitMemberList = append(req.InitMemberList, &rpc.GroupAddMemberInfo{UserID: v.UserID, RoleLevel: v.RoleLevel})
|
||||
}
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
req.OwnerUserID = req.OpUserID
|
||||
|
||||
req.OwnerUserID = params.OwnerUserID
|
||||
req.OperationID = params.OperationID
|
||||
|
||||
log.NewInfo(req.OperationID, "CreateGroup args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
RpcResp, err := client.CreateGroup(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -300,7 +370,13 @@ func GetRecvGroupApplicationList(c *gin.Context) {
|
||||
//}
|
||||
log.NewInfo(req.OperationID, "GetGroupApplicationList args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
reply, err := client.GetGroupApplicationList(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -331,7 +407,13 @@ func GetUserReqGroupApplicationList(c *gin.Context) {
|
||||
// return
|
||||
//}
|
||||
log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
RpcResp, err := client.GetUserReqApplicationList(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -355,15 +437,25 @@ func GetGroupsInfo(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.GetGroupsInfoReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
RpcResp, err := client.GetGroupsInfo(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -388,16 +480,26 @@ func ApplicationGroupResponse(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.GroupApplicationResponseReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "ApplicationGroupResponse args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
reply, err := client.GroupApplicationResponse(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -420,15 +522,25 @@ func JoinGroup(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.JoinGroupReq{}
|
||||
utils.CopyStructFields(req, params)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "JoinGroup args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
|
||||
RpcResp, err := client.JoinGroup(context.Background(), req)
|
||||
@@ -451,16 +563,26 @@ func QuitGroup(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.QuitGroupReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "QuitGroup args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
RpcResp, err := client.QuitGroup(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -483,16 +605,26 @@ func SetGroupInfo(c *gin.Context) {
|
||||
req := &rpc.SetGroupInfoReq{GroupInfo: &open_im_sdk.GroupInfo{}}
|
||||
utils.CopyStructFields(req.GroupInfo, ¶ms)
|
||||
req.OperationID = params.OperationID
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "SetGroupInfo args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
RpcResp, err := client.SetGroupInfo(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -514,16 +646,26 @@ func TransferGroupOwner(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.TransferGroupOwnerReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "TransferGroupOwner args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
reply, err := client.TransferGroupOwner(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -536,3 +678,317 @@ func TransferGroupOwner(c *gin.Context) {
|
||||
log.NewInfo(req.OperationID, "TransferGroupOwner api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func DismissGroup(c *gin.Context) {
|
||||
params := api.DismissGroupReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.DismissGroupReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
reply, err := client.DismissGroup(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), " failed ", req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := api.DismissGroupResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func MuteGroupMember(c *gin.Context) {
|
||||
params := api.MuteGroupMemberReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.MuteGroupMemberReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
reply, err := client.MuteGroupMember(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), " failed ", req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := api.MuteGroupMemberResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func CancelMuteGroupMember(c *gin.Context) {
|
||||
params := api.CancelMuteGroupMemberReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.CancelMuteGroupMemberReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
reply, err := client.CancelMuteGroupMember(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), " failed ", req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := api.CancelMuteGroupMemberResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func MuteGroup(c *gin.Context) {
|
||||
params := api.MuteGroupReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.MuteGroupReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
reply, err := client.MuteGroup(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), " failed ", req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := api.MuteGroupResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func CancelMuteGroup(c *gin.Context) {
|
||||
params := api.CancelMuteGroupReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.CancelMuteGroupReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
reply, err := client.CancelMuteGroup(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), " failed ", req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := api.CancelMuteGroupResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
//SetGroupMemberNickname
|
||||
|
||||
func SetGroupMemberNickname(c *gin.Context) {
|
||||
params := api.SetGroupMemberNicknameReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.SetGroupMemberNicknameReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
reply, err := client.SetGroupMemberNickname(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), " failed ", req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp := api.SetGroupMemberNicknameResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func SetGroupMemberInfo(c *gin.Context) {
|
||||
var (
|
||||
req api.SetGroupMemberInfoReq
|
||||
resp api.SetGroupMemberInfoResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req)
|
||||
var opUserID string
|
||||
ok, opUserID, errInfo := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
reqPb := &rpc.SetGroupMemberInfoReq{
|
||||
GroupID: req.GroupID,
|
||||
UserID: req.UserID,
|
||||
OperationID: req.OperationID,
|
||||
OpUserID: opUserID,
|
||||
}
|
||||
if req.Nickname != nil {
|
||||
reqPb.Nickname = &wrappers.StringValue{Value: *req.Nickname}
|
||||
}
|
||||
if req.FaceURL != nil {
|
||||
reqPb.FaceURL = &wrappers.StringValue{Value: *req.FaceURL}
|
||||
}
|
||||
if req.Ex != nil {
|
||||
reqPb.Ex = &wrappers.StringValue{Value: *req.Ex}
|
||||
}
|
||||
if req.RoleLevel != nil {
|
||||
reqPb.RoleLevel = &wrappers.Int32Value{Value: *req.RoleLevel}
|
||||
}
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
respPb, err := client.SetGroupMemberInfo(context.Background(), reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), " failed ", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
resp.ErrMsg = respPb.CommonResp.ErrMsg
|
||||
resp.ErrCode = respPb.CommonResp.ErrCode
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
jsonData "Open_IM/internal/utils"
|
||||
api "Open_IM/pkg/base_info"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
rpc "Open_IM/pkg/proto/group"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func GetJoinedSuperGroupList(c *gin.Context) {
|
||||
req := api.GetJoinedSuperGroupListReq{}
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
ok, opUserID, errInfo := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
reqPb := rpc.GetJoinedSuperGroupListReq{OperationID: req.OperationID, OpUserID: opUserID, UserID: req.FromUserID}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
rpcResp, err := client.GetJoinedSuperGroupList(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "InviteUserToGroup failed ", err.Error(), reqPb.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
GroupListResp := api.GetJoinedSuperGroupListResp{GetJoinedGroupListResp: api.GetJoinedGroupListResp{CommResp: api.CommResp{ErrCode: rpcResp.CommonResp.ErrCode, ErrMsg: rpcResp.CommonResp.ErrMsg}, GroupInfoList: rpcResp.GroupList}}
|
||||
GroupListResp.Data = jsonData.JsonDataList(GroupListResp.GroupInfoList)
|
||||
log.NewInfo(req.OperationID, "GetJoinedGroupList api return ", GroupListResp)
|
||||
c.JSON(http.StatusOK, GroupListResp)
|
||||
}
|
||||
|
||||
func GetSuperGroupsInfo(c *gin.Context) {
|
||||
req := api.GetSuperGroupsInfoReq{}
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
ok, opUserID, errInfo := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
reqPb := rpc.GetSuperGroupsInfoReq{OperationID: req.OperationID, OpUserID: opUserID, GroupIDList: req.GroupIDList}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewGroupClient(etcdConn)
|
||||
rpcResp, err := client.GetSuperGroupsInfo(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "InviteUserToGroup failed ", err.Error(), reqPb.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
resp := api.GetSuperGroupsInfoResp{GetGroupInfoResp: api.GetGroupInfoResp{CommResp: api.CommResp{ErrCode: rpcResp.CommonResp.ErrCode, ErrMsg: rpcResp.CommonResp.ErrMsg}, GroupInfoList: rpcResp.GroupInfoList}}
|
||||
resp.Data = jsonData.JsonDataList(resp.GroupInfoList)
|
||||
log.NewInfo(req.OperationID, "GetGroupsInfo api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -27,8 +28,9 @@ import (
|
||||
|
||||
var validate *validator.Validate
|
||||
|
||||
func newUserSendMsgReq(params *ManagementSendMsgReq) *pbChat.SendMsgReq {
|
||||
func newUserSendMsgReq(params *api.ManagementSendMsgReq) *pbChat.SendMsgReq {
|
||||
var newContent string
|
||||
var err error
|
||||
switch params.ContentType {
|
||||
case constant.Text:
|
||||
newContent = params.Content["text"].(string)
|
||||
@@ -38,13 +40,16 @@ func newUserSendMsgReq(params *ManagementSendMsgReq) *pbChat.SendMsgReq {
|
||||
fallthrough
|
||||
case constant.Voice:
|
||||
fallthrough
|
||||
case constant.Video:
|
||||
fallthrough
|
||||
case constant.File:
|
||||
newContent = utils.StructToJsonString(params.Content)
|
||||
case constant.Revoke:
|
||||
newContent = params.Content["revokeMsgClientID"].(string)
|
||||
default:
|
||||
}
|
||||
var options map[string]bool
|
||||
options := make(map[string]bool, 5)
|
||||
if params.IsOnlineOnly {
|
||||
options = make(map[string]bool, 5)
|
||||
utils.SetSwitchFromOptions(options, constant.IsOfflinePush, false)
|
||||
utils.SetSwitchFromOptions(options, constant.IsHistory, false)
|
||||
utils.SetSwitchFromOptions(options, constant.IsPersistent, false)
|
||||
@@ -70,6 +75,14 @@ func newUserSendMsgReq(params *ManagementSendMsgReq) *pbChat.SendMsgReq {
|
||||
OfflinePushInfo: params.OfflinePushInfo,
|
||||
},
|
||||
}
|
||||
if params.ContentType == constant.OANotification {
|
||||
var tips open_im_sdk.TipsComm
|
||||
tips.JsonDetail = utils.StructToJsonString(params.Content)
|
||||
pbData.MsgData.Content, err = proto.Marshal(&tips)
|
||||
if err != nil {
|
||||
log.Error(params.OperationID, "Marshal failed ", err.Error(), tips.String())
|
||||
}
|
||||
}
|
||||
return &pbData
|
||||
}
|
||||
func init() {
|
||||
@@ -78,10 +91,10 @@ func init() {
|
||||
|
||||
func ManagementSendMsg(c *gin.Context) {
|
||||
var data interface{}
|
||||
params := ManagementSendMsgReq{}
|
||||
params := api.ManagementSendMsgReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
log.ErrorByKv("json unmarshal err", c.PostForm("operationID"), "err", err.Error(), "content", c.PostForm("content"))
|
||||
log.Error(c.PostForm("operationID"), "json unmarshal err", err.Error(), c.PostForm("content"))
|
||||
return
|
||||
}
|
||||
switch params.ContentType {
|
||||
@@ -103,30 +116,35 @@ func ManagementSendMsg(c *gin.Context) {
|
||||
//case constant.Location:
|
||||
case constant.Custom:
|
||||
data = CustomElem{}
|
||||
//case constant.Revoke:
|
||||
case constant.Revoke:
|
||||
data = RevokeElem{}
|
||||
case constant.OANotification:
|
||||
data = OANotificationElem{}
|
||||
params.SessionType = constant.NotificationChatType
|
||||
//case constant.HasReadReceipt:
|
||||
//case constant.Typing:
|
||||
//case constant.Quote:
|
||||
default:
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 404, "errMsg": "contentType err"})
|
||||
log.ErrorByKv("contentType err", c.PostForm("operationID"), "content", c.PostForm("content"))
|
||||
log.Error(c.PostForm("operationID"), "contentType err", c.PostForm("content"))
|
||||
return
|
||||
}
|
||||
if err := mapstructure.WeakDecode(params.Content, &data); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": err.Error()})
|
||||
log.ErrorByKv("content to Data struct err", "", "err", err.Error())
|
||||
log.Error(c.PostForm("operationID"), "content to Data struct err", err.Error())
|
||||
return
|
||||
} else if err := validate.Struct(data); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 403, "errMsg": err.Error()})
|
||||
log.ErrorByKv("data args validate err", "", "err", err.Error())
|
||||
log.Error(c.PostForm("operationID"), "data args validate err", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(params.OperationID, data, params)
|
||||
token := c.Request.Header.Get("token")
|
||||
claims, err := token_verify.ParseToken(token)
|
||||
claims, err := token_verify.ParseToken(token, params.OperationID)
|
||||
if err != nil {
|
||||
log.NewError(params.OperationID, "parse token failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "parse token failed", "sendTime": 0, "MsgID": ""})
|
||||
return
|
||||
}
|
||||
if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "not authorized", "sendTime": 0, "MsgID": ""})
|
||||
@@ -138,23 +156,31 @@ func ManagementSendMsg(c *gin.Context) {
|
||||
if len(params.RecvID) == 0 {
|
||||
log.NewError(params.OperationID, "recvID is a null string")
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 405, "errMsg": "recvID is a null string", "sendTime": 0, "MsgID": ""})
|
||||
return
|
||||
}
|
||||
case constant.GroupChatType:
|
||||
if len(params.GroupID) == 0 {
|
||||
log.NewError(params.OperationID, "groupID is a null string")
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 405, "errMsg": "groupID is a null string", "sendTime": 0, "MsgID": ""})
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
log.InfoByKv("Ws call success to ManagementSendMsgReq", params.OperationID, "Parameters", params)
|
||||
log.NewInfo(params.OperationID, "Ws call success to ManagementSendMsgReq", params)
|
||||
|
||||
pbData := newUserSendMsgReq(¶ms)
|
||||
log.Info("", "", "api ManagementSendMsg call start..., [data: %s]", pbData.String())
|
||||
log.Info(params.OperationID, "", "api ManagementSendMsg call start..., [data: %s]", pbData.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, params.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := params.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(params.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbChat.NewChatClient(etcdConn)
|
||||
|
||||
log.Info("", "", "api ManagementSendMsg call, api call rpc...")
|
||||
log.Info(params.OperationID, "", "api ManagementSendMsg call, api call rpc...")
|
||||
|
||||
RpcResp, err := client.SendMsg(context.Background(), pbData)
|
||||
if err != nil {
|
||||
@@ -162,52 +188,123 @@ func ManagementSendMsg(c *gin.Context) {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call UserSendMsg rpc server failed"})
|
||||
return
|
||||
}
|
||||
log.Info("", "", "api ManagementSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), RpcResp.String())
|
||||
log.Info(params.OperationID, "", "api ManagementSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), RpcResp.String())
|
||||
resp := api.ManagementSendMsgResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, ResultList: server_api_params.UserSendMsgResp{ServerMsgID: RpcResp.ServerMsgID, ClientMsgID: RpcResp.ClientMsgID, SendTime: RpcResp.SendTime}}
|
||||
log.Info(params.OperationID, "ManagementSendMsg return", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
//type MergeElem struct {
|
||||
// Title string `json:"title"`
|
||||
// AbstractList []string `json:"abstractList"`
|
||||
// MultiMessage []*MsgStruct `json:"multiMessage"`
|
||||
//}
|
||||
//
|
||||
//type QuoteElem struct {
|
||||
// Text string `json:"text"`
|
||||
// QuoteMessage *MsgStruct `json:"quoteMessage"`
|
||||
//}
|
||||
type ManagementSendMsgReq struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
SendID string `json:"sendID" binding:"required"`
|
||||
RecvID string `json:"recvID" `
|
||||
GroupID string `json:"groupID" `
|
||||
SenderNickname string `json:"senderNickname" `
|
||||
SenderFaceURL string `json:"senderFaceURL" `
|
||||
SenderPlatformID int32 `json:"senderPlatformID"`
|
||||
ForceList []string `json:"forceList" `
|
||||
Content map[string]interface{} `json:"content" binding:"required"`
|
||||
ContentType int32 `json:"contentType" binding:"required"`
|
||||
SessionType int32 `json:"sessionType" binding:"required"`
|
||||
IsOnlineOnly bool `json:"isOnlineOnly"`
|
||||
OfflinePushInfo *open_im_sdk.OfflinePushInfo `json:"offlinePushInfo"`
|
||||
func ManagementBatchSendMsg(c *gin.Context) {
|
||||
var data interface{}
|
||||
params := api.ManagementBatchSendMsgReq{}
|
||||
resp := api.ManagementBatchSendMsgResp{}
|
||||
resp.Data.FailedIDList = make([]string, 0)
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
log.Error(c.PostForm("operationID"), "json unmarshal err", err.Error(), c.PostForm("content"))
|
||||
return
|
||||
}
|
||||
switch params.ContentType {
|
||||
case constant.Text:
|
||||
data = TextElem{}
|
||||
case constant.Picture:
|
||||
data = PictureElem{}
|
||||
case constant.Voice:
|
||||
data = SoundElem{}
|
||||
case constant.Video:
|
||||
data = VideoElem{}
|
||||
case constant.File:
|
||||
data = FileElem{}
|
||||
//case constant.AtText:
|
||||
// data = AtElem{}
|
||||
//case constant.Merger:
|
||||
// data =
|
||||
//case constant.Card:
|
||||
//case constant.Location:
|
||||
case constant.Custom:
|
||||
data = CustomElem{}
|
||||
case constant.Revoke:
|
||||
data = RevokeElem{}
|
||||
case constant.OANotification:
|
||||
data = OANotificationElem{}
|
||||
params.SessionType = constant.NotificationChatType
|
||||
//case constant.HasReadReceipt:
|
||||
//case constant.Typing:
|
||||
//case constant.Quote:
|
||||
default:
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 404, "errMsg": "contentType err"})
|
||||
log.Error(c.PostForm("operationID"), "contentType err", c.PostForm("content"))
|
||||
return
|
||||
}
|
||||
if err := mapstructure.WeakDecode(params.Content, &data); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": err.Error()})
|
||||
log.Error(c.PostForm("operationID"), "content to Data struct err", err.Error())
|
||||
return
|
||||
} else if err := validate.Struct(data); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 403, "errMsg": err.Error()})
|
||||
log.Error(c.PostForm("operationID"), "data args validate err", err.Error())
|
||||
return
|
||||
}
|
||||
log.NewInfo(params.OperationID, data, params)
|
||||
token := c.Request.Header.Get("token")
|
||||
claims, err := token_verify.ParseToken(token, params.OperationID)
|
||||
if err != nil {
|
||||
log.NewError(params.OperationID, "parse token failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "parse token failed", "sendTime": 0, "MsgID": ""})
|
||||
return
|
||||
}
|
||||
if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "not authorized", "sendTime": 0, "MsgID": ""})
|
||||
return
|
||||
|
||||
}
|
||||
log.NewInfo(params.OperationID, "Ws call success to ManagementSendMsgReq", params)
|
||||
for _, recvID := range params.RecvIDList {
|
||||
pbData := newUserSendMsgReq(¶ms.ManagementSendMsgReq)
|
||||
pbData.MsgData.RecvID = recvID
|
||||
log.Info(params.OperationID, "", "api ManagementSendMsg call start..., ", pbData.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, params.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := params.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(params.OperationID, errMsg)
|
||||
resp.Data.FailedIDList = append(resp.Data.FailedIDList, recvID)
|
||||
continue
|
||||
}
|
||||
client := pbChat.NewChatClient(etcdConn)
|
||||
rpcResp, err := client.SendMsg(context.Background(), pbData)
|
||||
if err != nil {
|
||||
log.NewError(params.OperationID, "call delete UserSendMsg rpc server failed", err.Error())
|
||||
resp.Data.FailedIDList = append(resp.Data.FailedIDList, recvID)
|
||||
continue
|
||||
}
|
||||
if rpcResp.ErrCode != 0 {
|
||||
log.NewError(params.OperationID, utils.GetSelfFuncName(), "rpc failed", pbData, rpcResp)
|
||||
resp.Data.FailedIDList = append(resp.Data.FailedIDList, recvID)
|
||||
continue
|
||||
}
|
||||
resp.Data.ResultList = append(resp.Data.ResultList, server_api_params.UserSendMsgResp{
|
||||
ServerMsgID: rpcResp.ServerMsgID,
|
||||
ClientMsgID: rpcResp.ClientMsgID,
|
||||
SendTime: rpcResp.SendTime,
|
||||
})
|
||||
}
|
||||
|
||||
log.NewInfo(params.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
type PictureBaseInfo struct {
|
||||
UUID string `mapstructure:"uuid"`
|
||||
Type string `mapstructure:"type" validate:"required"`
|
||||
Size int64 `mapstructure:"size" validate:"required"`
|
||||
Width int32 `mapstructure:"width" validate:"required"`
|
||||
Height int32 `mapstructure:"height" validate:"required"`
|
||||
Url string `mapstructure:"url" validate:"required"`
|
||||
Type string `mapstructure:"type" `
|
||||
Size int64 `mapstructure:"size" `
|
||||
Width int32 `mapstructure:"width" `
|
||||
Height int32 `mapstructure:"height"`
|
||||
Url string `mapstructure:"url" `
|
||||
}
|
||||
|
||||
type PictureElem struct {
|
||||
SourcePath string `mapstructure:"sourcePath"`
|
||||
SourcePicture PictureBaseInfo `mapstructure:"sourcePicture" validate:"required"`
|
||||
SourcePicture PictureBaseInfo `mapstructure:"sourcePicture"`
|
||||
BigPicture PictureBaseInfo `mapstructure:"bigPicture" `
|
||||
SnapshotPicture PictureBaseInfo `mapstructure:"snapshotPicture"`
|
||||
}
|
||||
@@ -257,3 +354,20 @@ type CustomElem struct {
|
||||
type TextElem struct {
|
||||
Text string `mapstructure:"text" validate:"required"`
|
||||
}
|
||||
|
||||
type RevokeElem struct {
|
||||
RevokeMsgClientID string `mapstructure:"revokeMsgClientID" validate:"required"`
|
||||
}
|
||||
type OANotificationElem struct {
|
||||
NotificationName string `mapstructure:"notificationName" json:"notificationName" validate:"required"`
|
||||
NotificationFaceURL string `mapstructure:"notificationFaceURL" json:"notificationFaceURL" validate:"required"`
|
||||
NotificationType int32 `mapstructure:"notificationType" json:"notificationType" validate:"required"`
|
||||
Text string `mapstructure:"text" json:"text" validate:"required"`
|
||||
Url string `mapstructure:"url" json:"url"`
|
||||
MixType int32 `mapstructure:"mixType" json:"mixType"`
|
||||
PictureElem PictureElem `mapstructure:"pictureElem" json:"pictureElem"`
|
||||
SoundElem SoundElem `mapstructure:"soundElem" json:"soundElem"`
|
||||
VideoElem VideoElem `mapstructure:"videoElem" json:"videoElem"`
|
||||
FileElem FileElem `mapstructure:"fileElem" json:"fileElem"`
|
||||
Ex string `mapstructure:"ex" json:"ex"`
|
||||
}
|
||||
|
||||
@@ -30,15 +30,25 @@ func DeleteUser(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.DeleteUsersReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(params.OperationID, "DeleteUser args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewUserClient(etcdConn)
|
||||
|
||||
RpcResp, err := client.DeleteUsers(context.Background(), req)
|
||||
@@ -62,15 +72,25 @@ func GetAllUsersUid(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.GetAllUserIDReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(params.OperationID, "GetAllUsersUid args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewUserClient(etcdConn)
|
||||
RpcResp, err := client.GetAllUserID(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -94,15 +114,25 @@ func AccountCheck(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.AccountCheckReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(params.OperationID, "AccountCheck args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewUserClient(etcdConn)
|
||||
|
||||
RpcResp, err := client.AccountCheck(context.Background(), req)
|
||||
@@ -118,6 +148,7 @@ func AccountCheck(c *gin.Context) {
|
||||
log.NewInfo(req.OperationID, "AccountCheck api return", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetUsersOnlineStatus(c *gin.Context) {
|
||||
params := api.GetUsersOnlineStatusReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -126,13 +157,17 @@ func GetUsersOnlineStatus(c *gin.Context) {
|
||||
}
|
||||
req := &pbRelay.GetUsersOnlineStatusReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(params.OperationID, "GetUsersOnlineStatus args ", req.String())
|
||||
var wsResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult
|
||||
var respResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult
|
||||
@@ -176,5 +211,4 @@ func GetUsersOnlineStatus(c *gin.Context) {
|
||||
}
|
||||
log.NewInfo(req.OperationID, "GetUsersOnlineStatus api return", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,366 @@
|
||||
package office
|
||||
|
||||
import (
|
||||
apistruct "Open_IM/pkg/base_info"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbOffice "Open_IM/pkg/proto/office"
|
||||
pbCommon "Open_IM/pkg/proto/sdk_ws"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"google.golang.org/grpc"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func GetUserTags(c *gin.Context) {
|
||||
var (
|
||||
req apistruct.GetUserTagsReq
|
||||
resp apistruct.GetUserTagsResp
|
||||
reqPb pbOffice.GetUserTagsReq
|
||||
respPb *pbOffice.GetUserTagsResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
reqPb.UserID = userID
|
||||
reqPb.OperationID = req.OperationID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.GetUserTags(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserTags failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserTags rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp.CommResp, respPb.CommonResp); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
if respPb.Tags != nil {
|
||||
resp.Data.Tags = respPb.Tags
|
||||
} else {
|
||||
resp.Data.Tags = []*pbOffice.Tag{}
|
||||
}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func CreateTag(c *gin.Context) {
|
||||
var (
|
||||
req apistruct.CreateTagReq
|
||||
resp apistruct.CreateTagResp
|
||||
reqPb pbOffice.CreateTagReq
|
||||
respPb *pbOffice.CreateTagResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
reqPb.UserID = userID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.CreateTag(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserTags failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "CreateTag rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp.CommResp, respPb.CommonResp); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func DeleteTag(c *gin.Context) {
|
||||
var (
|
||||
req apistruct.DeleteTagReq
|
||||
resp apistruct.DeleteTagResp
|
||||
reqPb pbOffice.DeleteTagReq
|
||||
respPb *pbOffice.DeleteTagResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
reqPb.UserID = userID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.DeleteTag(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserTags failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "CreateTag rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp.CommResp, respPb.CommonResp); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func SetTag(c *gin.Context) {
|
||||
var (
|
||||
req apistruct.SetTagReq
|
||||
resp apistruct.SetTagResp
|
||||
reqPb pbOffice.SetTagReq
|
||||
respPb *pbOffice.SetTagResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
reqPb.UserID = userID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.SetTag(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserTags failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "CreateTag rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp.CommResp, respPb.CommonResp); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func SendMsg2Tag(c *gin.Context) {
|
||||
var (
|
||||
req apistruct.SendMsg2TagReq
|
||||
resp apistruct.SendMsg2TagResp
|
||||
reqPb pbOffice.SendMsg2TagReq
|
||||
respPb *pbOffice.SendMsg2TagResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
reqPb.SendID = userID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.SendMsg2Tag(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserTags failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "CreateTag rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp.CommResp, respPb.CommonResp); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetTagSendLogs(c *gin.Context) {
|
||||
var (
|
||||
req apistruct.GetTagSendLogsReq
|
||||
resp apistruct.GetTagSendLogsResp
|
||||
reqPb pbOffice.GetTagSendLogsReq
|
||||
respPb *pbOffice.GetTagSendLogsResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
reqPb.UserID = userID
|
||||
reqPb.OperationID = req.OperationID
|
||||
reqPb.Pagination = &pbCommon.RequestPagination{
|
||||
PageNumber: req.PageNumber,
|
||||
ShowNumber: req.ShowNumber,
|
||||
}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
maxSizeOption := grpc.MaxCallRecvMsgSize(1024 * 1024 * 20)
|
||||
respPb, err := client.GetTagSendLogs(context.Background(), &reqPb, maxSizeOption)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetTagSendLogs failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetTagSendLogs rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp.CommResp, respPb.CommonResp); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
if respPb.TagSendLogs != nil {
|
||||
resp.Data.Logs = respPb.TagSendLogs
|
||||
} else {
|
||||
resp.Data.Logs = []*pbOffice.TagSendLog{}
|
||||
}
|
||||
resp.Data.ShowNumber = respPb.Pagination.ShowNumber
|
||||
resp.Data.CurrentPage = respPb.Pagination.CurrentPage
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetUserTagByID(c *gin.Context) {
|
||||
var (
|
||||
req apistruct.GetUserTagByIDReq
|
||||
resp apistruct.GetUserTagByIDResp
|
||||
reqPb pbOffice.GetUserTagByIDReq
|
||||
respPb *pbOffice.GetUserTagByIDResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
reqPb.UserID = userID
|
||||
reqPb.OperationID = req.OperationID
|
||||
reqPb.TagID = req.TagID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.GetUserTagByID(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserTagByID failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "CreateTag rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp.CommResp, respPb.CommonResp); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
resp.Data.Tag = respPb.Tag
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
@@ -0,0 +1,578 @@
|
||||
package office
|
||||
|
||||
import (
|
||||
apiStruct "Open_IM/pkg/base_info"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbOffice "Open_IM/pkg/proto/office"
|
||||
pbCommon "Open_IM/pkg/proto/sdk_ws"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func CreateOneWorkMoment(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.CreateOneWorkMomentReq
|
||||
resp apiStruct.CreateOneWorkMomentResp
|
||||
reqPb pbOffice.CreateOneWorkMomentReq
|
||||
respPb *pbOffice.CreateOneWorkMomentResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
reqPb.WorkMoment.UserID = userID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.CreateOneWorkMoment(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "CreateOneWorkMoment rpc failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "CreateOneWorkMoment rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.CommResp = apiStruct.CommResp{
|
||||
ErrCode: respPb.CommonResp.ErrCode,
|
||||
ErrMsg: respPb.CommonResp.ErrMsg,
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func DeleteOneWorkMoment(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.DeleteOneWorkMomentReq
|
||||
resp apiStruct.DeleteOneWorkMomentResp
|
||||
reqPb pbOffice.DeleteOneWorkMomentReq
|
||||
respPb *pbOffice.DeleteOneWorkMomentResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
reqPb.UserID = userID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.DeleteOneWorkMoment(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "DeleteOneWorkMoment rpc failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "DeleteOneWorkMoment rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp, respPb.CommonResp); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func LikeOneWorkMoment(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.LikeOneWorkMomentReq
|
||||
resp apiStruct.LikeOneWorkMomentResp
|
||||
reqPb pbOffice.LikeOneWorkMomentReq
|
||||
respPb *pbOffice.LikeOneWorkMomentResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
reqPb.UserID = userID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.LikeOneWorkMoment(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "LikeOneWorkMoment rpc failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "LikeOneWorkMoment rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp, respPb.CommonResp); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func CommentOneWorkMoment(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.CommentOneWorkMomentReq
|
||||
resp apiStruct.CommentOneWorkMomentResp
|
||||
reqPb pbOffice.CommentOneWorkMomentReq
|
||||
respPb *pbOffice.CommentOneWorkMomentResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
reqPb.UserID = userID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.CommentOneWorkMoment(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "CommentOneWorkMoment rpc failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "CommentOneWorkMoment rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp, respPb.CommonResp); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func DeleteComment(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.DeleteCommentReq
|
||||
resp apiStruct.DeleteCommentResp
|
||||
reqPb pbOffice.DeleteCommentReq
|
||||
respPb *pbOffice.DeleteCommentResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), err.Error())
|
||||
}
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, reqPb.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.DeleteComment(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "DeleteComment rpc failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "DeleteComment rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp, respPb.CommonResp); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetWorkMomentByID(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.GetWorkMomentByIDReq
|
||||
resp apiStruct.GetWorkMomentByIDResp
|
||||
reqPb pbOffice.GetWorkMomentByIDReq
|
||||
respPb *pbOffice.GetWorkMomentByIDResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
reqPb.OperationID = req.OperationID
|
||||
reqPb.OpUserID = userID
|
||||
reqPb.WorkMomentID = req.WorkMomentID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.GetWorkMomentByID(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserWorkMoments rpc failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserWorkMoments rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp, respPb.CommonResp); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
resp.Data.WorkMoment = &apiStruct.WorkMoment{LikeUserList: []*apiStruct.WorkMomentUser{}, Comments: []*apiStruct.Comment{},
|
||||
AtUserList: []*apiStruct.WorkMomentUser{}, PermissionUserList: []*apiStruct.WorkMomentUser{}}
|
||||
if err := utils.CopyStructFields(&resp.Data.WorkMoment, respPb.WorkMoment); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetUserWorkMoments(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.GetUserWorkMomentsReq
|
||||
resp apiStruct.GetUserWorkMomentsResp
|
||||
reqPb pbOffice.GetUserWorkMomentsReq
|
||||
respPb *pbOffice.GetUserWorkMomentsResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var opUserID string
|
||||
ok, opUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
reqPb.OperationID = req.OperationID
|
||||
reqPb.Pagination = &pbCommon.RequestPagination{
|
||||
PageNumber: req.PageNumber,
|
||||
ShowNumber: req.ShowNumber,
|
||||
}
|
||||
reqPb.OpUserID = opUserID
|
||||
reqPb.UserID = req.UserID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.GetUserWorkMoments(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserWorkMoments rpc failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserWorkMoments rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.Data.WorkMoments = []*apiStruct.WorkMoment{}
|
||||
if err := utils.CopyStructFields(&resp, respPb.CommonResp); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
//if err := utils.CopyStructFields(&resp.Data.WorkMoments, respPb.WorkMoments); err != nil {
|
||||
// log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
//}
|
||||
for _, v := range respPb.WorkMoments {
|
||||
workMoment := apiStruct.WorkMoment{
|
||||
WorkMomentID: v.WorkMomentID,
|
||||
UserID: v.UserID,
|
||||
Content: v.Content,
|
||||
FaceURL: v.FaceURL,
|
||||
UserName: v.UserName,
|
||||
CreateTime: v.CreateTime,
|
||||
Comments: make([]*apiStruct.Comment, len(v.Comments)),
|
||||
LikeUserList: make([]*apiStruct.WorkMomentUser, len(v.LikeUserList)),
|
||||
AtUserList: make([]*apiStruct.WorkMomentUser, len(v.AtUserList)),
|
||||
PermissionUserList: make([]*apiStruct.WorkMomentUser, len(v.PermissionUserList)),
|
||||
Permission: v.Permission,
|
||||
}
|
||||
for i, comment := range v.Comments {
|
||||
workMoment.Comments[i] = &apiStruct.Comment{
|
||||
UserID: comment.UserID,
|
||||
UserName: comment.UserName,
|
||||
ReplyUserID: comment.ReplyUserID,
|
||||
ReplyUserName: comment.ReplyUserName,
|
||||
ContentID: comment.ContentID,
|
||||
Content: comment.Content,
|
||||
CreateTime: comment.CreateTime,
|
||||
}
|
||||
}
|
||||
for i, likeUser := range v.LikeUserList {
|
||||
workMoment.LikeUserList[i] = &apiStruct.WorkMomentUser{
|
||||
UserID: likeUser.UserID,
|
||||
UserName: likeUser.UserName,
|
||||
}
|
||||
}
|
||||
for i, atUser := range v.AtUserList {
|
||||
workMoment.AtUserList[i] = &apiStruct.WorkMomentUser{
|
||||
UserID: atUser.UserID,
|
||||
UserName: atUser.UserName,
|
||||
}
|
||||
}
|
||||
for i, permissionUser := range v.PermissionUserList {
|
||||
workMoment.PermissionUserList[i] = &apiStruct.WorkMomentUser{
|
||||
UserID: permissionUser.UserID,
|
||||
UserName: permissionUser.UserName,
|
||||
}
|
||||
}
|
||||
resp.Data.WorkMoments = append(resp.Data.WorkMoments, &workMoment)
|
||||
}
|
||||
resp.Data.ShowNumber = respPb.Pagination.ShowNumber
|
||||
resp.Data.CurrentPage = respPb.Pagination.CurrentPage
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetUserFriendWorkMoments(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.GetUserFriendWorkMomentsReq
|
||||
resp apiStruct.GetUserFriendWorkMomentsResp
|
||||
reqPb pbOffice.GetUserFriendWorkMomentsReq
|
||||
respPb *pbOffice.GetUserFriendWorkMomentsResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
reqPb.OperationID = req.OperationID
|
||||
reqPb.Pagination = &pbCommon.RequestPagination{
|
||||
PageNumber: req.PageNumber,
|
||||
ShowNumber: req.ShowNumber,
|
||||
}
|
||||
reqPb.UserID = userID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.GetUserFriendWorkMoments(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserFriendWorkMoments rpc failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserFriendWorkMoments rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp, respPb.CommonResp); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
//if err := utils.CopyStructFields(&resp.Data.WorkMoments, respPb.WorkMoments); err != nil {
|
||||
// log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
//}
|
||||
resp.Data.WorkMoments = []*apiStruct.WorkMoment{}
|
||||
for _, v := range respPb.WorkMoments {
|
||||
workMoment := apiStruct.WorkMoment{
|
||||
WorkMomentID: v.WorkMomentID,
|
||||
UserID: v.UserID,
|
||||
Content: v.Content,
|
||||
FaceURL: v.FaceURL,
|
||||
UserName: v.UserName,
|
||||
CreateTime: v.CreateTime,
|
||||
Comments: make([]*apiStruct.Comment, len(v.Comments)),
|
||||
LikeUserList: make([]*apiStruct.WorkMomentUser, len(v.LikeUserList)),
|
||||
AtUserList: make([]*apiStruct.WorkMomentUser, len(v.AtUserList)),
|
||||
PermissionUserList: make([]*apiStruct.WorkMomentUser, len(v.PermissionUserList)),
|
||||
Permission: v.Permission,
|
||||
}
|
||||
for i, comment := range v.Comments {
|
||||
workMoment.Comments[i] = &apiStruct.Comment{
|
||||
UserID: comment.UserID,
|
||||
UserName: comment.UserName,
|
||||
ReplyUserID: comment.ReplyUserID,
|
||||
ReplyUserName: comment.ReplyUserName,
|
||||
ContentID: comment.ContentID,
|
||||
Content: comment.Content,
|
||||
CreateTime: comment.CreateTime,
|
||||
}
|
||||
}
|
||||
for i, likeUser := range v.LikeUserList {
|
||||
workMoment.LikeUserList[i] = &apiStruct.WorkMomentUser{
|
||||
UserID: likeUser.UserID,
|
||||
UserName: likeUser.UserName,
|
||||
}
|
||||
}
|
||||
for i, atUser := range v.AtUserList {
|
||||
workMoment.AtUserList[i] = &apiStruct.WorkMomentUser{
|
||||
UserID: atUser.UserID,
|
||||
UserName: atUser.UserName,
|
||||
}
|
||||
}
|
||||
for i, permissionUser := range v.PermissionUserList {
|
||||
workMoment.PermissionUserList[i] = &apiStruct.WorkMomentUser{
|
||||
UserID: permissionUser.UserID,
|
||||
UserName: permissionUser.UserName,
|
||||
}
|
||||
}
|
||||
resp.Data.WorkMoments = append(resp.Data.WorkMoments, &workMoment)
|
||||
}
|
||||
resp.Data.ShowNumber = respPb.Pagination.ShowNumber
|
||||
resp.Data.CurrentPage = respPb.Pagination.CurrentPage
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func SetUserWorkMomentsLevel(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.SetUserWorkMomentsLevelReq
|
||||
resp apiStruct.SetUserWorkMomentsLevelResp
|
||||
reqPb pbOffice.SetUserWorkMomentsLevelReq
|
||||
respPb *pbOffice.SetUserWorkMomentsLevelResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "bind json failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "bind json failed " + err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
var userID string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
if err := utils.CopyStructFields(&reqPb, req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
reqPb.UserID = userID
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := pbOffice.NewOfficeServiceClient(etcdConn)
|
||||
respPb, err := client.SetUserWorkMomentsLevel(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetUserWorkMomentsLevel rpc failed", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "SetUserWorkMomentsLevel rpc server failed" + err.Error()})
|
||||
return
|
||||
}
|
||||
if err := utils.CopyStructFields(&resp, respPb.CommonResp); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
@@ -0,0 +1,517 @@
|
||||
package organization
|
||||
|
||||
import (
|
||||
jsonData "Open_IM/internal/utils"
|
||||
api "Open_IM/pkg/base_info"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
rpc "Open_IM/pkg/proto/organization"
|
||||
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func CreateDepartment(c *gin.Context) {
|
||||
params := api.CreateDepartmentReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.CreateDepartmentReq{DepartmentInfo: &open_im_sdk.Department{}}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
utils.CopyStructFields(req.DepartmentInfo, ¶ms)
|
||||
err, opUserID := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID)
|
||||
req.OpUserID = opUserID
|
||||
if err != nil {
|
||||
errMsg := "ParseTokenGetUserID failed " + err.Error() + " " + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
client := rpc.NewOrganizationClient(etcdConn)
|
||||
RpcResp, err := client.CreateDepartment(context.Background(), req)
|
||||
if err != nil {
|
||||
errMsg := "rpc CreateDepartment failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
apiResp := api.CreateDepartmentResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, Department: RpcResp.DepartmentInfo}
|
||||
apiResp.Data = jsonData.JsonDataOne(RpcResp.DepartmentInfo)
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
|
||||
func UpdateDepartment(c *gin.Context) {
|
||||
params := api.UpdateDepartmentReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.UpdateDepartmentReq{DepartmentInfo: &open_im_sdk.Department{}}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
utils.CopyStructFields(req.DepartmentInfo, ¶ms)
|
||||
err, opUserID := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID)
|
||||
req.OpUserID = opUserID
|
||||
if err != nil {
|
||||
errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
client := rpc.NewOrganizationClient(etcdConn)
|
||||
RpcResp, err := client.UpdateDepartment(context.Background(), req)
|
||||
if err != nil {
|
||||
errMsg := "rpc UpdateDepartment failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
apiResp := api.UpdateDepartmentResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
|
||||
func GetSubDepartment(c *gin.Context) {
|
||||
params := api.GetSubDepartmentReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.GetSubDepartmentReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
err, opUserID := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID)
|
||||
req.OpUserID = opUserID
|
||||
if err != nil {
|
||||
errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewOrganizationClient(etcdConn)
|
||||
RpcResp, err := client.GetSubDepartment(context.Background(), req)
|
||||
if err != nil {
|
||||
errMsg := "rpc GetDepartment failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
apiResp := api.GetSubDepartmentResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, DepartmentList: RpcResp.DepartmentList}
|
||||
apiResp.Data = jsonData.JsonDataList(RpcResp.DepartmentList)
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
|
||||
func GetAllDepartment(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
func DeleteDepartment(c *gin.Context) {
|
||||
params := api.DeleteDepartmentReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.DeleteDepartmentReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
err, opUserID := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID)
|
||||
req.OpUserID = opUserID
|
||||
if err != nil {
|
||||
errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewOrganizationClient(etcdConn)
|
||||
RpcResp, err := client.DeleteDepartment(context.Background(), req)
|
||||
if err != nil {
|
||||
errMsg := "rpc DeleteDepartment failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
apiResp := api.DeleteDepartmentResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
|
||||
func CreateOrganizationUser(c *gin.Context) {
|
||||
params := api.CreateOrganizationUserReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
req := &rpc.CreateOrganizationUserReq{OrganizationUser: &open_im_sdk.OrganizationUser{}}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
utils.CopyStructFields(req.OrganizationUser, ¶ms)
|
||||
|
||||
err, opUserID := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID)
|
||||
req.OpUserID = opUserID
|
||||
if err != nil {
|
||||
errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewOrganizationClient(etcdConn)
|
||||
RpcResp, err := client.CreateOrganizationUser(context.Background(), req)
|
||||
if err != nil {
|
||||
errMsg := "rpc CreateOrganizationUser failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
apiResp := api.CreateOrganizationUserResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
|
||||
func UpdateOrganizationUser(c *gin.Context) {
|
||||
params := api.UpdateOrganizationUserReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
req := &rpc.UpdateOrganizationUserReq{OrganizationUser: &open_im_sdk.OrganizationUser{}}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
utils.CopyStructFields(req.OrganizationUser, ¶ms)
|
||||
err, opUserID := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID)
|
||||
req.OpUserID = opUserID
|
||||
if err != nil {
|
||||
errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewOrganizationClient(etcdConn)
|
||||
RpcResp, err := client.UpdateOrganizationUser(context.Background(), req)
|
||||
if err != nil {
|
||||
errMsg := "rpc UpdateOrganizationUser failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
apiResp := api.UpdateOrganizationUserResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
|
||||
func CreateDepartmentMember(c *gin.Context) {
|
||||
params := api.CreateDepartmentMemberReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
req := &rpc.CreateDepartmentMemberReq{DepartmentMember: &open_im_sdk.DepartmentMember{}}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
utils.CopyStructFields(req.DepartmentMember, ¶ms)
|
||||
|
||||
err, opUserID := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID)
|
||||
req.OpUserID = opUserID
|
||||
if err != nil {
|
||||
errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewOrganizationClient(etcdConn)
|
||||
RpcResp, err := client.CreateDepartmentMember(context.Background(), req)
|
||||
if err != nil {
|
||||
errMsg := "rpc CreateDepartmentMember failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
apiResp := api.CreateDepartmentMemberResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
|
||||
func GetUserInDepartment(c *gin.Context) {
|
||||
params := api.GetUserInDepartmentReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
req := &rpc.GetUserInDepartmentReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
err, opUserID := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID)
|
||||
req.OpUserID = opUserID
|
||||
if err != nil {
|
||||
errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewOrganizationClient(etcdConn)
|
||||
RpcResp, err := client.GetUserInDepartment(context.Background(), req)
|
||||
if err != nil {
|
||||
errMsg := "rpc GetUserInDepartment failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
apiResp := api.GetUserInDepartmentResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, UserInDepartment: RpcResp.UserInDepartment}
|
||||
apiResp.Data = jsonData.JsonDataOne(RpcResp.UserInDepartment)
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
|
||||
func UpdateUserInDepartment(c *gin.Context) {
|
||||
params := api.UpdateUserInDepartmentReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
req := &rpc.UpdateUserInDepartmentReq{DepartmentMember: &open_im_sdk.DepartmentMember{}}
|
||||
utils.CopyStructFields(req.DepartmentMember, ¶ms)
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
err, opUserID := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID)
|
||||
req.OpUserID = opUserID
|
||||
if err != nil {
|
||||
errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewOrganizationClient(etcdConn)
|
||||
RpcResp, err := client.UpdateUserInDepartment(context.Background(), req)
|
||||
if err != nil {
|
||||
errMsg := "rpc UpdateUserInDepartment failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
apiResp := api.UpdateUserInDepartmentResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
|
||||
func DeleteOrganizationUser(c *gin.Context) {
|
||||
params := api.DeleteOrganizationUserReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
req := &rpc.DeleteOrganizationUserReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
err, opUserID := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID)
|
||||
req.OpUserID = opUserID
|
||||
if err != nil {
|
||||
errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewOrganizationClient(etcdConn)
|
||||
RpcResp, err := client.DeleteOrganizationUser(context.Background(), req)
|
||||
if err != nil {
|
||||
errMsg := "rpc DeleteOrganizationUser failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
apiResp := api.DeleteOrganizationUserResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
|
||||
func GetDepartmentMember(c *gin.Context) {
|
||||
params := api.GetDepartmentMemberReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
req := &rpc.GetDepartmentMemberReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
err, opUserID := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID)
|
||||
req.OpUserID = opUserID
|
||||
if err != nil {
|
||||
errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewOrganizationClient(etcdConn)
|
||||
RpcResp, err := client.GetDepartmentMember(context.Background(), req)
|
||||
if err != nil {
|
||||
errMsg := "rpc GetDepartmentMember failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
apiResp := api.GetDepartmentMemberResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, UserInDepartmentList: RpcResp.UserDepartmentMemberList}
|
||||
apiResp.Data = jsonData.JsonDataList(RpcResp.UserDepartmentMemberList)
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
|
||||
func DeleteUserInDepartment(c *gin.Context) {
|
||||
params := api.DeleteUserInDepartmentReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.DeleteUserInDepartmentReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
err, opUserID := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID)
|
||||
req.OpUserID = opUserID
|
||||
if err != nil {
|
||||
errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewOrganizationClient(etcdConn)
|
||||
RpcResp, err := client.DeleteUserInDepartment(context.Background(), req)
|
||||
if err != nil {
|
||||
errMsg := "rpc DeleteUserInDepartment failed " + err.Error() + req.String()
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
apiResp := api.DeleteUserInDepartmentResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api return ", apiResp)
|
||||
c.JSON(http.StatusOK, apiResp)
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package apiThird
|
||||
|
||||
import (
|
||||
api "Open_IM/pkg/base_info"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"fmt"
|
||||
openapi "github.com/alibabacloud-go/darabonba-openapi/client"
|
||||
sts20150401 "github.com/alibabacloud-go/sts-20150401/client"
|
||||
"github.com/alibabacloud-go/tea/tea"
|
||||
"github.com/fatih/structs"
|
||||
|
||||
//"github.com/fatih/structs"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
var stsClient *sts20150401.Client
|
||||
|
||||
/**
|
||||
* 使用AK&SK初始化账号Client
|
||||
* @param accessKeyId
|
||||
* @param accessKeySecret
|
||||
* @return Client
|
||||
* @throws Exception
|
||||
*/
|
||||
func getStsClient() *sts20150401.Client {
|
||||
if stsClient != nil {
|
||||
return stsClient
|
||||
}
|
||||
conf := &openapi.Config{
|
||||
// 您的AccessKey ID
|
||||
AccessKeyId: tea.String(config.Config.Credential.Ali.AccessKeyID),
|
||||
// 您的AccessKey Secret
|
||||
AccessKeySecret: tea.String(config.Config.Credential.Ali.AccessKeySecret),
|
||||
// Endpoint
|
||||
Endpoint: tea.String(config.Config.Credential.Ali.StsEndpoint),
|
||||
}
|
||||
result, err := sts20150401.NewClient(conf)
|
||||
if err != nil {
|
||||
log.NewError("", "alists client初始化失败 ", err)
|
||||
}
|
||||
stsClient = result
|
||||
return stsClient
|
||||
}
|
||||
|
||||
func AliOSSCredential(c *gin.Context) {
|
||||
req := api.OSSCredentialReq{}
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
var ok bool
|
||||
var userID string
|
||||
var errInfo string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "AliOSSCredential args ", userID)
|
||||
|
||||
stsResp, err := getStsClient().AssumeRole(&sts20150401.AssumeRoleRequest{
|
||||
DurationSeconds: tea.Int64(config.Config.Credential.Ali.StsDurationSeconds),
|
||||
Policy: nil,
|
||||
RoleArn: tea.String(config.Config.Credential.Ali.OssRoleArn),
|
||||
RoleSessionName: tea.String(fmt.Sprintf("%s-%d", userID, time.Now().Unix())),
|
||||
})
|
||||
|
||||
resp := api.OSSCredentialResp{}
|
||||
if err != nil {
|
||||
resp.ErrCode = constant.ErrTencentCredential.ErrCode
|
||||
resp.ErrMsg = err.Error()
|
||||
} else {
|
||||
resp = api.OSSCredentialResp{
|
||||
CommResp: api.CommResp{},
|
||||
OssData: api.OSSCredentialRespData{
|
||||
Endpoint: config.Config.Credential.Ali.OssEndpoint,
|
||||
AccessKeyId: *stsResp.Body.Credentials.AccessKeyId,
|
||||
AccessKeySecret: *stsResp.Body.Credentials.AccessKeySecret,
|
||||
Token: *stsResp.Body.Credentials.SecurityToken,
|
||||
Bucket: config.Config.Credential.Ali.Bucket,
|
||||
FinalHost: config.Config.Credential.Ali.FinalHost,
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
}
|
||||
|
||||
resp.Data = structs.Map(&resp.OssData)
|
||||
log.NewInfo(req.OperationID, "AliOSSCredential return ", resp)
|
||||
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
@@ -10,43 +10,79 @@ import (
|
||||
url2 "net/url"
|
||||
)
|
||||
|
||||
var (
|
||||
MinioClient *minio.Client
|
||||
)
|
||||
|
||||
func MinioInit() {
|
||||
minioUrl, err := url2.Parse(config.Config.Credential.Minio.Endpoint)
|
||||
operationID := utils.OperationIDGenerator()
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "minio config: ", config.Config.Credential.Minio)
|
||||
var initUrl string
|
||||
if config.Config.Credential.Minio.EndpointInnerEnable {
|
||||
initUrl = config.Config.Credential.Minio.EndpointInner
|
||||
} else {
|
||||
initUrl = config.Config.Credential.Minio.Endpoint
|
||||
}
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "use initUrl: ", initUrl)
|
||||
minioUrl, err := url2.Parse(initUrl)
|
||||
if err != nil {
|
||||
log.NewError("", utils.GetSelfFuncName(), "parse failed, please check config/config.yaml", err.Error())
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), "parse failed, please check config/config.yaml", err.Error())
|
||||
return
|
||||
}
|
||||
minioClient, err := minio.New(minioUrl.Host, &minio.Options{
|
||||
Creds: credentials.NewStaticV4(config.Config.Credential.Minio.AccessKeyID, config.Config.Credential.Minio.SecretAccessKey, ""),
|
||||
Secure: false,
|
||||
})
|
||||
opts := &minio.Options{
|
||||
Creds: credentials.NewStaticV4(config.Config.Credential.Minio.AccessKeyID, config.Config.Credential.Minio.SecretAccessKey, ""),
|
||||
}
|
||||
if minioUrl.Scheme == "http" {
|
||||
opts.Secure = false
|
||||
} else if minioUrl.Scheme == "https" {
|
||||
opts.Secure = true
|
||||
}
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "Parse ok ", config.Config.Credential.Minio)
|
||||
MinioClient, err = minio.New(minioUrl.Host, opts)
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "new ok ", config.Config.Credential.Minio)
|
||||
if err != nil {
|
||||
log.NewError("", utils.GetSelfFuncName(), "init minio client failed", err.Error())
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), "init minio client failed", err.Error())
|
||||
return
|
||||
}
|
||||
opt := minio.MakeBucketOptions{
|
||||
Region: config.Config.Credential.Minio.Location,
|
||||
ObjectLocking: false,
|
||||
}
|
||||
err = minioClient.MakeBucket(context.Background(), config.Config.Credential.Minio.Bucket, opt)
|
||||
err = MinioClient.MakeBucket(context.Background(), config.Config.Credential.Minio.Bucket, opt)
|
||||
if err != nil {
|
||||
log.NewInfo("", utils.GetSelfFuncName(), err.Error())
|
||||
exists, err := minioClient.BucketExists(context.Background(), config.Config.Credential.Minio.Bucket)
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), "MakeBucket failed ", err.Error())
|
||||
exists, err := MinioClient.BucketExists(context.Background(), config.Config.Credential.Minio.Bucket)
|
||||
if err == nil && exists {
|
||||
log.NewInfo("", utils.GetSelfFuncName(), "We already own %s\n", config.Config.Credential.Minio.Bucket)
|
||||
log.NewWarn(operationID, utils.GetSelfFuncName(), "We already own ", config.Config.Credential.Minio.Bucket)
|
||||
} else {
|
||||
if err != nil {
|
||||
log.NewError("", utils.GetSelfFuncName(), err.Error())
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
|
||||
}
|
||||
log.NewError("", utils.GetSelfFuncName(), "create bucket failed and bucket not exists")
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), "create bucket failed and bucket not exists")
|
||||
return
|
||||
}
|
||||
}
|
||||
// make app bucket
|
||||
err = MinioClient.MakeBucket(context.Background(), config.Config.Credential.Minio.AppBucket, opt)
|
||||
if err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), "MakeBucket failed ", err.Error())
|
||||
exists, err := MinioClient.BucketExists(context.Background(), config.Config.Credential.Minio.Bucket)
|
||||
if err == nil && exists {
|
||||
log.NewWarn(operationID, utils.GetSelfFuncName(), "We already own ", config.Config.Credential.Minio.Bucket)
|
||||
} else {
|
||||
if err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
|
||||
}
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), "create bucket failed and bucket not exists")
|
||||
return
|
||||
}
|
||||
}
|
||||
// 自动化桶public的代码
|
||||
//err = minioClient.SetBucketPolicy(context.Background(), config.Config.Credential.Minio.Bucket, policy.BucketPolicyReadWrite)
|
||||
//err = MinioClient.SetBucketPolicy(context.Background(), config.Config.Credential.Minio.Bucket, policy.BucketPolicyReadWrite)
|
||||
//err = MinioClient.SetBucketPolicy(context.Background(), config.Config.Credential.Minio.AppBucket, policy.BucketPolicyReadWrite)
|
||||
//if err != nil {
|
||||
// log.NewError("", utils.GetSelfFuncName(), "SetBucketPolicy failed please set in ", err.Error())
|
||||
// return`z
|
||||
// log.NewDebug("", utils.GetSelfFuncName(), "SetBucketPolicy failed please set in web", err.Error())
|
||||
// return
|
||||
//}
|
||||
log.NewInfo("", utils.GetSelfFuncName(), "minio create and set policy success")
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "minio create and set policy success")
|
||||
}
|
||||
|
||||
@@ -4,19 +4,103 @@ import (
|
||||
apiStruct "Open_IM/pkg/base_info"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
_ "Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/minio/minio-go/v7"
|
||||
_ "github.com/minio/minio-go/v7"
|
||||
cr "github.com/minio/minio-go/v7/pkg/credentials"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func MinioUploadFile(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.MinioUploadFileReq
|
||||
resp apiStruct.MinioUploadFileResp
|
||||
)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), r)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "missing file or snapShot args"})
|
||||
return
|
||||
}
|
||||
}()
|
||||
if err := c.Bind(&req); err != nil {
|
||||
log.NewError("0", utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req)
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, _, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req)
|
||||
switch req.FileType {
|
||||
// videoType upload snapShot
|
||||
case constant.VideoType:
|
||||
snapShotFile, err := c.FormFile("snapShot")
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "missing snapshot arg: " + err.Error()})
|
||||
return
|
||||
}
|
||||
snapShotFileObj, err := snapShotFile.Open()
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "Open file error", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
snapShotNewName, snapShotNewType := utils.GetNewFileNameAndContentType(snapShotFile.Filename, constant.ImageType)
|
||||
log.Debug(req.OperationID, utils.GetSelfFuncName(), snapShotNewName, snapShotNewType)
|
||||
_, err = MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.Bucket, snapShotNewName, snapShotFileObj, snapShotFile.Size, minio.PutObjectOptions{ContentType: snapShotNewType})
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "PutObject snapShotFile error", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
resp.SnapshotURL = config.Config.Credential.Minio.Endpoint + "/" + config.Config.Credential.Minio.Bucket + "/" + snapShotNewName
|
||||
resp.SnapshotNewName = snapShotNewName
|
||||
}
|
||||
file, err := c.FormFile("file")
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "FormFile failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "missing file arg: " + err.Error()})
|
||||
return
|
||||
}
|
||||
fileObj, err := file.Open()
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "Open file error", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "invalid file path" + err.Error()})
|
||||
return
|
||||
}
|
||||
newName, newType := utils.GetNewFileNameAndContentType(file.Filename, req.FileType)
|
||||
log.Debug(req.OperationID, utils.GetSelfFuncName(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, newType, MinioClient.EndpointURL())
|
||||
_, err = MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, minio.PutObjectOptions{ContentType: newType})
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "upload file error", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "upload file error" + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.NewName = newName
|
||||
resp.URL = config.Config.Credential.Minio.Endpoint + "/" + config.Config.Credential.Minio.Bucket + "/" + newName
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 0, "errMsg": "", "data": resp})
|
||||
return
|
||||
}
|
||||
|
||||
func MinioStorageCredential(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.MinioStorageCredentialReq
|
||||
req apiStruct.MinioStorageCredentialReq
|
||||
resp apiStruct.MiniostorageCredentialResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
@@ -24,17 +108,28 @@ func MinioStorageCredential(c *gin.Context) {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
ok, _ := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, _, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError("", utils.GetSelfFuncName(), "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
var stsOpts cr.STSAssumeRoleOptions
|
||||
stsOpts.AccessKey = config.Config.Credential.Minio.AccessKeyID
|
||||
stsOpts.SecretKey = config.Config.Credential.Minio.SecretAccessKey
|
||||
stsOpts.DurationSeconds = constant.MinioDurationTimes
|
||||
li, err := cr.NewSTSAssumeRole(config.Config.Credential.Minio.Endpoint, stsOpts)
|
||||
var endpoint string
|
||||
if config.Config.Credential.Minio.EndpointInnerEnable {
|
||||
endpoint = config.Config.Credential.Minio.EndpointInner
|
||||
} else {
|
||||
endpoint = config.Config.Credential.Minio.Endpoint
|
||||
}
|
||||
li, err := cr.NewSTSAssumeRole(endpoint, stsOpts)
|
||||
if err != nil {
|
||||
log.NewError("", utils.GetSelfFuncName(), "NewSTSAssumeRole failed", err.Error(), stsOpts, config.Config.Credential.Minio.Endpoint)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
@@ -51,5 +146,100 @@ func MinioStorageCredential(c *gin.Context) {
|
||||
resp.AccessKeyID = v.AccessKeyID
|
||||
resp.BucketName = config.Config.Credential.Minio.Bucket
|
||||
resp.StsEndpointURL = config.Config.Credential.Minio.Endpoint
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 0, "errMsg": "", "data":resp})
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 0, "errMsg": "", "data": resp})
|
||||
}
|
||||
|
||||
func UploadUpdateApp(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.UploadUpdateAppReq
|
||||
resp apiStruct.UploadUpdateAppResp
|
||||
)
|
||||
if err := c.Bind(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
var yamlName string
|
||||
if req.Yaml == nil {
|
||||
yamlName = ""
|
||||
} else {
|
||||
yamlName = req.Yaml.Filename
|
||||
}
|
||||
fileObj, err := req.File.Open()
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "Open file error", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "Open file error" + err.Error()})
|
||||
return
|
||||
}
|
||||
_, err = MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.AppBucket, req.File.Filename, fileObj, req.File.Size, minio.PutObjectOptions{})
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "PutObject file error")
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "PutObject file error" + err.Error()})
|
||||
return
|
||||
}
|
||||
if yamlName != "" {
|
||||
yamlObj, err := req.Yaml.Open()
|
||||
if err == nil {
|
||||
_, err = MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.AppBucket, yamlName, yamlObj, req.Yaml.Size, minio.PutObjectOptions{})
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "PutObject yaml error")
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "PutObject yaml error" + err.Error()})
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error())
|
||||
}
|
||||
}
|
||||
if err := imdb.UpdateAppVersion(req.Type, req.Version, req.ForceUpdate, req.File.Filename, yamlName, req.UpdateLog); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "UpdateAppVersion error", err.Error())
|
||||
resp.ErrCode = http.StatusInternalServerError
|
||||
resp.ErrMsg = err.Error()
|
||||
c.JSON(http.StatusInternalServerError, resp)
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName())
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetDownloadURL(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.GetDownloadURLReq
|
||||
resp apiStruct.GetDownloadURLResp
|
||||
)
|
||||
defer func() {
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
}()
|
||||
if err := c.Bind(&req); err != nil {
|
||||
log.NewError("0", utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
app, err := imdb.GetNewestVersion(req.Type)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "getNewestVersion failed", err.Error())
|
||||
}
|
||||
log.Debug(req.OperationID, utils.GetSelfFuncName(), "app: ", app)
|
||||
if app != nil {
|
||||
if app.Version != req.Version && app.Version != "" {
|
||||
resp.Data.HasNewVersion = true
|
||||
if app.ForceUpdate == true {
|
||||
resp.Data.ForceUpdate = true
|
||||
}
|
||||
if app.YamlName != "" {
|
||||
resp.Data.YamlURL = config.Config.Credential.Minio.Endpoint + "/" + config.Config.Credential.Minio.AppBucket + "/" + app.YamlName
|
||||
}
|
||||
resp.Data.FileURL = config.Config.Credential.Minio.Endpoint + "/" + config.Config.Credential.Minio.AppBucket + "/" + app.FileName
|
||||
resp.Data.Version = app.Version
|
||||
resp.Data.UpdateLog = app.UpdateLog
|
||||
c.JSON(http.StatusOK, resp)
|
||||
return
|
||||
} else {
|
||||
resp.Data.HasNewVersion = false
|
||||
c.JSON(http.StatusOK, resp)
|
||||
return
|
||||
}
|
||||
}
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 0, "errMsg": "not found app version"})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package apiThird
|
||||
|
||||
import (
|
||||
api "Open_IM/pkg/base_info"
|
||||
"Open_IM/pkg/common/db"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetRTCInvitationInfo(c *gin.Context) {
|
||||
var (
|
||||
req api.GetRTCInvitationInfoReq
|
||||
resp api.GetRTCInvitationInfoResp
|
||||
)
|
||||
if err := c.Bind(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
ok, userID, errInfo := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
var err error
|
||||
invitationInfo, err := db.DB.GetSignalInfoFromCacheByClientMsgID(req.ClientMsgID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetSignalInfoFromCache", err.Error(), req)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
if err := db.DB.DelUserSignalList(userID); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "DelUserSignalList result:", err.Error())
|
||||
}
|
||||
|
||||
resp.Data.OpUserID = invitationInfo.OpUserID
|
||||
resp.Data.Invitation.RoomID = invitationInfo.Invitation.RoomID
|
||||
resp.Data.Invitation.SessionType = invitationInfo.Invitation.SessionType
|
||||
resp.Data.Invitation.GroupID = invitationInfo.Invitation.GroupID
|
||||
resp.Data.Invitation.InviterUserID = invitationInfo.Invitation.InviterUserID
|
||||
resp.Data.Invitation.InviteeUserIDList = invitationInfo.Invitation.InviteeUserIDList
|
||||
resp.Data.Invitation.MediaType = invitationInfo.Invitation.MediaType
|
||||
resp.Data.Invitation.Timeout = invitationInfo.Invitation.Timeout
|
||||
resp.Data.Invitation.InitiateTime = invitationInfo.Invitation.InitiateTime
|
||||
resp.Data.Invitation.PlatformID = invitationInfo.Invitation.PlatformID
|
||||
resp.Data.Invitation.CustomData = invitationInfo.Invitation.CustomData
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetRTCInvitationInfoStartApp(c *gin.Context) {
|
||||
var (
|
||||
req api.GetRTCInvitationInfoStartAppReq
|
||||
resp api.GetRTCInvitationInfoStartAppResp
|
||||
)
|
||||
if err := c.Bind(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, userID, errInfo := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
invitationInfo, err := db.DB.GetAvailableSignalInvitationInfo(userID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetSignalInfoFromCache", err.Error(), req)
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 0, "errMsg": err.Error(), "data": struct{}{}})
|
||||
return
|
||||
}
|
||||
resp.Data.OpUserID = invitationInfo.OpUserID
|
||||
resp.Data.Invitation.RoomID = invitationInfo.Invitation.RoomID
|
||||
resp.Data.Invitation.SessionType = invitationInfo.Invitation.SessionType
|
||||
resp.Data.Invitation.GroupID = invitationInfo.Invitation.GroupID
|
||||
resp.Data.Invitation.InviterUserID = invitationInfo.Invitation.InviterUserID
|
||||
resp.Data.Invitation.InviteeUserIDList = invitationInfo.Invitation.InviteeUserIDList
|
||||
resp.Data.Invitation.MediaType = invitationInfo.Invitation.MediaType
|
||||
resp.Data.Invitation.Timeout = invitationInfo.Invitation.Timeout
|
||||
resp.Data.Invitation.InitiateTime = invitationInfo.Invitation.InitiateTime
|
||||
resp.Data.Invitation.PlatformID = invitationInfo.Invitation.PlatformID
|
||||
resp.Data.Invitation.CustomData = invitationInfo.Invitation.CustomData
|
||||
c.JSON(http.StatusOK, resp)
|
||||
|
||||
}
|
||||
@@ -22,12 +22,18 @@ func TencentCloudStorageCredential(c *gin.Context) {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
|
||||
var ok bool
|
||||
var userID string
|
||||
var errInfo string
|
||||
ok, userID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "TencentCloudStorageCredential args ", userID)
|
||||
|
||||
cli := sts.NewClient(
|
||||
|
||||
+284
-18
@@ -4,9 +4,12 @@ import (
|
||||
jsonData "Open_IM/internal/utils"
|
||||
api "Open_IM/pkg/base_info"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
cacheRpc "Open_IM/pkg/proto/cache"
|
||||
pbRelay "Open_IM/pkg/proto/relay"
|
||||
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||
rpc "Open_IM/pkg/proto/user"
|
||||
"Open_IM/pkg/utils"
|
||||
@@ -16,25 +19,32 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func GetUsersInfo(c *gin.Context) {
|
||||
func GetUsersInfoFromCache(c *gin.Context) {
|
||||
params := api.GetUsersInfoReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": http.StatusBadRequest, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(params.OperationID, "GetUsersInfoFromCache req: ", params)
|
||||
req := &rpc.GetUserInfoReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(params.OperationID, "GetUserInfo args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||
client := rpc.NewUserClient(etcdConn)
|
||||
RpcResp, err := client.GetUserInfo(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -45,7 +55,138 @@ func GetUsersInfo(c *gin.Context) {
|
||||
var publicUserInfoList []*open_im_sdk.PublicUserInfo
|
||||
for _, v := range RpcResp.UserInfoList {
|
||||
publicUserInfoList = append(publicUserInfoList,
|
||||
&open_im_sdk.PublicUserInfo{UserID: v.UserID, Nickname: v.Nickname, FaceURL: v.FaceURL, Gender: v.Gender})
|
||||
&open_im_sdk.PublicUserInfo{UserID: v.UserID, Nickname: v.Nickname, FaceURL: v.FaceURL, Gender: v.Gender, Ex: v.Ex})
|
||||
}
|
||||
resp := api.GetUsersInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, UserInfoList: publicUserInfoList}
|
||||
resp.Data = jsonData.JsonDataList(resp.UserInfoList)
|
||||
log.NewInfo(req.OperationID, "GetUserInfo api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetFriendIDListFromCache(c *gin.Context) {
|
||||
var (
|
||||
req api.GetFriendIDListFromCacheReq
|
||||
resp api.GetFriendIDListFromCacheResp
|
||||
reqPb cacheRpc.GetFriendIDListFromCacheReq
|
||||
respPb *cacheRpc.GetFriendIDListFromCacheResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": http.StatusBadRequest, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req)
|
||||
reqPb.OperationID = req.OperationID
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, reqPb.UserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := cacheRpc.NewCacheClient(etcdConn)
|
||||
respPb, err := client.GetFriendIDListFromCache(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetFriendIDListFromCache", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed:" + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.UserIDList = respPb.UserIDList
|
||||
resp.CommResp = api.CommResp{ErrMsg: respPb.CommonResp.ErrMsg, ErrCode: respPb.CommonResp.ErrCode}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetBlackIDListFromCache(c *gin.Context) {
|
||||
var (
|
||||
req api.GetBlackIDListFromCacheReq
|
||||
resp api.GetBlackIDListFromCacheResp
|
||||
reqPb cacheRpc.GetBlackIDListFromCacheReq
|
||||
respPb *cacheRpc.GetBlackIDListFromCacheResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError(req.OperationID, "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": http.StatusBadRequest, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
reqPb.OperationID = req.OperationID
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, reqPb.UserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := cacheRpc.NewCacheClient(etcdConn)
|
||||
respPb, err := client.GetBlackIDListFromCache(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetFriendIDListFromCache", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed:" + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.UserIDList = respPb.UserIDList
|
||||
resp.CommResp = api.CommResp{ErrMsg: respPb.CommonResp.ErrMsg, ErrCode: respPb.CommonResp.ErrCode}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetUsersInfo(c *gin.Context) {
|
||||
params := api.GetUsersInfoReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": http.StatusBadRequest, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.GetUserInfoReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(params.OperationID, "GetUserInfo args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewUserClient(etcdConn)
|
||||
RpcResp, err := client.GetUserInfo(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "GetUserInfo failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
||||
return
|
||||
}
|
||||
var publicUserInfoList []*open_im_sdk.PublicUserInfo
|
||||
for _, v := range RpcResp.UserInfoList {
|
||||
publicUserInfoList = append(publicUserInfoList,
|
||||
&open_im_sdk.PublicUserInfo{UserID: v.UserID, Nickname: v.Nickname, FaceURL: v.FaceURL, Gender: v.Gender, Ex: v.Ex})
|
||||
}
|
||||
|
||||
resp := api.GetUsersInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, UserInfoList: publicUserInfoList}
|
||||
@@ -63,18 +204,24 @@ func UpdateUserInfo(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.UpdateUserInfoReq{UserInfo: &open_im_sdk.UserInfo{}}
|
||||
utils.CopyStructFields(req.UserInfo, ¶ms)
|
||||
|
||||
req.OperationID = params.OperationID
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(params.OperationID, "UpdateUserInfo args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewUserClient(etcdConn)
|
||||
RpcResp, err := client.UpdateUserInfo(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -86,6 +233,44 @@ func UpdateUserInfo(c *gin.Context) {
|
||||
log.NewInfo(req.OperationID, "UpdateUserInfo api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
func SetGlobalRecvMessageOpt(c *gin.Context) {
|
||||
params := api.SetGlobalRecvMessageOptReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &rpc.SetGlobalRecvMessageOptReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
req.OperationID = params.OperationID
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.UserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(params.OperationID, "SetGlobalRecvMessageOpt args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewUserClient(etcdConn)
|
||||
RpcResp, err := client.SetGlobalRecvMessageOpt(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, "SetGlobalRecvMessageOpt failed ", err.Error(), req.String())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
|
||||
return
|
||||
}
|
||||
resp := api.UpdateUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}}
|
||||
log.NewInfo(req.OperationID, "SetGlobalRecvMessageOpt api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetSelfUserInfo(c *gin.Context) {
|
||||
params := api.GetSelfUserInfoReq{}
|
||||
@@ -97,17 +282,27 @@ func GetSelfUserInfo(c *gin.Context) {
|
||||
req := &rpc.GetUserInfoReq{}
|
||||
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
req.UserIDList = append(req.UserIDList, req.OpUserID)
|
||||
log.NewInfo(params.OperationID, "GetUserInfo args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
client := rpc.NewUserClient(etcdConn)
|
||||
RpcResp, err := client.GetUserInfo(context.Background(), req)
|
||||
if err != nil {
|
||||
@@ -127,3 +322,74 @@ func GetSelfUserInfo(c *gin.Context) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func GetUsersOnlineStatus(c *gin.Context) {
|
||||
params := api.GetUsersOnlineStatusReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
req := &pbRelay.GetUsersOnlineStatusReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
if len(config.Config.Manager.AppManagerUid) == 0 {
|
||||
log.NewError(req.OperationID, "Manager == 0")
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "Manager == 0"})
|
||||
return
|
||||
}
|
||||
req.OpUserID = config.Config.Manager.AppManagerUid[0]
|
||||
|
||||
log.NewInfo(params.OperationID, "GetUsersOnlineStatus args ", req.String())
|
||||
var wsResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult
|
||||
var respResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult
|
||||
flag := false
|
||||
grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
|
||||
for _, v := range grpcCons {
|
||||
client := pbRelay.NewOnlineMessageRelayServiceClient(v)
|
||||
reply, err := client.GetUsersOnlineStatus(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(params.OperationID, "GetUsersOnlineStatus rpc err", req.String(), err.Error())
|
||||
continue
|
||||
} else {
|
||||
if reply.ErrCode == 0 {
|
||||
wsResult = append(wsResult, reply.SuccessResult...)
|
||||
}
|
||||
}
|
||||
}
|
||||
log.NewInfo(params.OperationID, "call GetUsersOnlineStatus rpc server is success", wsResult)
|
||||
//Online data merge of each node
|
||||
for _, v1 := range params.UserIDList {
|
||||
flag = false
|
||||
temp := new(pbRelay.GetUsersOnlineStatusResp_SuccessResult)
|
||||
for _, v2 := range wsResult {
|
||||
if v2.UserID == v1 {
|
||||
flag = true
|
||||
temp.UserID = v1
|
||||
temp.Status = constant.OnlineStatus
|
||||
temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, v2.DetailPlatformStatus...)
|
||||
}
|
||||
|
||||
}
|
||||
if !flag {
|
||||
temp.UserID = v1
|
||||
temp.Status = constant.OfflineStatus
|
||||
}
|
||||
respResult = append(respResult, temp)
|
||||
}
|
||||
resp := api.GetUsersOnlineStatusResp{CommResp: api.CommResp{ErrCode: 0, ErrMsg: ""}, SuccessResult: respResult}
|
||||
if len(respResult) == 0 {
|
||||
resp.SuccessResult = []*pbRelay.GetUsersOnlineStatusResp_SuccessResult{}
|
||||
}
|
||||
log.NewInfo(req.OperationID, "GetUsersOnlineStatus api return", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user