Compare commits
1469 Commits
master
...
540dff822d
| Author | SHA1 | Date | |
|---|---|---|---|
| 540dff822d | |||
| 7a9b1ef9cf | |||
| f259bab4ed | |||
| 878f9f8ff7 | |||
| 8575a04639 | |||
| be9dee86dc | |||
| c93d05a1a3 | |||
| 75c4a27556 | |||
| d04e6d7303 | |||
| 8cc3cb3217 | |||
| 1276c4e8d5 | |||
| c5a622148f | |||
| 69e3570600 | |||
| a1010ff2c7 | |||
| e7b14d20f1 | |||
| 3a120b55cb | |||
| 761fc6e86f | |||
| f66f3a2247 | |||
| b570510602 | |||
| 373a8ecedd | |||
| 90b19f20b6 | |||
| 0e6afcaab9 | |||
| 30461d6986 | |||
| aaea1c429a | |||
| 7d327edd21 | |||
| b7ec1b1eda | |||
| 7e04e72070 | |||
| 43e69a2895 | |||
| 446076cc2e | |||
| 13cdbb56ee | |||
| d6ea318358 | |||
| 487f0277fd | |||
| 2046e61c1b | |||
| 34ea8ac762 | |||
| bad55084a1 | |||
| 405b632a8a | |||
| 59d646925f | |||
| 8922fa93f3 | |||
| e29f4bd4df | |||
| 08cd7af663 | |||
| 53964b5398 | |||
| 19bb1d742e | |||
| 29e35435a6 | |||
| b8b935c8b2 | |||
| 50a7226864 | |||
| 522c240771 | |||
| aa5ada0790 | |||
| 14107d60e4 | |||
| 48066e7b13 | |||
| fcad79edf1 | |||
| 91d19f413a | |||
| b0b6ef72a5 | |||
| 9bec4ef093 | |||
| 54abef6b56 | |||
| 7ad88c1e98 | |||
| c83216aa23 | |||
| 6f82b130c0 | |||
| f24de31a92 | |||
| b367d1a97d | |||
| 54bf441b6c | |||
| 2d392039ac | |||
| 4b379b7e53 | |||
| dd2c676ecc | |||
| 1d6b09e20e | |||
| abae40397c | |||
| 3a8ccf4c35 | |||
| 885d1a631a | |||
| 6b08d327ec | |||
| 097b719937 | |||
| 0ac1fc2b46 | |||
| 699d6d4245 | |||
| 767f51d1d6 | |||
| 06983dfe46 | |||
| 8bcee346ff | |||
| a588175a9e | |||
| 2d9edc4c78 | |||
| 2c45e0b38f | |||
| 824fc52717 | |||
| 5002913d70 | |||
| aa0615974b | |||
| 4765a738c0 | |||
| 1806a6a38a | |||
| 515955f65d | |||
| bea3dcd873 | |||
| 7eb9d49ede | |||
| 8f96b4cae3 | |||
| c083b0576f | |||
| 5822832ab3 | |||
| 1623277e26 | |||
| ffbf0c0f37 | |||
| 4d528e0e72 | |||
| a6ac190358 | |||
| 49728c6fcb | |||
| dc5eba281e | |||
| fd1a88cdf6 | |||
| c21d6ed238 | |||
| 401c3f8842 | |||
| 7f266b4b15 | |||
| 4eaa1efdbf | |||
| 2624aa6c56 | |||
| 74db686f47 | |||
| 6582f9ca96 | |||
| 4aa09e49a9 | |||
| 6c1cd57e6a | |||
| 094221ab2b | |||
| 8ef22d87a2 | |||
| a42ae7a94f | |||
| c2b49aad9f | |||
| 1903774cdf | |||
| ce2bf4c7ce | |||
| 8d995cb5b4 | |||
| 059703b1f4 | |||
| dc9d6671a4 | |||
| a4ee889127 | |||
| 9f8e25948a | |||
| 46821425a8 | |||
| 48625c4845 | |||
| 0447163694 | |||
| 323c800751 | |||
| f45b60c9d3 | |||
| aaa1837502 | |||
| 9a27bb7014 | |||
| 96ff53bbea | |||
| 29f7626fc8 | |||
| 0b687e6712 | |||
| b22c9af6a6 | |||
| bc0f052359 | |||
| 64d0812adb | |||
| a3109f6ab4 | |||
| 903496c893 | |||
| a198a31755 | |||
| 8b5a368b17 | |||
| 6c051fa8e7 | |||
| 98a94385a3 | |||
| a0b16e8f72 | |||
| ae1421c495 | |||
| 74759b5599 | |||
| d7838b772a | |||
| fa350cb505 | |||
| fe830e1a52 | |||
| 8b3c6e45ef | |||
| 36e8fec12f | |||
| 963df499b9 | |||
| 7d77ba7745 | |||
| f0bc7ec9ed | |||
| 377392b9dd | |||
| 1057fadb57 | |||
| 97e6c41725 | |||
| 90c4ec7346 | |||
| c22414b2fd | |||
| 9a95595dd8 | |||
| be15b70885 | |||
| 57a0c4f21d | |||
| 53e01f61ad | |||
| 5e37cddc82 | |||
| 446af258b9 | |||
| 35deebd0f8 | |||
| e753695146 | |||
| 4152f46504 | |||
| e293cacd44 | |||
| fbfc0975dd | |||
| d8a299e4a2 | |||
| 4d284c4328 | |||
| 413ff05221 | |||
| 334dca1b5d | |||
| 23bcf3f864 | |||
| a6bf88c22d | |||
| 737fb817d3 | |||
| 40879dd516 | |||
| 280d4be22b | |||
| dd3622adf0 | |||
| fc543ed9c1 | |||
| 26e4b4ac82 | |||
| 0660edfeeb | |||
| ffb073bf92 | |||
| 155a66d84c | |||
| c9b1d4c541 | |||
| 598dd3c471 | |||
| bd5cf6a0c5 | |||
| e4c73706bb | |||
| 8b9fd4d927 | |||
| 31c9d2a325 | |||
| 77c7e300f5 | |||
| 55e48b5e13 | |||
| 42785f219f | |||
| 5bc428b5f1 | |||
| 9c7dbe9b4d | |||
| 843b16f5cd | |||
| ce4e9ff0d7 | |||
| 46c4671920 | |||
| 8e59118d68 | |||
| 727132bef1 | |||
| 9066ea946f | |||
| d091589dac | |||
| bcafb4fae6 | |||
| c6ca1094bf | |||
| f509962c9b | |||
| ae8f35f54e | |||
| 7e6fdad0cf | |||
| e859b65659 | |||
| feb8dff689 | |||
| dae88e5ae6 | |||
| 3c8aa521ae | |||
| f7239cd9d4 | |||
| 9c9af7ce1f | |||
| 965718a18e | |||
| 716dcb810e | |||
| 8536183aad | |||
| 6e3b88c61c | |||
| bfbdcb8708 | |||
| b7f782db4a | |||
| d5c597db92 | |||
| f392b8c2ae | |||
| ae30b71aed | |||
| 9144f06859 | |||
| 74c496efbe | |||
| eddb1e2fc0 | |||
| 7e64fe73a9 | |||
| d81c2c977d | |||
| fcf5dcf94a | |||
| e1c45ea6cf | |||
| 5495e82905 | |||
| 805bbf9d00 | |||
| db01e57029 | |||
| f4c8c1ac9c | |||
| c04bcb7072 | |||
| 52893ee84f | |||
| a6a844ade0 | |||
| b3e63d74ac | |||
| 05aedf2231 | |||
| 971d11c27d | |||
| b79dc9236c | |||
| 24abbba56d | |||
| 89992325e5 | |||
| d4201cf3a6 | |||
| 94f6521907 | |||
| 16db1ccf1f | |||
| cd4e70b4d7 | |||
| ff52c3fee9 | |||
| d60e9cb0e0 | |||
| 3087e7aa6a | |||
| 92cf24a9dd | |||
| 7b428dc9ab | |||
| 14fc8ce0a3 | |||
| f8efd223ee | |||
| 227ad92a2f | |||
| 05915ae64a | |||
| b5834b4c33 | |||
| 136a819ccf | |||
| 2249223d31 | |||
| bf214611c3 | |||
| 174c9fd7b3 | |||
| 1291553ed9 | |||
| fff27c609b | |||
| c25ea4edc4 | |||
| fac55d0614 | |||
| 519ba46165 | |||
| 040f3312fa | |||
| 9612381897 | |||
| 2d2aaf3372 | |||
| 778e067540 | |||
| 13dfbd7e0c | |||
| 6f883cabdc | |||
| 9eebfd8268 | |||
| 1cedc4d547 | |||
| b7538b0340 | |||
| 5b467fca78 | |||
| 3cc5ee00b8 | |||
| da10e294ae | |||
| 1c17ec17ce | |||
| eeba316880 | |||
| 95768638ac | |||
| 99c95a92e1 | |||
| 40af6214b2 | |||
| 9095851f33 | |||
| ac4897f0ac | |||
| 38732a626a | |||
| 726d1c7c55 | |||
| f4edac6ef5 | |||
| fb9963d49f | |||
| 53d38e816c | |||
| f11fc0a099 | |||
| 12b6d1b866 | |||
| 8791579969 | |||
| d1f5dbf5e9 | |||
| d1d07197f1 | |||
| b46bef67df | |||
| 8ee7b255f3 | |||
| 38705cc76a | |||
| 5a76970fb4 | |||
| 33bc871529 | |||
| 71f24f26c8 | |||
| dd71e57903 | |||
| fef69f0640 | |||
| d96931c7e5 | |||
| 5ffe2fc3df | |||
| 132e9df303 | |||
| 581122b4d9 | |||
| 88682f65ce | |||
| de17f54160 | |||
| fcf19e80a4 | |||
| 41f10bc387 | |||
| 8221bfb85b | |||
| a701321417 | |||
| ff961f42ee | |||
| a3f6327739 | |||
| 0d758d8587 | |||
| 499f9407b6 | |||
| d1cdb23175 | |||
| cb6516bfea | |||
| ba78531cbe | |||
| b30efada95 | |||
| 203aeb3842 | |||
| c2765a0260 | |||
| c0a175092f | |||
| a6bc94af50 | |||
| 7373d66506 | |||
| 07ed282141 | |||
| 3972716675 | |||
| 0e80ab61a2 | |||
| 20071a4f40 | |||
| 3c5db83d4c | |||
| c1c79075d1 | |||
| 0aa351cd63 | |||
| 624a9478de | |||
| 2865e800e6 | |||
| 928f86011a | |||
| 4086c8282f | |||
| 005533fd27 | |||
| f5e8fad6bd | |||
| 5c6b6e028b | |||
| f1acf8db53 | |||
| 93b21b4ee0 | |||
| 891087cf7a | |||
| 618623432a | |||
| 165e0565b5 | |||
| 630e67693f | |||
| fce818807e | |||
| 4a254d9f28 | |||
| 52d41e9e36 | |||
| 34b74335c2 | |||
| 1119e366ee | |||
| 632527da5c | |||
| 78c06adaf8 | |||
| 8d6beb7884 | |||
| 68d1fe3cf6 | |||
| 93e7cb60e8 | |||
| 569bdbf4ce | |||
| f54a9b6728 | |||
| 686f24e090 | |||
| 09147525a0 | |||
| 149546ee8e | |||
| 1535a5cc33 | |||
| 9539bc069e | |||
| d5703bd99a | |||
| 821ec4183f | |||
| b1ff156a6c | |||
| df06595007 | |||
| 2a7179abe5 | |||
| 4be7ddc1c2 | |||
| c438fb049e | |||
| 70d5e2fc80 | |||
| 3824fae695 | |||
| 55161e242e | |||
| fbcc2a0483 | |||
| befc1bf41e | |||
| 55abd48d30 | |||
| 7a6695c7ed | |||
| 239815839a | |||
| a385776538 | |||
| 96822cf248 | |||
| 35a90fef3b | |||
| 67ae480665 | |||
| 5420a24800 | |||
| 002f20af78 | |||
| 30ad1e720d | |||
| 999a5603be | |||
| ffa9cc98ed | |||
| f81b84cf39 | |||
| c366cc34b0 | |||
| 98be6cc43e | |||
| 9dba7647c5 | |||
| 7f55f1997a | |||
| 88ebe674de | |||
| cedc621e95 | |||
| 4187931abd | |||
| a8b3d30ac6 | |||
| f439929e6d | |||
| b68db7b6c5 | |||
| ffd2769bad | |||
| 150aa8f5c7 | |||
| bb68bdd25b | |||
| b3e52f9c3d | |||
| 07c71c04ba | |||
| 358dd0f2b7 | |||
| a1324cf390 | |||
| c0509263d4 | |||
| f5187c013e | |||
| 33e9b3612a | |||
| 0fe00cf140 | |||
| 0d2bdb5f18 | |||
| 9e3ef5090a | |||
| 7a8a6ed462 | |||
| 3cd1ab90d6 | |||
| fd2809c1a8 | |||
| b47dc76429 | |||
| 0dcc0bfa80 | |||
| f05205b3c1 | |||
| 4cdbc6a7cc | |||
| 7b827874e0 | |||
| 8538410fec | |||
| def606d3a0 | |||
| 454816959c | |||
| ed923cd0bf | |||
| 2f5457107c | |||
| f8e7ff1d52 | |||
| 6dc429ec36 | |||
| 51338300c5 | |||
| 87290ab4c9 | |||
| 479fd37014 | |||
| a2f11a319e | |||
| 48b217fce0 | |||
| 3cf0f68569 | |||
| 7a8faf7ae9 | |||
| 73094e132d | |||
| 0b8655e5d2 | |||
| 705018e3e8 | |||
| a17697056a | |||
| 793804fe45 | |||
| 805a665392 | |||
| 19a846c274 | |||
| 0499b8c98d | |||
| 69daeb15ee | |||
| 316b916052 | |||
| 81f44d4a81 | |||
| 797c6c1e62 | |||
| 7f0fbadb51 | |||
| 50396ae5e4 | |||
| 0f0907b534 | |||
| bfc40fb248 | |||
| 8df95110cf | |||
| 6cde21fe2d | |||
| 2ab9208236 | |||
| 32a8b351df | |||
| 84273faee1 | |||
| 674e026c29 | |||
| 85a3776ab0 | |||
| b695ef4209 | |||
| fccdfb1c0a | |||
| 56cfdea96e | |||
| 9522170898 | |||
| d787e3941a | |||
| 50ff822b10 | |||
| bf5333937e | |||
| 7b3fff03c4 | |||
| fd8e4c7c79 | |||
| 8f7ea8b289 | |||
| f9de7a3a06 | |||
| 8307b6c83d | |||
| 36f4187ada | |||
| 5a72687aee | |||
| 7d8b0d766c | |||
| f9539d9675 | |||
| 434caca2b0 | |||
| 9fca28c57f | |||
| 877c4cfcb4 | |||
| 769b5af542 | |||
| 5b0eac6db6 | |||
| 20e68f280d | |||
| 7d2c35c4c7 | |||
| 8e032deff2 | |||
| 4b68ed4ca1 | |||
| 58621423f1 | |||
| 843693f4f9 | |||
| a45d928567 | |||
| 440ff3b11f | |||
| 2143a7d6c8 | |||
| 82df081fd0 | |||
| 89c86fc21d | |||
| e3e51f222d | |||
| eab06a9b10 | |||
| d87d469aa3 | |||
| c5d1a2f893 | |||
| 136802fa48 | |||
| 6488f65bd3 | |||
| 545ce25703 | |||
| 3003b489a3 | |||
| 60d800ba0d | |||
| 25635b0e46 | |||
| 2fb87137dd | |||
| 16134c993a | |||
| d672397e35 | |||
| 3831baa37a | |||
| 20a8ff5e98 | |||
| fa35040a88 | |||
| d3d461e316 | |||
| ae518ca9e5 | |||
| 3ad46c624b | |||
| 6c311abb98 | |||
| f3e692f3fc | |||
| 0dfccdd617 | |||
| 6466b0cab7 | |||
| fc0f6cd725 | |||
| 270714928b | |||
| 53e5e52203 | |||
| 58d77b1e1a | |||
| ee59c5ccff | |||
| b63184ce52 | |||
| ef86241ad4 | |||
| 28b4c9bb76 | |||
| 697512c46d | |||
| 63b64dfb18 | |||
| 018865fcac | |||
| ea876dba28 | |||
| c95410311d | |||
| 242ae07d2a | |||
| 5fca7b9e06 | |||
| bae8b3158d | |||
| c2d6df9384 | |||
| c860344609 | |||
| 1e02332678 | |||
| d13dae6746 | |||
| 2860daef6e | |||
| bf02aaad14 | |||
| d03e1285e4 | |||
| a60937297b | |||
| f0898345a1 | |||
| 41be4738da | |||
| b8a55853d5 | |||
| 7664fd812d | |||
| 702f09d0de | |||
| 7c002eab1d | |||
| fe83b67ef4 | |||
| 9bfcc77d1c | |||
| 5e66113357 | |||
| 9429cf17c1 | |||
| 48f6ce44ab | |||
| 4ba205e565 | |||
| 2efcfd069c | |||
| 901fe0dbc2 | |||
| 88d21d0a6a | |||
| 1e69aa94a7 | |||
| 5dde1fa795 | |||
| 6f32ca2b08 | |||
| 8191237775 | |||
| b9d876437a | |||
| 0624562dda | |||
| 694483f526 | |||
| 0630170a72 | |||
| bf3b69da7d | |||
| cc922eceb8 | |||
| 43c188e8a9 | |||
| 33450890aa | |||
| 6e81a0942f | |||
| 58865a984a | |||
| 444a2c59e8 | |||
| 604d60eb71 | |||
| 95bb00e2cc | |||
| 92a2fb10cd | |||
| e0d854b1fd | |||
| e2b55a4f28 | |||
| f318e54a3a | |||
| 685bca8bdb | |||
| 73b3808dec | |||
| 400461fd5a | |||
| 763b1b1892 | |||
| f81440882b | |||
| c661018a1e | |||
| bdb738a47f | |||
| e71d01c5a0 | |||
| 051d6589e9 | |||
| f9f0d01948 | |||
| 4f32f98ad2 | |||
| 5cff222264 | |||
| c68bb44650 | |||
| 4b5eb28781 | |||
| 32815cc578 | |||
| ff5222e333 | |||
| 3e90c1ae38 | |||
| 9210cf9635 | |||
| 2cf309e082 | |||
| 8cfe127c32 | |||
| 690bc258d0 | |||
| cd69ab6b73 | |||
| 1c2b981649 | |||
| 301b7c6d5c | |||
| d470264617 | |||
| 0c989521d6 | |||
| eb76e324e9 | |||
| 1d6152acb4 | |||
| e12e8c4ad2 | |||
| 94184b89a8 | |||
| 9d68d429f6 | |||
| 86e91af96f | |||
| b6e669ac9d | |||
| 7323ed2028 | |||
| f1e9b82471 | |||
| f2dc348994 | |||
| cfadaf4326 | |||
| df4e3aabdf | |||
| 3b531033bf | |||
| 5db7367438 | |||
| bf0e187e71 | |||
| e9eaedd14d | |||
| 3c3c332d05 | |||
| 81621fe62c | |||
| 1b3f562bb0 | |||
| e6ed912f42 | |||
| 2155ce1d4e | |||
| a6724faa99 | |||
| 2121a0a28b | |||
| 3c37a5c481 | |||
| d514f39dc3 | |||
| aa498d682a | |||
| 5ec94fda56 | |||
| 8ed22d99be | |||
| 6065183faf | |||
| d2f9c457ad | |||
| cbaf8a6d2c | |||
| a462d63bc5 | |||
| 794ea56b09 | |||
| 52c34275f5 | |||
| e4528232ed | |||
| fc42e14b75 | |||
| 0af34072ff | |||
| 2ba8392f2c | |||
| 97c5322446 | |||
| aa3db1f068 | |||
| 6c29963372 | |||
| c1e22c5fe1 | |||
| c55716196c | |||
| 122ba13243 | |||
| 6135f82944 | |||
| dcf926e496 | |||
| 04349ae7f0 | |||
| 1502709a9f | |||
| 19d2b6c9f6 | |||
| 287b108ce6 | |||
| 4ccee5f8ac | |||
| cda159929c | |||
| 375867a2ea | |||
| c4cea0c231 | |||
| a4409b0bb3 | |||
| 78d7ae8279 | |||
| 820468263f | |||
| 5722486bc5 | |||
| d1b20bdcd4 | |||
| 071bb6a399 | |||
| e681918ca0 | |||
| 235b795eb8 | |||
| 817a1ad59b | |||
| ffaf75bb72 | |||
| 8058605a0b | |||
| 4f2ddedc5d | |||
| 32ba6cbf08 | |||
| 8f72278eaa | |||
| 326a819f72 | |||
| d9626c6a59 | |||
| 4ca0bbd84d | |||
| ca48f2682c | |||
| f8855c7191 | |||
| 0937ceac6b | |||
| 2b4b3509e8 | |||
| ebb341fef2 | |||
| bfb7fdb2e8 | |||
| 5d6d8af442 | |||
| fc102dceb2 | |||
| 3e3d0c7e20 | |||
| 483e985e94 | |||
| ff916aec3d | |||
| 728ab6c908 | |||
| 8bbf624a8c | |||
| 1f1a9c52a7 | |||
| 6fea1aa312 | |||
| d6eb1c19fd | |||
| cd12717f46 | |||
| aa88579e82 | |||
| 0ca96dc673 | |||
| c999f5af2b | |||
| 816cc9241e | |||
| 515493258b | |||
| f4a25cf20e | |||
| b1b1acb181 | |||
| 949195555d | |||
| 5bf22491d5 | |||
| 6be3116c35 | |||
| 70434c181c | |||
| 14b45c638c | |||
| 4e4f702273 | |||
| 3cca2d34ed | |||
| b810d7d584 | |||
| b4e01723b7 | |||
| 217c8d21ea | |||
| c6d936baa9 | |||
| d3289ed24e | |||
| b7d7938736 | |||
| 28751fea44 | |||
| 93482c3d95 | |||
| 2621912c8b | |||
| b5af9ac3a3 | |||
| 5baaf177f0 | |||
| 088e0ae163 | |||
| d6d9c30561 | |||
| 378a1cf11b | |||
| 8988b9a135 | |||
| a14df3b0e8 | |||
| 72b6c9eefe | |||
| ce5dbf7976 | |||
| c26ba285fb | |||
| 7217063ca3 | |||
| b67e093605 | |||
| afa0e019a0 | |||
| c6a078dd16 | |||
| da7b4f565b | |||
| c37179e908 | |||
| fa133911b8 | |||
| 68f574b10b | |||
| 38fb2eb501 | |||
| cb90a2c6a2 | |||
| 3f99248479 | |||
| bee75bc5e6 | |||
| 75eceaa656 | |||
| 624bae5acd | |||
| 95b6f4ce4d | |||
| bd3ffd9a0a | |||
| d608172252 | |||
| 93c49ecda0 | |||
| d42c37bd0e | |||
| a61753d3c7 | |||
| 7b33568abd | |||
| 8b7c48fe00 | |||
| 910ab76e2e | |||
| 9c2111ba9f | |||
| 18eab7ea4c | |||
| 77e328147d | |||
| 3ae792815c | |||
| 0a09b16e71 | |||
| a2383add23 | |||
| f67acd0866 | |||
| 72c64f7a98 | |||
| f628def5f4 | |||
| 51764f4f53 | |||
| 0fbe7a1f54 | |||
| 7c5b155b15 | |||
| 6858bd95d5 | |||
| bd2c8bd5b2 | |||
| d57faa5166 | |||
| b54d1c3ffb | |||
| 99a2c368e3 | |||
| 4f1092131f | |||
| ebefea922b | |||
| fc3a2eed01 | |||
| 4d90900227 | |||
| 032f99ef79 | |||
| 8b473b95d6 | |||
| f6869b0941 | |||
| 4723ad2e2d | |||
| c7d3aa4059 | |||
| 60134a68f7 | |||
| 2b625d176c | |||
| f67b530117 | |||
| 8822b40d57 | |||
| 34ee7081e9 | |||
| ec1abadae1 | |||
| 1a01ec66e5 | |||
| b2f535be6e | |||
| b21bc68610 | |||
| eba24310bc | |||
| e1d54f287a | |||
| 348f373d9e | |||
| ede2764fc7 | |||
| f0eb51edd9 | |||
| 5589f3a55b | |||
| 51ab47a3f6 | |||
| 89eb41d8c1 | |||
| d261d7ff65 | |||
| 671c659076 | |||
| fe12eed9e9 | |||
| 05bafb3458 | |||
| e733aa1317 | |||
| 23e469673f | |||
| d9ac47c2c1 | |||
| 77aaf97c9c | |||
| 5f77e537f2 | |||
| 0eaf84fbb3 | |||
| 7c077e9e44 | |||
| 619b7c36af | |||
| 742cd5aef2 | |||
| 1687640191 | |||
| f72d5782ed | |||
| 000d802def | |||
| 750275ddd6 | |||
| 3d47b350bb | |||
| f1feaea496 | |||
| 9fbc544a85 | |||
| b29b9bbcd9 | |||
| 2726aa852d | |||
| 41c90c615b | |||
| 6edee924c7 | |||
| dd8ec0d7df | |||
| a3f0a0cd83 | |||
| 156d2ed368 | |||
| 7ae760c78a | |||
| 3e66125e3e | |||
| e967900ce0 | |||
| 58a4dade1a | |||
| d31b8e1960 | |||
| 65abf4fb59 | |||
| e199c6bc4c | |||
| 9a316a2699 | |||
| 27ab27296f | |||
| 16c8ec2856 | |||
| 9fe9906f7d | |||
| 78f7f5ff75 | |||
| 672a43a599 | |||
| f4800b9d9d | |||
| a7236605e4 | |||
| 2d55d2cbf8 | |||
| 1ca65ed7ba | |||
| be28f83d8b | |||
| 35cc69be3c | |||
| 4ea5a630a1 | |||
| b5be581786 | |||
| dcc373fe2a | |||
| ea03bf88bc | |||
| f548dfa335 | |||
| d41c57fafc | |||
| d594dcbf1b | |||
| 4a383afa03 | |||
| 4111014542 | |||
| 844f22f17a | |||
| dceca03fbf | |||
| 6c09ba626d | |||
| 7349789c9a | |||
| 99369fc8cc | |||
| 8336217944 | |||
| dfe5fe96ec | |||
| 49dd2afc03 | |||
| d3de53715d | |||
| ec181d951f | |||
| 7484817c82 | |||
| c10f055585 | |||
| e4c3f572e5 | |||
| 5c0ab3b64c | |||
| 71ce9595e3 | |||
| bc60c3b9b9 | |||
| e2e27e386d | |||
| 5820fed771 | |||
| f0d4efa6f2 | |||
| 046f4cace3 | |||
| 89a4fdc7c9 | |||
| 505cf70f4c | |||
| 683816d3ec | |||
| 828a29d0ee | |||
| bbcb4a7a8c | |||
| 3b4a407d8a | |||
| be6383bd65 | |||
| d28167401b | |||
| 8aabd01f0b | |||
| 5c991b161a | |||
| 2f91d9f144 | |||
| 3231be78fd | |||
| 996fca617b | |||
| d0203ecc8b | |||
| 7ddfd45eec | |||
| d456099f56 | |||
| 77edc04069 | |||
| ab0b23539e | |||
| d6005ffe1f | |||
| 7aa07a0486 | |||
| c503b7a1d5 | |||
| bed754f8b5 | |||
| 76af99f47e | |||
| eb15a69649 | |||
| c6c4be30ce | |||
| 1460a2c788 | |||
| 020174c99b | |||
| 140d09f276 | |||
| f25774338f | |||
| 1a40974ee2 | |||
| 3df68b3c74 | |||
| 2ba055d5e9 | |||
| a88a83f2b0 | |||
| c2cae98437 | |||
| fe168eba18 | |||
| 0dca064fe8 | |||
| 384f631cd6 | |||
| ac708c793d | |||
| bca8131370 | |||
| 53cc460514 | |||
| 3702c0710f | |||
| 7d97217190 | |||
| fb3d7f9fc9 | |||
| bc24d6abad | |||
| 301a09ccf0 | |||
| 59c5fb1575 | |||
| 4c51486726 | |||
| 095c1a28fb | |||
| 30a774baf9 | |||
| 689897fd6c | |||
| 890e71e2eb | |||
| 409f9fb04b | |||
| 4cc6af9805 | |||
| a888de758d | |||
| 019cb8e737 | |||
| a732eaa2d5 | |||
| 0fd272bf37 | |||
| 0d36a906ff | |||
| ffe6768c0a | |||
| 92b9053c3a | |||
| 40f05adca5 | |||
| 38673d4eb4 | |||
| 7f4fd3d68f | |||
| c507f5ed1a | |||
| 2fd4e58d52 | |||
| a9cfaf86b9 | |||
| 584b86048c | |||
| f886dcbb8d | |||
| 550b1e4fd9 | |||
| 1f49b8d6e9 | |||
| 8285462258 | |||
| 0fdf551e0a | |||
| fde96159fd | |||
| d361b1157e | |||
| 748821467f | |||
| 0fac85c05d | |||
| a09c17bd60 | |||
| 2c96fb6a0e | |||
| a166932694 | |||
| 1da84f7f7a | |||
| 5475c6805e | |||
| e200b46379 | |||
| 2a74cc71c8 | |||
| 929fb8cdc3 | |||
| 16855049b8 | |||
| a274636bec | |||
| ba2e6943a0 | |||
| d1482d0271 | |||
| df3f668f11 | |||
| 44caa72ca8 | |||
| e7d3121215 | |||
| 51946d5300 | |||
| 0a832692b2 | |||
| 5262a62b82 | |||
| 8fe9e6f2f3 | |||
| 9192b58ff5 | |||
| 2b6add741d | |||
| da78a50621 | |||
| 57d6bfb72a | |||
| 01177ce7ca | |||
| e3d5b8cd37 | |||
| a984de992b | |||
| 3422c0931c | |||
| b2b9d9133a | |||
| d0eb2d4cf1 | |||
| 4a13de59ff | |||
| 4590503029 | |||
| 5b4101db1a | |||
| 0bfa4e6c3a | |||
| 2e819654fb | |||
| 1e5bf47891 | |||
| e0b4c7cf7e | |||
| 12b62fe679 | |||
| 7c9c82b208 | |||
| 1ed607a1db | |||
| 1d2cb34dd0 | |||
| 4ed322e636 | |||
| 05b230f811 | |||
| df52882ff9 | |||
| dbe3557ca8 | |||
| 89cfa4ca63 | |||
| 77f5c059f0 | |||
| 435915ef2e | |||
| e2ee2c8338 | |||
| 3a202fb50f | |||
| ca511768f3 | |||
| 83f404cb9e | |||
| a92b5d85f6 | |||
| 05db9b6f02 | |||
| be7dc27d20 | |||
| 2d5645813b | |||
| 496c7307dc | |||
| 02a5988800 | |||
| 4595d759a4 | |||
| dc468b0a2f | |||
| 7b5f017c49 | |||
| e078824070 | |||
| c4b03097bf | |||
| 6f9d80c744 | |||
| 8ce5e3f473 | |||
| f3104f30a8 | |||
| 4acf42aba3 | |||
| 68ff1ae76d | |||
| 22b7bf3b8c | |||
| 422938b03d | |||
| 963e6c9da6 | |||
| f1da50de78 | |||
| abf611d725 | |||
| a82ef834b4 | |||
| 48f0c44fba | |||
| 263cbe1bdc | |||
| bbc58d5752 | |||
| b99ef24a2e | |||
| 6d98047dc4 | |||
| c794c8c1f7 | |||
| 21d5951455 | |||
| 17788c162c | |||
| bde8bd5d69 | |||
| 768d3c9484 | |||
| 485da90f42 | |||
| 258ba5e5c2 | |||
| c6fc8163a9 | |||
| dfa38ac51b | |||
| 27bbd59fb5 | |||
| 2586346b73 | |||
| ef8b93c8d1 | |||
| 3ad2731dba | |||
| 0779bfce73 | |||
| bcd691bbf4 | |||
| 97dbbb1eb6 | |||
| 6ab1491301 | |||
| 2043893065 | |||
| d6e5e75f40 | |||
| 3f303cf069 | |||
| efaef64481 | |||
| c0da472500 | |||
| c310c4d833 | |||
| 4f48725e65 | |||
| 37b511006d | |||
| b1f6879334 | |||
| 6a3b885438 | |||
| fa268d3145 | |||
| da5d277a02 | |||
| 331addd004 | |||
| a4224b6524 | |||
| b6356f5fd2 | |||
| 8a53e8aeaf | |||
| 0fd40b7a2d | |||
| a6053adc7c | |||
| 76a7a1fec7 | |||
| 48970d2117 | |||
| 3b24126cdf | |||
| fedc496263 | |||
| dd81f497a9 | |||
| 315558a00c | |||
| 672df01ee4 | |||
| debbb4ad5c | |||
| 691146a3a4 | |||
| 23931f7afc | |||
| bf05496a17 | |||
| fefbf22fa1 | |||
| 19794dfe4e | |||
| 2e60b43a22 | |||
| 5d152e1b0e | |||
| 65704e0e8e | |||
| d5f6e8a2a2 | |||
| e71546fb90 | |||
| bc66d40f88 | |||
| edcc78affd | |||
| 30deb1ab92 | |||
| b696040549 | |||
| ee6b07ee98 | |||
| 09e3933b80 | |||
| 4355262512 | |||
| 35f304dec7 | |||
| 79458797d0 | |||
| cccb38ea7b | |||
| 037c9bdb71 | |||
| 9e67b9c1ff | |||
| a5351df13d | |||
| feb1224774 | |||
| 8b5e003713 | |||
| a126eac997 | |||
| 6d75474d17 | |||
| 87eb493259 | |||
| fc674262af | |||
| f04fa2166f | |||
| 1fac081547 | |||
| 1c84efb0a1 | |||
| 216a2c4010 | |||
| df812236c4 | |||
| 0f867666e7 | |||
| 7c950d0a0e | |||
| ef0814b850 | |||
| 17e50b95f8 | |||
| f23ed45309 | |||
| ba7c97f03e | |||
| 02f39cc02f | |||
| 06a01e4908 | |||
| 5d9ee030b8 | |||
| ad6b12bc4d | |||
| c5c0819374 | |||
| 74fa6796a1 | |||
| b3ea7f1b2c | |||
| 83e18a669a | |||
| c1c008b036 | |||
| ecf69fcf34 | |||
| e9d65a1bc3 | |||
| 0c0f71a181 | |||
| 3508c844f2 | |||
| 11afdf93aa | |||
| b42bc92366 | |||
| b5501cd6e8 | |||
| 8dbbe1e2b3 | |||
| acfda2f044 | |||
| aa96a2d805 | |||
| f0aca7ec79 | |||
| 5f71a0df80 | |||
| 82a078cae1 | |||
| a0fcc3b8dd | |||
| 3d17e38bb0 | |||
| 5618d9e80c | |||
| aebef67454 | |||
| 4fff67edaa | |||
| 72c7e76280 | |||
| ea405b6d11 | |||
| b040bf5f68 | |||
| c3670ec2b0 | |||
| 384355f52c | |||
| a6054e3db3 | |||
| ca8dca40fe | |||
| 99c499df82 | |||
| 6f43c6d4ac | |||
| b797c69cc1 | |||
| 42e61ca469 | |||
| 8110ea2f53 | |||
| 5975e892bb | |||
| e1afb178a7 | |||
| a66c0608d8 | |||
| 755a0c9af4 | |||
| ab99ecff49 | |||
| 9b5e1bed0e | |||
| ccfb0c0f30 | |||
| 7064f1e523 | |||
| fb743edee2 | |||
| 7f1ac47668 | |||
| 7413753d63 | |||
| d40d71ab68 | |||
| c7a514e313 | |||
| cb07adc207 | |||
| 0bba1504eb | |||
| 10b3a01513 | |||
| bdb727e28a | |||
| 56a7730da4 | |||
| 1c54c137f2 | |||
| 5df65a5cc4 | |||
| 7d1a3e4fc9 | |||
| 9045dbf219 | |||
| 06059ac9cc | |||
| 2b79407e37 | |||
| 1d191dae3a | |||
| 94529c0102 | |||
| 8d9659d0fa | |||
| 10370f0da5 | |||
| 81a09aadc3 | |||
| f57f6c3474 | |||
| 195c99cf97 | |||
| a9d155e9e0 | |||
| c3e7867823 | |||
| f840bd89b0 | |||
| a1b15f79f2 | |||
| 79d1549e99 | |||
| 251569b117 | |||
| 75626066b0 | |||
| 8f4975eb22 | |||
| 626df0fd65 | |||
| 8e726d8670 | |||
| aa061a126d | |||
| f1f01d8a62 | |||
| 31917a4aad | |||
| 81897a34b4 | |||
| afb6ee48f7 | |||
| e0c5846462 | |||
| e4b605d738 | |||
| bca0247363 | |||
| 57904ee568 | |||
| 53a6cd4c80 | |||
| 4aa8bbcc4a | |||
| 4d22a41ec4 | |||
| 9ad44c621e | |||
| 82387abf4e | |||
| 4f036119c8 | |||
| 10289a7bf3 | |||
| 90b85bc40a | |||
| eb40faf08e | |||
| 86fa4b8fa2 | |||
| 4a67312897 | |||
| aaff62d46c | |||
| f876d121c3 | |||
| 497a4d9717 | |||
| 4ab363301a | |||
| c79b047a55 | |||
| 8ac4357d33 | |||
| 38795fe94c | |||
| b8d5dc1ebe | |||
| e1aaaacdda | |||
| 658257bc0a | |||
| 8239615cb6 | |||
| 7b788cf81d | |||
| ea50e5678e | |||
| fd94c7815d | |||
| 1552ff51c4 | |||
| 843ed44a12 | |||
| 46b7767dcf | |||
| a49681a76d | |||
| b6ed0ff157 | |||
| 8aa6c779c5 | |||
| d9a54d7ea0 | |||
| 14f0686206 | |||
| 7490acac12 | |||
| dc239087d5 | |||
| 53375c3997 | |||
| 5d78a97823 | |||
| 63898a02e3 | |||
| b707b39dd0 | |||
| 74eccf0e4e | |||
| 1e63d189b0 | |||
| c3c1417466 | |||
| 795c950bc7 | |||
| 5961d3c21c | |||
| cdffb76b37 | |||
| 4bf358de6b | |||
| 9ea7e69f22 | |||
| 92f047756b | |||
| ada9cd495e | |||
| 93162a2e4c | |||
| f8310275df | |||
| 5d20cd1ea2 | |||
| 9d64218d75 | |||
| 20079ba01f | |||
| f8b444e395 | |||
| d3ac48d286 | |||
| 49e6e5e256 | |||
| 12341e3987 | |||
| 0b69fc5ddd | |||
| b82dac2ddd | |||
| 63a9c478d1 | |||
| 85945da148 | |||
| 03bf140f85 | |||
| b102995ab1 | |||
| 15df770071 | |||
| 770c78b3e2 | |||
| 5d67407029 | |||
| ce72bc86f4 | |||
| fb31eeb919 | |||
| 86e09fe175 | |||
| 722aaf5834 | |||
| 808a61060c | |||
| 32b9c57197 | |||
| d9bc6fc646 | |||
| 106602d625 | |||
| a9cc4c3922 | |||
| bd91f7c65c | |||
| 6db7935df2 | |||
| 9aac2ff737 | |||
| d19202765b | |||
| 21999cc62d | |||
| 2e7f0e84af | |||
| ce9895d43d | |||
| 2fd11dcab7 | |||
| cb9c901b35 | |||
| 2094ee35f2 | |||
| 5f167b4557 | |||
| a1f0578c29 | |||
| 0d8e371981 | |||
| fa3296c07e | |||
| cb96fefc08 | |||
| 720d814915 | |||
| aeb97bb2fc | |||
| eb95c9d0b4 | |||
| a37eb9f660 | |||
| b492e921c3 | |||
| 71ac1132f6 | |||
| cc787ccead | |||
| a21257f9c3 | |||
| 92cb473c7a | |||
| 3d7a3226c8 | |||
| 8bc77df88d | |||
| 2aa28a1be5 | |||
| 9b637ef207 | |||
| 59af01983e | |||
| 2c5d80dc45 | |||
| 06508ca830 | |||
| 8248363a83 | |||
| 36d9b70e49 | |||
| 49581504c3 | |||
| e16137c2a0 | |||
| e49f004005 | |||
| f3dfc3fb61 | |||
| ec8d680f8b | |||
| 5335f54462 | |||
| 2de7412550 | |||
| 3aef38f4fc | |||
| 789c01b47d | |||
| 5965cd1d07 | |||
| d68adcc386 | |||
| f67fbde73a | |||
| fbe80fff80 | |||
| f10be786cf | |||
| 59e973001f | |||
| bf28dee4fe | |||
| 6f1fc408f6 | |||
| b8a24abeef | |||
| 7f13ebbcbc | |||
| b59fd2a727 | |||
| 54d3b95f87 | |||
| 2def8d279d | |||
| e57366840c | |||
| 512ae2c06e | |||
| 430e7b1186 | |||
| 92550f3ce4 | |||
| d25e68256a | |||
| 8bcdfd200b | |||
| ddf0774367 | |||
| 6eca2f374d | |||
| 86b15c0017 | |||
| 5eb016a65c | |||
| a8f224c6d3 | |||
| f495e827e7 | |||
| 7b5dbd4bda | |||
| d8b5a3b22f | |||
| 2d89e1c6f7 | |||
| 7756313a94 | |||
| 58bed24f6b | |||
| f1c9081457 | |||
| f3c87b6c82 | |||
| d102fe5e19 | |||
| 150f233088 | |||
| 73f82b29da | |||
| 2122e11f3c | |||
| 8bd1293aa7 | |||
| afc21ca457 | |||
| fb016ed07e | |||
| bde107a92d | |||
| 94f87237fe | |||
| e96a8c8b4c | |||
| 8168a34ac2 | |||
| 80ae48b98e | |||
| 5c81d96ac2 | |||
| d47300ee8c | |||
| 6a5e767745 | |||
| 8d532b6658 | |||
| 8234782ece | |||
| 3beb63f2a2 | |||
| 57655e014d | |||
| 20b4962e90 | |||
| 910902731e | |||
| 29ffed2b1b | |||
| 032c1c3bcb | |||
| 5f1ec8c108 | |||
| fb0f5f0362 | |||
| 048771fbf0 | |||
| ee0469aa3f | |||
| fb8276d741 | |||
| f237ad2f17 | |||
| ed60919899 | |||
| be1324da3a | |||
| 3e9be53acb | |||
| 2f2c7a7c96 | |||
| 8c78d9d9ba | |||
| 18945048bd | |||
| b96dabbff2 | |||
| be8f205aba | |||
| f7752cceef | |||
| ccc3e1b909 | |||
| b5be88a728 | |||
| ceae162772 | |||
| c47a19fd51 | |||
| d96985b712 | |||
| 0c4d4b5d12 | |||
| 9e81410cee | |||
| df7a9a5d6c | |||
| b96dc56e30 | |||
| af146c5bf8 | |||
| fae8a63a92 | |||
| 0eb4f975b9 | |||
| 13cd6f58b1 | |||
| d84e5d4151 | |||
| 4dbe3c52a6 | |||
| 08eaf68a31 | |||
| f9ae895049 | |||
| ce6f13ad1d | |||
| a2de9cc9f5 | |||
| 96cb3cc9a0 | |||
| 2acfaa8a09 | |||
| c6f7685fed | |||
| 0bf4fff05e | |||
| 4fc82cbc3d | |||
| c1d217d8b1 | |||
| b27612e564 | |||
| b47d9e7471 | |||
| 8b12d876a0 | |||
| 950f8354ad | |||
| 87b3ec4e98 | |||
| 4600c657a9 | |||
| 0b4abbe3d6 | |||
| 5672b29d14 | |||
| 4654f24690 | |||
| 78a35941da | |||
| 7ac489a902 | |||
| 17cbde1094 | |||
| 9c458a8802 | |||
| a751597890 | |||
| c787abbcdf | |||
| 02f0c966c5 | |||
| 61a2484b0a | |||
| e9bedb277d | |||
| 97b03db6e1 | |||
| b0e53b14ee | |||
| d09bb36ad7 | |||
| 6c87a8540a | |||
| 7529c3f611 | |||
| ab7e7da011 | |||
| 13d413ed90 | |||
| 25de01dc99 | |||
| dc9d23b797 | |||
| 96f393ab4f | |||
| 1eeeeb1c7c | |||
| 5df6ffa870 | |||
| 5d131ebffe | |||
| 023fe399d7 | |||
| 7b8b7dedc6 | |||
| 4b10bf3cba | |||
| 16933674ca | |||
| e4546acd31 | |||
| ca1fc28af8 | |||
| b74b1ec0a9 | |||
| acb010e295 | |||
| 88ff83ef21 | |||
| f66221dfd1 | |||
| 53d4e4c380 | |||
| 113923f8ad | |||
| 484d561944 | |||
| e59c3e1df6 | |||
| c21fb674a5 | |||
| eb75b0d097 | |||
| a2533669bc | |||
| 8f31af203b | |||
| 20da900dd7 | |||
| fe50dc4ca3 | |||
| 06f0dfac62 | |||
| 1a089f49f4 | |||
| e79036a6dd | |||
| bf5ed0a0a7 | |||
| 4c24e7187d | |||
| 07a0330196 | |||
| ac2f232c3f | |||
| 791562cfd3 | |||
| 828bf74397 | |||
| f3e1d7fb60 | |||
| e4c98cbd49 | |||
| bb03e95eb7 | |||
| 1f08ea3c09 | |||
| 0dae5bf4d0 | |||
| 9d6fab3220 | |||
| 0ff014b899 | |||
| 70777b26a1 | |||
| 1c7412c98f | |||
| 1a1d192057 | |||
| 28b19e0619 | |||
| 5d1983fdb1 | |||
| 8e4907cab4 | |||
| 3fdb023fbe | |||
| 41f081078c | |||
| b0ca77e7ff | |||
| 7b8dba195c | |||
| cca261410f | |||
| 14af58889f | |||
| f9a51177fd |
28
.env
28
.env
@@ -1,27 +1,23 @@
|
||||
[app]
|
||||
# local:本地调试 test:测试环境 prod:生产环境
|
||||
system_type = test
|
||||
debug = ture
|
||||
trace = false
|
||||
|
||||
[database]
|
||||
; hostname = 127.0.0.1
|
||||
; database = super_chat
|
||||
; username = root
|
||||
; password = 1111111
|
||||
; hostport = 3306
|
||||
; prefix = fa_
|
||||
|
||||
|
||||
#测试
|
||||
hostname = 1.13.181.248
|
||||
database = midi
|
||||
username = midi
|
||||
password = 5B2zwShhTi5L7t2w
|
||||
database = yusheng
|
||||
username = yusheng
|
||||
password = GEDYGj3HbZfKYBjp
|
||||
hostport = 3306
|
||||
prefix = fa_
|
||||
|
||||
#hostname = 62.234.12.147
|
||||
#database = midi
|
||||
#username = midi
|
||||
#password = EC6cak6fzXdXnERz
|
||||
#正式
|
||||
#hostname = 1.13.20.30
|
||||
#database = yusheng
|
||||
#username = yusheng
|
||||
#password = GEDYGj3HbZfKYBjp
|
||||
#hostport = 3306
|
||||
#prefix = fa_
|
||||
|
||||
@@ -35,7 +31,7 @@ mqtt_password = public
|
||||
[smsbao]
|
||||
dxb_name = xqgy1818
|
||||
dxb_pwd = "xqgy1818!"
|
||||
dxb_temp = "【西安熙晟文化传媒】您的验证码是{code}。如非本人操作,请忽略本短信"
|
||||
dxb_temp = "【羽声语音】您的验证码是{code}。如非本人操作,请忽略本短信"
|
||||
|
||||
[wechatpay]
|
||||
mch_id = 1719907761
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,3 +3,5 @@
|
||||
.idea
|
||||
*.log
|
||||
.env
|
||||
.node_modules
|
||||
node_modules/
|
||||
|
||||
@@ -60,7 +60,7 @@ class Auth extends \fast\Auth
|
||||
}
|
||||
$admin->loginfailure = 0;
|
||||
$admin->logintime = time();
|
||||
$admin->loginip = request()->ip();
|
||||
$admin->loginip = request()->server('HTTP_X_REAL_IP') ?: request()->server('HTTP_X_FORWARDED_FOR') ?: request()->ip();
|
||||
$admin->token = Random::uuid();
|
||||
$admin->save();
|
||||
Session::set("admin", $admin->toArray());
|
||||
@@ -229,6 +229,7 @@ class Auth extends \fast\Auth
|
||||
if ($this->logined) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$admin = Session::get('admin');
|
||||
if (!$admin) {
|
||||
$admin = Cache::get("admin_" . $token);
|
||||
@@ -239,6 +240,7 @@ class Auth extends \fast\Auth
|
||||
// Session::set("admin.safecode", $this->getEncryptSafecode($admin));
|
||||
}
|
||||
}
|
||||
|
||||
if (!$admin) {
|
||||
return false;
|
||||
}
|
||||
@@ -246,6 +248,7 @@ class Auth extends \fast\Auth
|
||||
if (!$my) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//校验安全码,可用于判断关键信息发生了变更需要重新登录
|
||||
// if (!isset($admin['safecode']) || $this->getEncryptSafecode($my) !== $admin['safecode']) {
|
||||
// $this->logout();
|
||||
@@ -259,12 +262,13 @@ class Auth extends \fast\Auth
|
||||
}
|
||||
}
|
||||
//判断管理员IP是否变动
|
||||
if (Config::get('fastadmin.loginip_check')) {
|
||||
if (!isset($admin['loginip']) || $admin['loginip'] != request()->ip()) {
|
||||
$this->logout();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// if (Config::get('fastadmin.loginip_check')) {
|
||||
// if (!isset($admin['loginip']) || $admin['loginip'] != request()->ip()) {
|
||||
// $this->logout();
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
$this->logined = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ class AdminLog extends Model
|
||||
}
|
||||
$title = implode(' / ', $title);
|
||||
}
|
||||
$login_ip = request()->server('HTTP_X_REAL_IP') ?: request()->server('HTTP_X_FORWARDED_FOR') ?: request()->ip();
|
||||
self::create([
|
||||
'title' => $title,
|
||||
'content' => !is_scalar($content) ? json_encode($content, JSON_UNESCAPED_UNICODE) : $content,
|
||||
@@ -84,7 +85,7 @@ class AdminLog extends Model
|
||||
'admin_id' => $admin_id,
|
||||
'username' => $username,
|
||||
'useragent' => substr(request()->server('HTTP_USER_AGENT'), 0, 255),
|
||||
'ip' => xss_clean(strip_tags(request()->ip()))
|
||||
'ip' => $login_ip//xss_clean(strip_tags(request()->ip()))
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -598,7 +598,14 @@ class Activities extends adminApi
|
||||
$lists[$key]['box_name'] = $bag_data['name'];
|
||||
$lists[$key]['gift_type'] = $value['type'];
|
||||
$lists[$key]['gift_type_str'] = $this->gift_type[$value['type']];
|
||||
if ($value['type'] == 2) {
|
||||
if ($value['type'] == 1) {
|
||||
$lists[$key]['gift_id'] = "--";
|
||||
$lists[$key]['gift_name'] = "--";
|
||||
$lists[$key]['base_image'] = localpath_to_netpath("static/image/icon/gold.png");
|
||||
$lists[$key]['quantity'] = $value['quantity'];
|
||||
$lists[$key]['quantity_str'] = $value['quantity']."个";
|
||||
$lists[$key]['gift_price'] = $value['gold']*$value['quantity'];
|
||||
} elseif ($value['type'] == 2) {
|
||||
$lists[$key]['gift_id'] = $value['foreign_id'];
|
||||
$lists[$key]['gift_name'] = $value['name'];
|
||||
$gift_data = db::name('vs_gift')->where(['gid' => $value['foreign_id']])->find();
|
||||
@@ -618,10 +625,10 @@ class Activities extends adminApi
|
||||
}else{
|
||||
$lists[$key]['gift_id'] = "--";
|
||||
$lists[$key]['gift_name'] = "--";
|
||||
$lists[$key]['base_image'] = "--";
|
||||
$lists[$key]['quantity'] = 0;
|
||||
$lists[$key]['quantity_str'] = "0";
|
||||
$lists[$key]['gift_price'] = $value['gold'];
|
||||
$lists[$key]['base_image'] = localpath_to_netpath("static/image/icon/diamond.png");
|
||||
$lists[$key]['quantity'] = $value['quantity'];
|
||||
$lists[$key]['quantity_str'] = $value['quantity']."个";
|
||||
$lists[$key]['gift_price'] = $value['gold']*$value['quantity'];
|
||||
}
|
||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||
|
||||
@@ -700,15 +707,26 @@ class Activities extends adminApi
|
||||
* 装扮列表
|
||||
*/
|
||||
public function decorate_list(){
|
||||
$type = input('type', '');
|
||||
$where = [];
|
||||
if($type){
|
||||
$where['b.type'] = $type;
|
||||
}
|
||||
$decorate_list = db::name('vs_decorate_price')->alias('a')
|
||||
->field('a.id,a.did,b.type,a.day,a.price,b.title,b.base_image')
|
||||
->where('b.delete_time',0)
|
||||
->where($where)
|
||||
->join('vs_decorate b','a.did = b.did')
|
||||
->select();
|
||||
$return_data = [];
|
||||
foreach ($decorate_list as $key => $value) {
|
||||
$return_data[$key]['id'] = $value['id'];
|
||||
$return_data[$key]['name'] = model('api/Decorate')->TypeArray[$value['type']].'-'.$value['day'].'天-'.$value['title'];
|
||||
if($value['day'] == 0){
|
||||
$day = "永久";
|
||||
}else{
|
||||
$day = $value['day'].'天';
|
||||
}
|
||||
$return_data[$key]['name'] = model('api/Decorate')->TypeArray[$value['type']].'-'.$day.'-'.$value['title'];
|
||||
$return_data[$key]['day'] = $value['day'];
|
||||
}
|
||||
return V(1,"成功", $return_data);
|
||||
|
||||
@@ -62,17 +62,14 @@ class BlindBox extends adminApi
|
||||
$lists[$key]['gift_id'] = $value['foreign_id'];
|
||||
$lists[$key]['gift_name'] = $value['name'];
|
||||
$gift_data = db::name('vs_gift')->where(['gid'=>$value['foreign_id']])->find();
|
||||
if(empty($gift_data)){
|
||||
continue;
|
||||
}
|
||||
$lists[$key]['base_image'] = $gift_data['base_image'];
|
||||
$lists[$key]['gift_price'] = $gift_data['gift_price'];
|
||||
$lists[$key]['quantity'] = $value['quantity'];
|
||||
$lists[$key]['remaining_number'] = $value['remaining_number'];
|
||||
$lists[$key]['is_public_screen'] = $gift_data['is_public_screen'];
|
||||
$lists[$key]['is_public_server'] = $gift_data['is_public_server'];
|
||||
$lists[$key]['is_world_show'] = $value['is_world_show'];
|
||||
$lists[$key]['weight'] = $value['weight'];
|
||||
$lists[$key]['base_image'] = $gift_data['base_image'] ?? "";
|
||||
$lists[$key]['gift_price'] = $gift_data['gift_price'] ?? 0;
|
||||
$lists[$key]['quantity'] = $value['quantity'] ?? 0;
|
||||
$lists[$key]['remaining_number'] = $value['remaining_number'] ?? 0;
|
||||
$lists[$key]['is_public_screen'] = $gift_data['is_public_screen'] ?? 0;
|
||||
$lists[$key]['is_public_server'] = $gift_data['is_public_server'] ?? 0;
|
||||
$lists[$key]['is_world_show'] = $value['is_world_show'] ?? 0;
|
||||
$lists[$key]['weight'] = $value['weight'] ?? 0;
|
||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||
|
||||
}
|
||||
@@ -354,6 +351,14 @@ class BlindBox extends adminApi
|
||||
foreach ($gift_bag_detail as $k=>$v){
|
||||
$bag_data = db::name($this->table)->where(['id'=>$v['id']])->update(['remaining_number'=>$v['quantity']]);
|
||||
}
|
||||
// 清除缓存
|
||||
Cache::rm("pan_gift_bag".$gift_bag_id);
|
||||
Cache::rm("pan_gift_bag_detail".$gift_bag_id);
|
||||
Cache::rm("pan_total_quantity".$gift_bag_id);
|
||||
Cache::rm("pan_total_remaining".$gift_bag_id);
|
||||
Cache::rm("pan_total_draw".$gift_bag_id);
|
||||
Cache::rm("pan_gift_info_map".$gift_bag_id);
|
||||
|
||||
return V(1,"成功");
|
||||
}
|
||||
|
||||
@@ -367,6 +372,8 @@ class BlindBox extends adminApi
|
||||
}
|
||||
$gift_id = input('gift_id', '');
|
||||
$description = input('description', '');
|
||||
$status = input('status', 1);
|
||||
|
||||
$introd =$_POST['introd']??"";
|
||||
if(empty($gift_id)){
|
||||
return V(0,"请配置礼物");
|
||||
@@ -381,7 +388,10 @@ class BlindBox extends adminApi
|
||||
'introd' => $introd,
|
||||
];
|
||||
$ext = json_encode($ext);
|
||||
$res = db::name('vs_gift_bag')->where(['id'=>$gift_bag_id])->update(['ext'=>$ext]);
|
||||
$res = db::name('vs_gift_bag')->where(['id'=>$gift_bag_id])->update([
|
||||
'ext'=>$ext,
|
||||
'status' => $status,
|
||||
]);
|
||||
if($res){
|
||||
return V(1,"成功");
|
||||
}else{
|
||||
@@ -401,6 +411,7 @@ class BlindBox extends adminApi
|
||||
'gift_id' => $ext_data['gift_id'],
|
||||
'description' => $ext_data['description'],
|
||||
'introd' => stripcslashes($ext_data['introd']),
|
||||
'status' => $gift_bag['status'],
|
||||
];
|
||||
if($gift_bag){
|
||||
return V(1,"成功",$ext);
|
||||
@@ -445,10 +456,10 @@ class BlindBox extends adminApi
|
||||
$where['createtime'] = ['>=', strtotime($stime)];
|
||||
}
|
||||
if($etime!==""){
|
||||
$where['createtime'] = ['<=', strtotime($etime.'23:59:59')];
|
||||
$where['createtime'] = ['<=', strtotime($etime)];
|
||||
}
|
||||
if($stime!=="" && $etime!==""){
|
||||
$where['createtime'] = ['between', [strtotime($stime), strtotime($etime.'23:59:59')]];
|
||||
$where['createtime'] = ['between', [strtotime($stime), strtotime($etime)]];
|
||||
}
|
||||
$count = db::name('vs_gift_bag_receive_log')->where($where)->count();
|
||||
$lists_data = db::name('vs_gift_bag_receive_log')->where($where)->page($page, $page_limit)->order("id desc")->select();
|
||||
@@ -727,11 +738,11 @@ class BlindBox extends adminApi
|
||||
$room_id = input('room_id', '');
|
||||
$gift_bag_id = input('gift_bag_id', '');
|
||||
$periods = input('periods', '');
|
||||
$stime = input('stime', '');
|
||||
$etime = input('etime', '');
|
||||
$stime = input('stime', date('Y-m-d'));
|
||||
$etime = input('etime', date('Y-m-d h:i:s', time()));
|
||||
$where = [];
|
||||
if($room_id){
|
||||
$where['room_id'] = $room_id;
|
||||
$where['room_number'] = $room_id;
|
||||
}
|
||||
if($gift_id){
|
||||
$where['gift_id'] = $gift_id;
|
||||
@@ -752,10 +763,10 @@ class BlindBox extends adminApi
|
||||
$where['createtime'] = ['>=', strtotime($stime)];
|
||||
}
|
||||
if($etime!==""){
|
||||
$where['createtime'] = ['<=', strtotime($etime.'23:59:59')];
|
||||
$where['createtime'] = ['<=', strtotime($etime)];
|
||||
}
|
||||
if($stime!=="" && $etime!==""){
|
||||
$where['createtime'] = ['between', [strtotime($stime), strtotime($etime.'23:59:59')]];
|
||||
$where['createtime'] = ['between', [strtotime($stime), strtotime($etime)]];
|
||||
}
|
||||
$count = db::name('vs_gift_bag_receive_pan_log')->where($where)->count();
|
||||
$lists_data = db::name('vs_gift_bag_receive_pan_log')->where($where)->page($page, $page_limit)->order("id desc")->select();
|
||||
@@ -855,7 +866,7 @@ class BlindBox extends adminApi
|
||||
}
|
||||
if($user_id){
|
||||
$user_id = db::name('user')->where('user_code', $user_id)->value('id');
|
||||
$where['b.user_id'] = $user_id;
|
||||
$where['a.user_id'] = $user_id;
|
||||
}
|
||||
if($periods){
|
||||
$where['b.periods'] = $periods;
|
||||
@@ -866,7 +877,7 @@ class BlindBox extends adminApi
|
||||
->where($where)->count();
|
||||
$lists_data = db::name('vs_room_pan_xlh_log')->alias('a')
|
||||
->join('vs_room_pan_xlh b', 'a.xlh_id = b.id')
|
||||
->field('a.id,b.periods as periods,a.user_id,a.createtime,b.user_id,b.room_id,b.gift_id,b.num,a.is_send,b.pay_price,b.locking_gift_id')
|
||||
->field('a.id,b.periods as periods,a.user_id,a.createtime,b.room_id,b.gift_id,b.num,a.is_send,b.pay_price,b.locking_gift_id')
|
||||
->where($where)
|
||||
->page($page, $page_limit)
|
||||
->order("id desc")
|
||||
@@ -897,7 +908,9 @@ class BlindBox extends adminApi
|
||||
$today = strtotime(date('Y-m-d'));
|
||||
$locking_num = db::name('vs_room_pan_xlh_log')->alias('a')
|
||||
->join('vs_room_pan_xlh b', 'a.xlh_id = b.id')
|
||||
->where('a.createtime','>=',$today)->where(['a.is_send'=>1,'b.room_id'=>$room_id])->sum('a.num');
|
||||
->where('a.createtime','>=',$today)->where(['a.is_send'=>1])
|
||||
->where($where)
|
||||
->sum('a.num');
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
|
||||
@@ -39,7 +39,7 @@ class Decorate extends adminApi
|
||||
$type = input('type', '');
|
||||
$where = ['delete_time'=>0];
|
||||
if($name){
|
||||
$where['name'] = ['like', '%'.$name.'%'];
|
||||
$where['title'] = ['like', '%'.$name.'%'];
|
||||
}
|
||||
if($type){
|
||||
$where['type'] = $type;
|
||||
@@ -51,7 +51,7 @@ class Decorate extends adminApi
|
||||
$return_list[$k]['id'] = $v['did'];
|
||||
$return_list[$k]['name'] = $v['title'];
|
||||
$return_list[$k]['type'] = $v['type'];
|
||||
$return_list[$k]['type_str'] = model('api/Decorate')->TypeArray[$v['type']];
|
||||
$return_list[$k]['type_str'] = model('api/Decorate')->TypeArray[$v['type']] ?? "--";
|
||||
$return_list[$k]['base_image'] = $v['base_image'];
|
||||
$return_list[$k]['file_type'] = $v['file_type'];
|
||||
$return_list[$k]['file_type_str'] = $v['file_type']==1 ? "SVGA" : "MP4";
|
||||
@@ -60,6 +60,9 @@ class Decorate extends adminApi
|
||||
$return_list[$k]['is_buy'] = $v['is_buy'];
|
||||
$return_list[$k]['createtime'] = date('Y-m-d H:i:s', $v['createtime']);
|
||||
$return_list[$k]['admin_name'] = db::name('admin')->where(['id'=>$v['admin_id']])->value('nickname')??"--";
|
||||
$return_list[$k]['ext_value'] = $v['ext_value'] ?? 0;
|
||||
$return_list[$k]['price'] = $v['price'] ?? 0;
|
||||
$return_list[$k]['special_num'] = $v['special_num'] ?? '';
|
||||
|
||||
}
|
||||
$return_data = [
|
||||
@@ -86,12 +89,19 @@ class Decorate extends adminApi
|
||||
$play_image = input('play_image', '');
|
||||
//靓号
|
||||
$special_num = input('special_num', '');
|
||||
$ext_value = input('ext_value', '');
|
||||
$price = input('price', 0);
|
||||
if($title==""){
|
||||
return V(0,"参数错");
|
||||
}
|
||||
if($type==""){
|
||||
return V(0,"参数错");
|
||||
}
|
||||
if(in_array($type, [6,7,8])){
|
||||
if($special_num==""){
|
||||
return V(0,"请填写靓号");
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
'title' => $title,
|
||||
@@ -104,7 +114,9 @@ class Decorate extends adminApi
|
||||
'special_num' => $special_num,
|
||||
'createtime' => time(),
|
||||
'updatetime' => time(),
|
||||
'admin_id' => $admin_id
|
||||
'admin_id' => $admin_id,
|
||||
'ext_value' => $ext_value,
|
||||
'price' => $price,
|
||||
];
|
||||
$id = db::name($this->table)->insertGetId($data);
|
||||
if(!$id){
|
||||
@@ -143,6 +155,13 @@ class Decorate extends adminApi
|
||||
$file_type = input('file_type', 2);
|
||||
$play_image = input('play_image', '');
|
||||
$special_num = input('special_num', '');
|
||||
$ext_value = input('ext_value', '');
|
||||
$price = input('price', '');
|
||||
if(in_array($type, [6,7,8])){
|
||||
if($special_num==""){
|
||||
return V(0,"请填写靓号");
|
||||
}
|
||||
}
|
||||
$data = [];
|
||||
if($title!=""){
|
||||
$data['title'] = $title;
|
||||
@@ -168,6 +187,12 @@ class Decorate extends adminApi
|
||||
if($special_num!=""){
|
||||
$data['special_num'] = $special_num;
|
||||
}
|
||||
if($ext_value!=""){
|
||||
$data['ext_value'] = $ext_value;
|
||||
}
|
||||
if($price!=""){
|
||||
$data['price'] = $price;
|
||||
}
|
||||
$data['updatetime'] = time();
|
||||
$res = db::name($this->table)->where(['did'=>$did])->update($data);
|
||||
if(!$res){
|
||||
@@ -256,12 +281,20 @@ class Decorate extends adminApi
|
||||
if($price==""){
|
||||
return V(0,"参数错");
|
||||
}
|
||||
$decorate_data = db::name($this->table)->where(['did'=>$did,'day'=>$day])->find();
|
||||
$decorate_data = db::name('vs_decorate_price')->where(['did'=>$did,'day'=>$day])->find();
|
||||
if($decorate_data){
|
||||
return V(0,"该价格已存在");
|
||||
}
|
||||
//计算折扣取整
|
||||
if($price==0 || $original_price==0){
|
||||
$discount = 0;
|
||||
}else{
|
||||
$discount = round($price/$original_price, 2)*10;
|
||||
if($discount >= 10){
|
||||
$discount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
'did' => $did,
|
||||
'day' => $day,
|
||||
@@ -343,8 +376,8 @@ class Decorate extends adminApi
|
||||
$return_list[$k]['id'] = $v['udid'];
|
||||
$user_data = db::name('user')->where(['id'=>$v['user_id']])->find();
|
||||
$return_list[$k]['user_name'] = $user_data['user_code']."-".db::name('user')->where(['id'=>$v['user_id']])->value('nickname');
|
||||
$return_list[$k]['type'] = model('api/Decorate')->TypeArray[$v['type']];
|
||||
if($v['type'] >= 6){
|
||||
$return_list[$k]['type'] = model('api/Decorate')->TypeArray[$v['type']] ?? "";
|
||||
if(in_array($v['type'], [6,7,8])){
|
||||
$return_list[$k]['name'] = $v['special_num'];
|
||||
|
||||
}else{
|
||||
@@ -375,7 +408,7 @@ class Decorate extends adminApi
|
||||
public function give_decorate(){
|
||||
$user_id = input('user_id', '');
|
||||
$decorate_id = input('decorate_id', '');
|
||||
$day = input('day', '');
|
||||
$day = input('day', 0);
|
||||
$user = db::name('user')->where(['user_code'=>$user_id])->find();
|
||||
if(!$user){
|
||||
return V(0,"用户不存在");
|
||||
@@ -385,10 +418,12 @@ class Decorate extends adminApi
|
||||
if(!$decorate){
|
||||
return V(0,"装扮不存在");
|
||||
}
|
||||
if($decorate['type']!=12){
|
||||
$decorate_price = db::name('vs_decorate_price')->where(['did'=>$decorate_id,'day'=>$day,'is_delete'=>1])->find();
|
||||
if(!$decorate_price){
|
||||
return V(0,"该装扮天数不存在");
|
||||
}
|
||||
}
|
||||
$result = model('api/Decorate')->pay_decorate($user_id,$decorate_id,$day,2);
|
||||
if($result['code'] == 1){
|
||||
return V(1,"成功");
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace app\adminapi\controller;
|
||||
|
||||
use app\admin\model\AdminLog;
|
||||
use app\common\controller\adminApi;
|
||||
use think\Cache;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\Hook;
|
||||
@@ -99,6 +100,7 @@ class Gift extends adminApi
|
||||
$lists[$key]['is_can_buy'] = $value['is_can_buy'];
|
||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||
$lists[$key]['updatetime'] = date('Y-m-d H:i:s', $value['updatetime']);
|
||||
$lists[$key]['icon'] = $value['icon']??"";
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
@@ -126,6 +128,7 @@ class Gift extends adminApi
|
||||
$is_can_buy = input('is_can_buy', 1);
|
||||
$is_show = input('is_show', 1);
|
||||
$sort = input('sort', 0);
|
||||
$icon = input('icon', '');
|
||||
if($gift_name==""){
|
||||
return V(0,"礼物名称不能为空");
|
||||
}
|
||||
@@ -156,12 +159,19 @@ class Gift extends adminApi
|
||||
'is_show' => $is_show,
|
||||
'sort' => $sort,
|
||||
'createtime' => time(),
|
||||
'updatetime' => time()
|
||||
'updatetime' => time(),
|
||||
'icon' => $icon,
|
||||
];
|
||||
$id = db::name($this->table)->insertGetId($data);
|
||||
if(!$id){
|
||||
return V(0,"添加失败");
|
||||
}
|
||||
//删除缓存
|
||||
$cache_key = 'gift_list_'.$label.'_1';
|
||||
Cache::rm($cache_key);
|
||||
$cache_key = 'gift_list_'.$label;
|
||||
Cache::rm($cache_key);
|
||||
|
||||
return V(1,"成功",['id'=>$id]);
|
||||
}
|
||||
/*
|
||||
@@ -196,6 +206,7 @@ class Gift extends adminApi
|
||||
$is_can_buy = input('is_can_buy', '');
|
||||
$is_show = input('is_show', '');
|
||||
$sort = input('sort', '');
|
||||
$icon = input('icon', '');
|
||||
if($gid == ''){
|
||||
return V(0,"ID不能为空");
|
||||
}
|
||||
@@ -245,10 +256,18 @@ class Gift extends adminApi
|
||||
if($is_show){
|
||||
$data['is_show'] = $is_show;
|
||||
}
|
||||
if($icon){
|
||||
$data['icon'] = $icon;
|
||||
}
|
||||
$result = db::name($this->table)->where(['gid'=>$gid])->update($data);
|
||||
if(!$result){
|
||||
return V(0,"修改失败,礼物内容无更改");
|
||||
}
|
||||
//删除缓存
|
||||
$cache_key = 'gift_list_'.$gift_data['label'].'_1';
|
||||
Cache::rm($cache_key);
|
||||
$cache_key = 'gift_list_'.$gift_data['label'];
|
||||
Cache::rm($cache_key);
|
||||
return V(1,"成功", ['id'=>$gid]);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
namespace app\adminapi\controller;
|
||||
ini_set('memory_limit', '512M'); // 临时增加到512MB
|
||||
use app\common\controller\adminApi;
|
||||
use app\common\library\GiftTableManager;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
|
||||
class GiveGift extends adminApi
|
||||
{
|
||||
@@ -27,67 +29,95 @@ class GiveGift extends adminApi
|
||||
$from_id = input('from_id', '');//礼物来源id
|
||||
$gift_id = input('gift_id', '');//礼物id
|
||||
$from = input('from', '');// 来源类型,1聊天送礼物 2房间语聊送礼 3直播送礼 4动态打赏 5系统任务 6-cp房间送礼
|
||||
$start_time = input('start_time', '');
|
||||
$end_time = input('end_time', '');
|
||||
|
||||
//获取当前月份的开始时间和结束时间
|
||||
$firstDay = date('Y-m-01');
|
||||
$lastDay = date('Y-m-t 23:59:59');
|
||||
$start_time = input('start_time', $firstDay);
|
||||
$end_time = input('end_time', $lastDay);
|
||||
$start_time = empty($start_time) ? $firstDay : $start_time;
|
||||
$end_time = empty($end_time) ? $lastDay : $end_time;
|
||||
$search_time = [];
|
||||
$search_time = [strtotime($start_time), strtotime($end_time)];
|
||||
$where = [];
|
||||
$gwhere = [];
|
||||
if($send_user != ''){
|
||||
$user_id = db::name('user')->where('user_code', $send_user)->value('id');
|
||||
$where['user_id'] = $user_id;
|
||||
$gwhere['gg.user_id'] = $user_id;
|
||||
}
|
||||
if($gift_user != ''){
|
||||
$gift_user_id = db::name('user')->where('user_code', $gift_user)->value('id');
|
||||
$where['gift_user'] = $gift_user_id;
|
||||
$gwhere['gg.gift_user'] = $gift_user_id;
|
||||
}
|
||||
if($from_id != ''){
|
||||
$room_id = db::name('vs_room')->where('room_number', $from_id)->value('id');
|
||||
if($room_id){
|
||||
$where['from_id'] = $room_id;
|
||||
$gwhere['gg.from_id'] = $room_id;
|
||||
}else{
|
||||
$where['from_id'] = $from_id;
|
||||
$gwhere['gg.from_id'] = $from_id;
|
||||
}
|
||||
}
|
||||
if($gift_id != ''){
|
||||
$where['gift_id'] = $gift_id;
|
||||
$gwhere['gg.gift_id'] = $gift_id;
|
||||
}
|
||||
if($from != ''){
|
||||
$where['from'] = $from;
|
||||
$gwhere['gg.from'] = $from;
|
||||
}
|
||||
// 时间筛选优化
|
||||
if (!empty($start_time) || !empty($end_time)) {
|
||||
if (!empty($start_time) && !empty($end_time)) {
|
||||
$where['createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||
$gwhere['gg.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||
} elseif (!empty($start_time)) {
|
||||
$where['createtime'] = ['>=', strtotime($start_time)];
|
||||
$gwhere['gg.createtime'] = ['>=', strtotime($start_time)];
|
||||
} elseif (!empty($end_time)) {
|
||||
$where['createtime'] = ['<=', strtotime($end_time)];
|
||||
$gwhere['gg.createtime'] = ['<=', strtotime($end_time)];
|
||||
}
|
||||
}
|
||||
$page_array = [];
|
||||
$page_array = [
|
||||
'page' => !empty($page)?$page:1,
|
||||
'page_limit' => !empty($page_limit)?$page_limit:10,
|
||||
];
|
||||
$gift_list = model('Gift')->getGiftRecords($search_time,$where,$page_array);
|
||||
//礼物总数
|
||||
$gift_num = db::name('vs_give_gift')->where($where)->sum('number');
|
||||
$gift_num = $gift_list['number'];
|
||||
//总金额
|
||||
$total_price = db::name('vs_give_gift')->where($where)->sum('total_price');
|
||||
$total_price = $gift_list['total_price'];
|
||||
//平台收益
|
||||
$app_earning = 0;
|
||||
//接收人收益
|
||||
$receive_earning = 0;
|
||||
//房主收益
|
||||
$room_owner_earning = 0;
|
||||
|
||||
// 获取所有送礼记录
|
||||
$lists = db::name('vs_give_gift')->where($where)->order('id', 'desc')->page($page, $page_limit)->select();
|
||||
$count = db::name('vs_give_gift')->where($where)->count();
|
||||
$lists = $gift_list['lists'];
|
||||
$count = $gift_list['count'];
|
||||
// $lists = db::name('vs_give_gift')->where($where)->order('id', 'desc')->page($page, $page_limit)->select();
|
||||
// $count = db::name('vs_give_gift')->where($where)->count();
|
||||
$earning_list = [];
|
||||
if(!empty($where)){
|
||||
$gift_ids = db::name('vs_give_gift')->where($where)->column('id');
|
||||
if (!empty($gift_ids)) {
|
||||
// 批量获取所有收益记录
|
||||
$earning_list = db::name('vs_give_gift_ratio_log')
|
||||
->field('app_earning,gift_user_earning,room_owner_earning')
|
||||
->where('give_gift_id', 'in', $gift_ids)
|
||||
->order('id', 'desc')
|
||||
->select();
|
||||
$tables = GiftTableManager::getTablesByTimeRange(
|
||||
strtotime($start_time),
|
||||
strtotime($end_time)
|
||||
);
|
||||
if(empty($tables)){
|
||||
$tables[0] = "fa_vs_give_gift";
|
||||
}
|
||||
$table_name = substr($tables[0], 3);//截取可查询的表名
|
||||
$earning_list = db::name('vs_give_gift_ratio_log')
|
||||
->alias('egl')
|
||||
->join($table_name.' gg', 'egl.give_gift_id = gg.id')
|
||||
->where($gwhere) // 替换为实际的筛选条件
|
||||
->field('egl.app_earning,egl.gift_user_earning,egl.room_owner_earning')
|
||||
->select();
|
||||
}else{
|
||||
// 批量获取所有收益记录
|
||||
$earning_list = db::name('vs_give_gift_ratio_log')
|
||||
@@ -107,10 +137,11 @@ class GiveGift extends adminApi
|
||||
array_column($lists, 'user_id'),
|
||||
array_column($lists, 'gift_user')
|
||||
);
|
||||
$room_ids = array_filter(array_merge(
|
||||
array_column($lists, 'room_id'),
|
||||
array_column($lists, 'from_id')
|
||||
));
|
||||
// $room_ids = array_filter(array_merge(
|
||||
// array_column($lists, 'room_id'),
|
||||
// array_column($lists, 'from_id')
|
||||
// ));
|
||||
$room_ids = array_column($lists, 'from_id');
|
||||
$gift_ids_list = array_column($lists, 'gift_id');
|
||||
|
||||
// 批量获取用户信息
|
||||
@@ -142,7 +173,7 @@ class GiveGift extends adminApi
|
||||
if (!empty($gift_ids_list)) {
|
||||
$gift_list = db::name('vs_gift')
|
||||
->where('gid', 'in', array_unique($gift_ids_list))
|
||||
->field('gid,gift_name,gift_price')
|
||||
->field('gid,gift_name,gift_price,type,label')
|
||||
->select();
|
||||
foreach ($gift_list as $gift) {
|
||||
$gifts[$gift['gid']] = $gift;
|
||||
@@ -175,8 +206,11 @@ class GiveGift extends adminApi
|
||||
// 礼物信息
|
||||
$gift_info = isset($gifts[$value['gift_id']]) ? $gifts[$value['gift_id']] : null;
|
||||
$value['gift_name'] = $gift_info ? $gift_info['gift_name'].'-'.$value['gift_id'] : '';
|
||||
if($gift_info && $gift_info['label']==2){
|
||||
$value['gift_price'] ="未知(盲盒)";
|
||||
}else{
|
||||
$value['gift_price'] = $gift_info ? $gift_info['gift_price'] : 0;
|
||||
|
||||
}
|
||||
// 房间信息处理
|
||||
if($value['from'] == 1){
|
||||
$value['room'] = '聊天送礼';
|
||||
@@ -199,6 +233,8 @@ class GiveGift extends adminApi
|
||||
$value['gift_user_earning'] = $earning_info ? $earning_info['gift_user_earning'] : 0;
|
||||
$value['room_owner_earning'] = $earning_info ? $earning_info['room_owner_earning'] : 0;
|
||||
}
|
||||
//比例
|
||||
$config = get_system_config();
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
@@ -209,7 +245,10 @@ class GiveGift extends adminApi
|
||||
'total_price' => $total_price,
|
||||
'app_earning' => round($app_earning,2) ,
|
||||
'receive_earning' => round($receive_earning,2),
|
||||
'room_owner_earning' => round($room_owner_earning,2)
|
||||
'room_owner_earning' => round($room_owner_earning,2),
|
||||
'app_earning_ratio' => 100 - $config['room_gift_ratio'] - $config['room_author_ratio'],
|
||||
'receive_earning_ratio' => $config['room_gift_ratio'] ?? 0,
|
||||
'room_owner_earning_ratio' => $config['room_author_ratio'] ?? 0,
|
||||
]
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
@@ -219,4 +258,5 @@ class GiveGift extends adminApi
|
||||
$start = ($page - 1) * $limit;
|
||||
return array_slice($array, $start, $limit);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -62,7 +62,7 @@ class Guild extends adminApi
|
||||
// $where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime.' 23:59:59')]];
|
||||
// }
|
||||
$count = db::name('vs_guild')->where($where)->count();
|
||||
$data = db::name('vs_guild')->where($where)->page($page,$page_limit)->select();
|
||||
$data = db::name('vs_guild')->where($where)->order('income desc')->page($page,$page_limit)->select();
|
||||
$list = [];
|
||||
foreach ($data as $k=>$v) {
|
||||
$list[$k]['id'] = $v['id'];
|
||||
@@ -82,14 +82,19 @@ class Guild extends adminApi
|
||||
}
|
||||
$list[$k]['guild_logo'] = $v['cover'];
|
||||
//当日流水
|
||||
$list[$k]['today_money'] = model('Guild')->getTodayMoney($v['id'],$search_stime,$search_etime);
|
||||
$list[$k]['today_money'] = $v['income'];//model('Guild')->getTodayMoney($v['id'],$search_stime,$search_etime);
|
||||
$list[$k]['is_show'] = $v['is_show'];
|
||||
$list[$k]['is_show_str'] = $v['is_show'] == 1 ? '显示' : '隐藏';
|
||||
$list[$k]['status'] = $v['status'];
|
||||
$list[$k]['status_str'] = $v['status'] == 1 ? '正常' : '解散';
|
||||
$list[$k]['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||
$list[$k]['updatetime'] = date('Y-m-d H:i:s',$v['updatetime']);
|
||||
$list[$k]['user_id'] = $user['user_code']??"";
|
||||
$list[$k]['intro'] = $v['intro'];
|
||||
//幸运币流水
|
||||
$list[$k]['lucky_coin'] = model('Guild')->getTodayMoneyLuckyCoin($v['id'],$search_stime,$search_etime);
|
||||
//查询会长手机号和后台登录密码
|
||||
$list[$k]['mobile'] = db::name('user')->where('id',$v['user_id'])->value('mobile');
|
||||
}
|
||||
// 数组按today_money 排序
|
||||
usort($list, function($a, $b) {
|
||||
@@ -102,7 +107,21 @@ class Guild extends adminApi
|
||||
$reslut['list'] = $list;
|
||||
return V(1,"成功", $reslut);
|
||||
}
|
||||
|
||||
/*
|
||||
* 工会显示状态修改
|
||||
*/
|
||||
public function guild_show_status_edit(){
|
||||
$id = input('id',0);
|
||||
$guild = model('Guild')->getOne(['id'=>$id]);
|
||||
if (!$guild) {
|
||||
return V(0, "数据不存在");
|
||||
}
|
||||
if ($guild) {
|
||||
$status = $guild['is_show'] == 1 ? 0 : 1;
|
||||
}
|
||||
$res = db::name('vs_guild')->where('id',$id)->update(['is_show'=>$status]);;
|
||||
return V(1,"成功", $res);
|
||||
}
|
||||
/**
|
||||
* 工会添加
|
||||
* @param guild_special_id 靓号 guild_special_id
|
||||
@@ -154,6 +173,15 @@ class Guild extends adminApi
|
||||
return V(0, "靓号已使用");
|
||||
}
|
||||
}
|
||||
if(empty($request['guild_user_mobile'])){
|
||||
return V(0, "请填写会长手机号");
|
||||
}
|
||||
if($request['guild_user_mobile'] != $user['mobile']){
|
||||
return V(0, "请正确填写会长手机号");
|
||||
}
|
||||
if(empty($request['password'])){
|
||||
return V(0, "请填写后台登录密码");
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$data = [
|
||||
@@ -186,8 +214,18 @@ class Guild extends adminApi
|
||||
$insert_data['room_id'] = $rid;
|
||||
$insert_data['status'] = 1;
|
||||
$insert_data['is_deacon'] = 1;
|
||||
$insert_data['apply_time'] = time();
|
||||
$insert_data['createtime'] = time();
|
||||
$insert_data['is_show_room'] = 1;
|
||||
//结算比例
|
||||
$configs = get_system_config();
|
||||
//未加入工会的收益
|
||||
$ratiogr = $configs['room_gift_ratio'];
|
||||
//收益增加 加入工会的收益
|
||||
$ratiog = $configs['room_gift_guild_ratio'];
|
||||
//收礼人最终的收益比例
|
||||
$ratio = $ratiogr + $ratiog;
|
||||
$insert_data['settlement_ratio'] = $ratio;
|
||||
$re = db::name('vs_guild_user')->insert($insert_data);
|
||||
if (!$re) {
|
||||
db::rollback();
|
||||
@@ -199,6 +237,26 @@ class Guild extends adminApi
|
||||
return V(0, $reslut['msg']);
|
||||
}
|
||||
model('api/Tencent')->send_group_system_notification('g'.$res, $request['guild_name'].'工会群聊创建成功');
|
||||
|
||||
//新功能
|
||||
//创建基础信息数据
|
||||
$boss_auth = db::name('user_auth')->where('mobile',$user['mobile'])->find();
|
||||
$data = [
|
||||
'guild_id' => $res,
|
||||
'boss_mobile' => $request['guild_user_mobile'] ?? $user['mobile'],
|
||||
'boss_name' => $boss_auth['real_name']?? '',
|
||||
'createtime' => time(),
|
||||
];
|
||||
db::name('vs_guild_data')->insert($data);
|
||||
//创建后台登录账号
|
||||
$data = [
|
||||
'guild_id' => $res,
|
||||
'guild_name' => $request['guild_name'],
|
||||
'username' => $request['guild_user_mobile'],
|
||||
'password' => $request['password'],
|
||||
'nickname' => $request['guild_name']."管理员",
|
||||
];
|
||||
model('guildadmin/Admin')->createAdmin($data);
|
||||
db::commit();
|
||||
return V(1,"成功", []);
|
||||
} catch (\Exception $e) {
|
||||
@@ -224,7 +282,7 @@ class Guild extends adminApi
|
||||
return V(0, "该工会不存在");
|
||||
}
|
||||
if (!empty($request['guild_name'])) {
|
||||
$guild_name = model('Guild')->getOne(['guild_name'=>$request['guild_name']]);
|
||||
$guild_name = model('Guild')->getOne(['guild_name'=>$request['guild_name'],'delete_time'=>0]);
|
||||
if (!empty($guild_name) && $guild_name['id'] != $request['id']) {
|
||||
return V(0, "该工会名称已存在");
|
||||
}
|
||||
@@ -248,10 +306,10 @@ class Guild extends adminApi
|
||||
if(isset($request['guild_name']) && $request['guild_name']){
|
||||
$data['guild_name'] = $request['guild_name'];
|
||||
}
|
||||
if(isset($request['user_id']) && $request['user_id']){
|
||||
$userID = db::name('user')->where('user_code',$request['user_id'])->value('id');
|
||||
$data['user_id'] = $userID;
|
||||
}
|
||||
// if(isset($request['user_id']) && $request['user_id']){
|
||||
// $userID = db::name('user')->where('user_code',$request['user_id'])->value('id');
|
||||
// $data['user_id'] = $userID;
|
||||
// }
|
||||
if(isset($request['guild_logo']) && $request['guild_logo']){
|
||||
$data['cover'] = $request['guild_logo'];
|
||||
}
|
||||
@@ -259,14 +317,56 @@ class Guild extends adminApi
|
||||
$data['intro'] = $request['guild_desc'];
|
||||
}
|
||||
$res = model('Guild')->edit(['id' => $request['id']], $data);
|
||||
if ($res) {
|
||||
//新功能
|
||||
//创建基础信息数据
|
||||
$guild_data = db::name('vs_guild_data')->where('guild_id',$guild['id'])->find();
|
||||
$user = db::name('user')->where('id',$guild['user_id'])->find();
|
||||
if($request['guild_user_mobile'] != $user['mobile']){
|
||||
db::rollback();
|
||||
return V(0, "请正确填写会长手机号");
|
||||
}
|
||||
if(empty($guild_data)){
|
||||
$boss_auth = db::name('user_auth')->where('mobile',$user['mobile'])->find();
|
||||
$data = [
|
||||
'guild_id' => $guild['id'],
|
||||
'boss_mobile' => $request['guild_user_mobile'] ?? $user['mobile'],
|
||||
'boss_name' => $boss_auth['real_name']?? '',
|
||||
'createtime' => time(),
|
||||
];
|
||||
db::name('vs_guild_data')->insert($data);
|
||||
}
|
||||
$guildadmin = db::name('vs_guild_admin')->where('guild_id',$guild['id'])->order('id','asc')->find();
|
||||
if(empty($guildadmin)){
|
||||
//创建后台登录账号
|
||||
$data = [
|
||||
'guild_id' => $guild['id'],
|
||||
'guild_name' => $guild['guild_name'],
|
||||
'username' => $request['guild_user_mobile'],
|
||||
'password' => $request['password'],
|
||||
'nickname' => $request['guild_name']."管理员",
|
||||
];
|
||||
$res = model('guildadmin/Admin')->createAdmin($data);
|
||||
if($res['code']==0){
|
||||
db::rollback();
|
||||
return V(0, $res['msg']);
|
||||
}
|
||||
}else{
|
||||
$up_data =[];
|
||||
if($request['guild_user_mobile'] != $guildadmin['username']){
|
||||
db::rollback();
|
||||
return V(0, "会长手机号填写错误");
|
||||
}
|
||||
if($request['password'] != ""){
|
||||
$up_data['password'] = $request['password'];
|
||||
}
|
||||
$res = model('guildadmin/Admin')->edit($guildadmin['id'],$up_data);
|
||||
if($res['code']==0){
|
||||
db::rollback();
|
||||
return V(0, $res['msg']);
|
||||
}
|
||||
}
|
||||
db::commit();
|
||||
return V(1, "修改成功");
|
||||
} else {
|
||||
db::rollback();
|
||||
return V(0, "修改失败");
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
db::rollback();
|
||||
return V(0, $e->getMessage());
|
||||
@@ -379,8 +479,8 @@ class Guild extends adminApi
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$guild_id = input('guild_id', 0);
|
||||
$search_stime = input('search_stime','');
|
||||
$search_etime = input('search_etime','');
|
||||
$search_stime_str = input('search_stime','');
|
||||
$search_etime_str = input('search_etime','');
|
||||
$room_id = input('room_id', 0);
|
||||
$where=['a.status'=>1];
|
||||
$where=['a.room_id'=>['>',0]];
|
||||
@@ -399,38 +499,84 @@ class Guild extends adminApi
|
||||
->where(['a.guild_id'=>$guild_id])->where($where)->count();
|
||||
$list = db::name($this->table_guild_user)->alias('a')
|
||||
->join('vs_room b', 'a.room_id = b.id', 'left')
|
||||
->where(['a.guild_id'=>$guild_id])->where($where)->page($page, $page_limit)->select();
|
||||
->where(['a.guild_id'=>$guild_id])->where($where)
|
||||
// ->page($page, $page_limit)
|
||||
->select();
|
||||
if(!$list){
|
||||
return V(0,"暂无数据");
|
||||
}
|
||||
$rum_lists = [];
|
||||
//总流水
|
||||
$total_consumption = 0;
|
||||
foreach ($list as $k=>$v){
|
||||
if($search_stime!="" && $v['createtime'] < strtotime($search_stime)){
|
||||
$search_stime = $search_stime;
|
||||
}else{
|
||||
$search_stime = date('Y-m-d H:i:s',$v['createtime']) ;
|
||||
$search_stime = $search_stime_str;
|
||||
$search_etime = $search_etime_str;
|
||||
// $search_stime = date('Y-m-d H:i:s','1761554521');
|
||||
// $search_etime = date('Y-m-d H:i:s','1766564906');
|
||||
if($search_stime!=""){
|
||||
if($v['apply_time'] && strtotime($search_stime) < $v['apply_time']) {
|
||||
$search_stime = date('Y-m-d H:i:s',$v['apply_time']);
|
||||
}
|
||||
if($v['quit_time']){
|
||||
if($search_etime!="" && $v['quit_time'] > strtotime($search_etime)){
|
||||
$search_etime = $search_etime;
|
||||
}else{
|
||||
$search_stime = date('Y-m-d H:i:s',$v['apply_time']);
|
||||
}
|
||||
if($search_etime!=""){
|
||||
if($v['quit_time'] && (strtotime($search_etime) > $v['quit_time'])){
|
||||
$search_etime = date('Y-m-d H:i:s',$v['quit_time']);
|
||||
}
|
||||
}else{
|
||||
if($v['quit_time']){
|
||||
$search_etime = date('Y-m-d H:i:s',$v['quit_time']);
|
||||
}else{
|
||||
$search_etime = date('Y-m-d H:i:s',time());
|
||||
}
|
||||
}
|
||||
|
||||
$room_info = db::name('vs_room')->where(['id'=>$v['room_id']])->find();
|
||||
$rum_lists[$k]['id']=$v['id'];
|
||||
$rum_lists[$k]['room_id']=$v['room_id'];
|
||||
$room_ids[] =$v['room_id'];
|
||||
$rum_lists[$k]['room_code']= model('api/Decorate')->user_decorate_detail($v['room_id'], 7);
|
||||
$rum_lists[$k]['room_name']=$room_info['room_name']?? '';
|
||||
$rum_lists[$k]['room_cover']=$room_info['room_cover']?? '';
|
||||
//房间流水
|
||||
$rum_lists[$k]['consumption']= model('Room')->getRoomFlow($v['room_id'],$search_stime,$search_etime);
|
||||
$rum_lists[$k]['add_time'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||
$total_consumption += $rum_lists[$k]['consumption'];
|
||||
//幸运币统计
|
||||
$where_lucky = [];
|
||||
if($search_stime !== ''){
|
||||
$where_lucky['createtime'] = ['>=', strtotime($search_stime)];
|
||||
}
|
||||
if($search_etime !== ''){
|
||||
$where_lucky['createtime'] = ['<=', strtotime($search_etime)];
|
||||
}
|
||||
if(!empty($search_stime) && !empty($search_etime)){
|
||||
$where_lucky['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
|
||||
}
|
||||
$rum_lists[$k]['lucky_coin'] = db::name('vs_room_luck_value')->where('room_id',$room_id)->where($where_lucky)->sum('luck_value');
|
||||
}
|
||||
usort($rum_lists, function($a, $b) {
|
||||
return $b['consumption'] - $a['consumption'];
|
||||
});
|
||||
//分页
|
||||
$rum_lists = array_slice($rum_lists, ($page-1)*$page_limit, $page_limit);
|
||||
//幸运币统计
|
||||
|
||||
$where_lucky = [];
|
||||
if($search_stime !== ''){
|
||||
$where_lucky['createtime'] = ['>=', strtotime($search_stime)];
|
||||
}
|
||||
if($search_etime !== ''){
|
||||
$where_lucky['createtime'] = ['<=', strtotime($search_etime)];
|
||||
}
|
||||
if(!empty($search_stime) && !empty($search_etime)){
|
||||
$where_lucky['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'total_consumption' => $total_consumption,
|
||||
'total_lucky_coin' => db::name('vs_room_luck_value')->whereIn('room_id',$room_ids)->where($where_lucky)->sum('luck_value'),
|
||||
'count' => $count,
|
||||
'lists' => $rum_lists
|
||||
];
|
||||
@@ -460,44 +606,44 @@ class Guild extends adminApi
|
||||
$guild_id = input('guild_id', '');
|
||||
$merge_guild_id = input('merge_guild_id', '');
|
||||
//解散工会
|
||||
$guild = model('Guild')->getOne(['id'=>$guild_id]);
|
||||
$guild = model('Guild')->getOne(['guild_special_id'=>$guild_id]);
|
||||
$merge_guild=model('Guild')->getOne(['guild_special_id'=>$merge_guild_id]);
|
||||
if(empty($guild)){
|
||||
return V(0,"该工会不存在");
|
||||
}
|
||||
if($guild['status'] == 2){
|
||||
return V(0,"该工会已解散");
|
||||
}
|
||||
if(!$merge_guild_id){
|
||||
return V(0,"参数错误");
|
||||
}
|
||||
if(empty($merge_guild)){
|
||||
return V(0,"并入工会不存在");
|
||||
}
|
||||
$guild_id = $guild['id'];
|
||||
$merge_guild_id = $merge_guild['id'];
|
||||
db::startTrans();
|
||||
try{
|
||||
$res = model('Guild')->edit(['id'=>$guild_id],['status'=>2,'delete_time'=>time()]);
|
||||
//并入工会
|
||||
if(!$merge_guild_id){
|
||||
db::rollback();
|
||||
return V(0,"参数错误");
|
||||
}
|
||||
$merge_guild = model('Guild')->getOne(['id'=>$merge_guild_id]);
|
||||
if(empty($merge_guild)){
|
||||
db::rollback();
|
||||
return V(0,"并入工会不存在");
|
||||
}
|
||||
$merge_guild_user = db('vs_guild_user')->where(['guild_id'=>$merge_guild_id,'quit_type'=>0])->select();
|
||||
$merge_guild_user = db('vs_guild_user')->where(['guild_id'=>$guild_id,'quit_type'=>0,'status'=>1])->select();
|
||||
foreach ($merge_guild_user as $key=>$value){
|
||||
$res = db('vs_guild_user')->insert([
|
||||
'user_id'=>$value['user_id'],
|
||||
'guild_id'=>$merge_guild_id,
|
||||
'room_id'=>$value['room_id'],
|
||||
'coin'=>$value['coin'],
|
||||
'status'=>$value['status'],
|
||||
'is_deacon'=>$value['is_deacon'],
|
||||
'is_show_room'=>$value['is_show_room'],
|
||||
'remarks'=>$value['remarks'],
|
||||
'apply_time'=>$value['apply_time'],
|
||||
'remarks'=>"公会合并:从".$guild['guild_name']."合入".$merge_guild['guild_name'],
|
||||
'settlement_ratio' =>$value['settlement_ratio'],
|
||||
'apply_time'=>time(),
|
||||
'createtime'=>time(),
|
||||
]);
|
||||
if(!$res){
|
||||
db::rollback();
|
||||
return V(0,"失败");
|
||||
}
|
||||
//更新公会人数
|
||||
db('vs_guild')->where('id', $merge_guild_id)->setInc('num');
|
||||
//拉用户进入工会群聊
|
||||
$rid = 'g'.$merge_guild_id;
|
||||
$reslut = model('api/Tencent')->add_group_member($rid, $value['user_id']);
|
||||
@@ -508,7 +654,7 @@ class Guild extends adminApi
|
||||
return V(0,"失败");
|
||||
}
|
||||
//解散群
|
||||
model('Tencent')->delete_group('g'.$guild_id);
|
||||
model('api/Tencent')->delete_group('g'.$guild_id);
|
||||
db::commit();
|
||||
return V(1,"成功");
|
||||
} catch(\Exception $e) {
|
||||
@@ -661,7 +807,7 @@ class Guild extends adminApi
|
||||
$lists_data = db::name($this->table_guild_subsidy)->alias('a')
|
||||
->join('vs_guild b','a.guild_id = b.id')
|
||||
->where($where)
|
||||
->order('a.id desc')
|
||||
->order('a.total_transaction desc')
|
||||
->field('a.*,b.guild_name,b.user_id,b.guild_special_id')
|
||||
->page($page,$page_limit)
|
||||
->select();
|
||||
|
||||
@@ -243,6 +243,8 @@ class Inform extends adminApi
|
||||
$from_info = db::name('vs_room')->where('id',$item['from_id'])->field('room_number as code,room_name as title')->find();
|
||||
}elseif($item['report_type'] ==3){
|
||||
$from_info = db::name('user_zone')->where('id',$item['from_id'])->field('content as title ,id as code')->find();
|
||||
}elseif($item['report_type'] ==4){
|
||||
$from_info = db::name('vs_guild')->where('id',$item['from_id'])->field('guild_name as title,id as code')->find();
|
||||
}
|
||||
$item['createtime'] = date('Y-m-d H:i:s', $item['createtime']);
|
||||
$item['updatetime'] = date('Y-m-d H:i:s', $item['updatetime']);
|
||||
@@ -253,7 +255,8 @@ class Inform extends adminApi
|
||||
$item['report_type_str'] = [
|
||||
1=>'用户',
|
||||
2=>'房间',
|
||||
3=>'动态'
|
||||
3=>'动态',
|
||||
4=>'公会'
|
||||
][$item['report_type']];
|
||||
|
||||
}
|
||||
@@ -307,5 +310,43 @@ class Inform extends adminApi
|
||||
}
|
||||
}
|
||||
|
||||
//安卓日志列表
|
||||
public function android_log_list(){
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$count = db::name('vs_android_log')->where('delete_time',0)->count();
|
||||
$list = db::name('vs_android_log')->where('delete_time',0)->order('id desc')->page($page, $page_limit)->select();
|
||||
foreach ($list as &$item) {
|
||||
$user_info = db::name('user')->where('id',$item['user_id'])->field('nickname,user_code')->find();
|
||||
if($user_info){
|
||||
$item['nickname'] = $user_info['user_code'] ."-".$user_info['nickname'];
|
||||
}else{
|
||||
$item['nickname'] = '';
|
||||
}
|
||||
$item['createtime'] = date('Y-m-d H:i:s', $item['createtime']);
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $list
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
//安卓日志删除
|
||||
public function android_log_delete(){
|
||||
$id = input('id', '');
|
||||
if($id){
|
||||
$res = db::name('vs_android_log')->where('id',$id)->update(['delete_time'=>time()]);
|
||||
if($res){
|
||||
return V(1,"成功");
|
||||
}
|
||||
else{
|
||||
return V(0,"失败");
|
||||
}
|
||||
}else{
|
||||
return V(0,"ID不能为空");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -125,28 +125,28 @@ class Level extends adminApi
|
||||
if($id == ''){
|
||||
return V(0,"参数错误");
|
||||
}
|
||||
if($level){
|
||||
if($level!=''){
|
||||
$level_data['level'] = $level;
|
||||
}
|
||||
if($name){
|
||||
if($name!=''){
|
||||
$level_data['name'] = $name;
|
||||
}
|
||||
if($image){
|
||||
if($image!=''){
|
||||
$level_data['image'] = $image;
|
||||
}
|
||||
if($status){
|
||||
if($status!=''){
|
||||
$level_data['status'] = $status;
|
||||
}
|
||||
if($change_value){
|
||||
if($change_value!=''){
|
||||
$level_data['change_value'] = $change_value;
|
||||
}
|
||||
if($coins){
|
||||
if($coins!=''){
|
||||
$level_data['coins'] = $coins;
|
||||
}
|
||||
if($bg_image){
|
||||
if($bg_image!=''){
|
||||
$level_data['bg_image'] = $bg_image;
|
||||
}
|
||||
if($color){
|
||||
if($color!=''){
|
||||
$level_data['color'] = $color;
|
||||
}
|
||||
$level_data['updatetime'] = time();
|
||||
|
||||
135
application/adminapi/controller/Lottery.php
Normal file
135
application/adminapi/controller/Lottery.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
use app\admin\model\AdminLog;
|
||||
use app\common\controller\adminApi;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\Hook;
|
||||
use think\Session;
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 等级管理
|
||||
* @internal
|
||||
*/
|
||||
class Lottery extends adminApi
|
||||
{
|
||||
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = [];
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
}
|
||||
/*
|
||||
* 配置列表
|
||||
*/
|
||||
public function config_list(){
|
||||
$list = db::name("bb_lottery_config")->order('sort desc')->select();
|
||||
$list_data = [];
|
||||
foreach ($list as $k=>$v){
|
||||
$list_data[$k]['id'] = $v['id'];
|
||||
$list_data[$k]['key'] = $v['key'];
|
||||
$list_data[$k]['value'] = $v['value'];
|
||||
$list_data[$k]['desc'] = $v['desc'];
|
||||
$list_data[$k]['sort'] = $v['sort'];
|
||||
}
|
||||
return V(1,"成功", $list_data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 配置设置
|
||||
*/
|
||||
public function config_set(){
|
||||
$params = $this->request->post();
|
||||
foreach ($params as $k=>$v){
|
||||
$data = [
|
||||
'value'=>$v,
|
||||
];
|
||||
db::name("bb_lottery_config")->where(['key'=>$k])->update($data);
|
||||
}
|
||||
return V(1,"成功");
|
||||
}
|
||||
|
||||
/*
|
||||
* 中奖记录
|
||||
*/
|
||||
public function record_list(){
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$stime = input('stime', '');
|
||||
$etime = input('etime', '');
|
||||
$where = [];
|
||||
if($stime!==""){
|
||||
$where['create_time'] = ['>=', strtotime($stime)];
|
||||
}
|
||||
if($etime!==""){
|
||||
$where['create_time'] = ['<=', strtotime($etime)];
|
||||
}
|
||||
if($stime!=="" && $etime!==""){
|
||||
$where['create_time'] = ['between', [strtotime($stime), strtotime($etime)]];
|
||||
}
|
||||
$count = db::name('bb_lottery_winner_record')->where($where)->count();
|
||||
$lists_data = db::name('bb_lottery_winner_record')->field('id,uid as user_id,prize_type,prize_amount,pool_amount,ratio,release_amount,status,create_time as createtime')->where($where)->page($page, $page_limit)->order("id desc")->select();
|
||||
foreach ($lists_data as $k=>$v){
|
||||
$user_info = db::name('user')->where(['id'=>$v['user_id']])->find();
|
||||
$lists_data[$k]['user_code'] = $user_info['user_code']??"";
|
||||
$lists_data[$k]['nickname'] = $user_info['user_code']."-".$user_info['nickname'];
|
||||
//奖项类型:1-小奖 2-大奖
|
||||
$lists_data[$k]['prize_type_str'] = $v['prize_type']==1?"小奖":"大奖";
|
||||
//状态:1-已发放 0-未发放'
|
||||
$lists_data[$k]['status_str'] = $v['status']==1?"已发放":"未发放";
|
||||
$lists_data[$k]['createtime'] = date("Y-m-d H:i:s", $v['createtime']);
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $lists_data,
|
||||
'total_data' => [
|
||||
]
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
|
||||
}
|
||||
/*
|
||||
* 实时统计
|
||||
*/
|
||||
public function realtime_statistics(){
|
||||
$bb_config = db::name('bb_lottery_config')->field('key,value')->select();
|
||||
$bb_config = array_column($bb_config, null, 'key');
|
||||
// 循环奖池进度
|
||||
//最新轮次
|
||||
$latest_times = db::name('bb_lottery_pool_flow')->where(['pool_type'=>1])->max('times');
|
||||
$pool_progress = db::name('bb_lottery_pool_flow')->where(['pool_type'=>1,'times'=>$latest_times])->count();//当前进度
|
||||
$pool_total_amount = db::name('bb_lottery_pool_flow')->where(['pool_type'=>1,'times'=>$latest_times,'type'=>1])->sum('amount');
|
||||
//获取配置表中奖池配置
|
||||
$pool_progress_str = $pool_progress."/".$bb_config['small_pool_trigger_times']['value']."(".$pool_total_amount."金币)";
|
||||
|
||||
//蓄水池当前金额
|
||||
$big_round = db::name('bb_lottery_pool_flow')->where(['pool_type'=>2])->max('times');
|
||||
$bigAddGold = Db::name('bb_lottery_pool_flow')
|
||||
->where(['pool_type' => 2, 'type' => 3, 'times' => $big_round])
|
||||
->sum('amount') ?: 0;
|
||||
//最近中奖用户
|
||||
$last_winner_user_id = db::name('bb_lottery_winner_record')->where(['status'=>1])->order('id desc')->find();
|
||||
if($last_winner_user_id){
|
||||
$last_winner_user_info = db::name('user')->where(['id'=>$last_winner_user_id['uid']])->find();
|
||||
$last_winner_user_text = "用户ID:".$last_winner_user_info['user_code']." 获得 ".$last_winner_user_id['prize_amount']." 金币 (".$last_winner_user_id['ratio']."%)";
|
||||
}else{
|
||||
$last_winner_user_text = "无";
|
||||
}
|
||||
|
||||
//平台累计收入
|
||||
$platform_total_income = db::name('bb_lottery_pool_flow')->where(['type'=>4])->sum('amount');
|
||||
$return_data=[
|
||||
'pool_progress' => $pool_progress_str,
|
||||
'pool_amount_now' => ($bigAddGold)."金币 (".(($bigAddGold)/$bb_config['big_pool_threshold']['value'])."%)",
|
||||
'last_winner_user' => $last_winner_user_text,
|
||||
'platform_total_income' => $platform_total_income." 金币",
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
}
|
||||
417
application/adminapi/controller/Nobility.php
Normal file
417
application/adminapi/controller/Nobility.php
Normal file
@@ -0,0 +1,417 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
use app\admin\model\AdminLog;
|
||||
use app\common\controller\adminApi;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\Hook;
|
||||
use think\Session;
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 等级管理
|
||||
* @internal
|
||||
*/
|
||||
class Nobility extends adminApi
|
||||
{
|
||||
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = [];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
}
|
||||
|
||||
//获取爵位列表
|
||||
public function get_nobility_list()
|
||||
{
|
||||
$order = input('order', 'lid');
|
||||
$sort = input('sort', 'desc');
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$count = db::name('vs_nobility')->where('delete_time', 0)->count();
|
||||
$lists = db::name('vs_nobility')
|
||||
->field('lid,name,image,images,pay_price,pay_price,renew_price,pay_coin,renew_coin,day,power_ids,nick_name_color,nick_name_color_name,createtime,updatetime,play_image,enter_image')
|
||||
->where('delete_time', 0)
|
||||
->order($order, $sort)
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
foreach ($lists as &$v) {
|
||||
$v['createtime'] = $v['createtime'] ? date('Y-m-d H:i:s', $v['createtime']) : '--';
|
||||
$v['updatetime'] = $v['updatetime'] ? date('Y-m-d H:i:s', $v['updatetime']) : '--';
|
||||
$power_ids = $v['power_ids'] ? explode(',', $v['power_ids']) : [];
|
||||
$v['power_ids_array'] = db::name('vs_nobility_power')
|
||||
->field('id,name')
|
||||
->where(['id'=>['in',$power_ids]])->select();
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $lists
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
|
||||
//添加爵位
|
||||
public function add_nobility(){
|
||||
$name = input('name', '');
|
||||
$image = input('image', '');
|
||||
$images = input('images', '');
|
||||
$pay_price = input('pay_price', '');
|
||||
$pay_coin = input('pay_coin', '');
|
||||
$renew_price = input('renew_price', '');
|
||||
$renew_coin = input('renew_coin', '');
|
||||
$day = input('day', '');
|
||||
$nick_name_color = input('nick_name_color', '');
|
||||
$nick_name_color_name = input('nick_name_color_name', '');
|
||||
$power_ids = input('power_ids', '');
|
||||
$play_image = input('play_image', '');
|
||||
$enter_image = input('enter_image', '');
|
||||
if (empty($name)) {
|
||||
return V(0, "请输入爵位名称");
|
||||
}
|
||||
$nobility_info = db::name('vs_nobility')->where('name', $name)->find();
|
||||
if ($nobility_info) {
|
||||
return V(0, "该爵位已存在");
|
||||
}
|
||||
$data = [
|
||||
'name' => $name,
|
||||
'image' => $image,
|
||||
'images' => $images,
|
||||
'pay_price' => $pay_price,
|
||||
'pay_coin' => $pay_coin,
|
||||
'renew_price' => $renew_price,
|
||||
'renew_coin' => $renew_coin,
|
||||
'play_image' => $play_image,
|
||||
'enter_image' => $enter_image,
|
||||
'day' => $day,
|
||||
'nick_name_color' => $nick_name_color,
|
||||
'nick_name_color_name' => $nick_name_color_name,
|
||||
'createtime' => time(),
|
||||
'power_ids' => $power_ids
|
||||
];
|
||||
$result = db::name('vs_nobility')->insert($data);
|
||||
if ($result) {
|
||||
return V(1, "添加成功");
|
||||
} else {
|
||||
return V(0, "添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
//编辑爵位
|
||||
public function edit_nobility(){
|
||||
$name = input('name', '');
|
||||
$image = input('image', '');
|
||||
$images = input('images', '');
|
||||
$pay_price = input('pay_price', '');
|
||||
$pay_coin = input('pay_coin', '');
|
||||
$renew_price = input('renew_price', '');
|
||||
$renew_coin = input('renew_coin', '');
|
||||
$day = input('day', '');
|
||||
$nick_name_color = input('nick_name_color', '');
|
||||
$nick_name_color_name = input('nick_name_color_name', '');
|
||||
$power_ids = input('power_ids', '');
|
||||
$play_image = input('play_image', '');
|
||||
$enter_image = input('enter_image', '');
|
||||
$lid = input('lid', '');
|
||||
$nobility_info = db::name('vs_nobility')->where('lid', $lid)->find();
|
||||
if (!$nobility_info) {
|
||||
return V(0, "该爵位不存在");
|
||||
}
|
||||
$data = [];
|
||||
if(!empty($name)){
|
||||
$nobility_info_other = db::name('vs_nobility')->where(['lid'=>['neq', $lid], 'name'=>$name])->find();
|
||||
if ($nobility_info_other) {
|
||||
return V(0, "该爵位已存在");
|
||||
}
|
||||
$data['name'] = $name;
|
||||
}
|
||||
if(!empty($image)){
|
||||
$data['image'] = $image;
|
||||
}
|
||||
if(!empty($images)){
|
||||
$data['images'] = $images;
|
||||
}
|
||||
if(!empty($pay_price)){
|
||||
$data['pay_price'] = $pay_price;
|
||||
}
|
||||
if(!empty($pay_coin)){
|
||||
$data['pay_coin'] = $pay_coin;
|
||||
}
|
||||
if(!empty($renew_price)){
|
||||
$data['renew_price'] = $renew_price;
|
||||
}
|
||||
if(!empty($renew_coin)){
|
||||
$data['renew_coin'] = $renew_coin;
|
||||
}
|
||||
if(!empty($day)){
|
||||
$data['day'] = $day;
|
||||
}
|
||||
if(!empty($nick_name_color)){
|
||||
$data['nick_name_color'] = $nick_name_color;
|
||||
}
|
||||
if(!empty($nick_name_color_name)){
|
||||
$data['nick_name_color_name'] = $nick_name_color_name;
|
||||
}
|
||||
if(!empty($power_ids)){
|
||||
$data['power_ids'] = $power_ids;
|
||||
}
|
||||
if(!empty($play_image)){
|
||||
$data['play_image'] = $play_image;
|
||||
}
|
||||
if(!empty($enter_image)){
|
||||
$data['enter_image'] = $enter_image;
|
||||
}
|
||||
$data['updatetime'] = time();
|
||||
$result = db::name('vs_nobility')->where('lid', $lid)->update($data);
|
||||
if ($result) {
|
||||
return V(1, "编辑成功");
|
||||
} else {
|
||||
return V(0, "编辑失败");
|
||||
}
|
||||
}
|
||||
|
||||
//删除爵位
|
||||
public function del_nobility(){
|
||||
$lid = input('lid', '');
|
||||
$nobility_info = db::name('vs_nobility')->where('lid', $lid)->find();
|
||||
if (!$nobility_info) {
|
||||
return V(0, "该爵位不存在");
|
||||
}
|
||||
$result = db::name('vs_nobility')->where('lid', $lid)->update(['delete_time'=>time()]);
|
||||
if ($result) {
|
||||
return V(1, "删除成功");
|
||||
} else {
|
||||
return V(0, "删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
//爵位权限列表
|
||||
public function get_nobility_power_list(){
|
||||
$order = input('order', 'id');
|
||||
$sort = input('sort', 'desc');
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$count = db::name('vs_nobility_power')->where('delete_time', 0)->count();
|
||||
$lists = db::name('vs_nobility_power')
|
||||
->field('id,name,content,image,images,createtime,updatetime')
|
||||
->where('delete_time', 0)
|
||||
->order($order, $sort)
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $lists
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
|
||||
//添加爵位权限
|
||||
public function add_nobility_power(){
|
||||
$name = input('name', '');
|
||||
$content = input('content', '');
|
||||
$image = input('image', '');
|
||||
$images = input('images', '');
|
||||
if (empty($name)) {
|
||||
return V(0, "请输入爵位权限名称");
|
||||
}
|
||||
$nobility_power_info = db::name('vs_nobility_power')->where('name', $name)->find();
|
||||
if ($nobility_power_info) {
|
||||
return V(0, "该爵位权限已存在");
|
||||
}
|
||||
$data = [
|
||||
'name' => $name,
|
||||
'content' => $content,
|
||||
'image' => $image,
|
||||
'images' => $images,
|
||||
'createtime' => time(),
|
||||
];
|
||||
$result = db::name('vs_nobility_power')->insert($data);
|
||||
if ($result) {
|
||||
return V(1, "添加成功");
|
||||
} else {
|
||||
return V(0, "添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
//编辑爵位权限
|
||||
public function edit_nobility_power(){
|
||||
$name = input('name', '');
|
||||
$content = input('content', '');
|
||||
$image = input('image', '');
|
||||
$images = input('images', '');
|
||||
$id = input('id', '');
|
||||
$nobility_power_info = db::name('vs_nobility_power')->where('id', $id)->find();
|
||||
if (!$nobility_power_info) {
|
||||
return V(0, "该爵位权限不存在");
|
||||
}
|
||||
$data = [];
|
||||
if(!empty($name)){
|
||||
$nobility_power_info_other = db::name('vs_nobility_power')->where(['id'=>['neq', $id], 'name'=>$name])->find();
|
||||
if ($nobility_power_info_other) {
|
||||
return V(0, "该爵位权限已存在");
|
||||
}
|
||||
$data['name'] = $name;
|
||||
}
|
||||
if(!empty($content)){
|
||||
$data['content'] = $content;
|
||||
}
|
||||
if(!empty($image)){
|
||||
$data['image'] = $image;
|
||||
}
|
||||
if(!empty($images)){
|
||||
$data['images'] = $images;
|
||||
}
|
||||
$data['updatetime'] = time();
|
||||
$result = db::name('vs_nobility_power')->where('id', $id)->update($data);
|
||||
if ($result) {
|
||||
return V(1, "编辑成功");
|
||||
} else {
|
||||
return V(0, "编辑失败");
|
||||
}
|
||||
}
|
||||
|
||||
//删除爵位权限
|
||||
public function del_nobility_power(){
|
||||
$id = input('id', '');
|
||||
$nobility_power_info = db::name('vs_nobility_power')->where('id', $id)->find();
|
||||
if (!$nobility_power_info) {
|
||||
return V(0, "该爵位权限不存在");
|
||||
}
|
||||
$result = db::name('vs_nobility_power')->where('id', $id)->update(['delete_time'=>time()]);
|
||||
if ($result) {
|
||||
return V(1, "删除成功");
|
||||
} else {
|
||||
return V(0, "删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
//用户爵位列表
|
||||
public function get_user_nobility_list(){
|
||||
$order = input('order', 'id');
|
||||
$sort = input('sort', 'desc');
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$count = db::name('vs_user_nobility')->where('delete_time', 0)->count();
|
||||
$lists = db::name('vs_user_nobility')
|
||||
->field('id,user_id,lid,end_time,createtime,updatetime')
|
||||
->where('delete_time', 0)
|
||||
->order($order, $sort)
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
foreach ($lists as &$list){
|
||||
$list['user_code'] = db::name('user')->where('id', $list['user_id'])->value('user_code');
|
||||
$list['user_nick_name'] = db::name('user')->where('id', $list['user_id'])->value('nickname');
|
||||
$list['nick_name_color'] = db::name('vs_nobility')->where('lid', $list['lid'])->value('nick_name_color');
|
||||
//头像
|
||||
$list['user_avatar'] = db::name('user')->where('id', $list['user_id'])->value('avatar');
|
||||
//爵位名称
|
||||
$list['nobility_name'] = db::name('vs_nobility')->where('lid', $list['lid'])->value('name');
|
||||
$list['createtime'] = $list['createtime'] ? date('Y-m-d H:i:s', $list['createtime']) : '--';
|
||||
$list['updatetime'] = $list['updatetime'] ? date('Y-m-d H:i:s', $list['updatetime']) : '--';
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $lists
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
|
||||
//装扮添加
|
||||
public function add_nobility_decorate(){
|
||||
$lid = input('lid', '');
|
||||
$dpid = input('dpid', '');
|
||||
if (empty($lid)) {
|
||||
return V(0, "请选择爵位");
|
||||
}
|
||||
if (empty($dpid)) {
|
||||
return V(0, "请选择装扮");
|
||||
}
|
||||
$decorate_price = db::name('vs_decorate_price')->where(['id'=>$dpid])->find();
|
||||
if (!$decorate_price) {
|
||||
return V(0, "该装扮不存在");
|
||||
}
|
||||
$decorate = db::name('vs_decorate')->where(['did'=>$decorate_price['did']])->find();
|
||||
if (!$decorate) {
|
||||
return V(0, "该装扮不存在");
|
||||
}
|
||||
$nobility_dress_info = db::name('vs_nobility_decorate')
|
||||
->where('delete_time', 0)
|
||||
->where(['lid'=>$lid, 'dpid'=>$dpid])->find();
|
||||
if ($nobility_dress_info) {
|
||||
return V(0, "该爵位已添加该装扮");
|
||||
}
|
||||
$data = [
|
||||
'lid' => $lid,
|
||||
'did' => $decorate['did'],
|
||||
'type' => $decorate['type'],
|
||||
'dpid' => $dpid,
|
||||
'day' => $decorate_price['day'],
|
||||
'createtime' => time(),
|
||||
];
|
||||
$result = db::name('vs_nobility_decorate')->insert($data);
|
||||
if ($result) {
|
||||
return V(1, "添加成功");
|
||||
} else {
|
||||
return V(0, "添加失败");
|
||||
}
|
||||
}
|
||||
//装扮列表
|
||||
public function get_nobility_decorate_list(){
|
||||
$order = input('order', 'id');
|
||||
$sort = input('sort', 'desc');
|
||||
$page = input('page', 1);
|
||||
$lid = input('lid', '');
|
||||
$page_limit = input('page_limit', 30);
|
||||
$count = db::name('vs_nobility_decorate')->where('delete_time', 0)->count();
|
||||
$lists = db::name('vs_nobility_decorate')
|
||||
->field('id,lid,did,type,dpid,day,createtime,updatetime')
|
||||
->where('delete_time', 0)
|
||||
->where('lid', $lid)
|
||||
->order($order, $sort)
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
$list = [];
|
||||
foreach ($lists as $key =>$value){
|
||||
$decorate = db::name('vs_decorate')->where('did', $value['did'])->find();
|
||||
$list[$key]['id'] = $value['id'];
|
||||
$list[$key]['lid'] = $value['lid'];
|
||||
$list[$key]['did'] = $value['did'];
|
||||
$list[$key]['dpid'] = $value['dpid'];
|
||||
$list[$key]['decorate_name'] = $decorate['title'] ?? '';
|
||||
$list[$key]['decorate_day'] = db::name('vs_decorate_price')->where('id', $value['dpid'])->value('day');
|
||||
$list[$key]['decorate_type_name'] = model('api/Decorate')->TypeArray[$value['type']] ?? '';
|
||||
$list[$key]['decorate_image'] = $decorate['base_image'] ?? '';
|
||||
$list[$key]['createtime'] = $value['createtime'] ? date('Y-m-d H:i:s', $value['createtime']) : '--';
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $list
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
//装扮删除
|
||||
public function del_nobility_decorate(){
|
||||
$id = input('id', '');
|
||||
$nobility_decorate_info = db::name('vs_nobility_decorate')->where('id', $id)->find();
|
||||
if (!$nobility_decorate_info) {
|
||||
return V(0, "该爵位装扮不存在");
|
||||
}
|
||||
$result = db::name('vs_nobility_decorate')->where('id', $id)->update(['delete_time'=>time()]);
|
||||
if ($result) {
|
||||
return V(1, "删除成功");
|
||||
} else {
|
||||
return V(0, "删除失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ namespace app\adminapi\controller;
|
||||
|
||||
use app\admin\model\AdminLog;
|
||||
use app\common\controller\adminApi;
|
||||
use app\common\library\GiftTableManager;
|
||||
use think\Cache;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\Hook;
|
||||
@@ -71,14 +73,24 @@ class Room extends adminApi
|
||||
$label_icon = input('label_icon', '');
|
||||
$label_icon_room = input('label_icon_room', '');
|
||||
$status = input('status', 1);
|
||||
$default_index = input('default_index', 0);
|
||||
$sort = input('sort', 99);
|
||||
if($label_name == ''){
|
||||
return V(0,"请输入房间标签名称");
|
||||
}
|
||||
if($default_index == 1){
|
||||
$lebel_data = db::name($this->table_room_label)->where(['default_index'=>1])->find();
|
||||
if($lebel_data){
|
||||
db::name($this->table_room_label)->where(['id'=>$lebel_data['id']])->update(['default_index'=>0]);
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'label_name' => $label_name,
|
||||
'label_icon' => $label_icon,
|
||||
'label_icon_room' => $label_icon_room,
|
||||
'status' => $status,
|
||||
'default_index' => $default_index,
|
||||
'sort' => $sort,
|
||||
'updatetime' => time(),
|
||||
'createtime' => time()
|
||||
];
|
||||
@@ -144,6 +156,8 @@ class Room extends adminApi
|
||||
$label_icon = input('label_icon', '');
|
||||
$label_icon_room = input('label_icon_room', '');
|
||||
$status = input('status', 1);
|
||||
$default_index = input('default_index', 0);
|
||||
$sort = input('sort', 99);
|
||||
if($label_id == ''){
|
||||
return V(0,"标签ID不能为空");
|
||||
}
|
||||
@@ -171,6 +185,18 @@ class Room extends adminApi
|
||||
if($status){
|
||||
$data['status'] = $status;
|
||||
}
|
||||
if($default_index == 1){
|
||||
$lebel_data = db::name($this->table_room_label)->where(['default_index'=>1])->find();
|
||||
if($lebel_data){
|
||||
db::name($this->table_room_label)->where(['id'=>$lebel_data['id']])->update(['default_index'=>0]);
|
||||
}
|
||||
}
|
||||
$data['default_index'] = $default_index;
|
||||
if($sort){
|
||||
$data['sort'] = $sort;
|
||||
}
|
||||
|
||||
|
||||
$data['updatetime'] = time();
|
||||
$result = db::name($this->table_room_label)->where(['id'=>$label_id])->update($data);
|
||||
if(!$result){
|
||||
@@ -196,6 +222,14 @@ class Room extends adminApi
|
||||
foreach ($lists as $key => $value) {
|
||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||
}
|
||||
$lists[]=[
|
||||
'createtime' => '',
|
||||
'deletetime' => 0,
|
||||
'id' => -1,
|
||||
'type_name' => '练歌房',
|
||||
'status' => 1,
|
||||
'sort' => 99
|
||||
];
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
@@ -386,6 +420,12 @@ class Room extends adminApi
|
||||
public function edit_relation(){
|
||||
$relation_id = input('relation_id', '');
|
||||
$name = input('name', '');
|
||||
if($relation_id == 0){
|
||||
if($name != '无'){
|
||||
return V(0,'此关系不允许修改');
|
||||
}
|
||||
}
|
||||
|
||||
$type = input('type', '');
|
||||
$is_open_movie = input('is_open_movie', 1);
|
||||
$icon = input('icon', '');
|
||||
@@ -444,8 +484,15 @@ class Room extends adminApi
|
||||
$where['room_status'] = $search_status;
|
||||
}
|
||||
if($type_id!==''){
|
||||
if($type_id == -1){
|
||||
$where['type_id'] = 1;
|
||||
$where['label_id'] = 2;
|
||||
}else{
|
||||
$where['type_id'] = $type_id;
|
||||
}
|
||||
}else{
|
||||
$where['type_id'] = ['<>',6];
|
||||
}
|
||||
if($label_id!==''){
|
||||
$where['label_id'] = $label_id;
|
||||
}
|
||||
@@ -460,7 +507,6 @@ class Room extends adminApi
|
||||
}
|
||||
//房间列表只展示 审核通过的房间
|
||||
$where['apply_status'] = 2;//1待审核 2审核通过 3审核失败
|
||||
$where['type_id'] = ['<>',6];
|
||||
$count = db::name($this->table)->where($where)->count();
|
||||
$room_lists = db::name($this->table)->where($where)->page($page, $page_limit)->select();
|
||||
$lists = [];
|
||||
@@ -478,8 +524,14 @@ class Room extends adminApi
|
||||
$lists[$key]['user_name'] = model('User')->where(['id'=>$value['user_id']])->value('nickname');
|
||||
$lists[$key]['room_name'] = $value['room_name'];
|
||||
$lists[$key]['room_cover'] = $value['room_cover'];
|
||||
if($value['type_id']==1 && $value['label_id']==2){
|
||||
$lists[$key]['room_type_str'] = "练歌房";
|
||||
$lists[$key]['room_label_str'] = "练歌房";
|
||||
$value['type_id']=-1;
|
||||
}else{
|
||||
$lists[$key]['room_type_str'] = db::name($this->table_room_type)->where(['id'=>$value['type_id']])->value('type_name');
|
||||
$lists[$key]['room_label_str'] = db::name($this->table_room_label)->where(['id'=>$value['label_id']])->value('label_name');
|
||||
}
|
||||
$lists[$key]['is_recommend'] = $value['is_recommend'] != 1 ? '是' : '否';
|
||||
$lists[$key]['is_top'] = $value['is_top'] != 1 ? '是' : '否';
|
||||
$lists[$key]['is_hot'] = $value['is_hot'] != 1 ? '是' : '否';
|
||||
@@ -610,6 +662,10 @@ class Room extends adminApi
|
||||
}
|
||||
$room_data['growth_week_subsidy'] = round($weekSubsidy, 2);
|
||||
|
||||
if($room_data['type_id']==1 && $room_data['label_id']==2){
|
||||
$room_data['type_id']=-1;
|
||||
}
|
||||
|
||||
return V(1,"成功", $room_data);
|
||||
}
|
||||
|
||||
@@ -662,71 +718,72 @@ class Room extends adminApi
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 10);
|
||||
$type = input('type', 1);//1:全部流水 2:日流水 3:周流水 4:月流水
|
||||
$stime = input('stime', '');
|
||||
$etime = input('etime', '');
|
||||
|
||||
$firstDay = date('Y-m-01');
|
||||
$lastDay = date('Y-m-t 23:59:59');
|
||||
$begin_time_table = empty($stime) ? $firstDay : $stime;
|
||||
$end_time_table = empty($etime) ? $lastDay : $etime;
|
||||
if($room_id == ''){
|
||||
return V(0,"参数错误");
|
||||
}
|
||||
if($type == 1){
|
||||
$begin_time = 1748676768;//2025-06-00 15:32:48
|
||||
$end_time = time();
|
||||
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
|
||||
}elseif ($type == 2){
|
||||
//日流水
|
||||
$begin_time = strtotime(date('Y-m-d 00:00:00',time()));
|
||||
$end_time = time();
|
||||
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
|
||||
|
||||
$params['from_id'] = $room_id;
|
||||
$ext_params['start_time'] = strtotime($begin_time_table);
|
||||
$ext_params['end_time'] = strtotime($end_time_table);
|
||||
$params['page'] = $page;
|
||||
$params['limit'] = $page_limit;
|
||||
$res = model('api/GiveGiftBases')->getGiftRecords($params,$ext_params);
|
||||
$list = $res['data'];
|
||||
$count = $res['total'];
|
||||
$list_data = [];
|
||||
foreach ($list as &$value) {
|
||||
$value['time'] = date('Y-m-d', $value['createtime']);
|
||||
$value['sender_nickname'] = db::name('user')->where('id', $value['user_id'])->value('nickname');
|
||||
$value['sender_avatar'] = db::name('user')->where('id', $value['user_id'])->value('avatar');
|
||||
$value['receive_nickname'] = db::name('user')->where('id', $value['gift_user'])->value('nickname');
|
||||
$value['receive_avatar'] = db::name('user')->where('id', $value['gift_user'])->value('avatar');
|
||||
$value['gift_name'] = db::name('vs_gift')->where('gid', $value['gift_id'])->value('gift_name');
|
||||
|
||||
}
|
||||
elseif ($type == 3){
|
||||
//周流水
|
||||
//本周一
|
||||
$begin_time = strtotime(date('Y-m-d 00:00:00', strtotime('this week')));
|
||||
$end_time = time();
|
||||
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
|
||||
}
|
||||
elseif ($type == 4){
|
||||
$begin_time = strtotime(date('Y-m-01'));
|
||||
$end_time = time();
|
||||
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
|
||||
}
|
||||
$count = db::name('vs_give_gift')->alias('a')
|
||||
->field('a.id')
|
||||
->join('user b', 'a.user_id = b.id', 'left')
|
||||
->join('user c', 'a.gift_user = c.id', 'left')
|
||||
->join('vs_gift d', 'a.gift_id = d.gid', 'left')
|
||||
->where('a.from',2)
|
||||
->where('a.from_id',$room_id)
|
||||
->where($where)
|
||||
->count();
|
||||
$list = db::name('vs_give_gift')->alias('a')
|
||||
->field('a.number,a.createtime,a.total_price,a.type,b.nickname,b.avatar,c.nickname as gift_nickname,c.avatar as gift_avatar,d.gift_name,a.from,a.from_id')
|
||||
->join('user b', 'a.user_id = b.id', 'left')
|
||||
->join('user c', 'a.gift_user = c.id', 'left')
|
||||
->join('vs_gift d', 'a.gift_id = d.gid', 'left')
|
||||
->where('a.from',2)
|
||||
->where('a.from_id',$room_id)
|
||||
->where($where)
|
||||
->order('a.id desc')
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
if($list){
|
||||
foreach ($list as &$v){
|
||||
$v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||
$v['content'] = $v['nickname'].' 给 '.$v['gift_nickname'].' 送了 '.$v['gift_name'].' x '.$v['number'];
|
||||
$v['content'] = $v['sender_nickname'].' 给 '.$v['receive_nickname'].' 送了 '.$v['gift_name'].' x '.$v['number'];
|
||||
// 来源:1聊天送礼物 2房间语聊送礼 3直播送礼 4动态打赏
|
||||
$v['from_str'] = model('Gift')->GiveGiftFromStr[$v['from']];
|
||||
|
||||
$v['from_str'] = model('adminapi/Gift')->GiveGiftFromStr[$v['from']];
|
||||
}
|
||||
}
|
||||
$where =[];
|
||||
$where['createtime'] = ['between', [strtotime($begin_time_table), strtotime($end_time_table)]];
|
||||
$all_total_price = 0;
|
||||
$tables = GiftTableManager::getTablesByTimeRange(
|
||||
strtotime($begin_time_table),
|
||||
strtotime($end_time_table)
|
||||
);
|
||||
if($tables){
|
||||
foreach ($tables as $table_name){
|
||||
//表前缀
|
||||
$table_prefix = config('database.prefix');
|
||||
$table_name = str_replace($table_prefix, '', $table_name);
|
||||
$total_price = db::name($table_name)
|
||||
->where('from',2)
|
||||
->where('from_id',$room_id)
|
||||
->where($where)->sum('total_price');
|
||||
$all_total_price += $total_price;
|
||||
}
|
||||
}
|
||||
//幸运流水总计
|
||||
$total_lucky_coin = db::name('vs_room_luck_value')->where('room_id',$room_id)->where($where)->sum('luck_value');
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $list,
|
||||
'total' =>[
|
||||
'total_price' => db::name('vs_give_gift')->alias('a')
|
||||
->join('user b', 'a.user_id = b.id', 'left')
|
||||
->where('a.from',2)
|
||||
->where('a.from_id',$room_id)
|
||||
->where($where)->sum('total_price')
|
||||
'total_price' => $all_total_price,
|
||||
'total_lucky_coin' => $total_lucky_coin,
|
||||
]
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
@@ -768,6 +825,26 @@ class Room extends adminApi
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
//添加房间
|
||||
public function add_room(){
|
||||
$admin_id = Session::get('admin_id');
|
||||
$user_code = input('user_code', '');
|
||||
$room_name = input('room_name', '');
|
||||
$room_cover = input('room_cover', '');
|
||||
$room_intro = input('room_intro', '');
|
||||
if($user_code == '' || $room_name == '' || $room_cover == '' || $room_intro == ''){
|
||||
return V(0,"参数错误");
|
||||
}
|
||||
$user_id = db::name('user')->where('user_code', $user_code)->value('id');
|
||||
if(!$user_id){
|
||||
return V(0,"用户不存在");
|
||||
}
|
||||
$reslut = model('api/Room')->user_create_room($user_id, $room_name, $room_cover, $room_intro,0,0);
|
||||
if($reslut['code'] == 0){
|
||||
return V(0,$reslut['msg']);
|
||||
}
|
||||
return V(1,"成功", $reslut);
|
||||
}
|
||||
|
||||
//编辑房间
|
||||
public function edit_room()
|
||||
@@ -875,8 +952,33 @@ class Room extends adminApi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//排序
|
||||
$sort = input('sort', '');//排序 越大越靠前
|
||||
if($sort !== ""){
|
||||
$data['sort'] = $sort;
|
||||
}
|
||||
if($type_id==-1){
|
||||
model('api/RoomSong')->agree_song(1,$room_id,1);
|
||||
unset($data['type_id']);
|
||||
}
|
||||
if($type_id==1){
|
||||
$data['label_id'] = 1;
|
||||
//推送给前端
|
||||
$text = [
|
||||
'room_id' => $room_id,
|
||||
'type' => $type_id,
|
||||
'text' => '房间类型已修改type--'.$type_id
|
||||
];
|
||||
model('api/Chat')->sendMsg(1012,$room_id,$text);
|
||||
}
|
||||
if($type_id == 9){
|
||||
$data['label_id'] = 6;
|
||||
}
|
||||
$data['updatetime'] = time();
|
||||
$res = db::name('vs_room')->where('id',$room_id)->update($data);
|
||||
if($res){
|
||||
Cache::rm('room_info_'.$room_id);
|
||||
return V(1,"成功");
|
||||
}
|
||||
else{
|
||||
@@ -1321,7 +1423,8 @@ class Room extends adminApi
|
||||
|
||||
foreach ($room_lists as &$value) {
|
||||
$value['room_code'] = model('api/Decorate')->user_decorate_detail($value['id'], 7);
|
||||
$value['user_name'] = model('User')->where(['id'=>$value['user_id']])->value('nickname').'-'.$value['user_id'];
|
||||
$user_code = db::name('user')->where(['id'=>$value['user_id']])->value('user_code');
|
||||
$value['user_name'] = model('User')->where(['id'=>$value['user_id']])->value('nickname').'-'.$user_code;
|
||||
$value['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||
$value['room_name'] = $value['room_name'].'-'.$value['room_number'];
|
||||
}
|
||||
@@ -1362,6 +1465,8 @@ class Room extends adminApi
|
||||
//发系统信息
|
||||
if($apply_status ==2){
|
||||
$deal_content = '审核通过';
|
||||
//首次建立房间【完成任务】
|
||||
model('api/Tasks')->tasks_complete($room_data['user_id'],34);
|
||||
}elseif($apply_status ==3){
|
||||
$deal_content = '审核未通过';
|
||||
}
|
||||
|
||||
227
application/adminapi/controller/RoomEmoji.php
Normal file
227
application/adminapi/controller/RoomEmoji.php
Normal file
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
use app\admin\model\AdminLog;
|
||||
use app\common\controller\adminApi;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\Hook;
|
||||
use think\Model;
|
||||
use think\Session;
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 房间
|
||||
* @internal
|
||||
*/
|
||||
class RoomEmoji extends adminApi
|
||||
{
|
||||
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = ['emoji_list','add_emoji','edit_emoji','del_emoji','emoji_detail','emoji_type_list'];
|
||||
|
||||
protected $table = 'vs_room_emoji';
|
||||
protected $table_type = 'vs_room_emoji_type';
|
||||
|
||||
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
|
||||
|
||||
}
|
||||
//房间表情列表
|
||||
function emoji_list(){
|
||||
$id = input('id', '', 'intval');
|
||||
$name = input('name', '', 'trim');
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$where = [];
|
||||
if ($id) {
|
||||
$where['id'] = $id;
|
||||
}
|
||||
if ($name) {
|
||||
$where['name'] = ['like', '%' . $name . '%'];
|
||||
}
|
||||
$total = Db::name($this->table)
|
||||
->where($where)
|
||||
->count();
|
||||
$list = Db::name($this->table)
|
||||
->where($where)
|
||||
->where(['deletetime' => 0])
|
||||
->order('sort desc,id desc')
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
foreach ($list as &$item) {
|
||||
$item['type_str'] = Db::name($this->table_type)->where('id', $item['type_id'])->value('type_name');
|
||||
$item['createtime'] = date('Y-m-d H:i:s', $item['createtime']);
|
||||
$item['status_str'] = $item['status'] == 1 ? '显示' : '隐藏';
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $total,
|
||||
'list' => $list
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
//添加房间表情
|
||||
function add_emoji(){
|
||||
$pid = input('pid', 0, 'intval');
|
||||
$name = input('name', '', 'trim');
|
||||
$img = input('image', '', 'trim');
|
||||
$animate_image = input('animate_image', '', 'trim');
|
||||
$sort = input('sort', 0, 'intval');
|
||||
$type_id = input('type_id', 0);
|
||||
$status = input('status', 1, 'intval');
|
||||
if (!$name) {
|
||||
return V(0, '请输入表情名称');
|
||||
}
|
||||
if (!$img) {
|
||||
return V(0, '请上传表情图片');
|
||||
}
|
||||
if (!$type_id) {
|
||||
return V(0, '请选择表情类型');
|
||||
}
|
||||
$data = [
|
||||
'pid' => $pid,
|
||||
'name' => $name,
|
||||
'image' => $img,
|
||||
'animate_image' => $animate_image,
|
||||
'sort' => $sort,
|
||||
'type_id' => $type_id,
|
||||
'status' => $status,
|
||||
'createtime' => time(),
|
||||
];
|
||||
$res = Db::name($this->table)->insert($data);
|
||||
if ($res) {
|
||||
return V(1, '添加成功');
|
||||
}
|
||||
}
|
||||
//房间表情修改
|
||||
function edit_emoji(){
|
||||
$id = input('id', 0, 'intval');
|
||||
$name = input('name', '', 'trim');
|
||||
$img = input('image', '', 'trim');
|
||||
$animate_image = input('animate_image', '', 'trim');
|
||||
$sort = input('sort', 0, 'intval');
|
||||
$type_id = input('type_id', 0);
|
||||
$status = input('status', 1, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要修改的表情');
|
||||
}
|
||||
if($name){
|
||||
$data['name'] = $name;
|
||||
}
|
||||
if($img){
|
||||
$data['image'] = $img;
|
||||
}
|
||||
if($animate_image){
|
||||
$data['animate_image'] = $animate_image;
|
||||
}
|
||||
if($sort){
|
||||
$data['sort'] = $sort;
|
||||
}
|
||||
if($type_id){
|
||||
$data['type_id'] = $type_id;
|
||||
}
|
||||
$data['status'] = $status;
|
||||
$res = Db::name($this->table)->where('id',$id)->update($data);
|
||||
if ($res) {
|
||||
return V(1, '修改成功');
|
||||
}
|
||||
}
|
||||
//房间表情删除
|
||||
function del_emoji(){
|
||||
$id = input('id', 0, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要删除的表情');
|
||||
}
|
||||
$res = Db::name($this->table)->where('id',$id)->update(
|
||||
['deletetime' => time()]
|
||||
);
|
||||
if ($res) {
|
||||
return V(1, '删除成功');
|
||||
}
|
||||
}
|
||||
//表情详情
|
||||
function emoji_detail(){
|
||||
$id = input('id', 0, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要查看的表情');
|
||||
}
|
||||
$detail = Db::name($this->table)->where('id',$id)->find();
|
||||
if (!$detail) {
|
||||
return V(0, '表情不存在');
|
||||
}
|
||||
return V(1,"成功", $detail);
|
||||
}
|
||||
|
||||
//表情类型列表
|
||||
function emoji_type_list(){
|
||||
$emoji_type = Db::name($this->table_type)
|
||||
->field('id,type_name')
|
||||
->where(['deletetime'=>0,'status'=>1])
|
||||
->order('sort desc,id desc')
|
||||
->select();
|
||||
return V(1,"成功", $emoji_type);
|
||||
}
|
||||
|
||||
//表情类型添加
|
||||
function add_emoji_type(){
|
||||
$type_name = input('type_name', '', 'trim');
|
||||
if (!$type_name) {
|
||||
return V(0, '请输入表情类型名称');
|
||||
}
|
||||
$data = [
|
||||
'type_name' => $type_name,
|
||||
'sort' => 0,
|
||||
'status' => 1,
|
||||
'createtime' => time(),
|
||||
];
|
||||
$res = Db::name($this->table_type)->insert($data);
|
||||
if ($res) {
|
||||
return V(1, '添加成功');
|
||||
}
|
||||
}
|
||||
//表情类型修改
|
||||
function edit_emoji_type(){
|
||||
$id = input('id', 0, 'intval');
|
||||
$type_name = input('type_name', '', 'trim');
|
||||
$sort = input('sort', 0, 'intval');
|
||||
$status = input('status', 1, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要修改的表情类型');
|
||||
}
|
||||
if($type_name){
|
||||
$data['type_name'] = $type_name;
|
||||
}
|
||||
if($sort){
|
||||
$data['sort'] = $sort;
|
||||
}
|
||||
if($status){
|
||||
$data['status'] = $status;
|
||||
}
|
||||
$res = Db::name($this->table_type)->where('id',$id)->update($data);
|
||||
if ($res) {
|
||||
return V(1, '修改成功');
|
||||
}
|
||||
return V(0, '修改失败');
|
||||
}
|
||||
//表情类型删除
|
||||
function del_emoji_type(){
|
||||
$id = input('id', 0, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要删除的表情类型');
|
||||
}
|
||||
$res = Db::name($this->table_type)->where('id',$id)->update(
|
||||
['deletetime' => time()]
|
||||
);
|
||||
if ($res) {
|
||||
return V(1, '删除成功');
|
||||
}
|
||||
return V(0, '删除失败');
|
||||
}
|
||||
}
|
||||
256
application/adminapi/controller/SingerSong.php
Normal file
256
application/adminapi/controller/SingerSong.php
Normal file
@@ -0,0 +1,256 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
use app\common\controller\adminApi;
|
||||
use think\Db;
|
||||
use think\Session;
|
||||
|
||||
class SingerSong extends adminApi
|
||||
{
|
||||
|
||||
//歌手认证列表
|
||||
public function singerList()
|
||||
{
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$start_time = input('start_time', '');
|
||||
$end_time = input('end_time', '');
|
||||
$search = input('search', '');
|
||||
$status = input('status', '');
|
||||
$where=[];
|
||||
$wheres = [];
|
||||
//搜索信息有值且是纯数字
|
||||
if(is_numeric($search)){
|
||||
$where['u.user_code'] = $search;
|
||||
$user_id = db::name('user')->where('user_code', $search)->value('id');
|
||||
$wheres['user_id'] = $user_id;
|
||||
}
|
||||
if($search && !is_numeric($search)){
|
||||
$where['u.nickname'] = ['like', '%'.$search.'%'];
|
||||
$user_id = db::name('user')->where('nickname', $search)->value('id');
|
||||
$wheres['user_id'] = $user_id;
|
||||
}
|
||||
if($start_time && $end_time){
|
||||
$where['ss.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||
$wheres['createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||
}
|
||||
if($status){
|
||||
$where['ss.status'] = $status;
|
||||
$wheres['status'] = $status;
|
||||
}
|
||||
|
||||
$count = db::name('vs_singer')->where($wheres)->count();
|
||||
$list = db::name('vs_singer')
|
||||
->alias('ss')
|
||||
->join('user u', 'ss.user_id=u.id', 'left')
|
||||
->field('ss.*,u.nickname,u.avatar,u.user_code,u.mobile,u.sex')
|
||||
->where($where)
|
||||
->order('ss.status asc ,ss.id desc')
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
if($list){
|
||||
foreach ($list as &$v){
|
||||
$v['createtime'] = date('Y-m-d H:i:s', $v['createtime']);
|
||||
}
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $list
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
|
||||
//歌手认证编辑
|
||||
public function singerEdit()
|
||||
{
|
||||
$id = input('id', '');
|
||||
if(empty($id)){
|
||||
return V(0, '参数错误');
|
||||
}
|
||||
$data = [
|
||||
'status' => input('status', ''),
|
||||
'remark' => input('remark', ''),
|
||||
];
|
||||
$res = db::name('vs_singer')->where('id', $id)->update($data);
|
||||
if($res){
|
||||
//推送消息-歌手认真成功
|
||||
//发系统信息
|
||||
if($data['status'] ==1){
|
||||
$deal_content = '审核通过';
|
||||
}elseif($data['status'] ==2){
|
||||
$deal_content = '审核拒绝';
|
||||
}
|
||||
if(!empty($data['remark'])){
|
||||
$deal_content .= ',原因:'.$data['remark'];
|
||||
}
|
||||
db::name('system_message')->insert([
|
||||
'title' => '歌手认证审核结果',
|
||||
'content' => '您的歌手认证申请 '.$deal_content,
|
||||
'type' => 1,
|
||||
'admin_id' => Session::get('admin_id'),
|
||||
'receiving_id' => db::name('vs_singer')->where('id', $id)->value('user_id'),
|
||||
'createtime' => time(),
|
||||
]);
|
||||
return V(1, '操作成功');
|
||||
}else{
|
||||
return V(0, '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//认证歌手歌曲列表
|
||||
public function singerSongList()
|
||||
{
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$user_id = input('user_id', '');
|
||||
$where=[];
|
||||
if($user_id){
|
||||
$where['user_id'] = $user_id;
|
||||
}else{
|
||||
return V(0, '请填写用户ID');
|
||||
}
|
||||
$count = db::name('vs_singer_song')->where($where)->count();
|
||||
$list = db::name('vs_singer_song')
|
||||
->alias('o')
|
||||
->join('user u', 'o.user_id=u.id', 'left')
|
||||
->join('vs_gift g', 'o.gift_id=g.gid', 'left')
|
||||
->field('o.*,u.nickname,u.user_code,g.gift_name,g.gift_price')
|
||||
->where($where)
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $list
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
|
||||
//歌手等级列表
|
||||
public function singerLevelList()
|
||||
{
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
|
||||
$where = ['deletetime' => 0];
|
||||
$count = db::name('vs_singer_level')->where($where)->count();
|
||||
$list = db::name('vs_singer_level')
|
||||
->where($where)
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $list
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
|
||||
|
||||
//编辑歌手等级
|
||||
public function singerLevelEdit()
|
||||
{
|
||||
$id = input('id', '');
|
||||
//没有 id就是新增
|
||||
if(empty($id)){
|
||||
$data = [
|
||||
'level' => input('level', ''),
|
||||
'name' => input('name', ''),
|
||||
'image' => input('image', ''),
|
||||
'change_value' => input('change_value', ''),
|
||||
'rights_icon' => input('rights_icon', ''),
|
||||
'bg_image' => input('bg_image', ''),
|
||||
'color' => input('color', ''),
|
||||
'createtime' => time(),
|
||||
];
|
||||
$res = db::name('vs_singer_level')->insert($data);
|
||||
if($res){
|
||||
return V(1, '操作成功');
|
||||
}else{
|
||||
return V(0, '操作失败');
|
||||
}
|
||||
}else{
|
||||
$data = [
|
||||
'level' => input('level', ''),
|
||||
'name' => input('name', ''),
|
||||
'image' => input('image', ''),
|
||||
'change_value' => input('change_value', ''),
|
||||
'rights_icon' => input('rights_icon', ''),
|
||||
'bg_image' => input('bg_image', ''),
|
||||
'color' => input('color', ''),
|
||||
];
|
||||
$res = db::name('vs_singer_level')->where('id', $id)->update($data);
|
||||
if($res){
|
||||
return V(1, '操作成功');
|
||||
}else{
|
||||
return V(0, '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//歌手等级删除
|
||||
public function singerLevelDel()
|
||||
{
|
||||
$id = input('id', '');
|
||||
$data['deletetime'] = time();
|
||||
$res = db::name('vs_singer_level')->where('id', $id)->update($data);
|
||||
if($res){
|
||||
return V(1, '操作成功');
|
||||
}else{
|
||||
return V(0, '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//点歌信息列表
|
||||
public function songList()
|
||||
{
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$type = input('type', 3);//1-今天,2-本周,3-本月,4-昨天
|
||||
$room_id = input('room_id', '');
|
||||
|
||||
$where=[];
|
||||
if($room_id){
|
||||
$where['room_id'] = $room_id;
|
||||
}else{
|
||||
return V(0, '请填写房间ID');
|
||||
}
|
||||
if($type==1){
|
||||
$where['o.createtime'] = ['between', [strtotime(date('Y-m-d')), strtotime(date('Y-m-d', strtotime('+1 day')))]];
|
||||
}elseif($type==2){
|
||||
$where['o.createtime'] = ['between', [strtotime(date('Y-m-d', strtotime('-7 day'))), strtotime(date('Y-m-d'))]];
|
||||
}elseif($type==3){
|
||||
$where['o.createtime'] = ['between', [strtotime(date('Y-m-01')), strtotime(date('Y-m-t', strtotime(date('Y-m-01'))))]];
|
||||
}elseif($type==4){
|
||||
$where['o.createtime'] = ['between', [strtotime(date('Y-m-d', strtotime('-1 day'))), strtotime(date('Y-m-d'))]];
|
||||
}
|
||||
$count = db::name('vs_song_log')->alias('o')->where($where)->count();
|
||||
$list = db::name('vs_song_log')
|
||||
->alias('o')
|
||||
->join('user u', 'o.user_id=u.id', 'left')
|
||||
->join('vs_singer_song r', 'o.singer_song_id=r.id', 'left')
|
||||
->join('user uu', 'r.user_id=u.id', 'left')
|
||||
->join('vs_gift g', 'r.gift_id=g.gid', 'left')
|
||||
->field('o.*,u.nickname boss_nickname,u.user_code boss_user_code,r.song_name,r.gift_num,uu.nickname singer_nickname,uu.user_code singer_user_code,g.gift_name,g.gift_price')
|
||||
->where($where)
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $list
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
use app\common\controller\adminApi;
|
||||
use app\common\library\GiftTableManager;
|
||||
use think\Db;
|
||||
use Yzh\YunPay;
|
||||
|
||||
@@ -11,6 +12,7 @@ class Statistical extends adminApi
|
||||
//初始化
|
||||
public function _initialize()
|
||||
{
|
||||
set_time_limit(0);
|
||||
parent::_initialize();
|
||||
}
|
||||
|
||||
@@ -85,6 +87,12 @@ class Statistical extends adminApi
|
||||
$search_uid = input('search_uid', '');
|
||||
$begin_time = input('begin_time', '');
|
||||
$end_time = input('end_time', '');
|
||||
|
||||
$firstDay = date('Y-m-01');
|
||||
$lastDay = date('Y-m-t 23:59:59');
|
||||
$begin_time = empty($begin_time) ? $firstDay : $begin_time;
|
||||
$end_time = empty($end_time) ? $lastDay : $end_time;
|
||||
|
||||
$where=[];
|
||||
$group = 'user_id';
|
||||
if($type == 2){
|
||||
@@ -117,11 +125,20 @@ class Statistical extends adminApi
|
||||
if(!empty($begin_time) && !empty($end_time)){
|
||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
|
||||
}
|
||||
$count = db::name('vs_give_gift')
|
||||
|
||||
$tables = GiftTableManager::getTablesByTimeRange(
|
||||
strtotime($begin_time),
|
||||
strtotime($end_time)
|
||||
);
|
||||
if(empty($tables)){
|
||||
$tables[0] = "fa_vs_give_gift";
|
||||
}
|
||||
$table_name = substr($tables[0], 3);//截取可查询的表名
|
||||
$count = db::name($table_name)
|
||||
->where($where)
|
||||
->group($group)
|
||||
->count();
|
||||
$lists = db::name('vs_give_gift')
|
||||
$lists = db::name($table_name)
|
||||
->field('id,createtime,user_id,gift_user,sum(total_price) as total_price,sum(number) as number')
|
||||
->where($where)
|
||||
->group($group)
|
||||
@@ -185,13 +202,13 @@ class Statistical extends adminApi
|
||||
// 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮
|
||||
// 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换
|
||||
// 15.首充 16.天降好礼充值 17.退出工会扣款 18.房主收益 19.主持人收益 20.抢头条 21.公会长收益
|
||||
$where['change_type'] = ['in', [4,7,10,17,20]];
|
||||
$count = db::name('vs_user_money_log')
|
||||
$where['change_type'] = ['in', [4,7,10,17,20,24,25,32,42,50,56,59]];
|
||||
$count = db::name('user_coin_log')
|
||||
->where($where)
|
||||
->group('user_id')
|
||||
->count();
|
||||
$lists = db::name('vs_user_money_log')
|
||||
->field('log_id,createtime,user_id,sum(change_value) as change_value')
|
||||
$lists = db::name('user_coin_log')
|
||||
->field('id,createtime,user_id,sum(coin) as change_value')
|
||||
->where($where)
|
||||
->group('user_id')
|
||||
->order('change_value desc')
|
||||
@@ -209,7 +226,7 @@ class Statistical extends adminApi
|
||||
'count' => $count,
|
||||
'lists' => $lists,
|
||||
'total' =>[
|
||||
'total_price' => db::name('vs_user_money_log')->where($where)->sum('change_value')
|
||||
'total_price' => db::name('user_coin_log')->where($where)->sum('coin')
|
||||
]
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
@@ -244,13 +261,21 @@ class Statistical extends adminApi
|
||||
if(!empty($begin_time) && !empty($end_time)){
|
||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
|
||||
}
|
||||
$tables = GiftTableManager::getTablesByTimeRange(
|
||||
strtotime($begin_time),
|
||||
strtotime($end_time)
|
||||
);
|
||||
if(empty($tables)){
|
||||
$tables[0] = "fa_vs_give_gift";
|
||||
}
|
||||
$table_name = substr($tables[0], 3);//截取可查询的表名
|
||||
//不为空
|
||||
$where['from'] = 2;
|
||||
$count = db::name('vs_give_gift')
|
||||
$count = db::name($table_name)
|
||||
->where($where)
|
||||
->group('from_id')
|
||||
->count();
|
||||
$lists = db::name('vs_give_gift')
|
||||
$lists = db::name($table_name)
|
||||
->field('id,createtime,user_id,gift_user,sum(total_price) as total_price,sum(number) as number,from_id')
|
||||
->where($where)
|
||||
->group('from_id')
|
||||
@@ -270,15 +295,41 @@ class Statistical extends adminApi
|
||||
$lists[$key]['room_cover'] = db::name('vs_room')->where('id', $value['from_id'])->value('room_cover');
|
||||
$label = db::name('vs_room')->where('id', $value['from_id'])->value('label_id');
|
||||
$lists[$key]['label'] = db::name('vs_room_label')->where('id', $label)->value('label_name');
|
||||
//幸运币统计
|
||||
$where_lucky = [];
|
||||
if($begin_time !== ''){
|
||||
$where_lucky['createtime'] = ['>=', strtotime($begin_time)];
|
||||
}
|
||||
if($end_time !== ''){
|
||||
$where_lucky['createtime'] = ['<=', strtotime($end_time)];
|
||||
}
|
||||
if(!empty($begin_time) && !empty($end_time)){
|
||||
$where_lucky['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
|
||||
}
|
||||
$lists[$key]['lucky_coin'] = db::name('vs_room_luck_value')->where('room_id',$value['from_id'])->where($where_lucky)->sum('luck_value');
|
||||
|
||||
}
|
||||
$where_lucky = [];
|
||||
if($search_room_id !== '' || $room_name !== ''){
|
||||
$where_lucky['room_id'] = $room_id;
|
||||
}
|
||||
if($begin_time !== ''){
|
||||
$where_lucky['createtime'] = ['>=', strtotime($begin_time)];
|
||||
}
|
||||
if($end_time !== ''){
|
||||
$where_lucky['createtime'] = ['<=', strtotime($end_time)];
|
||||
}
|
||||
if(!empty($begin_time) && !empty($end_time)){
|
||||
$where_lucky['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $lists,
|
||||
'total' =>[
|
||||
'total_price' => db::name('vs_give_gift')->where($where)->sum('total_price')
|
||||
'total_price' => db::name($table_name)->where($where)->sum('total_price'),
|
||||
'total_lucky_coin' => db::name('vs_room_luck_value')->where($where_lucky)->sum('luck_value'),
|
||||
]
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
@@ -481,4 +532,304 @@ class Statistical extends adminApi
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
//任务统计
|
||||
public function task_statistics(){
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 10);
|
||||
$search_id = input('search_uid', '');
|
||||
$search_name = input('search_name', '');
|
||||
$search_task_id = input('search_task_id', '');
|
||||
$search_task_name = input('search_task_name', '');
|
||||
$begin_time = input('begin_time', '');
|
||||
$end_time = input('end_time', '');
|
||||
$where =[];
|
||||
$search_user_id = 0;
|
||||
$search_gift_bag_id = 0;
|
||||
if($search_id){
|
||||
$where['b.user_code'] = $search_id;
|
||||
}
|
||||
if($search_name){
|
||||
$where['b.nickname'] = ['like', '%'.$search_name.'%'];
|
||||
}
|
||||
if($search_task_id){
|
||||
$where['a.task_id'] = $search_task_id;
|
||||
}
|
||||
if($search_task_name){
|
||||
$where['c.task_name'] = ['like', '%'.$search_task_name.'%'];
|
||||
}
|
||||
if(!empty($begin_time) && !empty($end_time)){
|
||||
$where['a.collection_time'] = ['between', [strtotime($begin_time), strtotime($end_time)]];
|
||||
}else{
|
||||
if(!empty($begin_time)){
|
||||
$where['a.collection_time'] = ['>=', strtotime($begin_time)];
|
||||
}elseif(!empty($end_time)){
|
||||
$where['a.collection_time'] = ['<=', strtotime($end_time)];
|
||||
}
|
||||
}
|
||||
if(!empty($begin_time) && !empty($end_time)){
|
||||
$where['a.createtime'] = ['between', [strtotime($begin_time), strtotime($end_time)]];
|
||||
}else{
|
||||
if(!empty($begin_time)){
|
||||
$where['a.createtime'] = ['>=', strtotime($begin_time)];
|
||||
}elseif(!empty($end_time)){
|
||||
$where['a.createtime'] = ['<=', strtotime($end_time)];
|
||||
}
|
||||
}
|
||||
// 添加条件:只统计已领取的任务奖励
|
||||
// $where['a.is_claimed'] = 1;
|
||||
|
||||
$count = db::name('vs_tasks_user_daily')
|
||||
->alias('a')
|
||||
->join('user b', 'a.user_id = b.id')
|
||||
->join('vs_tasks c', 'a.task_id = c.id')
|
||||
->where($where)
|
||||
->count();
|
||||
$lists = db::name('vs_tasks_user_daily')
|
||||
->alias('a')
|
||||
->join('user b', 'a.user_id = b.id')
|
||||
->join('vs_tasks c', 'a.task_id = c.id')
|
||||
->where($where)
|
||||
->field('a.*,c.task_name,b.nickname,b.user_code,c.tasks_bag_id')
|
||||
->order('a.id desc')
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
|
||||
// 收集所有需要的用户ID和任务包ID以批量获取数据
|
||||
$user_ids = array_column($lists, 'user_id');
|
||||
$bag_ids = array_unique(array_filter(array_column($lists, 'tasks_bag_id')));
|
||||
|
||||
// 批量获取用户装饰详情
|
||||
$user_decorates = [];
|
||||
if (!empty($user_ids)) {
|
||||
foreach ($user_ids as $user_id) {
|
||||
$user_decorates[$user_id] = model('api/Decorate')->user_decorate_detail($user_id, 6);
|
||||
}
|
||||
}
|
||||
// 批量获取奖励包详情
|
||||
$bag_details = [];
|
||||
if (!empty($bag_ids)) {
|
||||
$details = db::name('vs_gift_bag_detail')
|
||||
->where('gift_bag_id', 'in', $bag_ids)
|
||||
->select();
|
||||
|
||||
foreach ($details as $detail) {
|
||||
$bag_details[$detail['gift_bag_id']][] = $detail;
|
||||
}
|
||||
}
|
||||
// 获取所有相关礼品的价格信息
|
||||
$gift_ids = [];
|
||||
$decorate_ids = [];
|
||||
foreach ($bag_details as $details) {
|
||||
foreach ($details as $detail) {
|
||||
if ($detail['type'] == 2) {
|
||||
$gift_ids[] = $detail['foreign_id'];
|
||||
} elseif ($detail['type'] == 3) {
|
||||
$decorate_ids[] = $detail['foreign_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
// 批量获取礼品价格
|
||||
$gift_prices = [];
|
||||
if (!empty($gift_ids)) {
|
||||
$gifts = db::name('vs_gift')
|
||||
->where('gid', 'in', array_unique($gift_ids))
|
||||
->column('gift_price', 'gid');
|
||||
$gift_prices = $gifts;
|
||||
}
|
||||
|
||||
// 批量获取装饰价格
|
||||
$decorate_prices = [];
|
||||
if (!empty($decorate_ids)) {
|
||||
$decorates = db::name('vs_decorate_price')
|
||||
->where('id', 'in', array_unique($decorate_ids))
|
||||
->column('price', 'id');
|
||||
$decorate_prices = $decorates;
|
||||
}
|
||||
|
||||
$data_list = [];
|
||||
$total_reward_price = 0;
|
||||
foreach ($lists as $listkey=>$list){
|
||||
$user_code = isset($user_decorates[$list['user_id']]) ? $user_decorates[$list['user_id']] : '';
|
||||
$data_list[$listkey]['user_code'] = $user_code;
|
||||
$data_list[$listkey]['nickname'] = $list['nickname']."-".$user_code;
|
||||
$data_list[$listkey]['task_name'] = $list['task_name'];
|
||||
$data_list[$listkey]['createtime'] = date('Y-m-d H:i:s', $list['createtime']);
|
||||
$data_list[$listkey]['is_completed'] = $list['is_completed'];//是否已完成
|
||||
$data_list[$listkey]['is_completed_str'] = $list['is_completed']==1 ?"是":"否";
|
||||
//领取状态
|
||||
$data_list[$listkey]['is_claimed'] = $list['is_claimed']; //奖励是否已领取
|
||||
$data_list[$listkey]['is_claimed_str'] = $list['is_claimed']==1 ?"是":"否";
|
||||
//奖品内容
|
||||
$data_list[$listkey]['reward_str'] = "";
|
||||
//奖品价值
|
||||
$data_list[$listkey]['reward_price'] = 0;
|
||||
|
||||
$data_list[$listkey]['completion_time'] = date('Y-m-d H:i:s', $list['completion_time']);
|
||||
$data_list[$listkey]['collection_time'] = date('Y-m-d H:i:s', $list['collection_time']);
|
||||
|
||||
// 计算奖励信息
|
||||
if (isset($bag_details[$list['tasks_bag_id']])) {
|
||||
if($list['task_id']==1){
|
||||
$sign_in_info = Db::name('vs_user_tasks_sign_in')->where(['user_id'=>$list['user_id'],'sign_in_date'=>date('Y-m-d', $list['createtime'])])->order('id desc')->find();
|
||||
if($sign_in_info){
|
||||
$data_list[$listkey]['reward_str'] = ($bag_details[$list['tasks_bag_id']][$sign_in_info['continuous']-1]['gold']
|
||||
* $bag_details[$list['tasks_bag_id']][$sign_in_info['continuous']-1]['quantity'])
|
||||
.$bag_details[$list['tasks_bag_id']][$sign_in_info['continuous']-1]['name'];
|
||||
$data_list[$listkey]['reward_price'] = $bag_details[$list['tasks_bag_id']][$sign_in_info['continuous']-1]['gold']
|
||||
* $bag_details[$list['tasks_bag_id']][$sign_in_info['continuous']-1]['quantity'];
|
||||
}
|
||||
}else{
|
||||
$reward_info = $bag_details[$list['tasks_bag_id']];
|
||||
foreach ($reward_info as $value) {
|
||||
//价格
|
||||
$reward_price = 0;
|
||||
if($value['type'] == 1){
|
||||
$reward_name = $value['quantity'].$value['name'];
|
||||
$reward_price = $value['gold'] * $value['quantity'];
|
||||
}elseif($value['type'] == 2){
|
||||
$reward_name = $value['name'].'x'.$value['quantity'];
|
||||
$gift_price = isset($gift_prices[$value['foreign_id']]) ? $gift_prices[$value['foreign_id']] : 0;
|
||||
$reward_price = $gift_price * $value['quantity'];
|
||||
}elseif($value['type'] == 3){
|
||||
$reward_name = $value['name'].'x'.$value['days'].'天';
|
||||
//$reward_price = isset($decorate_prices[$value['foreign_id']]) ? $decorate_prices[$value['foreign_id']] : 0;
|
||||
}else{
|
||||
$reward_name = $value['quantity'].$value['name'];
|
||||
//$reward_price = $value['gold'] * $value['quantity'];
|
||||
}
|
||||
$data_list[$listkey]['reward_str'] .= $reward_name." ";
|
||||
$data_list[$listkey]['reward_price'] += $reward_price;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'total_reward_price' => 0,//$this->get_claimed_reward_price($begin_time, $end_time,$search_user_id,$search_gift_bag_id),
|
||||
'lists' => $data_list,
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
//每日任务领取金币统计
|
||||
public function get_claimed_reward_price_show(){
|
||||
$search_id = input('search_uid', '');
|
||||
$search_name = input('search_name', '');
|
||||
$search_task_id = input('search_task_id', '');
|
||||
$search_task_name = input('search_task_name', '');
|
||||
$begin_time = input('begin_time', '');
|
||||
$end_time = input('end_time', '');
|
||||
$search_user_id = 0;
|
||||
if($search_id){
|
||||
$search_user_id= db::name('user')->where('user_code', $search_id)->value('id');
|
||||
}
|
||||
if($search_name){
|
||||
$search_user_id= db::name('user')->where('nickname', $search_name)->value('id');
|
||||
}
|
||||
$search_gift_bag_id = 0;
|
||||
if($search_task_name){
|
||||
$search_gift_bag_id = db::name('vs_tasks')->where('task_name', $search_task_name)->value('tasks_bag_id');
|
||||
}
|
||||
if($search_task_id){
|
||||
$search_gift_bag_id = db::name('vs_tasks')->where('id', $search_task_id)->value('tasks_bag_id');
|
||||
}
|
||||
$total_reward_price = $this->get_claimed_reward_price($begin_time, $end_time,$search_user_id,$search_gift_bag_id);
|
||||
return V(1,"成功", ['total_reward_price' => $total_reward_price]);
|
||||
}
|
||||
//获取已领取任务奖励的总价值
|
||||
public function get_claimed_reward_price($stime="",$etime="",$search_user_id=0,$search_gift_bag_id=0){
|
||||
//获取所有已领取的任务奖励礼包
|
||||
$where = [];
|
||||
if($search_user_id > 0){
|
||||
$where['a.user_id'] = $search_user_id;
|
||||
}
|
||||
if($search_gift_bag_id > 0){
|
||||
$where['a.gift_bag_id'] = $search_gift_bag_id;
|
||||
}
|
||||
if(!empty($etime) && strtotime($etime)<="1767114849"){//2025-12-31 01:14:09
|
||||
if(!empty($stime) && !empty($etime)){
|
||||
$where['a.createtime'] = ['between', [strtotime($stime), strtotime($etime)]];
|
||||
}else{
|
||||
if(!empty($stime)){
|
||||
$where['a.createtime'] = ['>=', strtotime($stime)];
|
||||
}elseif(!empty($etime)){
|
||||
$where['a.createtime'] = ['<=', strtotime($etime)];
|
||||
}
|
||||
}
|
||||
$tasks_bag_details = db::name('vs_gift_bag_receive_log')
|
||||
->alias('a')
|
||||
->join('vs_gift_bag_detail b', 'a.parent_id=b.id', 'INNER')
|
||||
->field('a.createtime,b.type,b.foreign_id,b.quantity,b.gold')
|
||||
->where(['b.type'=>['in', [1,2]]])
|
||||
->whereBetween('a.gift_bag_id', [18, 51])
|
||||
->where($where)
|
||||
->select();
|
||||
}else{
|
||||
if(!empty($stime) && strtotime($stime)<="1767114849" && strtotime($etime)>"1767114849"){
|
||||
$old_tasks_bag_details = db::name('vs_gift_bag_receive_log')
|
||||
->alias('a')
|
||||
->join('vs_gift_bag_detail b', 'a.parent_id=b.id', 'INNER')
|
||||
->field('a.createtime,b.type,b.foreign_id,b.quantity,b.gold')
|
||||
->where(['b.type'=>['in', [1,2]]])
|
||||
->whereBetween('a.gift_bag_id', [18, 51])
|
||||
->whereBetween('a.createtime', [strtotime($stime), 1767114849])
|
||||
->where($where)
|
||||
->select();
|
||||
$new_tasks_bag_details = db::name('vs_gift_bag_receive_tasks_log')
|
||||
->alias('a')
|
||||
->join('vs_gift_bag_detail b', 'a.parent_id=b.id', 'INNER')
|
||||
->field('a.createtime,b.type,b.foreign_id,b.quantity,b.gold')
|
||||
->where(['b.type'=>['in', [1,2]]])
|
||||
->whereBetween('a.gift_bag_id', [18, 51])
|
||||
->whereBetween('a.createtime', [1767114849, strtotime($etime)])
|
||||
->where($where)
|
||||
->select();
|
||||
$tasks_bag_details = array_merge($old_tasks_bag_details, $new_tasks_bag_details);
|
||||
}else{
|
||||
if(!empty($stime) && !empty($etime)){
|
||||
$where['a.createtime'] = ['between', [strtotime($stime), strtotime($etime)]];
|
||||
}else{
|
||||
if(!empty($stime)){
|
||||
$where['a.createtime'] = ['>=', strtotime($stime)];
|
||||
}elseif(!empty($etime)){
|
||||
$where['a.createtime'] = ['<=', strtotime($etime)];
|
||||
}
|
||||
}
|
||||
$tasks_bag_details = db::name('vs_gift_bag_receive_tasks_log')
|
||||
->alias('a')
|
||||
->join('vs_gift_bag_detail b', 'a.parent_id=b.id', 'INNER')
|
||||
->field('a.createtime,b.type,b.foreign_id,b.quantity,b.gold')
|
||||
->where(['b.type'=>['in', [1,2]]])
|
||||
->whereBetween('a.gift_bag_id', [18, 51])
|
||||
->where($where)
|
||||
->select();
|
||||
}
|
||||
}
|
||||
$total_reward_price = 0;
|
||||
// 批量获取礼物价格以减少数据库查询
|
||||
$gift_ids = [];
|
||||
foreach ($tasks_bag_details as $detail) {
|
||||
if($detail['type'] == 2) {
|
||||
$gift_ids[] = $detail['foreign_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$gift_prices = [];
|
||||
if (!empty($gift_ids)) {
|
||||
$gifts = db::name('vs_gift')->where('gid', 'in', array_unique($gift_ids))->column('gift_price', 'gid');
|
||||
$gift_prices = $gifts ?: [];
|
||||
}
|
||||
|
||||
foreach ($tasks_bag_details as $detail){
|
||||
if($detail['type'] == 1){
|
||||
$total_reward_price += $detail['gold'] * $detail['quantity'];
|
||||
}else{
|
||||
$gift_price = isset($gift_prices[$detail['foreign_id']]) ? $gift_prices[$detail['foreign_id']] : 0;
|
||||
$total_reward_price += $gift_price * $detail['quantity'];
|
||||
}
|
||||
}
|
||||
return $total_reward_price;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace app\adminapi\controller;
|
||||
|
||||
use app\admin\model\AdminLog;
|
||||
use app\common\controller\adminApi;
|
||||
use think\Cache;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\Hook;
|
||||
@@ -35,6 +36,11 @@ class SysSet extends adminApi
|
||||
'10' => '邀请奖励',
|
||||
'11' => '二级密码',
|
||||
];
|
||||
public $noAdminConfigType = [
|
||||
'1' => '基础设置',
|
||||
'4' => '提现设置',
|
||||
'8' => '房间配置',
|
||||
];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
@@ -45,7 +51,11 @@ class SysSet extends adminApi
|
||||
* 类型列表
|
||||
*/
|
||||
public function type_list(){
|
||||
if($this->auth->isSuperAdmin()){
|
||||
$configType = $this->configType;
|
||||
}else{
|
||||
$configType = $this->noAdminConfigType;
|
||||
}
|
||||
$list = [];
|
||||
$i=0;
|
||||
foreach ($configType as $k=>$v){
|
||||
@@ -86,9 +96,25 @@ class SysSet extends adminApi
|
||||
$data = [
|
||||
'key_value'=>$v,
|
||||
];
|
||||
if($k == 'is_maintenance' || $k == 'inside_uid'){
|
||||
Cache::rm($k);
|
||||
}
|
||||
db::name($this->table)->where(['key_title'=>$k])->update($data);
|
||||
}
|
||||
return V(1,"成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 二级密码验证
|
||||
*/
|
||||
public function check_second_pwd()
|
||||
{
|
||||
$secondary_password = input('password', '');
|
||||
$check_pass = model('adminapi/admin')->check_secondary_password($secondary_password);
|
||||
if ($check_pass['code'] == 1) {
|
||||
return V(1, "验证成功");
|
||||
} else {
|
||||
return V(0, $check_pass['msg']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,9 @@ class SystemMessage extends adminApi
|
||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||
$lists[$key]['updatetime'] = date('Y-m-d H:i:s', $value['updatetime']);
|
||||
$lists[$key]['type_name'] = $value['type'] == 1 ? '系统消息' : '官方公告';
|
||||
if($value['type'] == 5){
|
||||
$lists[$key]['type_name'] = '公会公告';
|
||||
}
|
||||
$lists[$key]['admin_name'] = db::name('admin')->where('id', $value['admin_id'])->value('nickname');
|
||||
if($lists[$key]['room_id'] > 0){
|
||||
$lists[$key]['room_id'] = $lists[$key]['room_id'].'-'.db::name('vs_room')->where('id', $value['room_id'])->value('room_name');
|
||||
@@ -75,7 +78,7 @@ class SystemMessage extends adminApi
|
||||
$data['title'] = $title;
|
||||
}
|
||||
|
||||
$content = input('content', '');
|
||||
$content = input('content', ''); //$_POST['content'] ?? '';
|
||||
if($content){
|
||||
$data['content'] = $content;
|
||||
}
|
||||
|
||||
@@ -18,13 +18,7 @@ class Tasks extends adminApi
|
||||
{
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = [];
|
||||
protected $table = 'vs_daily_tasks';
|
||||
public $task_type = [
|
||||
'1' => '每日任务',
|
||||
'2' => '每日特殊任务',
|
||||
'3' => '平台常规任务'
|
||||
];
|
||||
|
||||
protected $table = 'vs_tasks';
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
@@ -41,21 +35,20 @@ class Tasks extends adminApi
|
||||
if($seach_task_type != ''){
|
||||
$where['task_type'] = $seach_task_type;
|
||||
}
|
||||
$list = db::name('vs_daily_tasks')->where(['delete_time'=>0])->where($where)->page($page, $page_limit)->order(['sort'=>'desc','task_id'=>'desc'])->select();
|
||||
$count = db::name('vs_daily_tasks')->where(['delete_time'=>0])->where($where)->count();
|
||||
$list = db::name('vs_tasks')->where(['delete_time'=>0])->where($where)->page($page, $page_limit)->order(['sort'=>'desc','id'=>'desc'])->select();
|
||||
$count = db::name('vs_tasks')->where(['delete_time'=>0])->where($where)->count();
|
||||
$list_data = [];
|
||||
foreach ($list as $k=>$v){
|
||||
$list_data[$k]['task_id'] = $v['task_id'];
|
||||
$list_data[$k]['task_id'] = $v['id'];
|
||||
$list_data[$k]['icon'] = $v['icon'];
|
||||
$list_data[$k]['task_name'] = $v['task_name'];
|
||||
$list_data[$k]['task_description'] = $v['task_description']??"";
|
||||
$list_data[$k]['gold_reward'] = $v['gold_reward'];
|
||||
$list_data[$k]['target_quantity'] = $v['target_quantity'];
|
||||
$list_data[$k]['task_type'] = $v['task_type'];
|
||||
$list_data[$k]['task_type_str'] = $this->task_type[$v['task_type']];
|
||||
$list_data[$k]['task_type_str'] = model('api/Tasks')->task_type[$v['task_type']]?? '';
|
||||
$list_data[$k]['sort'] = $v['sort'];
|
||||
$list_data[$k]['bag_id'] = $v['bag_id'];
|
||||
$list_data[$k]['bag_name'] = $v['bag_id']?db::name('vs_gift_bag')->where(['id'=>$v['bag_id']])->value('name'):'';
|
||||
$list_data[$k]['bag_id'] = $v['tasks_bag_id'];
|
||||
$list_data[$k]['bag_name'] = $v['tasks_bag_id']?db::name('vs_gift_bag')->where(['id'=>$v['tasks_bag_id']])->value('name'):'';
|
||||
$list_data[$k]['is_active'] = $v['is_active'];
|
||||
}
|
||||
$return_data = [
|
||||
@@ -63,7 +56,7 @@ class Tasks extends adminApi
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $list_data,
|
||||
'task_type' => $this->task_type,
|
||||
'task_type' => model('api/Tasks')->task_type,
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
@@ -95,7 +88,7 @@ class Tasks extends adminApi
|
||||
$data['sort'] = $sort;
|
||||
}
|
||||
if($bag_id != ''){
|
||||
$data['bag_id'] = $bag_id;
|
||||
$data['tasks_bag_id'] = $bag_id;
|
||||
}
|
||||
if($is_active != ''){
|
||||
$data['is_active'] = $is_active;
|
||||
@@ -103,13 +96,10 @@ class Tasks extends adminApi
|
||||
if($task_type != ''){
|
||||
$data['task_type'] = $task_type;
|
||||
}
|
||||
if($gold_reward != ''){
|
||||
$data['gold_reward'] = $gold_reward;
|
||||
}
|
||||
if($target_quantity){
|
||||
$data['target_quantity'] = $target_quantity;
|
||||
}
|
||||
$res = db::name($this->table)->where(['task_id'=>$task_id])->update($data);
|
||||
$res = db::name($this->table)->where(['id'=>$task_id])->update($data);
|
||||
if($res){
|
||||
return V(1,"修改成功");
|
||||
}else{
|
||||
@@ -123,7 +113,7 @@ class Tasks extends adminApi
|
||||
public function task_open(){
|
||||
$task_id = input('task_id', '');
|
||||
$is_active = input('is_active', '');
|
||||
$res = db::name($this->table)->where(['task_id'=>$task_id])->update(['is_active'=>$is_active]);
|
||||
$res = db::name($this->table)->where(['id'=>$task_id])->update(['is_active'=>$is_active]);
|
||||
if($res){
|
||||
return V(1,"开启成功");
|
||||
}else{
|
||||
|
||||
@@ -53,12 +53,19 @@ class UploadFile extends Upload
|
||||
$objectName = $fileName . '_' . $uniqueId . '.' . $extension;
|
||||
|
||||
// 调用父类方法上传到 OSS
|
||||
$result = $this->uploadFile($objectName, $filePath);
|
||||
// $result = $this->uploadFile($objectName, $filePath);
|
||||
// if (!$result) {
|
||||
// return V(0, '上传失败,请检查OSS配置或网络', null);
|
||||
// }
|
||||
// // 返回访问地址
|
||||
// $url = $this->config['oss_cdn_url'] . $objectName;
|
||||
|
||||
// 调用父类方法上传到 COS
|
||||
$result = $this->uploadFileCos($objectName, $filePath);
|
||||
if (!$result) {
|
||||
return V(0, '上传失败,请检查OSS配置或网络', null);
|
||||
return V(0, '上传失败,请检查COS配置或网络', null);
|
||||
}
|
||||
// 返回访问地址
|
||||
$url = $this->config['oss_cdn_url'] . $objectName;
|
||||
$url = $result;// 返回访问地址 具体访问地址根据你的实际配置来定这个需要修改 等域名通过备案后修改
|
||||
return V(1, '上传成功', ['url' => $url]);
|
||||
} catch (\Exception $e) {
|
||||
return V(0, '上传异常: ' . $e->getMessage(), null);
|
||||
|
||||
@@ -9,6 +9,7 @@ use think\Db;
|
||||
use think\Hook;
|
||||
use think\Session;
|
||||
use think\Validate;
|
||||
use app\common\library\Token as TokenLib;
|
||||
|
||||
/**
|
||||
* 后台首页
|
||||
@@ -35,8 +36,10 @@ class User extends adminApi
|
||||
$page_limit = input('page_limit', 30);
|
||||
$search_str = input('search', '');
|
||||
$search_user_code = input('search_user_code', '');
|
||||
$order_type = input('order_type', 'id');
|
||||
$order_type_val = input('order_type_val', '');
|
||||
$where['a.is_robot'] =0;
|
||||
$where['a.delete_time'] = 0;
|
||||
// $where['a.delete_time'] = 0;
|
||||
//如果是手机号查手机号
|
||||
if($search_str !==''){
|
||||
if(is_numeric($search_str)) {
|
||||
@@ -60,7 +63,7 @@ class User extends adminApi
|
||||
if($is_real == 1) {
|
||||
$where['b.is_real'] = 1;
|
||||
}else {
|
||||
$where['b.is_real'] = ['<>',1];
|
||||
$where['b.is_real'] = [['<>',1],['null', null],'or'];
|
||||
}
|
||||
}
|
||||
//高级搜索
|
||||
@@ -72,7 +75,9 @@ class User extends adminApi
|
||||
if($v=='coin1'){
|
||||
$where['c.coin'] = ['>=',$input_data];
|
||||
}elseif($v=='coin2'){
|
||||
if($input_data){
|
||||
$where['c.coin'] = ['<=',$input_data];
|
||||
}
|
||||
}elseif($v=='createtime'){
|
||||
$where['a.createtime'] = ['>=',strtotime($input_data)];
|
||||
$where['a.createtime'] = ['<=',strtotime($input_data)];
|
||||
@@ -91,26 +96,46 @@ class User extends adminApi
|
||||
a.login_device,
|
||||
a.loginip,
|
||||
c.coin,
|
||||
c.earnings,
|
||||
d.earnings,
|
||||
b.is_real,
|
||||
a.init_code,
|
||||
a.status
|
||||
';
|
||||
if($order_type_val ==2){
|
||||
$order_type_val_str = 'asc';
|
||||
}else{
|
||||
$order_type_val_str = 'desc';
|
||||
}
|
||||
$order = 'a.id '.$order_type_val_str;
|
||||
if($order_type=='coin'){
|
||||
$order = "c.coin ".$order_type_val_str;
|
||||
}elseif($order_type=='earnings'){
|
||||
$order = "d.earnings ".$order_type_val_str;
|
||||
}
|
||||
$user_data = db::name('user')->alias('a')
|
||||
->join('(SELECT * FROM fa_user_auth WHERE id IN (SELECT MAX(id) FROM fa_user_auth GROUP BY mobile)) b', 'a.mobile = b.mobile', 'LEFT')
|
||||
->join('user_wallet c', 'a.id = c.user_id','LEFT')
|
||||
->join('user_wallet_coin c', 'a.id = c.user_id','LEFT')
|
||||
->join('user_wallet_earnings d', 'a.id = d.user_id','LEFT')
|
||||
->where($where)
|
||||
->field($field)
|
||||
->order('a.id desc');
|
||||
->order($order);
|
||||
$lists = $user_data->page($page, $page_limit)->select();
|
||||
$count = db::name('user')->alias('a')
|
||||
->join('(SELECT * FROM fa_user_auth WHERE id IN (SELECT MAX(id) FROM fa_user_auth GROUP BY mobile)) b', 'a.mobile = b.mobile', 'LEFT')
|
||||
->join('user_wallet c', 'a.id = c.user_id','LEFT')
|
||||
->join('user_wallet_coin c', 'a.id = c.user_id','LEFT')
|
||||
->join('user_wallet_earnings d', 'a.id = d.user_id','LEFT')
|
||||
->where($where)
|
||||
->field($field)
|
||||
->order('a.id desc')->count();
|
||||
->count();
|
||||
foreach ($lists as $key => $value) {
|
||||
$lists[$key]['status_str'] = $value['status'] == 1 ? '正常' : '禁用';
|
||||
if($value['status'] == 1){
|
||||
$lists[$key]['status_str'] ='正常';
|
||||
}elseif($value['status'] == 2){
|
||||
$lists[$key]['status_str'] ='禁用';
|
||||
}else{
|
||||
$lists[$key]['status_str'] ='注销';
|
||||
}
|
||||
|
||||
$lists[$key]['is_real_str'] = $value['is_real'] == 1 ? '已实名' : '未实名';
|
||||
//禁用状态
|
||||
//1:禁用账号 2:禁用设备号 3:禁用IP
|
||||
@@ -146,9 +171,27 @@ class User extends adminApi
|
||||
$lists[$key]['special_num'] = "无";
|
||||
}
|
||||
}
|
||||
$total_coin = db::name('user')->alias('a')
|
||||
->join('(SELECT * FROM fa_user_auth WHERE id IN (SELECT MAX(id) FROM fa_user_auth GROUP BY mobile)) b', 'a.mobile = b.mobile', 'LEFT')
|
||||
->join('user_wallet_coin c', 'a.id = c.user_id','LEFT')
|
||||
->join('user_wallet_earnings d', 'a.id = d.user_id','LEFT')
|
||||
->where(['a.delete_time'=>0])
|
||||
->where($where)
|
||||
->field($field)
|
||||
->sum('c.coin');
|
||||
$total_earnings = db::name('user')->alias('a')
|
||||
->join('(SELECT * FROM fa_user_auth WHERE id IN (SELECT MAX(id) FROM fa_user_auth GROUP BY mobile)) b', 'a.mobile = b.mobile', 'LEFT')
|
||||
->join('user_wallet_coin c', 'a.id = c.user_id','LEFT')
|
||||
->join('user_wallet_earnings d', 'a.id = d.user_id','LEFT')
|
||||
->where(['a.delete_time'=>0])
|
||||
->where($where)
|
||||
->field($field)
|
||||
->sum('d.earnings');
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'total_coin' => $total_coin,
|
||||
'total_earnings' => $total_earnings,
|
||||
'count' => $count,
|
||||
'lists' => $lists
|
||||
];
|
||||
@@ -234,6 +277,9 @@ class User extends adminApi
|
||||
Db::name('block')->where($map)->delete();
|
||||
Db::name('sms_error')->where(['mobile' => $user_info['mobile']])->delete();
|
||||
}
|
||||
$token = db::name('user_token')->where('user_id', $user_id)->value('token');
|
||||
// 删除这个Token,使其失效
|
||||
TokenLib::delete($token);
|
||||
return V(1,"成功", null);
|
||||
}
|
||||
|
||||
@@ -335,7 +381,7 @@ class User extends adminApi
|
||||
$user_data['user_info']['wealth_level_icon'] = $user['wealth_level_icon'];
|
||||
$user_data['user_info']['user_code'] = $user['user_code'];
|
||||
$user_data['user_info']['mobile'] = $user['mobile'];
|
||||
$user_data['user_info']['sex'] = $user['sex']==1 ? '男' : '女';
|
||||
$user_data['user_info']['sex'] = $user['sex'];
|
||||
$user_data['user_info']['birthday'] = $user['birthday'];
|
||||
$user_data['user_info']['system'] = $user['system'];
|
||||
$user_data['user_info']['age'] = $user['age'];
|
||||
@@ -347,7 +393,16 @@ class User extends adminApi
|
||||
$user_data['user_info']['red_status_str'] = $user['red_status']==1 ? '开启' : '禁止';
|
||||
//标签
|
||||
$user_data['user_info']['tag'] = $user['tag_list'];
|
||||
$user_data['user_info']['createtime'] = date('Y-m-d H:i:s', $user['createtime']);//主持时间
|
||||
$user_data['user_info']['createtime'] = date('Y-m-d H:i:s', $user['createtime']);//注册时间
|
||||
//师傅 老师
|
||||
$user_sign = db::name('vs_user_sign')->where('sign_user_id', $user_id)->find();
|
||||
$user_data['user_info']['teacher_id'] = 0;
|
||||
$user_data['user_info']['teacher_nickname'] = '--';
|
||||
if($user_sign){
|
||||
$teacher_id = $user_sign['parent_user_id'];
|
||||
$user_data['user_info']['teacher_id'] = $teacher_id;
|
||||
$user_data['user_info']['teacher_nickname'] = db::name('user')->where('id', $teacher_id)->value('nickname');
|
||||
}
|
||||
//统计相关:
|
||||
$user_data['follow_num']['user_recharge_all_money'] = $user['user_recharge_all_money'];
|
||||
$user_data['follow_num']['coin'] = $user['coin'];
|
||||
@@ -423,7 +478,15 @@ class User extends adminApi
|
||||
$reslut = DB::name('user')->where('id', $user_id)->update($up_user);
|
||||
}
|
||||
if($up_user_data){
|
||||
$user_auth = DB::name('user_auth')->where('mobile', $user['mobile'])->find();
|
||||
if($user_auth){
|
||||
$res = DB::name('user_auth')->where('mobile', $user['mobile'])->update($up_user_data);
|
||||
}else{
|
||||
$up_user_data['mobile'] = $user['mobile'];
|
||||
if($real_name && $card_id){
|
||||
$res = DB::name('user_auth')->insert($up_user_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return V(1,'操作成功');
|
||||
}
|
||||
@@ -436,7 +499,15 @@ class User extends adminApi
|
||||
$page = input('page',1);
|
||||
$page_limit = input('page_limit',10);
|
||||
$type = input('type','');
|
||||
$return = model('UserWallet')->money_change_log($user_id,$type,$page,$page_limit);
|
||||
$stime = input('stime','');
|
||||
$etime = input('etime','');
|
||||
$change_type = input('change_type','');
|
||||
$seach = [
|
||||
'stime' => $stime,
|
||||
'etime' => $etime,
|
||||
'change_type' => $change_type
|
||||
];
|
||||
$return = model('UserWallet')->money_change_log($user_id,$seach,$type,$page,$page_limit);
|
||||
$list = [];
|
||||
foreach($return['list'] as $k=>$v){
|
||||
$list[$k] = [
|
||||
@@ -456,6 +527,14 @@ class User extends adminApi
|
||||
return V(1,"操作成功", $return_data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取用户资金类型
|
||||
*/
|
||||
public function get_money_type(){
|
||||
$reslut = model('UserWallet')->getChangeTypeLableList();
|
||||
return V(1,"操作成功", $reslut);
|
||||
}
|
||||
|
||||
/*
|
||||
* 相册列表
|
||||
*/
|
||||
@@ -516,7 +595,7 @@ class User extends adminApi
|
||||
a.user_code,
|
||||
a.login_device,
|
||||
c.coin,
|
||||
c.earnings,
|
||||
d.earnings,
|
||||
b.is_real,
|
||||
a.init_code,
|
||||
a.status,
|
||||
@@ -524,12 +603,14 @@ class User extends adminApi
|
||||
';
|
||||
$count = db::name('user')->alias('a')
|
||||
->join('fa_user_auth b', 'a.mobile = b.mobile','LEFT')
|
||||
->join('user_wallet c', 'a.id = c.user_id','LEFT')
|
||||
->join('user_wallet_coin c', 'a.id = c.user_id','LEFT')
|
||||
->join('user_wallet_earnings d', 'a.id = d.user_id','LEFT')
|
||||
->where($where)
|
||||
->count();
|
||||
$user_data = db::name('user')->alias('a')
|
||||
->join('fa_user_auth b', 'a.mobile = b.mobile','LEFT')
|
||||
->join('user_wallet c', 'a.id = c.user_id','LEFT')
|
||||
->join('user_wallet_coin c', 'a.id = c.user_id','LEFT')
|
||||
->join('user_wallet_earnings d', 'a.id = d.user_id','LEFT')
|
||||
->where($where)
|
||||
->field($field)
|
||||
->order('a.id desc');
|
||||
@@ -600,32 +681,68 @@ class User extends adminApi
|
||||
$page_limit = input('page_limit',10);
|
||||
$where['a.is_tester'] = 1;
|
||||
if($user_id){
|
||||
$where['a.user_id'] = $user_id;
|
||||
$where['b.user_code'] = $user_id;
|
||||
}
|
||||
if($gid){
|
||||
$where['a.gid'] = $gid;
|
||||
}
|
||||
$count = db::name('vs_user_gift_pack')->alias('a')->join('user b', 'a.user_id = b.id')->where($where)->count();
|
||||
$count = db::name('vs_user_gift_pack')
|
||||
->alias('a')
|
||||
->join('user b', 'a.user_id = b.id')
|
||||
->join('vs_gift c', 'a.gid = c.gid')
|
||||
->where($where)
|
||||
->where(['a.num'=>['>',0]])
|
||||
->count();
|
||||
$list = db::name('vs_user_gift_pack')
|
||||
->alias('a')
|
||||
->join('user b', 'a.user_id = b.id')
|
||||
->join('vs_gift c', 'a.gid = c.gid')
|
||||
->field('a.*,b.user_code,b.nickname,c.gift_name,c.base_image,c.gift_price')->where($where)->order('a.pid', "desc")->page($page, $page_limit)->select();
|
||||
->field('a.*,b.user_code,b.nickname,c.gift_name,c.base_image,c.gift_price')
|
||||
->where($where)
|
||||
->where(['a.num'=>['>',0]])
|
||||
->order('a.pid', "desc")
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
$gift_total = 0;
|
||||
$gift_count = 0;
|
||||
foreach ($list as $key => &$value) {
|
||||
$value['createtime'] = date('Y-m-d H:i:s',$value['createtime']);
|
||||
$value['user_id_nickname'] = $value['user_code'].'——'.$value['nickname'];
|
||||
$value['gift_id_name'] = $value['gid'].'——'.$value['gift_name'];
|
||||
$value['createtime'] = date('Y-m-d H:i:s',$value['updatetime']);
|
||||
$value['nickname'] = $value['nickname'].'-'.$value['user_code'];
|
||||
$value['gift_id_name'] = $value['gift_name'].'-'.$value['gid'];
|
||||
}
|
||||
//礼物个数
|
||||
$gift_count = db::name('vs_user_gift_pack')->alias('a')->join('user b', 'a.user_id = b.id')->where($where)->group('a.gid')->count();
|
||||
//礼物总金额
|
||||
$gift_total = db::name('vs_user_gift_pack')->alias('a')->join('user b', 'a.user_id = b.id')
|
||||
//礼物种类个数
|
||||
$gift_kinds = db::name('vs_user_gift_pack')->alias('a')->join('user b', 'a.user_id = b.id')->where($where)->where(['num'=>['>',0]])->group('a.gid')->count();
|
||||
$gift_count = db::name('vs_user_gift_pack')
|
||||
->alias('a')
|
||||
->join('user b', 'a.user_id = b.id')
|
||||
->join('vs_gift c', 'a.gid = c.gid')
|
||||
->where($where)->sum('c.gift_price');
|
||||
->where($where)
|
||||
->where(['a.num'=>['>',0]])
|
||||
->sum('a.num');
|
||||
// $gift_total = db::name('vs_user_gift_pack')
|
||||
// ->alias('a')
|
||||
// ->join('user b', 'a.user_id = b.id')
|
||||
// ->join('vs_gift c', 'a.gid = c.gid')
|
||||
// ->where($where)
|
||||
// ->where(['a.num'=>['>',0]])
|
||||
// ->sum('c.gift_price');
|
||||
$listss = Db::name('vs_user_gift_pack')->alias('a')
|
||||
->join('user b', 'a.user_id = b.id')
|
||||
->join('vs_gift c', 'a.gid = c.gid')
|
||||
->where($where)
|
||||
->field('a.num,c.gift_price')
|
||||
->select();
|
||||
|
||||
foreach ($listss as $v) {
|
||||
$gift_total += $v['num'] * $v['gift_price'];
|
||||
}
|
||||
|
||||
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'gift_kinds' => $gift_kinds,
|
||||
'gift_count' => $gift_count,
|
||||
'gift_total' => $gift_total,
|
||||
'lists' => $list
|
||||
@@ -744,4 +861,155 @@ class User extends adminApi
|
||||
$user = db::name('user')->field('id,nickname,avatar')->where($where)->where(['status'=>1,'is_robot'=>0,'delete_time'=>0])->select();
|
||||
return V(1,"操作成功", $user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//注销用户找回
|
||||
public function cancel_user_recovery(){
|
||||
$mobile = input('mobile', 0);
|
||||
|
||||
if (!$mobile){
|
||||
return V(0, "手机号不能为空");
|
||||
}
|
||||
$user = db::name('user')->where(['mobile'=>$mobile,'delete_time' => ['<>',0],'status'=>0])->find();
|
||||
if (!$user){
|
||||
return V(0, "该手机号未注销");
|
||||
}
|
||||
$user_count = db::name('user')->where(['mobile'=>$mobile,'delete_time' => 0])->count();
|
||||
if ($user_count > 3){
|
||||
return V(0, "该手机号绑定账号超限了");
|
||||
}
|
||||
$user_del = db::name('user')->where(['mobile'=>$mobile,'delete_time' => ['<>',0]])->count();
|
||||
if ($user_del > 1){
|
||||
return V(0, "相关注销超过1个,暂不支持找回");
|
||||
}
|
||||
//开启事务
|
||||
db::startTrans();
|
||||
try{
|
||||
$user_id = db::name('user')->where(['mobile'=>$mobile,'delete_time' => ['<>',0]])->value('id');
|
||||
db::name('user')->where(['id'=>$user_id])->update([
|
||||
'delete_time' => 0,
|
||||
'status' => 1,
|
||||
'nickname' => '游客_'.$user_id.rand(1000,9999),
|
||||
'avatar' => get_system_config_value('web_site').'/data/avatar/head_pic.png',
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
db::name('user_data')->where(['user_id'=>$user_id])->update([
|
||||
'deletetime' => 0,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
//查询创建的房间
|
||||
$room_list = db::name('vs_room')->where(['user_id'=>$user_id,'type_id' => ['<>',6]])->find();
|
||||
if($room_list){
|
||||
db::name('vs_room')->where(['id'=>$room_list['id']])->update([
|
||||
'room_status' => 1,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
}
|
||||
//查他的钱包
|
||||
//清空金币表
|
||||
$wallet_coin = db::name('user_wallet_coin')->where(['user_id'=>$user_id])->find();
|
||||
if($wallet_coin){
|
||||
db::name('user_wallet_coin')->where(['id'=>$wallet_coin['id']])->update([
|
||||
'coin' => 0,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
}
|
||||
//清空钻石表
|
||||
$wallet_earnings = db::name('user_wallet_earnings')->where(['user_id'=>$user_id])->find();
|
||||
if($wallet_earnings){
|
||||
db::name('user_wallet_earnings')->where(['id'=>$wallet_earnings['id']])->update([
|
||||
'earnings' => 0,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
}
|
||||
|
||||
//他的装扮
|
||||
$dress = db::name('vs_user_decorate')->where(['user_id'=>$user_id])->select();
|
||||
if($dress){
|
||||
foreach ($dress as $key => $value) {
|
||||
if($value['end_time'] > time()){
|
||||
db::name('vs_user_decorate')->where(['udid'=>$value['udid']])->update([
|
||||
'is_perpetual' => 2,
|
||||
'end_time' => time(),
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
db::commit();
|
||||
return V(1,"操作成功", null);
|
||||
}catch (\Exception $e){
|
||||
db::rollback();
|
||||
return V(0, "操作失败,".$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
//家族成员
|
||||
public function get_family_member(){
|
||||
$user_id = input('user_id', 0);
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
if (!$user_id){
|
||||
return V(0, "参数错误");
|
||||
}
|
||||
$user_sign = db::name('vs_user_sign')->where(['parent_user_id'=>$user_id,'end_time'=>['>',time()]])->select();
|
||||
$count = db::name('vs_user_sign')->where(['parent_user_id'=>$user_id,'end_time'=>['>',time()]])->count();
|
||||
$list = [];
|
||||
foreach ($user_sign as $key => $value) {
|
||||
$sign_user = db::name('user')->field('id,user_code,nickname,market_value')->where(['id'=>$value['sign_user_id']])->find();
|
||||
$list[$key]['id'] = $value['id'];
|
||||
$list[$key]['user_id'] = $sign_user['id'];
|
||||
$list[$key]['user_code'] = $sign_user['user_code'];
|
||||
$list[$key]['nickname'] = $sign_user['nickname'];
|
||||
$list[$key]['createtime'] = date('Y-m-d H:i:s',$value['createtime']);
|
||||
$list[$key]['end_time'] = date('Y-m-d H:i:s',$value['end_time']);
|
||||
//剩余天数
|
||||
$list[$key]['surplus_days'] = ceil(($value['end_time'] - time())/86400);
|
||||
//免费续约次数
|
||||
$list[$key]['free_renewal_times'] = 3 - $value['sign_times'];
|
||||
if($list[$key]['free_renewal_times']<=0){
|
||||
$list[$key]['free_renewal_times'] = 0;
|
||||
}
|
||||
//当前身价
|
||||
$list[$key]['market_value'] = $sign_user['market_value'];
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $list
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
//解约
|
||||
public function cancel_contract(){
|
||||
$user_sign_id = input('id', 0);
|
||||
if (!$user_sign_id){
|
||||
return V(0, "参数错误");
|
||||
}
|
||||
$user_sign = db::name('vs_user_sign')->where(['id'=>$user_sign_id])->find();
|
||||
if (!$user_sign){
|
||||
return V(0, "参数错误");
|
||||
}
|
||||
$resultt = db::name('vs_user_sign')
|
||||
->where(['id' => $user_sign_id])
|
||||
->update(['end_time' => time(),'sign_user_type' => 4,'type'=>4,'status' => 2]);
|
||||
if(!$resultt){
|
||||
return V(0, "操作失败");
|
||||
}
|
||||
//处理家族
|
||||
$myFamily = db::name('vs_family')
|
||||
->where(['user_id' => $user_sign['sign_user_id'],'type' => 0,'pid' => $user_sign['parent_user_id'],'deletetime' => 0])->find();
|
||||
if($myFamily){
|
||||
$mySignFamily = db::name('vs_family')->where(['user_id' => $user_sign['parent_user_id'],'type' => 1])->find();
|
||||
//删除群成员
|
||||
model('api/Tencent')->delete_group_member('f'.$mySignFamily['id'], $user_sign['sign_user_id']);
|
||||
//退出家族
|
||||
db::name('vs_family')->where('id', $myFamily['id'])->update(['deletetime' => time()]);
|
||||
}
|
||||
|
||||
|
||||
return V(1, "操作成功");
|
||||
}
|
||||
}
|
||||
121
application/adminapi/controller/UserCp.php
Normal file
121
application/adminapi/controller/UserCp.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
use app\common\controller\adminApi;
|
||||
use think\Db;
|
||||
|
||||
class UserCp extends adminApi
|
||||
{
|
||||
//用户CP等级列表
|
||||
public function userCpLevelList()
|
||||
{
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$where=['deletetime' => 0];
|
||||
$count = db::name('user_cp_level')->where($where)->count();
|
||||
$list = db::name('user_cp_level')
|
||||
->where($where)
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $list
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
|
||||
|
||||
//用户CP等级详情
|
||||
public function userCpLevelInfo()
|
||||
{
|
||||
$id = input('id', '');
|
||||
$where=['deletetime' => 0,'id'=>$id];
|
||||
$list = db::name('user_cp_level')->where($where)->find();
|
||||
if(empty($list)){
|
||||
return V(0,"数据不存在");
|
||||
}
|
||||
if($list['dress_id']){
|
||||
$dress = db::name('vs_decorate_price')->where('id',$list['dress_id'])->field('did,day')->find();
|
||||
$list['dress_title'] = '头像框-'.$dress['day'].'天-'.db::name('vs_decorate')->where('did',$dress['did'])->value('title');
|
||||
$list['dress_base_image'] = db::name('vs_decorate')->where('did',$dress['did'])->value('base_image');
|
||||
}else{
|
||||
$list['dress_title'] = '';
|
||||
$list['dress_base_image'] = '';
|
||||
}
|
||||
if($list['jiajia_id']){
|
||||
$jiajia = db::name('vs_decorate_price')->where('id',$list['jiajia_id'])->field('did,day')->find();
|
||||
$list['jiajia_title'] = '坐骑-'.$jiajia['day'].'天-'.db::name('vs_decorate')->where('did',$jiajia['did'])->value('title');
|
||||
$list['jiajia_base_image'] = db::name('vs_decorate')->where('did',$jiajia['did'])->value('base_image');
|
||||
}else{
|
||||
$list['jiajia_title'] = '';
|
||||
$list['jiajia_base_image'] = '';
|
||||
}
|
||||
if($list['pendant_id']){
|
||||
$pendant = db::name('vs_decorate_price')->where('id',$list['pendant_id'])->field('did,day')->find();
|
||||
$list['pendant_title'] = '装扮-'.$pendant['day'].'天-'.db::name('vs_decorate')->where('did',$pendant['did'])->value('title');
|
||||
$list['pendant_base_image'] = db::name('vs_decorate')->where('did',$pendant['did'])->value('base_image');
|
||||
}else{
|
||||
$list['pendant_title'] = '';
|
||||
$list['pendant_base_image'] = '';
|
||||
}
|
||||
if($list['rights_icon_id']){
|
||||
$rights_icon = db::name('vs_decorate_price')->where('id',$list['rights_icon_id'])->field('did,day')->find();
|
||||
$list['rights_icon_title'] = '特效-'.$rights_icon['day'].'天-'.db::name('vs_decorate')->where('did',$rights_icon['did'])->value('title');
|
||||
$list['rights_icon_base_image'] = db::name('vs_decorate')->where('did',$rights_icon['did'])->value('base_image');
|
||||
}else{
|
||||
$list['rights_icon_title'] = '';
|
||||
$list['rights_icon_base_image'] = '';
|
||||
}
|
||||
|
||||
return V(1,"成功", $list);
|
||||
}
|
||||
|
||||
//编辑用户CP等级
|
||||
public function userCpLevelEdit()
|
||||
{
|
||||
$id = input('id', '');
|
||||
$data = [
|
||||
'level' => input('level', ''),
|
||||
'name' => input('name', ''),
|
||||
'image' => input('image', ''),
|
||||
'change_value' => input('change_value', ''),
|
||||
'rights_icon_id' => input('rights_icon_id', ''),//特效id 11
|
||||
'dress_id' => input('dress_id', ''),
|
||||
'jiajia_id' => input('jiajia_id', ''),
|
||||
'pendant_id' => input('pendant_id', ''),//挂件(装扮)id 10
|
||||
'direction' => input('direction', 0),//挂件上的头像位置:0-上,1-右上,2-右,3-右下,4-下,5-左下,6-左,7-左上
|
||||
];
|
||||
//没有 id就是新增
|
||||
if(empty($id)){
|
||||
//新增
|
||||
$data['createtime'] = time();
|
||||
$res = db::name('user_cp_level')->insert($data);
|
||||
if($res){
|
||||
return V(1, '操作成功');
|
||||
}
|
||||
}else {
|
||||
$res = db::name('user_cp_level')->where('id', $id)->update($data);
|
||||
if($res){
|
||||
return V(1, '操作成功');
|
||||
}
|
||||
}
|
||||
return V(0, '操作失败');
|
||||
}
|
||||
|
||||
|
||||
//用户CP等级删除
|
||||
public function userCpLevelDel()
|
||||
{
|
||||
$id = input('id', '');
|
||||
$data['deletetime'] = time();
|
||||
$res = db::name('user_cp_level')->where('id', $id)->update($data);
|
||||
if($res){
|
||||
return V(1, '操作成功');
|
||||
}
|
||||
return V(0, '操作失败');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -162,6 +162,15 @@ class UserZone extends adminApi
|
||||
public function del_zone(){
|
||||
$id = input('id', 0);
|
||||
$res = db::name('user_zone')->where(['id'=>$id])->update(['is_delete'=> 2,'delete_time'=> time()]);
|
||||
if($res){
|
||||
//删除动态下的标签引用
|
||||
$top_zone = db::name('user_zone_topic')->where('zone_id',$id)->select();
|
||||
if($top_zone){
|
||||
foreach ($top_zone as $v){
|
||||
db::name('user_zone_topic')->where('id',$v['id'])->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
return V($res ? 1 : 0, $res ? '删除成功' : '删除失败');
|
||||
}
|
||||
|
||||
@@ -169,8 +178,46 @@ class UserZone extends adminApi
|
||||
public function del_comment(){
|
||||
$id = input('id', 0);
|
||||
$res = db::name('user_zone_comment')->where(['id'=>$id])->update(['is_delete'=> 2,'updatetime'=> time()]);
|
||||
if($res){
|
||||
$zone_id = db::name('user_zone_comment')->where(['id'=>$id])->value('zone_id');
|
||||
//删除评论下的回复
|
||||
$dd = db::name('user_zone_comment')->where('pid', $id)->find();
|
||||
if($dd){
|
||||
$reslut1 = db::name('user_zone_comment')->where('pid', $id)->update(['is_delete' => 2,'updatetime' => time()]);
|
||||
if (!$reslut1) {
|
||||
return ['code' => 0, 'msg' => '请重试!!', 'data' => null];
|
||||
}
|
||||
}
|
||||
//减少评论数量
|
||||
$num = db::name('user_zone_comment')->where('pid', $id)->count();
|
||||
if($num > 0){
|
||||
$num = $num + 1;
|
||||
}else{
|
||||
$num = 1;
|
||||
}
|
||||
$reslut2 = db::name('user_zone')->where('id', $zone_id)->setDec('comment_num', $num);
|
||||
if (!$reslut2) {
|
||||
return ['code' => 0, 'msg' => '请重试!!', 'data' => null];
|
||||
}
|
||||
}
|
||||
return V($res ? 1 : 0, $res ? '删除成功' : '删除失败');
|
||||
}
|
||||
|
||||
public function comment_zone()
|
||||
{
|
||||
$id = input('id', 0);
|
||||
$content = input('content', '');
|
||||
$comment_data = db::name('user_zone_comment')->where(['id'=>$id])->find();
|
||||
$zid = $comment_data['zone_id'];
|
||||
$pid = $id;
|
||||
$reply_to = input('reply_to', 0);
|
||||
if(!$reply_to){
|
||||
$reply_to = $comment_data['user_id'];
|
||||
}
|
||||
$reslut = model('api/UserZone')->comment_zone(21216, $zid, $content,$pid, $reply_to);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//动态置顶或显示操作操作
|
||||
public function zone_top_or_show(){
|
||||
$id = input('id', 0);
|
||||
|
||||
@@ -98,27 +98,34 @@ class Version extends adminApi
|
||||
* 修改
|
||||
*/
|
||||
public function version_edit(){
|
||||
$version = input('version', '');
|
||||
$type = input('type', '');
|
||||
$downloadurl = input('downloadurl', '');
|
||||
$content = $_POST['content'] ?? '';
|
||||
$enforce = input('enforce', '');
|
||||
$version_code = input('version_code', '');
|
||||
$status = input('status', 1);
|
||||
$version = input('version', '');//新版本好
|
||||
$type = input('type', '');//1-安卓 2-IOS
|
||||
$downloadurl = input('downloadurl', '');//下载地址
|
||||
$content = $_POST['content'] ?? '';//更新内容
|
||||
$enforce = input('enforce', '');//强制更新 1-是 0-否
|
||||
$version_code = input('version_code', '');//版本号(目前安卓使用,用来判定是否升级)
|
||||
$status = input('status', 1);//0-待发布,1-已发布,2-禁用
|
||||
|
||||
$id = input('id', '');
|
||||
$versions = db::name($this->table)->where(['newversion'=>$version,'id'=>['neq',$id]])->find();
|
||||
if($versions){
|
||||
$now_version = db::name($this->table)->where(['id'=>$id])->find();
|
||||
if(!$now_version){
|
||||
return V(0,"数据不存在");
|
||||
}
|
||||
$res = version_compare($now_version['newversion'], $version);
|
||||
if($res == 0){
|
||||
return V(0,"版本号已存在");
|
||||
}
|
||||
|
||||
$data = [
|
||||
'newversion' => $version,
|
||||
'oldversion' => $now_version['newversion'],
|
||||
'type' => $type,
|
||||
'downloadurl' => $downloadurl,
|
||||
'content' => $content,
|
||||
'enforce' => $enforce,
|
||||
'code' => $version_code,
|
||||
'status' => $status,
|
||||
'createtime' => time()
|
||||
'updatetime' => time()
|
||||
];
|
||||
$res = db::name($this->table)->where(['id'=>$id])->update($data);
|
||||
if($res){
|
||||
|
||||
@@ -104,15 +104,27 @@ class Withdrawal extends adminApi
|
||||
//统计
|
||||
|
||||
//待审核数量
|
||||
$wait_num = db::name('vs_user_withdrawal')->where('status',1)->count();
|
||||
$wait_num = db::name('vs_user_withdrawal')->where('a.status',1)
|
||||
->alias('a')
|
||||
->join('user b', 'a.user_id = b.id', 'left')
|
||||
->where($where)
|
||||
->count();
|
||||
//今日提现
|
||||
$today_money = db::name('vs_user_withdrawal')->whereIn('status',[2,6])->whereTime('createtime', 'today')->sum('money');
|
||||
//昨日提现
|
||||
$yesterday_money = db::name('vs_user_withdrawal')->whereIn('status',[2,6])->whereTime('createtime', 'yesterday')->sum('money');
|
||||
//已完成提现总额
|
||||
$complete_money = db::name('vs_user_withdrawal')->whereIn('status',[2,6])->sum('money');
|
||||
$complete_money = db::name('vs_user_withdrawal')->whereIn('a.status',[2,6])
|
||||
->alias('a')
|
||||
->join('user b', 'a.user_id = b.id', 'left')
|
||||
->where($where)
|
||||
->sum('money');
|
||||
//手续费收入
|
||||
$server_money = db::name('vs_user_withdrawal')->whereIn('status',[2,6])->sum('server_money');
|
||||
$server_money = db::name('vs_user_withdrawal')->whereIn('a.status',[2,6])
|
||||
->alias('a')
|
||||
->join('user b', 'a.user_id = b.id', 'left')
|
||||
->where($where)
|
||||
->sum('server_money');
|
||||
//提现总额
|
||||
$total_money = $complete_money+$server_money;
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace app\adminapi\model;
|
||||
|
||||
use app\common\library\GiftTableManager;
|
||||
use think\Log;
|
||||
use think\Model;
|
||||
use think\Session;
|
||||
use think\Db;
|
||||
@@ -19,14 +21,19 @@ class Gift extends Model
|
||||
public $giftType = [
|
||||
1 => '普通礼物',
|
||||
2 => '盲盒礼物',
|
||||
3 => '礼包礼物'
|
||||
3 => '礼包礼物',
|
||||
6 => '酒吧房礼物'
|
||||
];
|
||||
//送礼流水来源:1聊天送礼物 2房间语聊送礼 3直播送礼 4动态打赏
|
||||
public $GiveGiftFromStr = [
|
||||
1 => '聊天送礼',
|
||||
2 => '房间语聊送礼',
|
||||
3 => '直播送礼',
|
||||
4 => '动态打赏'
|
||||
4 => '动态打赏',
|
||||
5 => '房心愿礼物',
|
||||
6 => '酒吧房自定义礼物',
|
||||
7 => '酒吧房普通礼物',
|
||||
8 => '酒吧房小黑屋礼物'
|
||||
];
|
||||
|
||||
public function getList($where = [], $page = 1, $limit = 10)
|
||||
@@ -73,4 +80,104 @@ class Gift extends Model
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取送礼记录
|
||||
*/
|
||||
|
||||
public function getGiftRecords($search_time,$where,$page_array)
|
||||
{
|
||||
// 获取需要查询的表
|
||||
$tables = GiftTableManager::getTablesByTimeRange(
|
||||
$search_time[0],
|
||||
$search_time[1]
|
||||
);
|
||||
//数组排序fa_vs_give_gift_202601 表明数字大的排在前面
|
||||
arsort($tables);
|
||||
if(empty($tables)){
|
||||
$tables[0] = "fa_vs_give_gift";
|
||||
}
|
||||
$gift_count = 0;
|
||||
$gift_total_price = 0;
|
||||
$gift_number = 0;
|
||||
$all_lists = []; // 存储所有查询结果
|
||||
$remaining_page_offset = ($page_array['page'] - 1) * $page_array['page_limit']; // 需要跳过的记录数
|
||||
$collected_count = 0; // 已收集的记录数
|
||||
if($tables){
|
||||
foreach ($tables as $table) {
|
||||
$table_name = substr($table, 3);//截取可查询的表名
|
||||
|
||||
// 获取当前表的总记录数
|
||||
$count = db::name($table_name)->where($where)->count();
|
||||
|
||||
if($count > 0){
|
||||
// 如果还需要跳过记录
|
||||
if($remaining_page_offset > 0){
|
||||
// 如果当前表的记录数大于需要跳过的记录数
|
||||
if($count > $remaining_page_offset){
|
||||
// 从当前表中获取所需数据,跳过前面的记录
|
||||
$table_lists = db::name($table_name)
|
||||
->where($where)
|
||||
->order('createtime', 'desc')
|
||||
->limit($remaining_page_offset, $page_array['page_limit'])
|
||||
->select();
|
||||
|
||||
// 添加到结果中
|
||||
foreach($table_lists as $item){
|
||||
if($collected_count < $page_array['page_limit']){
|
||||
$all_lists[] = $item;
|
||||
$collected_count++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$remaining_page_offset = 0; // 已经跳过所需的记录
|
||||
} else {
|
||||
// 当前表的所有记录都需要跳过
|
||||
$remaining_page_offset -= $count;
|
||||
}
|
||||
} else if($collected_count < $page_array['page_limit']) {
|
||||
// 如果不需要跳过记录,且还没有收集足够的数据
|
||||
$remaining_needed = $page_array['page_limit'] - $collected_count;
|
||||
|
||||
// 从当前表获取剩余所需的数据
|
||||
$table_lists = db::name($table_name)
|
||||
->where($where)
|
||||
->order('createtime', 'desc')
|
||||
->limit($remaining_needed)
|
||||
->select();
|
||||
|
||||
// 添加到结果中
|
||||
foreach($table_lists as $item){
|
||||
if($collected_count < $page_array['page_limit']){
|
||||
$all_lists[] = $item;
|
||||
$collected_count++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$total_price = db::name($table_name)->where($where)->sum('total_price');
|
||||
$number = db::name($table_name)->where($where)->sum('number');
|
||||
$gift_count += $count;
|
||||
$gift_total_price += $total_price;
|
||||
$gift_number += $number;
|
||||
|
||||
// 如果已经收集到足够数据,跳出循环
|
||||
if($collected_count >= $page_array['page_limit']){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$result = [
|
||||
'lists' => $all_lists,
|
||||
'count' => $gift_count,
|
||||
'total_price' => $gift_total_price,
|
||||
'number' => $gift_number,
|
||||
];
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,28 +94,104 @@ class Guild extends Model
|
||||
*
|
||||
*工会当日流水
|
||||
*/
|
||||
// public function getTodayMoney($guild_id,$stoday="",$etoday=""){
|
||||
// //获取所有工会房间ID
|
||||
// $guild_user_data = db::name('vs_guild_user')->where('guild_id', $guild_id)->where(['apply_time'=>['>',0],'status'=>1])->field('room_id,apply_time,quit_time')->select();
|
||||
// $transaction = 0;
|
||||
// foreach ($guild_user_data as $k => $v) {
|
||||
// if(empty($stoday) && empty($etoday)){
|
||||
// $stoday_seach = strtotime(date('Y-m-d 00:00:00',time()));
|
||||
// $etoday_seach = strtotime(date('Y-m-d 23:59:59',time()));
|
||||
// }else{
|
||||
// $stoday_seach = strtotime($stoday);
|
||||
// $etoday_seach = strtotime($etoday);
|
||||
// }
|
||||
// if($v['apply_time'] && $stoday_seach < $v['apply_time']){
|
||||
// $stoday_seach = $v['apply_time'];
|
||||
// }
|
||||
// if($v['quit_time'] && ($etoday > $v['quit_time'])){
|
||||
// $etoday_seach = $v['quit_time'];
|
||||
// }
|
||||
// $transaction_one = db::name('vs_give_gift')
|
||||
// ->where('from_id',$v['room_id'])
|
||||
// ->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$stoday_seach, $etoday_seach]]])
|
||||
// ->sum('total_price');
|
||||
// $transaction += $transaction_one;
|
||||
// }
|
||||
// return $transaction;
|
||||
// }
|
||||
|
||||
public function getTodayMoney($guild_id,$stoday="",$etoday=""){
|
||||
$where = [];
|
||||
$where['guild_id'] = $guild_id;
|
||||
if(empty($stoday) && empty($etoday)){
|
||||
$where['day'] = date('Y-m-d');
|
||||
}else{
|
||||
if(!empty($stoday)){
|
||||
$where['createtime'] = ['>=',strtotime($stoday)];
|
||||
}
|
||||
if(!empty($etime)){
|
||||
$where['createtime'] = ['<',strtotime($etoday)];
|
||||
}
|
||||
if(!empty($stime) && !empty($etime)){
|
||||
$where['createtime'] = [['>=',strtotime($stoday)],['<',strtotime($etoday)]];
|
||||
}
|
||||
}
|
||||
$guild_flow = db::name('vs_guild_flow')
|
||||
->where($where)
|
||||
->sum('flow_price');
|
||||
return $guild_flow;
|
||||
}
|
||||
//获取公会流水
|
||||
public function getGuildFlow($guild_id=0,$room_id=0,$stoday="",$etoday=""){
|
||||
$where = [];
|
||||
if($guild_id!=0) {
|
||||
$where['guild_id'] = $guild_id;
|
||||
}
|
||||
if($room_id!=0){
|
||||
$where['room_id'] = $room_id;
|
||||
}
|
||||
if(!empty($stoday)){
|
||||
$where['createtime'] = ['>=',strtotime($stoday)];
|
||||
}
|
||||
if(!empty($etime)){
|
||||
$where['createtime'] = ['<',strtotime($etoday)];
|
||||
}
|
||||
if(!empty($stime) && !empty($etime)){
|
||||
$where['createtime'] = [['>=',strtotime($stoday)],['<',strtotime($etoday)]];
|
||||
}
|
||||
$guild_flow = db::name('vs_guild_flow')->where($where)->sum('flow_price');
|
||||
return $guild_flow;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*工会幸运流水
|
||||
*/
|
||||
public function getTodayMoneyLuckyCoin($guild_id,$stoday="",$etoday=""){
|
||||
//获取所有工会房间ID
|
||||
$guild_user_data = db::name('vs_guild_user')->where('guild_id', $guild_id)->field('room_id,createtime,quit_time')->select();
|
||||
$guild_user_data = db::name('vs_guild_user')->where('guild_id', $guild_id)->where(['apply_time'=>['>',0],'status'=>1])->field('room_id,apply_time,createtime,quit_time')->select();
|
||||
$transaction = 0;
|
||||
foreach ($guild_user_data as $k => $v) {
|
||||
if(empty($stoday) && empty($etoday)){
|
||||
$stoday_seach = strtotime(date('Y-m-d 00:00:00',time()));
|
||||
$etoday_seach = strtotime(date('Y-m-d 23:59:59',time()));
|
||||
}else{
|
||||
$stoday_seach = strtotime("2025-12-21 00:00:00");
|
||||
$etoday_seach = time();
|
||||
if(!empty($stoday)){
|
||||
$stoday_seach = strtotime($stoday);
|
||||
}
|
||||
if(!empty($etoday)){
|
||||
$etoday_seach = strtotime($etoday);
|
||||
}
|
||||
if($v['createtime'] && $stoday_seach < $v['createtime']){
|
||||
$stoday_seach = $v['createtime'];
|
||||
if($v['apply_time'] && $stoday_seach < $v['apply_time']){
|
||||
$stoday_seach = $v['apply_time'];
|
||||
}
|
||||
if($v['quit_time'] && ($etoday > $v['quit_time'])){
|
||||
$etoday_seach = $v['quit_time'];
|
||||
}
|
||||
$transaction_one = db::name('vs_give_gift')
|
||||
->where('from_id',$v['room_id'])
|
||||
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$stoday_seach, $etoday_seach]]])
|
||||
->sum('total_price');
|
||||
$transaction_one = db::name('vs_room_luck_value')
|
||||
->where('room_id',$v['room_id'])
|
||||
->where(['createtime'=>['>=',$stoday_seach]])
|
||||
->where(['createtime'=>['<',$etoday_seach]])
|
||||
->sum('luck_value');
|
||||
$transaction += $transaction_one;
|
||||
}
|
||||
return $transaction;
|
||||
|
||||
@@ -72,19 +72,21 @@ class Room extends Model
|
||||
*/
|
||||
public function getRoomFlow($room_id,$stime='',$etime=''){
|
||||
$give_where = [];
|
||||
$give_where['from_id'] = $room_id;
|
||||
$give_where['from'] = ["in",[2,3,6]];
|
||||
$give_where['room_id'] = $room_id;
|
||||
// $give_where['from'] = ["in",[2,3,6]];
|
||||
// $give_where['from'] = 2;
|
||||
if(!empty($stime)){
|
||||
$give_where['createtime'] = ['>=',strtotime($stime)];
|
||||
}
|
||||
if(!empty($etime)){
|
||||
$give_where['createtime'] = ['<=',strtotime($etime)];
|
||||
$give_where['createtime'] = ['<',strtotime($etime)];
|
||||
}
|
||||
if(!empty($stime) && !empty($etime)){
|
||||
$give_where['createtime'] = ['between',[strtotime($stime),strtotime($etime)]];
|
||||
// $give_where['createtime'] = ['between',[strtotime($stime),strtotime($etime)]];
|
||||
$give_where['createtime'] = [['>=',strtotime($stime)],['<',strtotime($etime)]];
|
||||
}
|
||||
$total_price = db::name('vs_give_gift')->where($give_where)
|
||||
->sum('total_price');
|
||||
$total_price = db::name('vs_guild_flow')->where($give_where)
|
||||
->sum('flow_price');
|
||||
return $total_price;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class Activities extends BaseCom
|
||||
$gift = DB::name('vs_gift')->where(['gid'=>$vv['foreign_id']])->find();
|
||||
if($gift){
|
||||
$list[$kk]['gift_name'] = $gift['gift_name'];
|
||||
$list[$kk]['num'] = $vv['quantity'];
|
||||
$list[$kk]['num'] = $vv['quantity']." 个";
|
||||
$list[$kk]['gift_price'] = $gift['gift_price'];
|
||||
$list[$kk]['type'] =2;
|
||||
$list[$kk]['base_image'] = $gift['base_image'];
|
||||
@@ -62,7 +62,7 @@ class Activities extends BaseCom
|
||||
if($decorate_price){
|
||||
$gift = DB::name('vs_decorate')->where(['did'=>$decorate_price['did']])->find();
|
||||
$list[$kk]['gift_name'] = $gift['title']??""; //装扮名称
|
||||
$list[$kk]['num'] = $decorate_price['day']??0; //天数
|
||||
$list[$kk]['num'] = $decorate_price['day']." 天"??0; //天数
|
||||
$list[$kk]['gift_price'] = $decorate_price['price']??0; //价格
|
||||
$list[$kk]['type'] =3;
|
||||
$list[$kk]['base_image'] = $gift['base_image'] ?? "";
|
||||
@@ -98,7 +98,7 @@ class Activities extends BaseCom
|
||||
$api_version = 0;
|
||||
if ($system == 'iOS') {
|
||||
$api_versions = db::name('version')->where(['type' => 2, 'status' => 1])->order('id', 'desc')->find();
|
||||
$result = version_compare($api_versions['oldversion'],$app_version);
|
||||
$result = version_compare($api_versions['apiversion'],$app_version);
|
||||
if ($result < 0) {
|
||||
$api_version = 1;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ class Activities extends BaseCom
|
||||
}elseif($v['type'] == 2) {
|
||||
$gift = DB::name('vs_gift')->where(['gid'=>$v['foreign_id']])->find();
|
||||
$list[$k]['gift_name'] = $gift['gift_name'];
|
||||
$list[$k]['num'] = $v['quantity'];
|
||||
$list[$k]['num'] = $v['quantity']." 个";
|
||||
$list[$k]['gift_price'] = $gift['gift_price'];
|
||||
$list[$k]['type'] =2;
|
||||
$list[$k]['base_image'] = $gift['base_image'];
|
||||
@@ -165,7 +165,7 @@ class Activities extends BaseCom
|
||||
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
|
||||
$gift = DB::name('vs_decorate')->where(['did'=>$decorate_price['did']])->find();
|
||||
$list[$k]['gift_name'] = $gift['title']; //装扮名称
|
||||
$list[$k]['num'] = $decorate_price['day']; //天数
|
||||
$list[$k]['num'] = $decorate_price['day']." 天"??0; //天数
|
||||
$list[$k]['gift_price'] = $decorate_price['price']; //价格
|
||||
$list[$k]['type'] =3;
|
||||
$list[$k]['base_image'] = $gift['base_image'];
|
||||
@@ -238,7 +238,7 @@ class Activities extends BaseCom
|
||||
$gift = DB::name('vs_gift')->where(['gid'=>$vv['foreign_id']])->find();
|
||||
if($gift){
|
||||
$list[$kk]['gift_name'] = $gift['gift_name'];
|
||||
$list[$kk]['num'] = $vv['quantity'];
|
||||
$list[$kk]['num'] = $vv['quantity']." 个";
|
||||
$list[$kk]['gift_price'] = $gift['gift_price'];
|
||||
$list[$kk]['type'] =2;
|
||||
$list[$kk]['base_image'] = $gift['base_image'];
|
||||
@@ -248,7 +248,7 @@ class Activities extends BaseCom
|
||||
if($decorate_price){
|
||||
$gift = DB::name('vs_decorate')->where(['did'=>$decorate_price['did']])->find();
|
||||
$list[$kk]['gift_name'] = $gift['title']??""; //装扮名称
|
||||
$list[$kk]['num'] = $decorate_price['day']??0; //天数
|
||||
$list[$kk]['num'] = $decorate_price['day']." 天"??0; //天数
|
||||
$list[$kk]['gift_price'] = $decorate_price['price']??0; //价格
|
||||
$list[$kk]['type'] =3;
|
||||
$list[$kk]['base_image'] = $gift['base_image'] ?? "";
|
||||
@@ -303,7 +303,7 @@ class Activities extends BaseCom
|
||||
$api_version = 0;
|
||||
if ($system == 'iOS') {
|
||||
$api_versions = db::name('version')->where(['type' => 2, 'status' => 1])->order('id', 'desc')->find();
|
||||
$result = version_compare($api_versions['oldversion'],$app_version);
|
||||
$result = version_compare($api_versions['apiversion'],$app_version);
|
||||
if ($result < 0) {
|
||||
$api_version = 1;
|
||||
}
|
||||
|
||||
@@ -48,4 +48,16 @@ class Banner extends controller
|
||||
$reslut = model('Banner')->banner_list($show_type);
|
||||
return V(1,'操作成功', $reslut);
|
||||
}
|
||||
|
||||
//平台客服获取接口
|
||||
public function app_customer_service()
|
||||
{
|
||||
$platform_customer_service = get_system_config_value('platform_customer_service');
|
||||
$user_id = model('User')->where('user_code', $platform_customer_service)->value('id');
|
||||
$reslut = [
|
||||
'user_id' => $user_id,
|
||||
'user_name' => "客服",
|
||||
];
|
||||
return V(1, '成功', $reslut);
|
||||
}
|
||||
}
|
||||
|
||||
101
application/api/controller/BarRoom.php
Normal file
101
application/api/controller/BarRoom.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Cache;
|
||||
use think\Db;
|
||||
|
||||
class BarRoom extends BaseCom
|
||||
{
|
||||
|
||||
//麦位时长列表
|
||||
public function get_pit_time_list(){
|
||||
$reslut = model('BarRoom')->get_pit_duration_list();
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//房间麦位时长设置
|
||||
public function set_pit_time(){
|
||||
$room_id = input('room_id', 0);
|
||||
$time = input('time', 0);
|
||||
$user_id = $this->uid;
|
||||
if (!$room_id || !$time) {
|
||||
return V(0, '参数错误');
|
||||
}
|
||||
//判断用户是否是主持
|
||||
$user_is_on_pit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $user_id])->value('pit_number');
|
||||
if($user_is_on_pit != 9){
|
||||
return V(0, '没有权限');
|
||||
}
|
||||
$reslut = model('BarRoom')->set_pit_duration($room_id, $time);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//约Ta礼物详情
|
||||
public function get_gift_info_ta(){
|
||||
$room_id = input('room_id', 0);
|
||||
$to_user_id =input('to_user_id', 0);
|
||||
$reslut = model('BarRoom')->get_gift_info_ta($room_id, $to_user_id, $this->uid);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//撩TA
|
||||
public function liao_ta(){
|
||||
$room_id = input('room_id', 0);
|
||||
$to_user_id =input('to_user_id', 0);
|
||||
$user_id = $this->uid;
|
||||
$type = input('type', 0);
|
||||
if($type == 1){
|
||||
if($user_id == $to_user_id){
|
||||
return V(0, '不能撩自己');
|
||||
}
|
||||
$reslut = model('BarRoom')->liao_ta($room_id,$user_id,$to_user_id);
|
||||
}else{
|
||||
$reslut = model('BarRoom')->one_key_liao_ta($room_id,$user_id);
|
||||
}
|
||||
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//约TA
|
||||
public function meeting_ta(){
|
||||
$key_name = "api:meeting:ta:" . $this->uid;
|
||||
redis_lock_exits($key_name);
|
||||
$room_id = input('room_id', 0);
|
||||
$user_id =input('user_id', 0);
|
||||
$gift_id =input('gift_id', 0);
|
||||
if(!$room_id || !$user_id || !$gift_id){
|
||||
redis_unlocks($key_name);
|
||||
return V(0, '参数错误');
|
||||
}
|
||||
//获取缓存
|
||||
$meet_user_id = Cache::get('meeting_user_id_'.$user_id);
|
||||
if($meet_user_id == $user_id){
|
||||
redis_unlocks($key_name);
|
||||
return V(0, '佳人有约!');
|
||||
}
|
||||
//设置缓存
|
||||
Cache::set('meeting_user_id_'.$user_id, $user_id, 20);
|
||||
|
||||
$reslut = model('BarRoom')->meeting_ta($this->uid,$room_id,$user_id,$gift_id);
|
||||
if($reslut['code'] != 1){
|
||||
//删除缓存
|
||||
Cache::rm('meeting_user_id_'.$user_id);
|
||||
}
|
||||
redis_unlocks($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//小黑屋列表
|
||||
public function black_room_list(){
|
||||
$room_id = input('room_id', 0);
|
||||
$reslut = model('BarRoom')->black_room_list($room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,17 @@ class BlindBoxTurntable extends BaseCom
|
||||
$num = input('num',1);
|
||||
$heart_id = input('heart_id',0);
|
||||
$auction_id = input('auction_id',0);
|
||||
$reslut = model('BlindBoxTurntableGiftDrawWorld')->draw_gift($gift_bag_id, $user_id, $gift_user_ids,$num,$room_id,$heart_id,$auction_id);
|
||||
if(!in_array($gift_bag_id,[10,11,12])){
|
||||
return v(0,'非法活动ID', null);
|
||||
}
|
||||
//删除字符串里所有的空格
|
||||
$gift_user_ids = preg_replace('/\s+/', '', $gift_user_ids);
|
||||
if($gift_bag_id==10){
|
||||
$reslut = model('api/BlindBoxTurntableGiftDrawWorldNew')->draw_gift($gift_bag_id, $user_id, $gift_user_ids,$num,$room_id,$heart_id,$auction_id);
|
||||
}else{
|
||||
$reslut = model('api/BlindBoxTurntableGiftDrawWorldNew')->draw_gift_drop_bag($gift_bag_id, $user_id,$num,$room_id);
|
||||
}
|
||||
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
/*
|
||||
@@ -70,13 +80,13 @@ class BlindBoxTurntable extends BaseCom
|
||||
/*
|
||||
* 获取全服抽奖记录
|
||||
*/
|
||||
public function get_all_record(){
|
||||
$gift_bag_id = input('gift_bag_id',0);
|
||||
$page = input('page',1);
|
||||
$page_size = input('page_size',12);
|
||||
$reslut = model('BlindBoxTurntableGift')->get_all_record($gift_bag_id,$page,$page_size);
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
// public function get_all_record(){
|
||||
// $gift_bag_id = input('gift_bag_id',0);
|
||||
// $page = input('page',1);
|
||||
// $page_size = input('page_size',12);
|
||||
// $reslut = model('BlindBoxTurntableGift')->get_all_record($gift_bag_id,$page,$page_size);
|
||||
// return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
// }
|
||||
/*
|
||||
* 巡乐会
|
||||
*/
|
||||
@@ -93,7 +103,7 @@ class BlindBoxTurntable extends BaseCom
|
||||
$user_id = $this->uid;
|
||||
$room_id = input('room_id',0);
|
||||
$num = input('num',1);
|
||||
$reslut = model('BlindBoxTurntableGiftDrawWorld')->xlh_draw_gift($user_id,$num,$room_id);
|
||||
$reslut = model('BlindBoxTurntableGiftDrawWorldNew')->xlh_draw_gift($user_id,$num,$room_id);
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
/*
|
||||
@@ -128,4 +138,13 @@ class BlindBoxTurntable extends BaseCom
|
||||
$reslut = model('BlindBoxTurntableGift')->xlh_ranking_list($room_id,$page,$page_size);
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
/*
|
||||
* 盲盒转盘状态
|
||||
* 1.开启 2.关闭
|
||||
*/
|
||||
public function blind_box_status(){
|
||||
$reslut = model('BlindBoxTurntableGift')->blind_box_status();
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
@@ -147,694 +147,6 @@ class Ceshi extends Controllers
|
||||
return V(1, '成功', $reslut);
|
||||
}
|
||||
|
||||
//清空数据 禁用 慎用 !!!!!!
|
||||
//清空数据 禁用 慎用 !!!!!!
|
||||
//清空数据 禁用 慎用 !!!!!!
|
||||
public function qing_chu_data()
|
||||
{
|
||||
//ip
|
||||
$ip = request()->ip();
|
||||
//白名单
|
||||
$white_list = $this -> allowIp;
|
||||
if (!in_array($ip, $white_list)) {
|
||||
return V(301, '非法访问!');
|
||||
}
|
||||
$i = 0;
|
||||
$res = [];
|
||||
//开启事务
|
||||
Db::startTrans();
|
||||
// $reslut = db::name('admin')->where('username','<>', 'admin')->delete();
|
||||
// if($reslut){
|
||||
// $i ++ ;
|
||||
// }else{
|
||||
// //数组末尾添加元素
|
||||
// array_push($res, '管理员删除失败!');
|
||||
// }
|
||||
$reslut1 = db::name('admin_log')->where('id','<>', 1)->delete();
|
||||
if($reslut1){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '管理员日志删除失败!');
|
||||
}
|
||||
|
||||
$reslut3 = db::name('block')->where('id','>', 0)->delete();
|
||||
if($reslut3){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '封禁表删除失败!');
|
||||
}
|
||||
|
||||
$reslut6 = db::name('sms')->where('id','>', 0)->delete();
|
||||
if($reslut6){
|
||||
$i ++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '短信发送记录删除失败!');
|
||||
}
|
||||
|
||||
$reslut7 = db::name('system_message')->where('id','>', 0)->delete();
|
||||
if($reslut7){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '系统消息删除失败!');
|
||||
}
|
||||
// $reslut8 = db::name('topic')->where('id','>', 0)->delete();
|
||||
// if($reslut8){
|
||||
// $i++ ;
|
||||
// }else{
|
||||
// //数组末尾添加元素
|
||||
// array_push($res, '话题删除失败!');
|
||||
// }
|
||||
|
||||
|
||||
$user = db::name('user')->where('id','>', 0)->select();
|
||||
// if($user){
|
||||
// foreach ($user as &$v){
|
||||
// if($v['id']){
|
||||
// $j = 0;
|
||||
// $data[$j] = [
|
||||
// 'UserID' => 'u'.$v['id'],
|
||||
// ];
|
||||
// }
|
||||
// // model('Tencent')->account_deletes($data);
|
||||
// }
|
||||
// }
|
||||
|
||||
$reslut9 = db::name('user')->where('id','>', 0)->delete();
|
||||
if($reslut9){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户删除失败!');
|
||||
}
|
||||
|
||||
|
||||
$reslut10 = db::name('user_album')->where('id','>', 0)->delete();
|
||||
if($reslut10){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户相册删除失败!');
|
||||
}
|
||||
|
||||
$reslut11 = db::name('user_album_image')->where('id','>', 0)->delete();
|
||||
if($reslut11){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户相册图片删除失败!');
|
||||
}
|
||||
|
||||
$reslut12 = db::name('user_auth')->where('id','>', 0)->delete();
|
||||
if($reslut12){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户实名删除失败!');
|
||||
}
|
||||
|
||||
$reslut13 = db::name('user_avatar_log')->where('id','>', 0)->delete();
|
||||
if($reslut13){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户头像修改记录删除失败!');
|
||||
}
|
||||
|
||||
$reslut14 = db::name('user_black')->where('id','>', 0)->delete();
|
||||
if($reslut14){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户黑名单删除失败!');
|
||||
}
|
||||
|
||||
$reslut141 = db::name('user_coin_transfer')->where('id','>', 0)->delete();
|
||||
if($reslut141){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户金币转让删除失败!');
|
||||
}
|
||||
|
||||
$reslut15 = db::name('user_data')->where('id','>', 0)->delete();
|
||||
if($reslut15){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户数据删除失败!');
|
||||
}
|
||||
$reslut16 = db::name('user_exchange')->where('id','>', 0)->delete();
|
||||
if($reslut16){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户积分兑换记录删除失败!');
|
||||
}
|
||||
$reslut17 = db::name('user_follow')->where('id','>', 0)->delete();
|
||||
if($reslut17){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户关注删除失败!');
|
||||
}
|
||||
$reslut18 = db::name('user_message')->where('id','>', 0)->delete();
|
||||
if($reslut18){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户消息删除失败!');
|
||||
}
|
||||
// $reslut19 = db::name('user_money_log')->where('id','>', 0)->delete();
|
||||
// if($reslut19){
|
||||
// $i++ ;
|
||||
// }else{
|
||||
// //数组末尾添加元素
|
||||
// array_push($res, '用户余额记录删除失败!');
|
||||
// }
|
||||
$reslut20 = db::name('user_token')->where('id','>', 0)->delete();
|
||||
if($reslut20){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户token删除失败!');
|
||||
}
|
||||
$reslut21 = db::name('user_visit_log')->where('id','>', 0)->delete();
|
||||
if($reslut21){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户访问记录删除失败!');
|
||||
}
|
||||
$reslut22 = db::name('user_wallet')->where('id','>', 0)->delete();
|
||||
if($reslut22){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户钱包删除失败!');
|
||||
}
|
||||
$reslut23 = db::name('user_zone')->where('id','>', 0)->delete();
|
||||
if($reslut23){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户空间删除失败!');
|
||||
}
|
||||
$reslut24 = db::name('user_zone_comment')->where('id','>', 0)->delete();
|
||||
if($reslut24){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户空间评论删除失败!');
|
||||
}
|
||||
$reslut25 = db::name('user_zone_like')->where('id','>', 0)->delete();
|
||||
if($reslut25){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户空间点赞删除失败!');
|
||||
}
|
||||
$reslut26 = db::name('user_zone_rewards')->where('id','>', 0)->delete();
|
||||
if($reslut26){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户空间打赏列表删除失败!');
|
||||
}
|
||||
$reslut261 = db::name('user_zone_topic')->where('id','>', 0)->delete();
|
||||
if($reslut261){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '动态话题关联删除失败!');
|
||||
}
|
||||
|
||||
$reslut262 = db::name('vs_activities_receive')->where('id','>', 0)->delete();
|
||||
if($reslut262){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '活动参加删除失败!');
|
||||
}
|
||||
|
||||
$reslut263 = db::name('vs_admin_recharge_log')->where('arid','>', 0)->delete();
|
||||
if($reslut263){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '后台充值删除失败!');
|
||||
}
|
||||
|
||||
$reslut27 = db::name('vs_gift_bag_receive_log')->where('id','>', 0)->delete();
|
||||
if($reslut27){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户礼物发放删除失败!');
|
||||
}
|
||||
$reslut28 = db::name('vs_give_gift')->where('id','>', 0)->delete();
|
||||
if($reslut28){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户送礼记录删除失败!');
|
||||
}
|
||||
|
||||
$reslut29 = db::name('vs_give_gift_ratio_log')->where('id','>', 0)->delete();
|
||||
if($reslut29){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户送礼当前利率记录删除失败!');
|
||||
}
|
||||
|
||||
//解散群
|
||||
$group = db::name('vs_guild')->select();
|
||||
foreach ($group as &$value){
|
||||
model('Tencent')->delete_group('g'.$value['id']);
|
||||
}
|
||||
$reslut30 = db::name('vs_guild')->where('id','>', 0)->delete();
|
||||
if($reslut30){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户工会删除失败!');
|
||||
}
|
||||
|
||||
$reslut31 = db::name('vs_guild_subsidy')->where('id','>', 0)->delete();
|
||||
if($reslut31){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户工会补贴删除失败!');
|
||||
}
|
||||
|
||||
$reslut32 = db::name('vs_guild_user')->where('id','>', 0)->delete();
|
||||
if($reslut32){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户工会用户删除失败!');
|
||||
}
|
||||
|
||||
$reslut33 = db::name('vs_guild_user_quit_log')->where('id','>', 0)->delete();
|
||||
if($reslut33){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户退出工会记录删除失败!');
|
||||
}
|
||||
|
||||
$reslut34 = db::name('vs_headline')->where('id','>', 0)->delete();
|
||||
if($reslut34){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '头条记录删除失败!');
|
||||
}
|
||||
|
||||
//删除腾讯房间
|
||||
$room = db::name('vs_room')->select();
|
||||
// foreach ($room as &$value){
|
||||
// // model('Tencent')->delete_group('room'.$value['id']);
|
||||
// }
|
||||
$reslut35 = db::name('vs_room')->where('id','>', 0)->delete();
|
||||
if($reslut35){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间删除失败!');
|
||||
}
|
||||
|
||||
$reslut36 = db::name('vs_room_auction')->where('auction_id','>', 0)->delete();
|
||||
if($reslut36){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间竞拍删除失败!');
|
||||
}
|
||||
|
||||
$reslut37 = db::name('vs_room_auction_bid_log')->where('id','>', 0)->delete();
|
||||
if($reslut37){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间竞拍记录删除失败!');
|
||||
}
|
||||
|
||||
$reslut371 = db::name('vs_room_auction_relation')->where('id','>', 0)->delete();
|
||||
if($reslut371){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户拍得关系删除失败!');
|
||||
}
|
||||
|
||||
$reslut372 = db::name('vs_room_auction_relation_top')->where('id','>', 0)->delete();
|
||||
if($reslut372){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '关系卡、位 置顶表删除失败!');
|
||||
}
|
||||
|
||||
$reslut373 = db::name('vs_room_background')->where('id','>', 2)->delete();
|
||||
if($reslut373){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间背景图片表删除失败!');
|
||||
}
|
||||
|
||||
$reslut38 = db::name('vs_room_black')->where('id','>', 0)->delete();
|
||||
if($reslut38){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间黑名单删除失败!');
|
||||
}
|
||||
|
||||
$reslut39 = db::name('vs_room_cp_movie')->where('cp_id','>', 0)->delete();
|
||||
if($reslut39){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, 'cp房间删除失败!');
|
||||
}
|
||||
|
||||
$reslut40 = db::name('vs_room_host')->where('id','>', 0)->delete();
|
||||
if($reslut40){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间主持删除失败!');
|
||||
}
|
||||
|
||||
$reslut41 = db::name('vs_room_operation_log')->where('id','>', 0)->delete();
|
||||
if($reslut41){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间日志删除失败!');
|
||||
}
|
||||
|
||||
$reslut42 = db::name('vs_room_pit')->where('id','>', 0)->delete();
|
||||
if($reslut42){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间坑位删除失败!');
|
||||
}
|
||||
|
||||
$reslut43 = db::name('vs_room_pit_apply')->where('id','>', 0)->delete();
|
||||
if($reslut43){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间坑位申请删除失败!');
|
||||
}
|
||||
|
||||
$reslut44 = db::name('vs_room_pit_apply_help')->where('id','>', 0)->delete();
|
||||
if($reslut44){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间坑位申请帮助删除失败!');
|
||||
}
|
||||
|
||||
$reslut45 = db::name('vs_room_pit_apply_help_gift')->where('id','>', 0)->delete();
|
||||
if($reslut45){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间坑位申请帮助礼物删除失败!');
|
||||
}
|
||||
|
||||
$reslut46 = db::name('vs_room_pit_simulate')->where('id','>', 0)->delete();
|
||||
if($reslut46){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间坑位模拟删除失败!');
|
||||
}
|
||||
|
||||
$reslut47 = db::name('vs_room_pk')->where('pk_id','>', 0)->delete();
|
||||
if($reslut47){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间pk删除失败!');
|
||||
}
|
||||
|
||||
$reslut48 = db::name('vs_room_song')->where('did','>', 0)->delete();
|
||||
if($reslut48){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间歌曲删除失败!');
|
||||
}
|
||||
|
||||
$reslut49 = db::name('vs_room_subsidy')->where('id','>', 0)->delete();
|
||||
if($reslut49){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间补贴删除失败!');
|
||||
}
|
||||
|
||||
$reslut50 = db::name('vs_room_user_charm')->where('id','>', 0)->delete();
|
||||
if($reslut50){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间用户魅力删除失败!');
|
||||
}
|
||||
|
||||
$reslut51 = db::name('vs_room_user_muted')->where('id','>', 0)->delete();
|
||||
if($reslut51){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间用户禁言删除失败!');
|
||||
}
|
||||
|
||||
$reslut52 = db::name('vs_room_visitor')->where('id','>', 0)->delete();
|
||||
if($reslut52){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间访客删除失败!');
|
||||
}
|
||||
|
||||
$reslut53 = db::name('vs_suggest')->where('id','>', 0)->delete();
|
||||
if($reslut53){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '建议删除失败!');
|
||||
}
|
||||
|
||||
$reslut54 = db::name('vs_user_daily_tasks')->where('id','>', 0)->delete();
|
||||
if($reslut54){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户日常任务删除失败!');
|
||||
}
|
||||
|
||||
$reslut55 = db::name('vs_user_decorate')->where('udid','>', 0)->delete();
|
||||
if($reslut55){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户装扮表删除失败!');
|
||||
}
|
||||
|
||||
$reslut56 = db::name('vs_user_decorate_log')->where('udid','>', 0)->delete();
|
||||
if($reslut56){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户装扮日志删除失败!');
|
||||
}
|
||||
|
||||
$reslut57 = db::name('vs_user_exp_day')->where('id','>', 0)->delete();
|
||||
if($reslut57){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户每日经验删除失败!');
|
||||
}
|
||||
|
||||
$reslut58 = db::name('vs_user_gift_pack')->where('pid','>', 0)->delete();
|
||||
if($reslut58){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户礼物背包删除失败!');
|
||||
}
|
||||
|
||||
$reslut59 = db::name('vs_user_gift_pack_log')->where('id','>', 0)->delete();
|
||||
if($reslut59){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户礼物背包日志删除失败!');
|
||||
}
|
||||
|
||||
$reslut60 = db::name('vs_user_inform')->where('id','>', 0)->delete();
|
||||
if($reslut60){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户举报删除失败!');
|
||||
}
|
||||
|
||||
$reslut61 = db::name('vs_user_invited')->where('id','>', 0)->delete();
|
||||
if($reslut61){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户邀请删除失败!');
|
||||
}
|
||||
|
||||
$reslut62 = db::name('vs_user_invited_income_log')->where('id','>', 0)->delete();
|
||||
if($reslut62){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户邀请收入日志删除失败!');
|
||||
}
|
||||
|
||||
$reslut63 = db::name('vs_user_live_remind')->where('id','>', 0)->delete();
|
||||
if($reslut63){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户直播提醒删除失败!');
|
||||
}
|
||||
|
||||
$reslut64 = db::name('vs_user_money_log')->where('log_id','>', 0)->delete();
|
||||
if($reslut64){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户钱包日志删除失败!');
|
||||
}
|
||||
|
||||
$reslut641 = db::name('vs_user_pk_close')->where('id','>', 0)->delete();
|
||||
if($reslut641){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户钱包日志删除失败!');
|
||||
}
|
||||
|
||||
$reslut65 = db::name('vs_user_recharge')->where('rid','>', 0)->delete();
|
||||
if($reslut65){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户充值删除失败!');
|
||||
}
|
||||
|
||||
$reslut66 = db::name('vs_user_tasks_sign_in')->where('id','>', 0)->delete();
|
||||
if($reslut66){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户任务签到删除失败!');
|
||||
}
|
||||
|
||||
$reslut661 = db::name('vs_user_withdrawal')->where('wid','>', 0)->delete();
|
||||
if($reslut661){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户提现表删除失败!');
|
||||
}
|
||||
|
||||
$reslut662 = db::name('vs_user_zone_manjiujiang')->where('id','>', 0)->delete();
|
||||
if($reslut662){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户发动态满九张图表删除失败!');
|
||||
}
|
||||
|
||||
$reslut67 = db::name('vs_wealth_level_log')->where('id','>', 0)->delete();
|
||||
if($reslut67){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '财富等级日志删除失败!');
|
||||
}
|
||||
$reslut68 = db::name('vs_user_friending')->where('id','>', 0)->delete();
|
||||
if($reslut68){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户好友删除失败!');
|
||||
}
|
||||
$reslut69 = db::name('vs_user_friending_heart')->where('id','>', 0)->delete();
|
||||
if($reslut69){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '用户好友心跳删除失败!');
|
||||
}
|
||||
$reslut70 = db::name('vs_room_hot_value_log')->where('id','>', 0)->delete();
|
||||
if($reslut70){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间热度值日志删除失败!');
|
||||
}
|
||||
|
||||
$reslut71 = db::name('vs_blind_box_turntable_results_log')->where('id','>', 0)->delete();
|
||||
if($reslut71){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '盲盒转盘结果日志删除失败!');
|
||||
}
|
||||
$reslut72 = db::name('vs_blind_box_turntable_log')->where('id','>', 0)->delete();
|
||||
if($reslut72){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '盲盒转盘日志删除失败!');
|
||||
}
|
||||
$reslut73 = db::name('vs_room_pan_xlh')->where('id','>', 0)->delete();
|
||||
if($reslut73){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间寻乐会删除失败!');
|
||||
}
|
||||
$reslut74 = db::name('vs_room_pan_xlh_log')->where('id','>', 0)->delete();
|
||||
if($reslut74){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间寻乐会日志删除失败!');
|
||||
}
|
||||
$reslut75 = db::name('vs_room_pan')->where('id','>', 0)->delete();
|
||||
if($reslut75){
|
||||
$i++ ;
|
||||
}else{
|
||||
//数组末尾添加元素
|
||||
array_push($res, '房间盘删除失败!');
|
||||
}
|
||||
|
||||
//数据提交
|
||||
db::commit();
|
||||
return V(1, '成功'.$i.'条数据!', $res);
|
||||
}
|
||||
|
||||
|
||||
//测试富文本消息
|
||||
public function test_rich_text(){
|
||||
@@ -856,6 +168,27 @@ class Ceshi extends Controllers
|
||||
|
||||
|
||||
|
||||
//测试异步信息
|
||||
public function test_async_info(){
|
||||
// 创建子进程
|
||||
$pid = pcntl_fork();
|
||||
|
||||
if ($pid == -1) {
|
||||
die('无法创建子进程');
|
||||
} elseif ($pid) {
|
||||
// 父进程
|
||||
echo "父进程继续执行\n";
|
||||
// 父进程不等待子进程
|
||||
} else {
|
||||
// 子进程
|
||||
sleep(5);
|
||||
Log::record("子进程:5秒后执行".json_encode($pid),"infoss");
|
||||
echo "子进程:5秒后执行\n";
|
||||
exit(0); // 子进程结束
|
||||
}
|
||||
|
||||
echo "父进程继续执行其他代码\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,19 +5,39 @@ namespace app\api\controller;
|
||||
class Cron
|
||||
{
|
||||
//每秒执行
|
||||
/*
|
||||
*拍卖房结束提醒
|
||||
* Pk房连线中倒计时结束操作PK结束
|
||||
* Pk房PK进行中倒计时结束操作PK结束
|
||||
* Pk房PK结束惩罚倒计时结束断开操作
|
||||
* 房间红包清退
|
||||
* pk发起10秒后无应答拒绝
|
||||
* 提现云账号订单状态查询
|
||||
* 签约房时间结束处理
|
||||
* 签约到期处理
|
||||
*/
|
||||
public function PerformPerSecond()
|
||||
{
|
||||
$cron = new \app\cron\controller\PerformPerSecond();
|
||||
$cron->index();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//每周执行
|
||||
/*工会补贴生成开始
|
||||
*房间补贴生成开始
|
||||
*/
|
||||
public function PerformPerWeek()
|
||||
{
|
||||
$cron = new \app\cron\controller\Subsidy();
|
||||
$cron->index();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//经业务调整 暂时不要了
|
||||
//每10秒执行
|
||||
public function TenSeconds()
|
||||
{
|
||||
@@ -25,28 +45,69 @@ class Cron
|
||||
$cron->index();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//每天执行
|
||||
/*
|
||||
* 清除房间热度值
|
||||
* 系统降身价
|
||||
* 过期验证码删除
|
||||
*/
|
||||
public function DaySeconds()
|
||||
{
|
||||
$cron = new \app\cron\controller\DaySeconds();
|
||||
$cron->index();
|
||||
}
|
||||
|
||||
//巡乐会结束 礼物发放
|
||||
|
||||
|
||||
//巡乐会结束 礼物发放 3S执行一次
|
||||
/*
|
||||
* 巡乐会礼物发放开始
|
||||
*盲盒转盘礼物补发
|
||||
* 保持心跳
|
||||
*/
|
||||
public function XlhSend(){
|
||||
$cron = new \app\cron\controller\RoomPan();
|
||||
$cron->index();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//交友房结束
|
||||
/*
|
||||
* 清除交友房过期未结束数据开始
|
||||
* 清除私密小屋过期数据开始
|
||||
*/
|
||||
public function FriendEnd(){
|
||||
$cron = new \app\cron\controller\FriendEnd();
|
||||
$cron->index();
|
||||
}
|
||||
|
||||
//房间小时榜发礼物(每小时执行一次)
|
||||
|
||||
|
||||
//每小时执行一次
|
||||
/*
|
||||
* 小时榜 开始发礼物
|
||||
* 清除房间离线超1小时的用户
|
||||
*/
|
||||
public function RoomHourRanking(){
|
||||
$cron = new \app\cron\controller\RoomHourRanking();
|
||||
$cron->index();
|
||||
}
|
||||
//每日执行(每天23点59分执行)
|
||||
/*
|
||||
* 每日任务开始
|
||||
*
|
||||
*/
|
||||
public function DayTask(){
|
||||
$cron = new \app\cron\controller\AppTodayStatistical();
|
||||
$cron->index();
|
||||
}
|
||||
|
||||
//临时
|
||||
public function teset(){
|
||||
$cron = new \app\cron\controller\Test();
|
||||
$cron->index();
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ class Decorate extends BaseCom
|
||||
$data = [];
|
||||
$reslut = model('Decorate')->get_decorate_detail($did);
|
||||
//当前用户金币
|
||||
$user_coin = db::name('user_wallet')->where(['user_id' => $this->uid])->value('coin');
|
||||
$user_coin = db::name('user_wallet_coin')->where(['user_id' => $this->uid])->value('coin');
|
||||
$data['user_info']['user_id'] = $this->uid;
|
||||
$data['user_info']['user_coin'] = intval($user_coin);
|
||||
$data['decorate'] = $reslut['data'];
|
||||
@@ -55,12 +55,13 @@ class Decorate extends BaseCom
|
||||
$did = input('did', 0);
|
||||
$day = input('day', 1);
|
||||
$user_id = input('user_id', 0);
|
||||
$num = input('num', 1);
|
||||
$keyname = "api:Decorate:pay_decorate:uid:".$uid;
|
||||
redis_lock_exit($keyname);
|
||||
if($user_id){//购买装扮 赠送好友
|
||||
$reslut = model('Decorate')->pay_decorate($user_id, $did, $day,4,$uid);
|
||||
$reslut = model('Decorate')->pay_decorate($user_id, $did, $day,4,$uid,'', $num);
|
||||
}else{
|
||||
$reslut = model('Decorate')->pay_decorate($uid, $did, $day,1);
|
||||
$reslut = model('Decorate')->pay_decorate($uid, $did, $day,1,0,'', $num);
|
||||
}
|
||||
redis_unlock($keyname);
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
|
||||
53
application/api/controller/Family.php
Normal file
53
application/api/controller/Family.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Db;
|
||||
|
||||
class Family extends BaseCom
|
||||
{
|
||||
//我的家族
|
||||
public function myFamily()
|
||||
{
|
||||
$reslut = model('Family')->myFamily($this->uid);
|
||||
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//我加入的家族
|
||||
public function myJoinFamily()
|
||||
{
|
||||
$user_id = db::name('vs_user_sign')->where(['sign_user_id' => $this->uid,'end_time' => ['>',time()]])->value('parent_user_id');
|
||||
if(!$user_id){
|
||||
return V(0, '没有加入家族');
|
||||
}
|
||||
$reslut = model('Family')->myFamily($user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//家族收益详情
|
||||
public function familyEarnings()
|
||||
{
|
||||
$user_id = input('user_id',0);//族长 id
|
||||
$where = ['a.user_id' => $user_id];
|
||||
if(input('start_time')){
|
||||
$where['a.createtime'][] = ['>', strtotime(input('start_time'))];
|
||||
}
|
||||
if(input('end_time')){
|
||||
$where['a.createtime'][] = ['<', strtotime(input('end_time'))];
|
||||
}
|
||||
|
||||
$reslut = db::name('vs_user_sign_earnings')->alias('a')
|
||||
->join('user b','a.sign_user_id = b.id')
|
||||
->join('vs_gift g','a.gift_id = g.gid')
|
||||
->field('b.nickname,b.avatar,b.user_code,a.earnings,a.createtime,g.gift_name,g.gift_price')
|
||||
->where($where)
|
||||
->order('a.createtime desc')
|
||||
->page(input('page',1),30)
|
||||
->select();
|
||||
return V(1, '成功', $reslut);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,8 @@ class Gift extends BaseCom
|
||||
{
|
||||
$label = input('label',0);
|
||||
$room_id = input('room_id',0);
|
||||
$reslut = model('Gift')->get_gift_list($label,$room_id);
|
||||
$user_id = $this->uid ?? 0;
|
||||
$reslut = model('Gift')->get_gift_list($label,$room_id,$user_id);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//聊天送礼物 (音信)
|
||||
|
||||
301
application/api/controller/GiftBase.php
Normal file
301
application/api/controller/GiftBase.php
Normal file
@@ -0,0 +1,301 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use app\common\model\GiveGiftBase;
|
||||
use think\Cache;
|
||||
use think\Log;
|
||||
|
||||
class GiftBase extends BaseCom
|
||||
{
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = ['*'];
|
||||
|
||||
protected $giftModel;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->giftModel = new GiveGiftBase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取送礼记录
|
||||
*/
|
||||
public function getGiftRecords()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
|
||||
$where = [];
|
||||
$options = [];
|
||||
|
||||
// 构建查询条件
|
||||
if (!empty($params['from_id'])) {
|
||||
$where['from_id'] = $params['from_id'];
|
||||
}
|
||||
if (!empty($params['user_id'])) {
|
||||
$where['user_id'] = $params['user_id'];
|
||||
}
|
||||
if (!empty($params['gift_user'])) {
|
||||
$where['gift_user'] = $params['gift_user'];
|
||||
}
|
||||
if (!empty($params['gift_id'])) {
|
||||
$where['gift_id'] = $params['gift_id'];
|
||||
}
|
||||
if (!empty($params['type'])) {
|
||||
$where['type'] = $params['type'];
|
||||
}
|
||||
if (!empty($params['from'])) {
|
||||
$where['from'] = $params['from'];
|
||||
}
|
||||
if (!empty($params['gift_type'])) {
|
||||
$where['gift_type'] = $params['gift_type'];
|
||||
}
|
||||
|
||||
// 时间范围
|
||||
if (!empty($params['start_time'])) {
|
||||
$options['start_time'] = intval($params['start_time']);
|
||||
}
|
||||
if (!empty($params['end_time'])) {
|
||||
$options['end_time'] = intval($params['end_time']);
|
||||
}
|
||||
|
||||
// 分页参数
|
||||
$options['page'] = $params['page'] ?? 1;
|
||||
$options['limit'] = min($params['limit'] ?? 20, 100); // 限制最大100条
|
||||
|
||||
// 排序
|
||||
if (!empty($params['order'])) {
|
||||
$options['order'] = $params['order'];
|
||||
}
|
||||
|
||||
// 查询数据
|
||||
$result = $this->giftModel->getGiftRecords($where, $options);
|
||||
|
||||
Log::info("查询送礼记录,条件: " . json_encode($where) . ", 结果数: " . count($result['data']));
|
||||
|
||||
$this->success('获取成功', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 房间送礼统计
|
||||
*/
|
||||
public function getRoomStatistics()
|
||||
{
|
||||
$fromId = $this->request->param('from_id/d', 0);
|
||||
$startTime = $this->request->param('start_time/d', strtotime('-7 days'));
|
||||
$endTime = $this->request->param('end_time/d', time());
|
||||
|
||||
if (!$fromId) {
|
||||
$this->error('房间ID不能为空');
|
||||
}
|
||||
|
||||
// 尝试从缓存获取
|
||||
$cacheKey = "gift:room:stats:{$fromId}:" . date('Ymd', $startTime) . '-' . date('Ymd', $endTime);
|
||||
$cachedData = Cache::get($cacheKey);
|
||||
|
||||
if ($cachedData !== false) {
|
||||
Log::info("从缓存获取房间统计: {$cacheKey}");
|
||||
$this->success('获取成功', $cachedData);
|
||||
}
|
||||
|
||||
$where = ['from_id' => $fromId];
|
||||
$options = [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
];
|
||||
|
||||
// 统计房间总数据
|
||||
$totalStats = $this->giftModel->getGiftStatistics($where, $options);
|
||||
|
||||
// 按送礼人分组统计
|
||||
$userStats = $this->giftModel->getGiftStatistics($where, array_merge($options, [
|
||||
'group_by' => 'user_id'
|
||||
]));
|
||||
|
||||
// 按收礼人分组统计
|
||||
$receiverStats = $this->giftModel->getGiftStatistics($where, array_merge($options, [
|
||||
'group_by' => 'gift_user'
|
||||
]));
|
||||
|
||||
$result = [
|
||||
'room_id' => $fromId,
|
||||
'time_range' => [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
'start_date' => date('Y-m-d H:i:s', $startTime),
|
||||
'end_date' => date('Y-m-d H:i:s', $endTime),
|
||||
],
|
||||
'total_stats' => $totalStats,
|
||||
'user_stats' => $userStats,
|
||||
'receiver_stats' => $receiverStats,
|
||||
];
|
||||
|
||||
// 缓存5分钟
|
||||
Cache::set($cacheKey, $result, 300);
|
||||
|
||||
Log::info("房间统计计算完成: {$fromId}, 送礼人数: " . count($userStats) . ", 收礼人数: " . count($receiverStats));
|
||||
|
||||
$this->success('获取成功', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户送礼统计
|
||||
*/
|
||||
public function getUserStatistics()
|
||||
{
|
||||
$userId = $this->request->param('user_id/d', 0);
|
||||
$startTime = $this->request->param('start_time/d', strtotime('-30 days'));
|
||||
$endTime = $this->request->param('end_time/d', time());
|
||||
|
||||
if (!$userId) {
|
||||
$this->error('用户ID不能为空');
|
||||
}
|
||||
|
||||
$cacheKey = "gift:user:stats:{$userId}:" . date('Ymd', $startTime) . '-' . date('Ymd', $endTime);
|
||||
$cachedData = Cache::get($cacheKey);
|
||||
|
||||
if ($cachedData !== false) {
|
||||
Log::info("从缓存获取用户统计: {$cacheKey}");
|
||||
$this->success('获取成功', $cachedData);
|
||||
}
|
||||
|
||||
$where = ['user_id' => $userId];
|
||||
$options = [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
];
|
||||
|
||||
// 用户总送礼统计
|
||||
$totalStats = $this->giftModel->getGiftStatistics($where, $options);
|
||||
|
||||
// 按房间分组统计
|
||||
$roomStats = $this->giftModel->getGiftStatistics($where, array_merge($options, [
|
||||
'group_by' => 'from_id'
|
||||
]));
|
||||
|
||||
// 按收礼人分组统计
|
||||
$receiverStats = $this->giftModel->getGiftStatistics($where, array_merge($options, [
|
||||
'group_by' => 'gift_user'
|
||||
]));
|
||||
|
||||
$result = [
|
||||
'user_id' => $userId,
|
||||
'time_range' => [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
'start_date' => date('Y-m-d H:i:s', $startTime),
|
||||
'end_date' => date('Y-m-d H:i:s', $endTime),
|
||||
],
|
||||
'total_stats' => $totalStats,
|
||||
'room_stats' => $roomStats,
|
||||
'receiver_stats' => $receiverStats,
|
||||
];
|
||||
|
||||
// 缓存5分钟
|
||||
Cache::set($cacheKey, $result, 300);
|
||||
|
||||
Log::info("用户统计计算完成: {$userId}, 房间数: " . count($roomStats) . ", 收礼人数: " . count($receiverStats));
|
||||
|
||||
$this->success('获取成功', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 收礼统计
|
||||
*/
|
||||
public function getReceiveStatistics()
|
||||
{
|
||||
$giftUser = $this->request->param('gift_user/d', 0);
|
||||
$startTime = $this->request->param('start_time/d', strtotime('-30 days'));
|
||||
$endTime = $this->request->param('end_time/d', time());
|
||||
|
||||
if (!$giftUser) {
|
||||
$this->error('用户ID不能为空');
|
||||
}
|
||||
|
||||
$cacheKey = "gift:receive:stats:{$giftUser}:" . date('Ymd', $startTime) . '-' . date('Ymd', $endTime);
|
||||
$cachedData = Cache::get($cacheKey);
|
||||
|
||||
if ($cachedData !== false) {
|
||||
Log::info("从缓存获取收礼统计: {$cacheKey}");
|
||||
$this->success('获取成功', $cachedData);
|
||||
}
|
||||
|
||||
$where = ['gift_user' => $giftUser];
|
||||
$options = [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
];
|
||||
|
||||
// 总收礼统计
|
||||
$totalStats = $this->giftModel->getGiftStatistics($where, $options);
|
||||
|
||||
// 按房间分组统计
|
||||
$roomStats = $this->giftModel->getGiftStatistics($where, array_merge($options, [
|
||||
'group_by' => 'from_id'
|
||||
]));
|
||||
|
||||
// 按送礼人分组统计
|
||||
$giverStats = $this->giftModel->getGiftStatistics($where, array_merge($options, [
|
||||
'group_by' => 'user_id'
|
||||
]));
|
||||
|
||||
$result = [
|
||||
'gift_user' => $giftUser,
|
||||
'time_range' => [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
'start_date' => date('Y-m-d H:i:s', $startTime),
|
||||
'end_date' => date('Y-m-d H:i:s', $endTime),
|
||||
],
|
||||
'total_stats' => $totalStats,
|
||||
'room_stats' => $roomStats,
|
||||
'giver_stats' => $giverStats,
|
||||
];
|
||||
|
||||
// 缓存5分钟
|
||||
Cache::set($cacheKey, $result, 300);
|
||||
|
||||
Log::info("收礼统计计算完成: {$giftUser}, 房间数: " . count($roomStats) . ", 送礼人数: " . count($giverStats));
|
||||
|
||||
$this->success('获取成功', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取送礼趋势
|
||||
*/
|
||||
public function getGiftTrend()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
|
||||
$startTime = $params['start_time'] ?? strtotime('-7 days');
|
||||
$endTime = $params['end_time'] ?? time();
|
||||
$interval = $params['interval'] ?? 'day';
|
||||
|
||||
if (!in_array($interval, ['day', 'week', 'month'])) {
|
||||
$interval = 'day';
|
||||
}
|
||||
|
||||
$cacheKey = "gift:trend:" . date('Ymd', $startTime) . '-' . date('Ymd', $endTime) . ":{$interval}";
|
||||
$cachedData = Cache::get($cacheKey);
|
||||
|
||||
if ($cachedData !== false) {
|
||||
$this->success('获取成功', $cachedData);
|
||||
}
|
||||
|
||||
$trendData = $this->giftModel->getTrendStatistics($startTime, $endTime, $interval);
|
||||
|
||||
// 缓存10分钟
|
||||
Cache::set($cacheKey, $trendData, 600);
|
||||
|
||||
$this->success('获取成功', [
|
||||
'trend_data' => $trendData,
|
||||
'interval' => $interval,
|
||||
'time_range' => [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
48
application/api/controller/GiftNew.php
Normal file
48
application/api/controller/GiftNew.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
|
||||
class GiftNew extends BaseCom
|
||||
{
|
||||
|
||||
/*
|
||||
* 获取礼物列表
|
||||
* @param int $label 礼物标签
|
||||
* @param int $type 类型:1-房间送礼礼物,2-排麦设置插麦礼物,3-拍卖位选择拍卖礼物,4-歌手添加歌单礼物,5-动态打赏礼物
|
||||
* @return array
|
||||
*/
|
||||
public function get_gift_list()
|
||||
{
|
||||
$key_name = "api:gift_new:get_gift_list:" . $this->uid;
|
||||
redis_lock_exits($key_name);
|
||||
$label = input('label', 0);
|
||||
$type = input('type');
|
||||
if (empty($type)) {
|
||||
return V(0, 'type参数错误');
|
||||
}
|
||||
$reslut = model('GiftNew')->get_gift_list($this->uid, $type, $label);
|
||||
redis_unlocks($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
/*
|
||||
* 酒吧房-自定义礼物设置
|
||||
*/
|
||||
public function set_custom_gift(){
|
||||
$gift_id = input('gift_id', 0);
|
||||
$room_id = input('room_id', 0);
|
||||
$gift_remark_name = input('gift_remark_name', '');
|
||||
$reslut = model('GiftNew')->set_custom_gift($this->uid, $gift_id, $room_id, $gift_remark_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
/*
|
||||
* 获取自定义礼物列表
|
||||
*/
|
||||
public function get_custom_gift_list(){
|
||||
$user_id = input('user_id', 0); //收礼人用户Id
|
||||
$reslut = model('GiftNew')->get_custom_gift_list($user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
179
application/api/controller/GiveGiftBase.php
Normal file
179
application/api/controller/GiveGiftBase.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\library\GiftQueue;
|
||||
use think\Log;
|
||||
use app\common\controller\BaseCom;
|
||||
|
||||
class GiveGiftBase extends BaseCom
|
||||
{
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = ['*'];
|
||||
|
||||
/**
|
||||
* 送礼接口
|
||||
*/
|
||||
public function give()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
|
||||
// 验证必要参数
|
||||
$required = ['user_id', 'gift_id', 'gift_user', 'from_id'];
|
||||
foreach ($required as $field) {
|
||||
if (empty($params[$field])) {
|
||||
$this->error("{$field}不能为空");
|
||||
}
|
||||
}
|
||||
|
||||
// 构建送礼数据
|
||||
$giftData = [
|
||||
'user_id' => intval($params['user_id']),
|
||||
'gift_id' => intval($params['gift_id']),
|
||||
'gift_type' => intval($params['gift_type'] ?? 1),
|
||||
'number' => intval($params['number'] ?? 1),
|
||||
'gift_user' => intval($params['gift_user']),
|
||||
'from_id' => intval($params['from_id']),
|
||||
'pit_number' => intval($params['pit_number'] ?? 0),
|
||||
'total_price' => floatval($params['total_price'] ?? 0),
|
||||
'type' => intval($params['type'] ?? 1),
|
||||
'from' => intval($params['from'] ?? 1),
|
||||
'createtime' => time(),
|
||||
];
|
||||
|
||||
// 验证价格
|
||||
if ($giftData['total_price'] <= 0) {
|
||||
$this->error('礼物总价值必须大于0');
|
||||
}
|
||||
|
||||
// 验证数量
|
||||
if ($giftData['number'] <= 0) {
|
||||
$this->error('礼物数量必须大于0');
|
||||
}
|
||||
|
||||
// 使用队列异步处理
|
||||
$result = GiftQueue::push($giftData);
|
||||
|
||||
if ($result) {
|
||||
// 记录日志
|
||||
Log::info("用户送礼成功(队列),用户: {$giftData['user_id']}, 收礼人: {$giftData['gift_user']}, 房间: {$giftData['from_id']}");
|
||||
|
||||
// 立即返回成功,后台异步处理
|
||||
$this->success('送礼成功,正在处理中', [
|
||||
'queue_status' => 'processing',
|
||||
'user_id' => $giftData['user_id'],
|
||||
'gift_user' => $giftData['gift_user'],
|
||||
'timestamp' => time()
|
||||
]);
|
||||
} else {
|
||||
Log::error("用户送礼失败(队列),用户: {$giftData['user_id']}, 收礼人: {$giftData['gift_user']}");
|
||||
$this->error('送礼失败,请重试');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量送礼
|
||||
*/
|
||||
public function batchGive()
|
||||
{
|
||||
$gifts = $this->request->param('gifts/a', []);
|
||||
|
||||
if (empty($gifts) || !is_array($gifts)) {
|
||||
$this->error('礼物数据不能为空');
|
||||
}
|
||||
|
||||
$successCount = 0;
|
||||
$failCount = 0;
|
||||
$giftList = [];
|
||||
|
||||
foreach ($gifts as $gift) {
|
||||
// 验证必要参数
|
||||
if (empty($gift['user_id']) || empty($gift['gift_user']) || empty($gift['from_id'])) {
|
||||
$failCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
$giftData = [
|
||||
'user_id' => intval($gift['user_id']),
|
||||
'gift_id' => intval($gift['gift_id'] ?? 0),
|
||||
'gift_type' => intval($gift['gift_type'] ?? 1),
|
||||
'number' => intval($gift['number'] ?? 1),
|
||||
'gift_user' => intval($gift['gift_user']),
|
||||
'from_id' => intval($gift['from_id']),
|
||||
'pit_number' => intval($gift['pit_number'] ?? 0),
|
||||
'total_price' => floatval($gift['total_price'] ?? 0),
|
||||
'type' => intval($gift['type'] ?? 1),
|
||||
'from' => intval($gift['from'] ?? 1),
|
||||
'createtime' => time(),
|
||||
];
|
||||
|
||||
$giftList[] = $giftData;
|
||||
}
|
||||
|
||||
// 批量加入队列
|
||||
$result = GiftQueue::pushBatch($giftList);
|
||||
|
||||
Log::info("批量送礼提交,总计: {$result['total']}, 成功: {$result['success']}, 失败: {$result['failed']}");
|
||||
|
||||
$this->success("批量送礼提交成功", $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取队列状态
|
||||
*/
|
||||
public function queueStatus()
|
||||
{
|
||||
$stats = GiftQueue::stats();
|
||||
|
||||
$this->success('获取成功', $stats);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试送礼接口(直接写入,用于测试)
|
||||
*/
|
||||
public function testGive()
|
||||
{
|
||||
// 只有测试环境可用
|
||||
if (config('app_debug') != true) {
|
||||
$this->error('测试接口仅限开发环境使用');
|
||||
}
|
||||
|
||||
$params = $this->request->param();
|
||||
|
||||
// 验证必要参数
|
||||
$required = ['user_id', 'gift_id', 'gift_user', 'from_id'];
|
||||
foreach ($required as $field) {
|
||||
if (empty($params[$field])) {
|
||||
$this->error("{$field}不能为空");
|
||||
}
|
||||
}
|
||||
|
||||
// 构建送礼数据
|
||||
$giftData = [
|
||||
'user_id' => intval($params['user_id']),
|
||||
'gift_id' => intval($params['gift_id']),
|
||||
'gift_type' => intval($params['gift_type'] ?? 1),
|
||||
'number' => intval($params['number'] ?? 1),
|
||||
'gift_user' => intval($params['gift_user']),
|
||||
'from_id' => intval($params['from_id']),
|
||||
'pit_number' => intval($params['pit_number'] ?? 0),
|
||||
'total_price' => floatval($params['total_price'] ?? 0),
|
||||
'type' => intval($params['type'] ?? 1),
|
||||
'from' => intval($params['from'] ?? 1),
|
||||
'createtime' => time(),
|
||||
];
|
||||
|
||||
// 直接写入数据库(测试用)
|
||||
$model = new \app\common\model\GiveGiftBase();
|
||||
$result = $model->addGiftRecord($giftData);
|
||||
|
||||
if ($result) {
|
||||
$this->success('测试送礼成功(直接写入)', [
|
||||
'id' => $result,
|
||||
'data' => $giftData
|
||||
]);
|
||||
} else {
|
||||
$this->error('测试送礼失败: ' . $model->getError());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class Guild extends BaseCom
|
||||
$guild_id = input('guild_id', 0);
|
||||
$key_name = "api:guild:join_guild:".$uid;
|
||||
redis_lock_exit($key_name);
|
||||
$reslut = model('Guild')->join_guild($guild_id,$uid);
|
||||
$reslut = model('Guild')->join_guild_apply($guild_id,$uid);
|
||||
redis_unlock($key_name);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ class Guild extends BaseCom
|
||||
$type = input('type', 1);
|
||||
$key_name = "api:guild:operate_guild:".$uid;
|
||||
redis_lock_exit($key_name);
|
||||
$reslut = model('Guild')->operate_guild($uid, $apply_id, $type);
|
||||
$reslut = model('Guild')->operate_guild($apply_id, $type,$uid);
|
||||
redis_unlock($key_name);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -174,9 +174,14 @@ class Guild extends BaseCom
|
||||
$uid = $this->uid;
|
||||
$reslut = model('Guild')->user_is_join($uid);
|
||||
if($reslut==0){
|
||||
return V(0,'用户不是工会成员');
|
||||
return V(0,'用户不是工会成员',['guild'=>[]]);
|
||||
}elseif($reslut['status']==2){
|
||||
return V(0,'用户已申请加入公会待会长审核', ['guild'=>$reslut]);
|
||||
}elseif($reslut['status']==3){
|
||||
return V(0,'用户加入公会申请已被拒绝', ['guild'=>$reslut]);
|
||||
}elseif($reslut['status']==1){
|
||||
return V(1,'用户是工会成员', ['guild'=>$reslut]);
|
||||
}
|
||||
return V(1,'用户是工会成员', ['guild_id'=>$reslut]);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -187,7 +192,8 @@ class Guild extends BaseCom
|
||||
$guild_id = input('guild_id', 0);
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 20);
|
||||
$reslut = model('Guild')->get_guild_user_list($guild_id,$uid,$page,$page_limit);
|
||||
$seach = input('search', '');
|
||||
$reslut = model('Guild')->get_guild_user_list($guild_id,$uid,$page,$page_limit,$seach);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
|
||||
}
|
||||
@@ -196,7 +202,7 @@ class Guild extends BaseCom
|
||||
*/
|
||||
public function get_guild_info(){
|
||||
$uid = $this->uid;
|
||||
$guild_id = input('guild_id', 0);
|
||||
$guild_id = input('guild_id', '');
|
||||
$reslut = model('Guild')->guild_info($guild_id,$uid);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -205,7 +211,7 @@ class Guild extends BaseCom
|
||||
*/
|
||||
public function set_guild_info(){
|
||||
$uid = $this->uid;
|
||||
$guild_id = input('guild_id', 0);
|
||||
$guild_id = input('guild_id', '');
|
||||
//群聊名称
|
||||
$name = input('name', '');
|
||||
//群聊公告
|
||||
@@ -216,5 +222,30 @@ class Guild extends BaseCom
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
/*
|
||||
* 我的工会
|
||||
*
|
||||
*/
|
||||
public function my_guild(){
|
||||
$uid = $this->uid;
|
||||
$reslut = model('Guild')->my_guild($uid);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
/*
|
||||
* 受邀申请处理
|
||||
*/
|
||||
public function invite_apply_handle(){
|
||||
$uid = $this->uid;
|
||||
$apply_id = input('apply_id', 0);
|
||||
$type = input('type', 0);
|
||||
$system_message = Db::name('system_message')->where(['id'=>$apply_id,'delete_time'=>0])->find();
|
||||
if($system_message['type'] == 6){
|
||||
$reslut = model('Guild')->guild_invite_handle($uid, $apply_id, $type);
|
||||
}elseif($system_message['type'] == 7){
|
||||
$reslut = model('Guild')->user_ratio_up_apply($uid, $apply_id, $type);
|
||||
}
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class Index extends BaseCom
|
||||
public function room_list()
|
||||
{
|
||||
$is_top = input('is_top', 0); //1非置顶2置顶
|
||||
$label_id = input('label_id', 0);
|
||||
$label_id = input('label_id');
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 20);
|
||||
|
||||
@@ -29,9 +29,47 @@ class Index extends BaseCom
|
||||
//房间类型列表
|
||||
public function room_type_list()
|
||||
{
|
||||
$list = db::name('vs_room_type')->where(['status' => 1, 'deletetime' => 0])->field('id,type_name as label_name')->order('sort asc')->select();
|
||||
$list = db::name('vs_room_label')
|
||||
->where(['status' => 1])
|
||||
->field('id,label_name,default_index,sort')->order('sort asc')->select();
|
||||
$is_default = 1;
|
||||
if($list){
|
||||
$default_index = 0;
|
||||
$label_name = '';
|
||||
$sort = 99;
|
||||
foreach ($list as $k => $v) {
|
||||
if($v['id'] == 3 || $v['id'] == 4){
|
||||
$label_name = '亲密/真爱拍';
|
||||
if($v['default_index'] == 1){
|
||||
$default_index = 1;
|
||||
}
|
||||
$sort = min($sort, $v['sort']);
|
||||
unset($list[$k]);
|
||||
}
|
||||
}
|
||||
if($label_name){
|
||||
//添加到列表后面
|
||||
$list[] = [
|
||||
'id' => 0,
|
||||
'label_name' => $label_name,
|
||||
'default_index' => $default_index,
|
||||
'sort' => $sort
|
||||
];
|
||||
}
|
||||
//数据重组避免乱序 再根据sort 排序 越小的越靠前
|
||||
$list = array_values($list);
|
||||
usort($list, function ($a, $b) {
|
||||
return $a['sort'] - $b['sort'];
|
||||
});
|
||||
}
|
||||
foreach ($list as $v){
|
||||
if($v['default_index'] == 1){
|
||||
$is_default = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//给前面添加一组数据
|
||||
array_unshift($list, ['id' => -1, 'label_name' => '热门']);
|
||||
array_unshift($list, ['id' => -1, 'label_name' => '热门','default_index' => $is_default, 'sort' => 99]);
|
||||
return V(1, '获取成功', $list);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,4 +36,27 @@ class Level extends BaseCom
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//歌手等级
|
||||
public function get_singer_level(){
|
||||
$uid = $this->uid;
|
||||
$reslut = model('Level')->get_singer_level($uid);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//是否歌手
|
||||
public function is_singer(){
|
||||
$uid = $this->uid;
|
||||
$singer = model('api/SingerSong')->singerAuthStatus($uid);
|
||||
if($singer['status'] == 1){
|
||||
$data = [
|
||||
'status' => 1,
|
||||
'level' => $singer['level'],
|
||||
];
|
||||
}else{
|
||||
$data = [
|
||||
'status' => 0,
|
||||
'level' => 0,
|
||||
];
|
||||
}
|
||||
return V(1,'成功', $data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use app\common\controller\NumberAuth;
|
||||
use app\api\controller\Sms;
|
||||
use http\Client;
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
use think\Loader;
|
||||
use Firebase\JWT\JWT;
|
||||
use think\Log;
|
||||
@@ -32,11 +33,11 @@ class Login extends Controller
|
||||
{
|
||||
$user_name = input('user_login', '');
|
||||
$password = input('password', '');
|
||||
$system = input('system','');
|
||||
$system = input('system');
|
||||
if(empty($system)){
|
||||
$system = request()->header('system');
|
||||
}
|
||||
$login_device = input('deviceId','');
|
||||
$login_device = input('deviceId');
|
||||
if(empty($login_device)){
|
||||
$login_device = request()->header('deviceId');
|
||||
}
|
||||
@@ -55,24 +56,31 @@ class Login extends Controller
|
||||
*/
|
||||
public function phone_code(){
|
||||
|
||||
$system = input('system','');
|
||||
$system = input('system');
|
||||
if(empty($system)){
|
||||
$system = request()->header('system');
|
||||
}
|
||||
$login_device = input('deviceId','');
|
||||
$login_device = input('deviceId');
|
||||
if(empty($login_device)){
|
||||
$login_device = request()->header('deviceId');
|
||||
}
|
||||
|
||||
$user_name = input('user_login');
|
||||
|
||||
$sms_code = input('sms_code', ''); //短信验证码
|
||||
if (\think\Env::get('app.system_type','prod') != "prod" && $sms_code == "999999999") {
|
||||
// 非正式环境且验证码为999999,直接放行
|
||||
}else{
|
||||
$key_name = "api:login:phone_code_verify:" . $user_name;
|
||||
redis_lock_exit($key_name);
|
||||
// $sms = new Sms;
|
||||
// $ret = $sms->check($user_name, $sms_code);//$event = default-默认登录,1-更换手机号,2绑定手机号,3-忘记密码,4-设置密码,5-账号注销,6-提现
|
||||
$ret = model('sms')->verification_code('default',$user_name, $sms_code);
|
||||
redis_unlock($key_name);
|
||||
if ($ret['code'] == 0) {
|
||||
return V($ret['code'], $ret['msg'], null);
|
||||
}
|
||||
|
||||
}
|
||||
$reslut = model('Login')->phone_verification_code_log($user_name, $system,$login_device);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -87,11 +95,11 @@ class Login extends Controller
|
||||
public function one_click_login()
|
||||
{
|
||||
$loginToken = input('login_token', '');
|
||||
$system = input('system','');
|
||||
$system = input('system');
|
||||
if(empty($system)){
|
||||
$system = request()->header('system');
|
||||
}
|
||||
$login_device = input('deviceId','');
|
||||
$login_device = input('deviceId');
|
||||
if(empty($login_device)){
|
||||
$login_device = request()->header('deviceId');
|
||||
}
|
||||
@@ -106,6 +114,21 @@ class Login extends Controller
|
||||
if (!$mobile) {
|
||||
return V(0, '登录失败, 请更换登录方式!' );
|
||||
}
|
||||
//检测是否注销过
|
||||
$config_time = get_system_config_value('cancel_no_login');
|
||||
$is_del = db::name('user')->where(['mobile' => $mobile,'delete_time' => ['<>', 0]])->order('delete_time', 'desc')->find();
|
||||
|
||||
//获取手机号绑定的账号数
|
||||
$count = db::name('user')->where(['mobile' => $mobile])->count();
|
||||
//获取注销的账号数
|
||||
$count_del = db::name('user')->where(['mobile' => $mobile,'delete_time' => ['<>', 0]])->count();
|
||||
if ($count == $count_del) {
|
||||
if ($is_del) {
|
||||
if (time() - $is_del['delete_time'] < $config_time * 24 * 3600) {//30天内注销过
|
||||
return V(0, '注销30天内,不可操作。');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ctype_digit($mobile)){
|
||||
$reslut = model('Login')->phone_verification_code_log($mobile,$system,$login_device);
|
||||
@@ -119,8 +142,8 @@ class Login extends Controller
|
||||
public function multi_account_login()
|
||||
{
|
||||
$user_name = input('user_login');
|
||||
$system = input('system','');
|
||||
$login_device = input('deviceId','');
|
||||
$system = input('system');
|
||||
$login_device = input('deviceId');
|
||||
if(empty($login_device)){
|
||||
$login_device = request()->header('deviceId');
|
||||
}
|
||||
@@ -138,11 +161,11 @@ class Login extends Controller
|
||||
public function wechatLogin()
|
||||
{
|
||||
$code = input('code');
|
||||
$system = input('system','');
|
||||
$system = input('system');
|
||||
if(empty($system)){
|
||||
$system = request()->header('system');
|
||||
}
|
||||
$login_device = input('deviceId','');
|
||||
$login_device = input('deviceId');
|
||||
if(empty($login_device)){
|
||||
$login_device = request()->header('deviceId');
|
||||
}
|
||||
@@ -238,11 +261,11 @@ class Login extends Controller
|
||||
public function aliLogin()
|
||||
{
|
||||
$authCode = input('auth_code');
|
||||
$system = input('system','');
|
||||
$system = input('system');
|
||||
if(empty($system)){
|
||||
$system = request()->header('system');
|
||||
}
|
||||
$login_device = input('deviceId','');
|
||||
$login_device = input('deviceId');
|
||||
if(empty($login_device)){
|
||||
$login_device = request()->header('deviceId');
|
||||
}
|
||||
@@ -290,11 +313,11 @@ class Login extends Controller
|
||||
*/
|
||||
public function iosLogin()
|
||||
{
|
||||
$system = input('system','');
|
||||
$system = input('system');
|
||||
if(empty($system)){
|
||||
$system = request()->header('system');
|
||||
}
|
||||
$login_device = input('deviceId','');
|
||||
$login_device = input('deviceId');
|
||||
if(empty($login_device)){
|
||||
$login_device = request()->header('deviceId');
|
||||
}
|
||||
@@ -357,8 +380,32 @@ class Login extends Controller
|
||||
//注销
|
||||
public function cancel()
|
||||
{
|
||||
$system = input('system');
|
||||
if(empty($system)){
|
||||
$system = request()->header('system');
|
||||
}
|
||||
$login_device = input('deviceId');
|
||||
if(empty($login_device)){
|
||||
$login_device = request()->header('deviceId');
|
||||
}
|
||||
$token = input('token');
|
||||
$reslut = model('Login')->cancel($token);
|
||||
$sms_code = input('sms_code', ''); //短信验证码
|
||||
|
||||
$user_info = db::name('user_token')->where('token', $token)->find();
|
||||
$user_phone = db::name('user')->where(['id' => $user_info['user_id']])->value('mobile');
|
||||
if ($user_phone) {
|
||||
if(!$sms_code){
|
||||
return V(0, '网络错误,请返回【我的】刷新后重新尝试!' );
|
||||
}else{
|
||||
//$event = default-默认登录,1-更换手机号,2绑定手机号,3-忘记密码,4-设置密码,5-账号注销,6-提现
|
||||
$ret = model('sms')->verification_code(5,$user_phone, $sms_code);
|
||||
if ($ret['code'] == 0) {
|
||||
return V($ret['code'], $ret['msg'], null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$reslut = model('Login')->cancel($token, $system,$login_device);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
43
application/api/controller/Lottery.php
Normal file
43
application/api/controller/Lottery.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use app\common\service\LotteryService;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use think\Log;
|
||||
|
||||
class Lottery extends BaseCom
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* 中奖统计接口
|
||||
* @return json
|
||||
*/
|
||||
public function stat()
|
||||
{
|
||||
try {
|
||||
$where = [
|
||||
'uid' => $this->request->param('uid/d', 0),
|
||||
'prize_type' => $this->request->param('prize_type/d', 0),
|
||||
'start_time' => $this->request->param('start_time/d', 0),
|
||||
'end_time' => $this->request->param('end_time/d', time())
|
||||
];
|
||||
$service = new LotteryService();
|
||||
$stat = $service->statWinner($where);
|
||||
return json([
|
||||
'code' => 0,
|
||||
'msg' => '统计成功',
|
||||
'data' => $stat
|
||||
]);
|
||||
} catch (Exception $e) {
|
||||
Log::error('中奖统计失败:' . $e->getMessage());
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => $e->getMessage(),
|
||||
'data' => []
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
45
application/api/controller/Nobility.php
Normal file
45
application/api/controller/Nobility.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
|
||||
class Nobility extends BaseCom
|
||||
{
|
||||
//初始化
|
||||
protected function initialize()
|
||||
{
|
||||
//允许跨域
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
}
|
||||
//爵位列表
|
||||
public function get_nobility_list(){
|
||||
$uid = $this->uid;
|
||||
$reslut = model('Nobility')->getNobilityList($uid);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//爵位详情
|
||||
public function get_nobility_detail(){
|
||||
$uid = $this->uid;
|
||||
$reslut = model('Nobility')->getNobilityInfo($uid);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//爵位购买价格
|
||||
public function get_nobility_price(){
|
||||
$id = input('id', 0);
|
||||
$uid = $this->uid;
|
||||
$reslut = model('Nobility')->buyNobilityPrice($uid,$id);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//爵位购买
|
||||
public function buy_nobility(){
|
||||
$lid = input('lid', 0);
|
||||
$uid = input('uid', $this->uid);
|
||||
$reslut = model('Nobility')->buyNobility($uid,$lid);
|
||||
return V($reslut['code'],$reslut['msg'], null);
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,12 @@ class Page extends controller
|
||||
{
|
||||
$id = input('id', '');
|
||||
$reslut = model('Page')->get_page($id);
|
||||
$html = $reslut['content'] ? $reslut['content'] : '';
|
||||
if($reslut){
|
||||
$html = $reslut['content'] ??'';
|
||||
}else{
|
||||
$html = '';
|
||||
}
|
||||
|
||||
//解析html
|
||||
$html = htmlspecialchars_decode($html);
|
||||
return $html;
|
||||
|
||||
@@ -22,14 +22,21 @@ class Payment extends Controller
|
||||
* APP支付
|
||||
*/
|
||||
public function app_pay() {
|
||||
$type = input('type', 0); //1-微信 2-支付宝 4-通联支付宝 5-通联微信
|
||||
$type = input('type', 0); //1-微信 2-支付宝 4-通联支付宝 5-通联微信 6-苹果支付
|
||||
$user_id = input('user_id', 0);
|
||||
$money = input('money', 0);
|
||||
$coin = input('coin', 0);
|
||||
$type_params = input('type_params', 0);
|
||||
$type_id = input('type_id', 0);
|
||||
$nobility_id = input('nobility_id', 0);//'0-购买金币(充值),其他是爵位id'
|
||||
if($nobility_id != 0){
|
||||
$nobility = model('Nobility')->buyNobilityPrice($user_id,$nobility_id);
|
||||
if($nobility['code'] == 0 || $nobility['data']['price'] != $money){
|
||||
return V(0, '网络错误,请重新操作!', null);
|
||||
}
|
||||
}
|
||||
|
||||
if(!$coin){
|
||||
if(!$coin && $nobility_id == 0){
|
||||
$coin = $money * get_system_config_value('rmb_coin_ratio');
|
||||
}
|
||||
if (!$user_id) {
|
||||
@@ -50,22 +57,23 @@ class Payment extends Controller
|
||||
return V(0, '未成年不可充值!', null);
|
||||
}
|
||||
|
||||
if (!is_numeric($money) || floor($money) != $money || $money <= 0 || $money > 2000) {
|
||||
if (!is_numeric($money) || floor($money) != $money || $money <= 0 || $money > 5000) {
|
||||
return V(0, '请选择正确的充值金额', null);
|
||||
}
|
||||
$user_code = db::name('user')->where(["id" => $user_id])->value('user_code');
|
||||
$title = "APP充值到用户". ($user_code ?? "") ."余额!";
|
||||
$title = $nobility_id == 0 ? '充值到app用户'.($user_code ?? "") ."余额!" :'购买爵位';
|
||||
|
||||
$order_number = $this->createOrderSn();
|
||||
$data['order_sn'] = $order_number;
|
||||
$data['money'] = $money;
|
||||
$data['coin'] = $coin;
|
||||
$data['user_id'] = $user_id;
|
||||
$data['pay_type'] = $type;
|
||||
$data['coin'] = $coin;
|
||||
$data['createtime'] = time();
|
||||
$data['remarke'] = '充值到app用户'.($user_code ?? "") ."余额!";
|
||||
$data['remarke'] = $nobility_id == 0 ? '充值到app用户'.($user_code ?? "") ."余额!" :'购买爵位';
|
||||
$data['type_params'] = $type_params;
|
||||
$data['type_id'] = $type_id;
|
||||
$data['nobility_id'] = $nobility_id;
|
||||
|
||||
$re = db::name('vs_user_recharge')->insert($data);
|
||||
if (!$re) {
|
||||
@@ -76,7 +84,7 @@ class Payment extends Controller
|
||||
//引用支付宝sdk
|
||||
Loader::import('AliPayV2.AliPay', EXTEND_PATH, '.php');
|
||||
$ali = new \AliPay();
|
||||
$result['ali'] = $ali->aliAppPays($order_number, $money, $title);
|
||||
$result['ali'] = $ali->aliAppPays($order_number, $money, $title, $user_id);
|
||||
}elseif($type == 1){
|
||||
//引用微信sdk
|
||||
Loader::import('WxPay.WxPay', EXTEND_PATH, '.php');
|
||||
@@ -87,6 +95,13 @@ class Payment extends Controller
|
||||
Loader::import('TongLian.TongLian', EXTEND_PATH, '.php');
|
||||
$tonglian = new \TongLian();
|
||||
$result['tl'] = $tonglian->TongLianPay($data, $type);
|
||||
}elseif($type == 6){
|
||||
$result = [
|
||||
'order_no' => $order_number,
|
||||
// 'merchant_id' => get_system_config_value('merchant_id')
|
||||
];
|
||||
}else{
|
||||
return V(0, '请选择正确的支付方式', null);
|
||||
}
|
||||
|
||||
return V(1, 'app支付', $result);
|
||||
@@ -327,4 +342,92 @@ class Payment extends Controller
|
||||
echo "fail";
|
||||
}
|
||||
}
|
||||
|
||||
//苹果回调
|
||||
public function notify_apple(){
|
||||
// 1. 接收APP端参数
|
||||
$orderNo = input('order_no', 0);
|
||||
$paymentToken = input('payment_token', ''); // APP端获取的支付凭证
|
||||
|
||||
// 2. 参数校验
|
||||
if (empty($orderNo) || empty($paymentToken)) {
|
||||
return V(0, '参数缺失');
|
||||
}
|
||||
|
||||
// 3. 查询订单(防止订单不存在)
|
||||
$order = Db::name('vs_user_recharge')->where('order_sn', $orderNo)->find();
|
||||
if (!$order) {
|
||||
return V(0, '订单不存在');
|
||||
}
|
||||
if ($order['pay_status'] == 2) {
|
||||
return V(0, '订单已支付');// 幂等处理,防止重复回调
|
||||
}
|
||||
|
||||
// 4. 调用苹果接口验证支付凭证
|
||||
$verifyResult = $this->verifyApplePayReceipt($paymentToken);
|
||||
if (!$verifyResult) {
|
||||
return V(0, '支付凭证验证失败');
|
||||
}
|
||||
|
||||
// 2. 从苹果返回的凭证中解析实际支付金额(//沙箱环境没有这个参数)
|
||||
$applePayAmount = $verifyResult['receipt']['in_app'][0]['price'] ?? 0; // 苹果返回的实际支付金额
|
||||
|
||||
// 3. 校验金额一致性(允许微小误差,如分位四舍五入)
|
||||
if (abs($order['money'] - $applePayAmount) > 0.01) {
|
||||
// 金额不一致,拒绝更新订单
|
||||
// return V(0, '金额不一致');//沙箱环境没有这个参数
|
||||
}
|
||||
|
||||
$transaction_id = $verifyResult['receipt']['in_app'][0]['transaction_id'] ?? '';// 苹果返回的订单号
|
||||
// 5. 更新订单状态
|
||||
//成功后的业务逻辑处理
|
||||
$where['order_sn']=$orderNo;
|
||||
$where['order_type']=1;//1 充值
|
||||
$where['pay_type']=6;//1微信2支付宝 3通联支付宝 4通联微信
|
||||
$where['pay_status']=1;
|
||||
|
||||
$data=[
|
||||
'trade_no' => $transaction_id
|
||||
];
|
||||
|
||||
$res = handelCharge($where,$data);
|
||||
if($res==0){
|
||||
return V(0, '订单处理失败');
|
||||
}
|
||||
return V(1, '支付成功');
|
||||
}
|
||||
|
||||
|
||||
// 核心:调用苹果服务器验证支付凭证
|
||||
private function verifyApplePayReceipt($paymentToken)
|
||||
{
|
||||
// 订单创建时的金额(固定/用户输入的自由金额)
|
||||
|
||||
// 1. 组装请求参数
|
||||
$postData = json_encode([
|
||||
'receipt-data' => $paymentToken, // APP端传入的支付凭
|
||||
]);
|
||||
|
||||
// 2. 先请求生产环境,失败再试沙箱(苹果推荐逻辑)
|
||||
// $url = 'https://buy.itunes.apple.com/verifyReceipt';//正式验证环境
|
||||
$url = "https://sandbox.itunes.apple.com/verifyReceipt";//沙箱测试环境
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 生产环境建议开启
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$result = json_decode($result, true);
|
||||
// 验证返回码:status=0表示验证成功
|
||||
if ($result['status'] == 0) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -40,17 +40,17 @@ class Ranking extends BaseCom
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//公会榜
|
||||
//公会榜【废弃】
|
||||
public function guild_ranking()
|
||||
{
|
||||
$reslut = $this->model->guild_ranking();
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//真爱榜
|
||||
//真爱榜【心动榜】
|
||||
public function love_ranking()
|
||||
{
|
||||
$reslut = $this->model->love_ranking();
|
||||
$reslut = $this->model->love_rankings();
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
@@ -116,4 +116,12 @@ class Redpacket extends BaseCom
|
||||
}
|
||||
return V(1, '获取成功', $result);
|
||||
}
|
||||
|
||||
//红包配置信息
|
||||
public function appConfig(){
|
||||
|
||||
$result['red_packet_min_amount'] = get_system_config_value('red_packet_min_amount') ?? 0;
|
||||
$result['red_packet_fee'] = get_system_config_value('red_packet_fee') ?? 0;
|
||||
return V(1, '获取成功', $result);
|
||||
}
|
||||
}
|
||||
@@ -22,14 +22,16 @@ class Report extends BaseCom
|
||||
public function report(){
|
||||
// $user_id = input('user_id', '');//举报者
|
||||
$type_id = input('type_id', '');//举报类型
|
||||
$report_type = input('report_type', '');//1-用户,2房间,3动态
|
||||
$report_type = input('report_type', '');//1-用户,2房间,3动态,4公会
|
||||
$content = input('content', '');//举报内容
|
||||
$image = input('image', '');//举报图片,多个用英文逗号隔开
|
||||
$from_id = input('from_id', '');//举报来源id
|
||||
if($type_id == '' || $report_type == '' || $from_id == ''){
|
||||
return V(0,"参数错误",null);
|
||||
}
|
||||
|
||||
if($content == '' && $image == ''){
|
||||
return V(0,"请填写举报内容或上传证据图片",null);
|
||||
}
|
||||
$data = [
|
||||
'user_id' => $this->uid,
|
||||
'type_id' => $type_id,
|
||||
@@ -42,5 +44,20 @@ class Report extends BaseCom
|
||||
$res = db::name('vs_user_inform')->insert($data);
|
||||
return V($res ? 1 : 0, $res ? "成功" : "失败", null);
|
||||
}
|
||||
//安卓日志提交
|
||||
public function android_log_report(){
|
||||
$log_name = input('log_name', '');
|
||||
$log_url = input('log_url', '');
|
||||
$user_id = $this->uid;
|
||||
$data = [
|
||||
'log_name' => $log_name,
|
||||
'log_url' => $log_url,
|
||||
'user_id' => $user_id,
|
||||
'createtime' => time(),
|
||||
];
|
||||
$res = db::name('vs_android_log')->insert($data);
|
||||
return V($res ? 1 : 0, $res ? "成功" : "失败", null);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,15 +7,25 @@ use think\Db;
|
||||
|
||||
class Room extends BaseCom
|
||||
{
|
||||
|
||||
|
||||
//创建房间
|
||||
public function create_room()
|
||||
{
|
||||
$room_name = input('room_name', '');
|
||||
$room_cover = input('room_cover', '');
|
||||
$room_intro = input('room_intro', '');
|
||||
|
||||
$signCount = db::name('vs_user_sign')->where(['parent_user_id' => $this->uid ,'end_time' => ['>', time()]] )->count();
|
||||
$num = get_system_config_value('sign_num_per_room');
|
||||
if($signCount < $num){
|
||||
$need_sign_num = $num - $signCount;
|
||||
return V(0, '还需签约'.$need_sign_num.'人,才能创建房间!');
|
||||
}
|
||||
|
||||
$key_name = "api:room:user_create_room:" . $this->uid;
|
||||
redis_lock_exits($key_name);
|
||||
$reslut = model('Room')->user_create_room($this->uid, $room_name, $room_cover, $room_intro);
|
||||
$reslut = model('Room')->user_create_room($this->uid, $room_name, $room_cover, $room_intro,0,0);
|
||||
redis_unlock($key_name);
|
||||
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
@@ -35,15 +45,6 @@ class Room extends BaseCom
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//关注的用户现在所在房间(废弃)
|
||||
public function user_follow_in_room_list()
|
||||
{
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 15);
|
||||
|
||||
$reslut = model('Room')->user_follow_in_room_list($this->uid, $page, $page_limit);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//房间随机名称
|
||||
public function room_random_name()
|
||||
@@ -55,7 +56,7 @@ class Room extends BaseCom
|
||||
public function user_room_history_list()
|
||||
{
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 15);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$reslut = model('UserData')->user_room_history_list($this->uid, $page, $page_limit);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -112,10 +113,23 @@ class Room extends BaseCom
|
||||
$end_time = input('end_time', '');
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 15);
|
||||
$reslut = model('Room')->room_turnover_detail($room_id, $start_time, $end_time, $page, $page_limit);
|
||||
$reslut = model('Room')->room_turnover_detail($this->uid, $room_id, $start_time, $end_time, $page, $page_limit);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//进入房间前的判断
|
||||
public function before_join_room_check()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间不存在');
|
||||
}
|
||||
$reslut = model('Room')->before_join_room_check($this->uid, $room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 进入房间
|
||||
*/
|
||||
@@ -123,6 +137,29 @@ class Room extends BaseCom
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
$password = input('password', '');
|
||||
|
||||
//检测系统是否维护中
|
||||
$is_maintenance = get_system_config_value('is_maintenance');
|
||||
//获取内侧账号
|
||||
$inside_uid = get_system_config_value('inside_uid');
|
||||
//先转为数组
|
||||
$inside_uid = explode(',',$inside_uid);
|
||||
if($inside_uid && $is_maintenance == 3){
|
||||
//排除小房间
|
||||
$room_type = db::name('vs_room')->where('id',$room_id)->value('type_id');
|
||||
if($room_type != 6){
|
||||
//room id = 9 是武松打鼠的房间 暂定为内侧房间
|
||||
if(in_array($this->uid,$inside_uid) && $room_id != 9 && $room_id != 37){
|
||||
return V(0, '不可访问');
|
||||
}
|
||||
}
|
||||
}
|
||||
//内侧账号 才可进入
|
||||
//暂定为内侧房间
|
||||
if(!in_array($this->uid,$inside_uid) && ($room_id == 9 || $room_id == 37 || $room_id == 8)){
|
||||
return V(0, '内侧房间,不可访问');
|
||||
}
|
||||
|
||||
$reslut = model('Room')->join_room($this->uid, $room_id, $password);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -131,6 +168,9 @@ class Room extends BaseCom
|
||||
public function quit_room()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if(!$room_id){
|
||||
return V(0, '房间不存在');
|
||||
}
|
||||
$user_id = input('user_id', 0);
|
||||
$reslut = model('Room')->quit_room($this->uid, $room_id,$user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
@@ -146,20 +186,26 @@ class Room extends BaseCom
|
||||
}
|
||||
|
||||
|
||||
//直播间送礼
|
||||
//直播间送礼【1.6废弃】
|
||||
//
|
||||
public function room_give_gift()
|
||||
{
|
||||
$key_name = "api:room:gift:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
$room_id = input('room_id', 0);
|
||||
$gift_id = input('gift_id', 0);
|
||||
$gift_num = input('gift_num', 0);
|
||||
$gift_num = input('gift_num', 1);
|
||||
$to_uid = input('to_uid', 0);//收礼人ID,逗号隔开的字符串
|
||||
$type = input('type', 1);//1金币购买 2送背包礼物
|
||||
$pit_number = input('pit_number', 0);
|
||||
$heart_id = input('heart_id', 0);
|
||||
|
||||
$pool_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
if($gift_id == $pool_gift_id){
|
||||
$reslut = model('Lottery')->gift($this->uid, $to_uid, $gift_id, $room_id,$gift_num);
|
||||
}else{
|
||||
$reslut = model('Room')->room_gift($this->uid, $to_uid, $gift_id, $gift_num, $type, $room_id, $pit_number,$heart_id);
|
||||
}
|
||||
redis_unlock($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -191,8 +237,11 @@ class Room extends BaseCom
|
||||
public function room_online_list()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if(!$room_id){
|
||||
return V(0, '房间不存在');
|
||||
}
|
||||
$page = input('page', 1);
|
||||
$limit = input('limit', 50);
|
||||
$limit = input('limit', 15);
|
||||
$reslut = model('Room')->room_online_list($room_id, $page, $limit);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -201,6 +250,9 @@ class Room extends BaseCom
|
||||
public function room_user_home()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if(!$room_id){
|
||||
return V(0, '房间不存在');
|
||||
}
|
||||
$user_id = input('user_id', 0);
|
||||
$reslut = model('Room')->room_user_home($this->uid,$room_id, $user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
@@ -275,7 +327,7 @@ class Room extends BaseCom
|
||||
public function change_room_type()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
$type = input('type', 1);//1-点唱,2-拍卖,3-男神,4-女神,7-交友
|
||||
$type = input('type', 1);//1-交友,2-拍卖,7-互娱,8-交友(不要了),9-点唱,10-签约,11-酒吧房
|
||||
$reslut = model('Room')->change_room_type($this->uid, $room_id, $type);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -301,6 +353,9 @@ class Room extends BaseCom
|
||||
public function room_info()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if(!$room_id){
|
||||
return V(0, '房间不存在');
|
||||
}
|
||||
$reslut = model('Room')->room_info($this->uid, $room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -315,16 +370,6 @@ class Room extends BaseCom
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//禁麦 \解禁
|
||||
// public function set_mute_pit()
|
||||
// {
|
||||
// $room_id = input('room_id', 0);
|
||||
// $pit_number = input('pit_number', 0);
|
||||
// $is_mute = input('is_mute', 0);//0 未禁麦 1已
|
||||
// $reslut = model('Room')->set_mute_pit($this->uid, $room_id, $pit_number,$is_mute);
|
||||
// return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
// }
|
||||
|
||||
//锁麦\解锁
|
||||
public function set_lock_pit()
|
||||
{
|
||||
@@ -412,16 +457,6 @@ class Room extends BaseCom
|
||||
}
|
||||
|
||||
|
||||
//房间在线列表
|
||||
public function room_online_list_ceshi()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
$page = input('page', 1);
|
||||
$limit = input('limit', 50);
|
||||
$reslut = model('Room')->room_online_list($room_id, $page, $limit);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//房间用户当前魅力值列表
|
||||
public function room_user_charm_list()
|
||||
{
|
||||
@@ -431,33 +466,25 @@ class Room extends BaseCom
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
// //创建房间
|
||||
// public function create_rooms()
|
||||
// {
|
||||
// //查询所有的房间信息
|
||||
// $room = db::name('vs_room')->field('id,user_id')->where(['room_status' => ['<>',3]])->select();
|
||||
// $i = 0;
|
||||
// foreach ($room as $value) {
|
||||
// $reslut = model('Tencent')->create_group($value['user_id'],'room'.$value['id']);
|
||||
// $i++;
|
||||
// }
|
||||
// return['code' => 1, 'msg' => '成功创建了'.$i.'个房间', 'data' => null];
|
||||
// }
|
||||
|
||||
//用户重连
|
||||
public function user_reconnect()
|
||||
//用户在房间内切后台保留机制
|
||||
|
||||
//给用户发送房间内消息
|
||||
public function send_room_message()
|
||||
{
|
||||
$user_id = input('user_id', '');
|
||||
$room_id = input('room_id', 0);
|
||||
$reslut = model('Room')->user_reconnect($this->uid, $room_id);
|
||||
$reslut = model('Room')->send_room_message($this->uid, $user_id,$room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//用户在房间内切后台保留机制
|
||||
public function user_in_room_background()
|
||||
|
||||
//师徒任务跳转房间
|
||||
public function task_jump_room()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
$type = input('type', 1);//1-切后台,2-切前台
|
||||
$reslut = model('Room')->user_in_room_background($this->uid, $room_id,$type);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
$task_id = input('task_id', 0);
|
||||
$reslut = model('Room')->task_jump_room_recommend($task_id);
|
||||
return V(1, '成功', $reslut);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Db;
|
||||
|
||||
class RoomAuction extends BaseCom
|
||||
{
|
||||
@@ -18,6 +19,10 @@ class RoomAuction extends BaseCom
|
||||
public function room_auction_time()
|
||||
{
|
||||
$gift_id = input('gift_id');
|
||||
$pool_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
if($gift_id == $pool_gift_id){
|
||||
return V(0, '此礼物不能进行此操作');
|
||||
}
|
||||
$reslut = model('RoomAuction')->room_auction_time($gift_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -29,6 +34,15 @@ class RoomAuction extends BaseCom
|
||||
$room_id = input('room_id');
|
||||
$user_id = input('user_id');
|
||||
$gift_id = input('gift_id');
|
||||
//礼物不能是CP礼物
|
||||
$cp_gift_ids = explode(',', get_system_config_value('cp_gift_id'));
|
||||
if (in_array($gift_id, $cp_gift_ids)) {
|
||||
return V( 0, '礼物不能是CP礼物,请重新选择');
|
||||
}
|
||||
$pool_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
if($gift_id == $pool_gift_id){
|
||||
return V(0, '此礼物不能进行此操作');
|
||||
}
|
||||
$relation_id = input('relation_id','');
|
||||
$auction_type = input('auction_type',1);//1真爱拍 2 亲密拍
|
||||
$time_day = input('time_day', 0);//小时
|
||||
@@ -54,8 +68,12 @@ class RoomAuction extends BaseCom
|
||||
$gift_id = input('gift_id');
|
||||
$num = input('num');
|
||||
$type = input('type',1);//1金币购买 2送背包礼物
|
||||
|
||||
$reslut = model('RoomAuction')->room_auction_join($auction_id,$user_id,$gift_id,$num,$type);
|
||||
$gift_bag_id = input('gift_bag_id',0);
|
||||
$pool_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
if($gift_id == $pool_gift_id){
|
||||
return V(0, '此礼物不能进行此操作');
|
||||
}
|
||||
$reslut = model('RoomAuction')->room_auction_join($auction_id,$user_id,$gift_id,$num,$type,$gift_bag_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
23
application/api/controller/RoomEmoji.php
Normal file
23
application/api/controller/RoomEmoji.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Db;
|
||||
|
||||
class RoomEmoji extends BaseCom
|
||||
{
|
||||
//表情类型列表
|
||||
public function type_list(){
|
||||
$reslut = model('RoomEmoji')->getRoomEmojiType();
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//表情列表
|
||||
public function emoji_list(){
|
||||
$type_id = input('type_id', "");
|
||||
$pid = input('pid', "");
|
||||
$user_id = $this->uid ?? 0;
|
||||
$reslut = model('RoomEmoji')->getRoomEmoji($type_id,$pid,true,$user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
@@ -7,33 +7,46 @@ use think\Db;
|
||||
|
||||
class RoomPit extends BaseCom
|
||||
{
|
||||
|
||||
//申请上麦
|
||||
public function apply_pit()
|
||||
{
|
||||
$key_name = "api:room:apply_pit:" . $this->uid;
|
||||
|
||||
$room_id = input('room_id', 0);
|
||||
$pit_number = input('pit_number', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$res = model('Room')->get_room_label($room_id);
|
||||
if($res['code'] != 1){
|
||||
return V(0, '房间不存在', null);
|
||||
}
|
||||
$pit_number = input('pit_number', 0);
|
||||
|
||||
$room_label = $res['data']['label_id'];
|
||||
$room_type = $res['data']['type_id'];
|
||||
$key_name = "api:room:apply_pit:" . $this->uid;
|
||||
redis_lock_exits($key_name);
|
||||
if(($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8))|| $room_type == 2 || $room_type == 7){
|
||||
$reslut = model('RoomPit')->apply_pit($this->uid, $room_id,$pit_number);
|
||||
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
|
||||
$reslut = model('RoomSong')->apply_kpit($this->uid, $room_id,$pit_number);
|
||||
}else{
|
||||
redis_unlocks($key_name);
|
||||
|
||||
$room_type = model('Room')->get_room_type($room_id);
|
||||
if($room_type == 0){
|
||||
return V(0, '房间不存在', null);
|
||||
}
|
||||
$gift_id = input('gift_id', 0);//酒吧房上其他麦需要带礼物
|
||||
if($room_type == 2){
|
||||
$reslut = model('RoomSong')->apply_kpit($this->uid, $room_id,$pit_number);
|
||||
}elseif($room_type == 11){
|
||||
//9麦位,10麦位 不做$gift_id校验
|
||||
if($pit_number != 9 && $pit_number != 10){
|
||||
//有麦位就是换麦
|
||||
$pit_infos = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $this->uid])->value('pit_number')??0;
|
||||
if($pit_infos == 10){
|
||||
return V(0, '此房间不允许嘉宾直接换麦', null);
|
||||
}
|
||||
if($gift_id == 0 && $pit_infos == 0){
|
||||
return V(0, '请选择礼物', null);
|
||||
}
|
||||
}
|
||||
$type = input('type', 0);//2-抱麦后的上麦
|
||||
$reslut = model('RoomPit')->apply_pit($this->uid, $room_id, $pit_number,$gift_id,$type);
|
||||
}else{
|
||||
$reslut = model('RoomPit')->apply_pit($this->uid, $room_id, $pit_number);
|
||||
}
|
||||
redis_unlocks($key_name);
|
||||
|
||||
//用户操作记录
|
||||
//1-禁麦位,2-清空消息,3-清空魅力值,4-加入黑名单,5-踢出房间,6-关闭麦克风,7-申请上麦,8-同意上麦,9-拒绝上麦,10-点歌,11-开启PK',
|
||||
model('Room')->room_operation_record($this->uid,$room_id,7,0,$pit_number);
|
||||
|
||||
@@ -44,6 +57,9 @@ class RoomPit extends BaseCom
|
||||
public function apply_pit_list()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$reslut = model('RoomPit')->apply_pit_list($this->uid, $room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -52,7 +68,13 @@ class RoomPit extends BaseCom
|
||||
public function help_apply_pit()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$user_id = input('user_id', 0);
|
||||
if($user_id == 0){
|
||||
return V(0, '请选择助力用户', null);
|
||||
}
|
||||
$reslut = model('RoomPit')->help_apply_pit($this->uid, $room_id, $user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -61,7 +83,13 @@ class RoomPit extends BaseCom
|
||||
public function agree_pit()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$user_id = input('user_id', 0);//逗号分割
|
||||
if($user_id == 0){
|
||||
return V(0, '请选择同意用户', null);
|
||||
}
|
||||
$reslut = model('RoomPit')->agree_pit($this->uid, $room_id, $user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -70,6 +98,9 @@ class RoomPit extends BaseCom
|
||||
public function refuse_pit()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$user_id = input('user_id', 0);//逗号分割
|
||||
$reslut = model('RoomPit')->clear_apply_pit_list($this->uid, $room_id, $user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
@@ -79,6 +110,9 @@ class RoomPit extends BaseCom
|
||||
public function clear_apply_pit_list()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$reslut = model('RoomPit')->clear_apply_pit_list($this->uid, $room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -87,8 +121,18 @@ class RoomPit extends BaseCom
|
||||
public function set_room_pit_apply_help_gift()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$gift_id = input('gift_id', 0);
|
||||
if($gift_id == 0){
|
||||
return V(0, '请选择礼物', null);
|
||||
}
|
||||
$gift_price = input('gift_price', 0);
|
||||
$pool_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
if($gift_id == $pool_gift_id){
|
||||
return V(0, '此礼物不能进行此操作');
|
||||
}
|
||||
$reslut = model('RoomPit')->set_room_pit_apply_help_gift($this->uid, $room_id, $gift_id, $gift_price);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -97,20 +141,27 @@ class RoomPit extends BaseCom
|
||||
public function down_pit()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
$pit_number = input('pit_number', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$res = model('Room')->get_room_label($room_id);
|
||||
if($res['code'] != 1){
|
||||
$pit_number = input('pit_number', 0);
|
||||
|
||||
$room_type = model('Room')->get_room_type($room_id);
|
||||
if($room_type == 0){
|
||||
return V(0, '房间不存在', null);
|
||||
}
|
||||
$room_label = $res['data']['label_id'];
|
||||
$room_type = $res['data']['type_id'];
|
||||
if(($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)) || $room_type == 2 || $room_type == 7){
|
||||
$reslut = model('RoomPit')->DownPit($this->uid, $room_id,$pit_number);
|
||||
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
|
||||
|
||||
if($room_type == 10){
|
||||
$upit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $this->uid])->value('pit_number');
|
||||
if($upit == 2){
|
||||
return V(0, '师父麦,不能操作', null);
|
||||
}
|
||||
}
|
||||
|
||||
if($room_type == 2){
|
||||
$reslut = model('RoomSong')->down_kpit($this->uid, $room_id);
|
||||
}else{
|
||||
$reslut = model('RoomPit')->DownPit($this->uid, $room_id,$pit_number);
|
||||
}
|
||||
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
@@ -122,7 +173,10 @@ class RoomPit extends BaseCom
|
||||
$key_name = "api:room:change_room_up_pit_type:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
$room_id = input('room_id', 0);
|
||||
// $user_id = input('user_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
|
||||
$reslut = model('RoomPit')->change_room_up_pit_type($this->uid, $room_id);
|
||||
redis_unlock($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
@@ -132,10 +186,28 @@ class RoomPit extends BaseCom
|
||||
public function host_user_pit()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$pit_number = input('pit_number', 0);
|
||||
$user_id = input('user_id', 0);//
|
||||
$user_id = input('user_id', 0);
|
||||
if($user_id == 0){
|
||||
return V(0, '请选择用户', null);
|
||||
}
|
||||
$type = input('type', 0);//1-抱麦 2-踢下去
|
||||
$reslut = model('RoomPit')->host_user_pit($this->uid, $room_id,$pit_number,$user_id,$type);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//签约房间主持邀请上签约麦用户拒绝
|
||||
public function refuse_sign_room_host_invite()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$reslut = model('RoomPit')->refuse_sign_room_host_invite($this->uid, $room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ class RoomSong extends BaseCom
|
||||
|
||||
//同意、拒绝点歌
|
||||
public function agree_song(){
|
||||
return V(0, '暂不支持此类型的操作');
|
||||
$room_id = input('room_id');
|
||||
$type = input('type',1);//1同意 2拒绝
|
||||
$res = model('RoomSong')->agree_song($this->uid,$room_id,$type);
|
||||
@@ -48,6 +49,23 @@ class RoomSong extends BaseCom
|
||||
return V($res['code'], $res['msg'], $res['data']);
|
||||
}
|
||||
|
||||
//删除歌曲
|
||||
public function del_song(){
|
||||
$room_song_id = input('did');
|
||||
$room_id = input('room_id');
|
||||
$res = model('RoomSong')->del_song($this->uid,$room_song_id,$room_id);
|
||||
return V($res['code'], $res['msg'], $res['data']);
|
||||
}
|
||||
|
||||
|
||||
//已点列表搜索
|
||||
public function search_song(){
|
||||
$room_id = input('room_id');
|
||||
$search_user = input('search_user');
|
||||
$res = model('RoomSong')->search_song($room_id,$search_user);
|
||||
return V($res['code'], $res['msg'], $res['data']);
|
||||
}
|
||||
|
||||
|
||||
//上移歌 $type 1上移 2置顶
|
||||
public function up_song(){
|
||||
@@ -63,7 +81,8 @@ class RoomSong extends BaseCom
|
||||
redis_lock_exit($key_name);
|
||||
$room_id = input('room_id');
|
||||
$now_room_song_id = input('now_did');
|
||||
$res = model('RoomSong')->change_song($room_id,$now_room_song_id);
|
||||
$is_auto_next = input('is_auto_next');
|
||||
$res = model('RoomSong')->change_song($room_id,$now_room_song_id,$is_auto_next);
|
||||
redis_unlock($key_name);
|
||||
return V($res['code'], $res['msg'], $res['data']);
|
||||
}
|
||||
|
||||
@@ -147,8 +147,8 @@ class Search extends BaseCom
|
||||
}
|
||||
|
||||
$rooms = db::name('vs_room')->field('id as room_id,room_name,room_cover,room_number,label_id,today_hot_value')->where($where1)->select();
|
||||
if(isset($rooms)){
|
||||
foreach ($rooms as $vv){
|
||||
if($rooms){
|
||||
foreach ($rooms as &$vv){
|
||||
$vv['label_icon'] = db::name('vs_room_label')->where('id', $vv['label_id'])->value('label_icon');
|
||||
$vv['hot_value'] = $vv['today_hot_value'];
|
||||
}
|
||||
|
||||
66
application/api/controller/SendGift.php
Normal file
66
application/api/controller/SendGift.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Db;
|
||||
|
||||
class SendGift extends BaseCom
|
||||
{
|
||||
|
||||
/*
|
||||
* 送礼
|
||||
* @param int $gift_id
|
||||
*/
|
||||
public function send_gift()
|
||||
{
|
||||
$key_name = "api:send:gift:" . $this->uid;
|
||||
redis_lock_exits($key_name);
|
||||
|
||||
$room_id = input('room_id/d', 0);//房间ID
|
||||
$gift_id = input('gift_id/d', 0);//礼物ID
|
||||
$gift_num = (int)input('gift_num/d', 1);//礼物数量
|
||||
$to_uid = input('to_uid', 0);//收礼人ID,逗号隔开的字符串
|
||||
$type = input('type/d', 1);//1金币购买 2送背包礼物
|
||||
$heart_id = input('heart_id/d', 0);//助力时的 ID
|
||||
$gift_bag_id = input('gift_bag_id/d', 0);//盲盒类型ID 7-初级,8-中级,9-高级
|
||||
|
||||
if($room_id <= 0 || $gift_id <= 0 || $to_uid <= 0 || $type <= 0){
|
||||
redis_unlocks($key_name);
|
||||
return V(0, '参数错误');
|
||||
}
|
||||
|
||||
//获取幸运币
|
||||
$pool_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
if($gift_id == $pool_gift_id){//送的是幸运币
|
||||
$reslut = model('Lottery')->gift($this->uid, $to_uid, $gift_id, $room_id,$gift_num);
|
||||
redis_unlocks($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}else{
|
||||
//获取房间类型 1:交友/pk(二卡八),2:练歌房(声网点歌),3:亲密拍,4:真爱拍,6:私密房,7:互娱房,9:点唱/歌手房,10:签约房,11:酒吧房
|
||||
$room_type = model('Room')->get_room_type($room_id);
|
||||
|
||||
//送礼 (送礼用户,收礼用户组,礼物ID,数量,礼物类型,房间ID )
|
||||
$reslut = model('SendGift')->send_gift($this->uid, $to_uid, $gift_id, $gift_num, $type, $room_id, $gift_bag_id, $heart_id);
|
||||
|
||||
if($room_type == 2){//2:练歌房(声网点歌)
|
||||
if($reslut['code'] == 1){
|
||||
$room_pits = model('RoomSong')->get_charm_rank($room_id);
|
||||
if($room_pits['code'] == 1){
|
||||
$room_pit = $room_pits['data'];
|
||||
//推送给前端
|
||||
$text = [
|
||||
'userCharmList' => $room_pit,
|
||||
];
|
||||
model('Chat')->sendMsg(1019,$room_id,$text);//K歌房送礼后魅力变化 排序变化
|
||||
}
|
||||
}
|
||||
redis_unlocks($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
redis_unlocks($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
}
|
||||
151
application/api/controller/Sign.php
Normal file
151
application/api/controller/Sign.php
Normal file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Db;
|
||||
|
||||
class Sign extends BaseCom
|
||||
{
|
||||
//签约出价价格列表
|
||||
public function sign_coin_list()
|
||||
{
|
||||
$sign_id = input('sign_id', 0);//场次id
|
||||
$room_sign = db::name('vs_room_sign')->where('id', $sign_id)->field('sign_user_id,room_id')->find();
|
||||
if (!$room_sign) {
|
||||
return v(0, '参数错误');
|
||||
}
|
||||
//获取出价最高用户
|
||||
$sign_user = db::name('vs_user_sign_auction')->where(['room_id' => $room_sign['room_id'],'sign_time' => $sign_id,'type' => 0])->order('sign_value desc')->field('id,user_id,sign_value')->find();
|
||||
if($sign_user){
|
||||
$market_value = $sign_user['sign_value'];
|
||||
}else{
|
||||
//获取当前用户的身价
|
||||
$market_value = db::name('user')->where('id', $room_sign['sign_user_id'])->value('market_value');
|
||||
}
|
||||
|
||||
$sign_market_value = get_system_config_value('sign_market_value');
|
||||
//组个列表
|
||||
$sign_coin_list = [];
|
||||
$first_value = $market_value + $sign_market_value; // 第一个值是身价加上sign_market_value
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$sign_coin_list[] = (string)($first_value + $i); // 每个值在第一个值的基础上加i(0到7)
|
||||
}
|
||||
return v(1, '成功', $sign_coin_list);
|
||||
}
|
||||
|
||||
|
||||
//签约开始
|
||||
public function start_sign()
|
||||
{
|
||||
$key_name = "api:sign:start_sign:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
$room_id = input('room_id', 0);
|
||||
$user_id = input('user_id', 0);
|
||||
if ($room_id <= 0 || $user_id <= 0) {
|
||||
return V(0, '参数错误');
|
||||
}
|
||||
$reslut = model('Sign')->start_sign($this->uid, $room_id, $user_id);
|
||||
redis_unlock($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//签约出价
|
||||
public function sign_coin()
|
||||
{
|
||||
$key_name = "api:sign:sign_coin:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
|
||||
$sign_id = input('sign_id', 0);//场次id
|
||||
$sign_value = input('sign_value', 0);
|
||||
|
||||
if ($sign_value <= 0 || $sign_id <= 0) {
|
||||
return V(0, '参数错误');
|
||||
}
|
||||
|
||||
$sign = db::name('vs_room_sign')->where('id', $sign_id)->field('room_id,sign_user_id,sign_type')->find();
|
||||
if($sign['sign_type'] != 1){
|
||||
return V( 0, '该场次签约已结束', null);
|
||||
}
|
||||
$user_id = $sign['sign_user_id'];
|
||||
$room_id = $sign['room_id'];
|
||||
|
||||
$reslut = model('Sign')->sign_coin($this->uid, $room_id, $user_id, $sign_value,$sign_id);
|
||||
|
||||
redis_unlock($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//签约结束
|
||||
public function end_sign()
|
||||
{
|
||||
$sign_id = input('sign_id', 0);
|
||||
if ($sign_id <= 0) {
|
||||
return V(0, '参数错误');
|
||||
}
|
||||
$sign = db::name('vs_room_sign')->where('id', $sign_id)->field('room_id,sign_user_id')->find();
|
||||
|
||||
$user_id = $sign['sign_user_id'];
|
||||
$room_id = $sign['room_id'];
|
||||
|
||||
$reslut = model('Sign')->end_sign($this->uid, $room_id, $sign_id,$user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//签约延时
|
||||
public function sign_delay()
|
||||
{
|
||||
$sign_id = input('sign_id', 0);
|
||||
if ($sign_id <= 0) {
|
||||
return V(0, '参数错误');
|
||||
}
|
||||
$sign = db::name('vs_room_sign')->where('id', $sign_id)->field('room_id,sign_user_id')->find();
|
||||
$room_id = $sign['room_id'];
|
||||
$reslut = model('Sign')->sign_delay($this->uid, $room_id, $sign_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//免费续约
|
||||
public function free_re_sign()
|
||||
{
|
||||
$sign_user_id = input('user_id', 0);
|
||||
if ($sign_user_id <= 0) {
|
||||
return V(0, '参数错误');
|
||||
}
|
||||
$reslut = model('Sign')->free_re_sign($this->uid, $sign_user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//续签
|
||||
public function re_sign()
|
||||
{
|
||||
$sign_user_id = input('user_id', 0);
|
||||
if ($sign_user_id <= 0) {
|
||||
return V(0, '参数错误');
|
||||
}
|
||||
$reslut = model('Sign')->re_sign($this->uid, $sign_user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//才艺列表
|
||||
public function skill_list()
|
||||
{
|
||||
$skill_list = [
|
||||
'唱歌','脱口秀','口技','喊麦','相声'
|
||||
];
|
||||
return V(1, '成功', $skill_list);
|
||||
}
|
||||
|
||||
//获取首次被签约且在约期内的徒弟列表
|
||||
public function get_first_sign_student_list()
|
||||
{
|
||||
$reslut = model('Sign')->get_first_sign_student_list($this->uid);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
209
application/api/controller/SingerSong.php
Normal file
209
application/api/controller/SingerSong.php
Normal file
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Db;
|
||||
|
||||
class SingerSong extends BaseCom
|
||||
{
|
||||
|
||||
//歌手认证
|
||||
public function singerAuth()
|
||||
{
|
||||
//试音地址
|
||||
$song = input('song', 0);
|
||||
if (!$song) {
|
||||
return V(0, '请上传试音地址');
|
||||
}
|
||||
|
||||
$reslut = model('SingerSong')->singerAuth($this->uid, $song);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//歌手添加歌曲
|
||||
public function singerAddSong()
|
||||
{
|
||||
$song_name = input('song_name', 0);
|
||||
if (!$song_name) {
|
||||
return V(0, '请输入歌曲名称');
|
||||
}
|
||||
$gift_id = input('gift_id', 0);
|
||||
if (!$gift_id) {
|
||||
return V(0, '请选择礼物');
|
||||
}
|
||||
$pool_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
if($gift_id == $pool_gift_id){
|
||||
return V(0, '此礼物不能进行此操作');
|
||||
}
|
||||
$gift_num = input('gift_num', 1);
|
||||
$reslut = model('SingerSong')->singerAddSong($this->uid, $song_name, $gift_id, $gift_num);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//歌手删除 歌曲
|
||||
public function singerDelSong()
|
||||
{
|
||||
$id = input('id', 0);
|
||||
if (!$id) {
|
||||
return V(0, '请选择歌曲');
|
||||
}
|
||||
$reslut = db::name('vs_singer_song')->where(['id' => $id])->update(['deletetime' => time()]);
|
||||
if ($reslut) {
|
||||
return V(1, '删除成功');
|
||||
} else {
|
||||
return V(0, '删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//歌手修改歌曲
|
||||
public function singerEditSong()
|
||||
{
|
||||
$id = input('id', 0);
|
||||
if (!$id) {
|
||||
return V(0, '请选择歌曲');
|
||||
}
|
||||
db::name('vs_singer_song')->where(['id' => $id])->update(['deletetime' => time()]);
|
||||
$song_name = input('song_name', 0);
|
||||
if (!$song_name) {
|
||||
return V(0, '请输入歌曲名称');
|
||||
}
|
||||
$gift_id = input('gift_id', 0);
|
||||
if (!$gift_id) {
|
||||
return V(0, '请选择礼物');
|
||||
}
|
||||
$pool_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
if($gift_id == $pool_gift_id){
|
||||
return V(0, '此礼物不能进行此操作');
|
||||
}
|
||||
$gift_num = input('gift_num', 1);
|
||||
$reslut = db::name('vs_singer_song')->insert([
|
||||
'user_id' => $this->uid,
|
||||
'song_name' => $song_name,
|
||||
'gift_id' => $gift_id,
|
||||
'gift_num' => $gift_num,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
if ($reslut) {
|
||||
return V(1, '修改成功');
|
||||
} else {
|
||||
return V(0, '修改失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//获取房间内麦位上歌手歌曲
|
||||
public function getSong()
|
||||
{
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$room_id = input('room_id', 0);
|
||||
//用户ID
|
||||
$user_id = input('user_id', 0);
|
||||
//以上两个参数二选一
|
||||
if (!$room_id && !$user_id) {
|
||||
return V(0, '请选择房间或歌手');
|
||||
}
|
||||
|
||||
$reslut = model('SingerSong')->getSong($this->uid, $user_id, $room_id, $page, $page_limit);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//点歌
|
||||
public function singerSong()
|
||||
{
|
||||
$song_id = input('song_id', 0);
|
||||
if (!$song_id) {
|
||||
return V(0, '请选择歌曲');
|
||||
}
|
||||
$room_id = input('room_id', 0);
|
||||
if (!$room_id) {
|
||||
return V(0, '请选择房间');
|
||||
}
|
||||
$reslut = model('SingerSong')->singerSong($this->uid, $song_id ,$room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//点歌列表
|
||||
public function singerSongList()
|
||||
{
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 10);
|
||||
$room_id = input('room_id', 0);
|
||||
if (!$room_id) {
|
||||
return V(0, '请选择房间');
|
||||
}
|
||||
$type = input('type', 1);//1:已点列表,2:今日列表,3:昨日列表,4:本周列表,5:本月列表
|
||||
$reslut = model('SingerSong')->singerSongList($room_id,$type,$page,$page_limit);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//点歌各类型各个总数
|
||||
public function singerSongCount()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if (!$room_id) {
|
||||
return V(0, '请选择房间');
|
||||
}
|
||||
$reslut = model('SingerSong')->singerSongCount($room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//歌曲置顶
|
||||
public function singerSongTop()
|
||||
{
|
||||
$id = input('id', 0);
|
||||
if (!$id) {
|
||||
return V(0, '请选择歌曲');
|
||||
}
|
||||
$reslut = db::name('vs_song_log')->where(['id' => $id])->update(['sort' => time()]);
|
||||
if ($reslut) {
|
||||
//给前端推送下首歌曲信息
|
||||
$next_song_info = db::name('vs_song_log')->where(['id' => $id])->find();
|
||||
$next_song_info['boss_user_id'] = $next_song_info['user_id'];
|
||||
$next_song_info['boss_nickname'] = db::name('user')->where(['id' => $next_song_info['user_id']])->value('nickname');
|
||||
$next_song_info['boss_avatar'] = db::name('user')->where(['id' => $next_song_info['user_id']])->value('avatar');
|
||||
$next_song_info['boss_dress'] = model('api/Decorate')->user_decorate_detail($next_song_info['user_id'], 1);
|
||||
$next_song_info['boss_mic_cycle'] = model('api/Decorate')->user_decorate_detail($next_song_info['user_id'],3);
|
||||
$singer_song = db::name('vs_singer_song')->where(['id' => $next_song_info['singer_song_id']])->find();
|
||||
$next_song_info['singer_user_id'] = $singer_song['user_id'];
|
||||
$next_song_info['singer_nickname'] = db::name('user')->where(['id' => $singer_song['user_id']])->value('nickname');
|
||||
$next_song_info['singer_avatar'] = db::name('user')->where(['id' => $singer_song['user_id']])->value('avatar');
|
||||
$next_song_info['singer_dress'] = model('api/Decorate')->user_decorate_detail($singer_song['user_id'], 1);
|
||||
$next_song_info['singer_mic_cycle'] = model('api/Decorate')->user_decorate_detail($singer_song['user_id'],3);
|
||||
$next_song_info['song_name'] = $singer_song['song_name'];
|
||||
|
||||
$data = [
|
||||
'text' => '房间下一首演唱歌曲变化',
|
||||
'next_song_info' => $next_song_info
|
||||
];
|
||||
model('Chat')->sendMsg(1071,$next_song_info['room_id'],$data);
|
||||
|
||||
return V(1, '置顶成功');
|
||||
} else {
|
||||
return V(0, '置顶失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//切歌
|
||||
public function singerSongCut()
|
||||
{
|
||||
$id = input('id', 0);//点歌列表的ID
|
||||
if (!$id) {
|
||||
return V(0, '请选择要切的歌曲列表ID');
|
||||
}
|
||||
|
||||
$reslut = model('SingerSong')->singerSongCut($this->uid, $id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -30,14 +30,32 @@ class Sms extends Api
|
||||
if (!checkMobile($mobile)) {
|
||||
return V(0, '手机号不正确');
|
||||
}
|
||||
|
||||
//检测是否注销过
|
||||
$config_time = get_system_config_value('cancel_no_login');
|
||||
$is_del = db::name('user')->where(['mobile' => $mobile,'delete_time' => ['<>', 0]])->find();
|
||||
|
||||
//获取手机号绑定的账号数
|
||||
$count = db::name('user')->where(['mobile' => $mobile])->count();
|
||||
//获取注销的账号数
|
||||
$count_del = db::name('user')->where(['mobile' => $mobile,'delete_time' => ['<>', 0]])->count();
|
||||
if ($count == $count_del) {
|
||||
if ($is_del) {
|
||||
if (time() - $is_del['delete_time'] < $config_time * 24 * 3600) {//30天内注销过
|
||||
return V(0, '注销30天内,不可操作。');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//频率控制
|
||||
$last = db::name('sms')->where(['mobile' => $mobile, 'event' => $event])->order('id', 'DESC')->find();
|
||||
if ($last && time() - $last['createtime'] < 60) {
|
||||
return V(0, '发送频繁');
|
||||
return V(0, '发送频繁!');
|
||||
}
|
||||
$ipSendTotal = db::name('sms')->where(['ip' => $this->request->ip()])->whereTime('createtime', '-1 hours')->count();
|
||||
$ip = request()->server('HTTP_X_REAL_IP') ?: request()->server('HTTP_X_FORWARDED_FOR') ?: request()->ip();
|
||||
$ipSendTotal = db::name('sms')->where(['ip' => $ip])->whereTime('createtime', '-1 hours')->count();
|
||||
if ($ipSendTotal >= 7) {
|
||||
return V(0, '发送频繁');
|
||||
return V(0, '发送频繁!!');
|
||||
}
|
||||
//发送短信
|
||||
$ret = $this->send_smsbao_msg($mobile, $event);
|
||||
|
||||
96
application/api/controller/Tasks.php
Normal file
96
application/api/controller/Tasks.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Controller;
|
||||
/*
|
||||
* 每日任务
|
||||
*
|
||||
*/
|
||||
class Tasks extends BaseCom
|
||||
{
|
||||
//初始化
|
||||
protected function initialize()
|
||||
{
|
||||
//允许跨域
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
}
|
||||
|
||||
//每日任务列表
|
||||
public function dailyTasksList()
|
||||
{
|
||||
$user_id = $this->uid;
|
||||
$reslut = model('Tasks')->dailyTasksList($user_id);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
|
||||
}
|
||||
|
||||
//完成每日任务
|
||||
public function dailyTasksComplete()
|
||||
{
|
||||
$user_id = $this->uid;
|
||||
$task_id = input('task_id');
|
||||
if (!$task_id) {
|
||||
return V(0,'请选择任务');
|
||||
}
|
||||
$reslut = model('Tasks')->tasks_complete($user_id,$task_id);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//领取每日任务金币奖励
|
||||
public function dailyTasksReceive()
|
||||
{
|
||||
$user_id = $this->uid;
|
||||
$task_id = input('task_id');
|
||||
$student_id = input('student_id',0);
|
||||
if (!$task_id) {
|
||||
return V(0,'请选择任务');
|
||||
}
|
||||
$reslut = model('Tasks')->daily_tasks_receive($user_id,$task_id,$student_id);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//开启礼盒
|
||||
public function dailyTasksOpenBox()
|
||||
{
|
||||
$user_id = $this->uid;
|
||||
$gift_box_id = input('gift_box_id');
|
||||
if (!$gift_box_id) {
|
||||
return V(0,'请选择礼盒');
|
||||
}
|
||||
$reslut = model('Tasks')->open_gift_box($user_id,$gift_box_id);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//礼盒记录
|
||||
public function dailyTasksBoxRecord()
|
||||
{
|
||||
$user_id = $this->uid;
|
||||
$reslut = model('Tasks')->gift_bag_receive_list($user_id);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//签到
|
||||
public function dailyTasksSign(){
|
||||
$user_id = $this->uid;
|
||||
$reslut = model('Tasks')->sign_in($user_id);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
|
||||
}
|
||||
//签到页面
|
||||
public function dailyTasksSignList(){
|
||||
$user_id = $this->uid;
|
||||
$reslut = model('Tasks')->daily_tasks_sign_in($user_id);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//今日签到状态
|
||||
public function dailyTasksSignStatus(){
|
||||
$user_id = $this->uid;
|
||||
$reslut = model('Tasks')->daily_tasks_sign_in_status($user_id);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//未领取奖励任务数量
|
||||
public function dailyTasksUnReceiveCount(){
|
||||
$user_id = $this->uid;
|
||||
$reslut = model('Tasks')->daily_tasks_unfinished_count($user_id);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ class Tencent extends Controller
|
||||
{
|
||||
public function call_back()
|
||||
{
|
||||
return ['ActionStatus' => 'OK', 'ErrorInfo' => '', 'ErrorCode' => 0];
|
||||
$data = input('post.');
|
||||
$sign_data = input('get.');
|
||||
$reslut = model('Tencent')->tencent_call_back($data,$sign_data);
|
||||
|
||||
@@ -29,23 +29,68 @@ class Theme extends controller
|
||||
*/
|
||||
public function get_theme_data()
|
||||
{
|
||||
$reslut = DB::name('vs_theme')->field('theme_color,file_url,auxiliary_color')
|
||||
->where(['delete_time' => 0 ,'is_active' => 1,'begin_time' => ['<',time()],'end_time' => ['>',time()]])->order('id desc')->find();
|
||||
// $reslut = DB::name('vs_theme')->field('theme_color,file_url,auxiliary_color')
|
||||
// ->where(['delete_time' => 0 ,'is_active' => 1,'begin_time' => ['<',time()],'end_time' => ['>',time()]])->order('id desc')->find();
|
||||
//
|
||||
// if($reslut){
|
||||
// $url = $reslut['file_url'];
|
||||
// $reslut['btn_text_color'] = $reslut['auxiliary_color'];
|
||||
// $reslut['app_bg'] = get_system_config_value('web_site').'/static/theme/'.$url.'/app_bg.png';
|
||||
// $reslut['home_sel'] = get_system_config_value('web_site').'/static/theme/'.$url.'/home_sel.png';
|
||||
// $reslut['home_nor'] = get_system_config_value('web_site').'/static/theme/'.$url.'/home_nor.png';
|
||||
// $reslut['find_sel'] = get_system_config_value('web_site').'/static/theme/'.$url.'/find_sel.png';
|
||||
// $reslut['find_nor'] = get_system_config_value('web_site').'/static/theme/'.$url.'/find_nor.png';
|
||||
// $reslut['msg_sel'] = get_system_config_value('web_site').'/static/theme/'.$url.'/msg_sel.png';
|
||||
// $reslut['msg_nor'] = get_system_config_value('web_site').'/static/theme/'.$url.'/msg_nor.png';
|
||||
// $reslut['mine_sel'] = get_system_config_value('web_site').'/static/theme/'.$url.'/mine_sel.png';
|
||||
// $reslut['mine_nor'] = get_system_config_value('web_site').'/static/theme/'.$url.'/mine_nor.png';
|
||||
// }
|
||||
|
||||
if($reslut){
|
||||
$url = $reslut['file_url'];
|
||||
$reslut['btn_text_color'] = $reslut['auxiliary_color'];
|
||||
$reslut['app_bg'] = get_system_config_value('web_site').'/static/theme/'.$url.'/app_bg.png';
|
||||
$reslut['home_sel'] = get_system_config_value('web_site').'/static/theme/'.$url.'/home_sel.png';
|
||||
$reslut['home_nor'] = get_system_config_value('web_site').'/static/theme/'.$url.'/home_nor.png';
|
||||
$reslut['find_sel'] = get_system_config_value('web_site').'/static/theme/'.$url.'/find_sel.png';
|
||||
$reslut['find_nor'] = get_system_config_value('web_site').'/static/theme/'.$url.'/find_nor.png';
|
||||
$reslut['msg_sel'] = get_system_config_value('web_site').'/static/theme/'.$url.'/msg_sel.png';
|
||||
$reslut['msg_nor'] = get_system_config_value('web_site').'/static/theme/'.$url.'/msg_nor.png';
|
||||
$reslut['mine_sel'] = get_system_config_value('web_site').'/static/theme/'.$url.'/mine_sel.png';
|
||||
$reslut['mine_nor'] = get_system_config_value('web_site').'/static/theme/'.$url.'/mine_nor.png';
|
||||
//版本号
|
||||
$app_version = request()->header('App-Version');
|
||||
$system = request()->header('system');
|
||||
$api_version = 0;
|
||||
if ($system == 'iOS') {
|
||||
$api_versions = db::name('version')->where(['type' => 2, 'status' => 1])->order('id', 'desc')->find();
|
||||
//app的版本和用户使用的当前版本比对
|
||||
//$api_versions['newversion'] 是数据库当前的版本 也是用户使用的版本
|
||||
//$app_version 有可能是appstore里面的审核版本 审核版本比用户的版本高
|
||||
//审核版本给前端返回1
|
||||
$result = version_compare($api_versions['newversion'],$app_version);
|
||||
if ($result < 0) {//-1:前面版本小于后面版本,0:相等,1:前面版本大于后面版本
|
||||
$api_version = 1;
|
||||
}
|
||||
}
|
||||
$reslut = [];
|
||||
return V(1,'操作成功', $reslut,$api_version);
|
||||
}
|
||||
|
||||
return V(1,'操作成功', $reslut);
|
||||
// 节日主题
|
||||
public function get_festival_theme()
|
||||
{
|
||||
$theme = DB::name('vs_theme')->field('theme_name,theme_color,file_url,auxiliary_color')
|
||||
->where(['delete_time' => 0 ,'is_active' => 1,'begin_time' => ['<=',time()],'end_time' => ['>=',time()]])->order('id desc')->find();
|
||||
$reslut['is_open'] = 0;
|
||||
if($theme){
|
||||
$reslut['theme_name'] = $theme['theme_name'];
|
||||
$reslut['is_open'] = 1;
|
||||
}
|
||||
|
||||
//版本号
|
||||
$app_version = request()->header('App-Version');
|
||||
$system = request()->header('system');
|
||||
$api_version = 0;
|
||||
if ($system == 'iOS') {
|
||||
$api_versions = db::name('version')->where(['type' => 2, 'status' => 1])->order('id', 'desc')->find();
|
||||
//app的版本和用户使用的当前版本比对
|
||||
//$api_versions['newversion'] 是数据库当前的版本 也是用户使用的版本
|
||||
//$app_version 有可能是appstore里面的审核版本 审核版本比用户的版本高
|
||||
//审核版本给前端返回1
|
||||
$result = version_compare($api_versions['newversion'],$app_version);
|
||||
if ($result < 0) {//-1:前面版本小于后面版本,0:相等,1:前面版本大于后面版本
|
||||
$api_version = 1;
|
||||
}
|
||||
}
|
||||
return V(1,'操作成功', $reslut,$api_version);
|
||||
}
|
||||
}
|
||||
|
||||
20
application/api/controller/Upload.php
Normal file
20
application/api/controller/Upload.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use app\common\controller\Upload as UploadFile;
|
||||
|
||||
class Upload extends BaseCom
|
||||
{
|
||||
|
||||
//获取上传文件的临时秘钥
|
||||
public function getTempKeys()
|
||||
{
|
||||
$upload = new UploadFile();
|
||||
$reslut = $upload->getTempCredential();
|
||||
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ use app\common\library\Ems;
|
||||
use app\common\library\Sms;
|
||||
use fast\Random;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
@@ -222,7 +223,18 @@ class User extends BaseCom
|
||||
public function get_user_info()
|
||||
{
|
||||
$reslut = model('user')->get_me($this->uid);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
//版本号
|
||||
$app_version = request()->header('App-Version');
|
||||
$system = request()->header('system');
|
||||
$api_version = 0;
|
||||
if ($system == 'iOS') {
|
||||
$api_versions = db::name('version')->where(['type' => 2, 'status' => 1])->order('id', 'desc')->find();
|
||||
$result = version_compare($api_versions['apiversion'],$app_version);
|
||||
if ($result < 0) {
|
||||
$api_version = 1;
|
||||
}
|
||||
}
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data'],$api_version);
|
||||
}
|
||||
|
||||
//关注(回关)
|
||||
@@ -273,4 +285,24 @@ class User extends BaseCom
|
||||
$reslut = model('UserWallet')->give_coin($this->uid, $give_uid, $coin);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//挚友列表
|
||||
public function get_friend_list()
|
||||
{
|
||||
$user_id = input('user_id', 0);//用户id
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$reslut = model('User')->get_friend_list($user_id, $page, $page_limit);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//挚友列表查看更多
|
||||
public function get_friend_list_more()
|
||||
{
|
||||
$user_id = input('user_id', 0);//用户id
|
||||
$relation_id = input('relation_id', 0);
|
||||
$reslut = model('User')->get_friend_list_more($user_id, $relation_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
|
||||
32
application/api/controller/UserCp.php
Normal file
32
application/api/controller/UserCp.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Db;
|
||||
|
||||
class UserCp extends BaseCom
|
||||
{
|
||||
//用户CP礼物回赠
|
||||
public function cpGiveGift()
|
||||
{
|
||||
$user_id = input('user_id', 0);
|
||||
$gift_id = input('gift_id', 0);
|
||||
$room_id = input('room_id', 0);
|
||||
|
||||
$reslut = model('SendGift')->send_gift($this->uid, $user_id, $gift_id, 1,1,$room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//Cp 空间
|
||||
public function cpZone()
|
||||
{
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 15);
|
||||
$user_id = input('user_id', 0);
|
||||
$reslut = model('UserCp')->cpZone($user_id, $page, $page_limit);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@ class UserData extends BaseCom
|
||||
$key_name = "api:user:follow_user:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
$nick_name = input('nickname');
|
||||
$birthday = input('birthday');
|
||||
$birthday = input('birthday', '1990-01-01');
|
||||
$sex = input('sex', 0);
|
||||
$head_pic = input('avatar', '');
|
||||
$reg_code = input('init_code', '');
|
||||
@@ -47,7 +47,7 @@ class UserData extends BaseCom
|
||||
$key_name = "api:user:follow_user:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
$nick_name = input('nick_name');
|
||||
$birthday = input('birthday');
|
||||
$birthday = input('birthday', '1990-01-01');
|
||||
$sex = input('sex', 1);
|
||||
$head_pic = input('head_pic', '');
|
||||
$images = input('images', '');//背景图(以json字符串的形式可以多图)
|
||||
@@ -80,19 +80,28 @@ class UserData extends BaseCom
|
||||
{
|
||||
$key_name = "api:user:bind_mobile:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
|
||||
$mobile = input('new_mobile');
|
||||
$sms_code = input('sms_code', '');
|
||||
|
||||
//default-默认登录,1-更换手机号,2绑定手机号,3-忘记密码,4-设置密码,5-账号注销,6-提现
|
||||
$reslut = model('sms')->verification_code(2,$mobile, $sms_code);
|
||||
if ($reslut['code'] == 0) {
|
||||
redis_unlock($key_name);
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//查询新手机号绑定的数量
|
||||
$new_mobile_num = db::name('user')->where(['mobile' => $mobile,'status' => ['neq', 0]])->count();
|
||||
if ($new_mobile_num >= 3) {
|
||||
return v(0, '该手机号已达绑定上限');
|
||||
}
|
||||
$reslut = model('UserData')->modify_mobile($mobile,$this->uid);
|
||||
redis_unlock($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//更换手机号
|
||||
//default-默认登录,1-更换手机号,2绑定手机号,3-忘记密码,4-设置密码,5-账号注销,6-提现
|
||||
//更换手机号
|
||||
public function modify_mobile()
|
||||
{
|
||||
@@ -102,10 +111,13 @@ class UserData extends BaseCom
|
||||
$new_mobile = input('new_mobile');
|
||||
$sms_code = input('sms_code', '');
|
||||
$user_mobile = db::name('user')->where('id',$this->uid)->value('mobile');
|
||||
if($user_mobile){
|
||||
if ($user_mobile != $mobile){
|
||||
redis_unlock($key_name);
|
||||
return V(0, "旧手机号错误", null);
|
||||
// return V(0, "旧手机号错误", null);
|
||||
}
|
||||
}
|
||||
|
||||
if ($new_mobile == $user_mobile){
|
||||
redis_unlock($key_name);
|
||||
return V(0, "新手机号不能与旧手机号一致", null);
|
||||
@@ -121,6 +133,59 @@ class UserData extends BaseCom
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//更换手机号
|
||||
//default-默认登录,1-更换手机号,2绑定手机号,3-忘记密码,4-设置密码,5-账号注销,6-提现
|
||||
public function modify_mobiles()
|
||||
{
|
||||
$key_name = "api:user:modify_mobile:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
|
||||
$mobile = input('mobile');
|
||||
$sms_code = input('sms_code', '');
|
||||
$user_mobile = db::name('user')->where('id',$this->uid)->value('mobile');
|
||||
if ($user_mobile != $mobile){
|
||||
redis_unlock($key_name);
|
||||
return V(0, "旧手机号错误", null);
|
||||
}
|
||||
//验证原有手机号
|
||||
$reslut = model('sms')->verification_code(1,$mobile, $sms_code);
|
||||
if ($reslut['code'] == 0) {
|
||||
redis_unlock($key_name);
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
$new_mobile = input('new_mobile');
|
||||
$new_sms_code = input('new_sms_code', '');
|
||||
if ($new_mobile == $user_mobile){
|
||||
redis_unlock($key_name);
|
||||
return V(0, "新手机号不能与旧手机号一致", null);
|
||||
}
|
||||
//验证新手机号
|
||||
$reslut1 = model('sms')->verification_code(1,$new_mobile, $new_sms_code);
|
||||
if ($reslut1['code'] == 0) {
|
||||
redis_unlock($key_name);
|
||||
return v($reslut1['code'], $reslut1['msg'], $reslut1['data']);
|
||||
}
|
||||
//查询新手机号是否绑定过
|
||||
$new_mobile_num = db::name('user')->where(['mobile' => $new_mobile])->select();
|
||||
if ($new_mobile_num){
|
||||
foreach ($new_mobile_num as $key => $value){
|
||||
if($value['status'] != 0){
|
||||
redis_unlock($key_name);
|
||||
return V(0, "换绑失败,请联系客服", null);
|
||||
}
|
||||
if(time() - $value['delete_time'] < 60 * 60 * 24 * 30){
|
||||
redis_unlock($key_name);
|
||||
return V(0, "此手机号已注销,30天内不允许操作", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$reslut2 = model('UserData')->modify_mobile($new_mobile,$this->uid);
|
||||
redis_unlock($key_name);
|
||||
return V($reslut2['code'], $reslut2['msg'], $reslut2['data']);
|
||||
}
|
||||
|
||||
//实名认证
|
||||
public function real_name()
|
||||
{
|
||||
@@ -128,13 +193,14 @@ class UserData extends BaseCom
|
||||
redis_lock_exit($key_name);
|
||||
$real_name = input('real_name');
|
||||
$card_number = input('card_number');
|
||||
|
||||
//去掉前后空格
|
||||
$card_number = trim($card_number);
|
||||
$reslut = model('UserData')->real_name($this->uid,$real_name, $card_number);
|
||||
redis_unlock($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//实名认证结果获取
|
||||
//实名认证成功后通知后端
|
||||
public function real_name_result()
|
||||
{
|
||||
$orderNo = input('orderNo', '');
|
||||
@@ -149,4 +215,13 @@ class UserData extends BaseCom
|
||||
$reslut = model('UserData')->real_name_info($this->uid);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//隐身设置
|
||||
public function modify_hide_status()
|
||||
{
|
||||
$status = input('hide_status', 0);//0-取消隐身,1-设置隐身
|
||||
$reslut = model('UserData')->modify_hide_status($this->uid,$status);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,51 +14,35 @@ class UserWallet extends BaseCom
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
// //给前端的类型组装一个
|
||||
// public function gift_type()
|
||||
// {
|
||||
// // 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮
|
||||
// // 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换
|
||||
// $data = [
|
||||
//// ['id' => 1, 'name' => '系统调节'],
|
||||
// ['id' => 2, 'name' => '充值'],
|
||||
// ['id' => 3, 'name' => '提现'],
|
||||
// ['id' => 4, 'name' => '金币转增'],
|
||||
// ['id' => 5, 'name' => '每日任务奖励'],
|
||||
// ['id' => 6, 'name' => '充值返利'],
|
||||
// ['id' => 7, 'name' => '购买装扮'],
|
||||
// ['id' => 8, 'name' => '礼盒奖励'],
|
||||
// ['id' => 9, 'name' => '房间补贴'],
|
||||
// ['id' => 10, 'name' => '购买礼物'],
|
||||
// ['id' => 11, 'name' => '收礼增加收益'],
|
||||
// ['id' => 12, 'name' => '工会补贴'],
|
||||
// ['id' => 13, 'name' => '金币转增'],
|
||||
// ['id' => 14, 'name' => '收益兑换'],
|
||||
// ['id' => 15, 'name' => '送礼'],
|
||||
// ];
|
||||
// return V(1, '获取成功', $data);
|
||||
// }
|
||||
|
||||
//金币(钻石)明细
|
||||
public function log_list()
|
||||
{
|
||||
$page = input('page', 1);
|
||||
// 1. 接收参数(前端传递:last_id=上一页最后一条的id,page_limit=每页条数)
|
||||
$last_id = input('last_id', 0); // 第一页 last_id=0
|
||||
$page_limit = input('page_limit', 30);
|
||||
$in_out_type = input('in_out_type', 1);//1收入2支出
|
||||
$gift_type = input('gift_type', 1);//1金币,2收益(钻石)
|
||||
//开始时间
|
||||
$start_time = input('start_time', '');
|
||||
$end_time = input('end_time', '');
|
||||
$start_time = input('start_time', '');//开始时间
|
||||
$end_time = input('end_time', '');//结束时间
|
||||
|
||||
$reslut = model('UserWallet')->log_list($this->uid, $page, $page_limit,$in_out_type,$start_time,$end_time,$gift_type);
|
||||
$reslut = model('UserWallet')->log_list($this->uid, $last_id, $page_limit,$in_out_type,$start_time,$end_time,$gift_type);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//收益(钻石)兑换金币
|
||||
public function exchange_coin()
|
||||
{
|
||||
$key_name = 'exchange_coin_' . $this->uid;
|
||||
redis_lock_exits($key_name, 10, 10);
|
||||
$earnings_num = input('earnings_num', 0);
|
||||
//最少兑换钻石
|
||||
$min_earnings_num = get_system_config_value('min_earnings_num');
|
||||
if ($earnings_num < $min_earnings_num) {
|
||||
return V(0, '兑换金额不能小于' . $min_earnings_num);
|
||||
}
|
||||
$reslut = model('UserWallet')->exchange_coin($this->uid,$earnings_num);
|
||||
redis_unlocks($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
@@ -77,9 +61,52 @@ class UserWallet extends BaseCom
|
||||
foreach ($reslut as $k=>$v){
|
||||
$reslut_data[$k]['money'] = $v['money'];
|
||||
$reslut_data[$k]['coins'] = $v['coins'];
|
||||
$reslut_data[$k]['ios_coins'] = $v['coins'] * 7 / 10;
|
||||
$reslut_data[$k]['product_id'] = $v['product_id'];
|
||||
}
|
||||
return V(1, '获取成功', $reslut_data);
|
||||
}
|
||||
|
||||
//苹果商店充值金额列表
|
||||
public function can_recharge_list_ios(){
|
||||
$app_version = request()->header('App-Version');
|
||||
$system = request()->header('system');
|
||||
|
||||
$reslut = db::name("vs_can_recharge")->where("status",1)->where("delete_time",0)->order('money asc')->select();
|
||||
$reslut_data = [];
|
||||
|
||||
if ($system == 'iOS') {
|
||||
$api_versions = db::name('version')->where(['type' => 2, 'status' => 1])->order('id', 'desc')->find();
|
||||
//app的版本和用户使用的当前版本比对
|
||||
//$api_versions['newversion'] 是数据库当前的版本 也是用户使用的版本
|
||||
//$app_version 有可能是appstore里面的审核版本 审核版本比用户的版本高
|
||||
|
||||
$result = version_compare($api_versions['newversion'],$app_version);
|
||||
if ($result < 0) {//-1:前面版本小于后面版本,0:相等,1:前面版本大于后面版本
|
||||
// $api_version = 1;//商店审核版本给前端返回1
|
||||
foreach ($reslut as $k=>$v){
|
||||
if($v['money'] == 2000){
|
||||
$reslut_data[$k]['money'] = '1999.00';
|
||||
}else{
|
||||
$reslut_data[$k]['money'] = $v['money'];
|
||||
}
|
||||
$reslut_data[$k]['coins'] = $v['coins'];
|
||||
$reslut_data[$k]['ios_coins'] = $v['coins'] * 7 / 10;
|
||||
$reslut_data[$k]['product_id'] = $v['product_id'];
|
||||
}
|
||||
}else{
|
||||
foreach ($reslut as $k=>$v){
|
||||
$reslut_data[$k]['money'] = $v['money'];
|
||||
$reslut_data[$k]['coins'] = $v['coins'];
|
||||
$reslut_data[$k]['ios_coins'] = $v['coins'] * 7 / 10;
|
||||
$reslut_data[$k]['product_id'] = $v['product_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return V(1, '获取成功', $reslut_data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 钻石兑换金币比例
|
||||
*/
|
||||
|
||||
@@ -170,7 +170,7 @@ class UserZone extends BaseCom
|
||||
$api_version = 0;
|
||||
if ($system == 'iOS') {
|
||||
$api_versions = db::name('version')->where(['type' => 2, 'status' => 1])->order('id', 'desc')->find();
|
||||
$result = version_compare($api_versions['oldversion'],$app_version);
|
||||
$result = version_compare($api_versions['newversion'],$app_version);
|
||||
if ($result < 0) {
|
||||
$api_version = 1;
|
||||
}
|
||||
@@ -185,6 +185,10 @@ class UserZone extends BaseCom
|
||||
$gift_id = input('gift_id', 0);
|
||||
$num = input('num', 1);
|
||||
$is_pack = input('is_pack', 1);//2背包 1金币
|
||||
$pool_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
if($gift_id == $pool_gift_id){
|
||||
return V(0, '此礼物不能进行此操作');
|
||||
}
|
||||
$reslut = model('GiveGift')->reward_zone($this->uid, $zid, $gift_id, $num, $is_pack);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
@@ -11,21 +11,102 @@ use app\common\controller\BaseCom;
|
||||
class Xintiao extends BaseCom
|
||||
{
|
||||
|
||||
|
||||
public function keep_xintiao()
|
||||
//房间内保持心跳
|
||||
public function keep_room_heartbeat()
|
||||
{
|
||||
$room_id = input('room_id');
|
||||
if(!$room_id){
|
||||
return V(0, '参数错误', null);
|
||||
}
|
||||
$user_id = $this->uid;
|
||||
$is_xintiao = db::name('vs_xintiao')->where('user_id' , $user_id)->find();
|
||||
$is_xintiao = db::name('vs_room_heartbeat')->where(['user_id' => $user_id, 'room_id' => $room_id])->find();
|
||||
if($is_xintiao){
|
||||
db::name('vs_xintiao')->where('user_id' , $user_id)->update(['updatetime' => time()]);
|
||||
db::name('vs_room_heartbeat')->where('id' , $is_xintiao['id'])->update(['updatetime' => time()]);
|
||||
}else{
|
||||
db::name('vs_xintiao')->insert([
|
||||
db::name('vs_room_heartbeat')->insert([
|
||||
'user_id' => $user_id,
|
||||
'room_id' => $room_id,
|
||||
'createtime' => time(),
|
||||
'updatetime' => time()
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
//任务:18-每日在线时长 5 分钟
|
||||
model('Tasks')->tasks_complete($user_id,18);
|
||||
//任务:19-每日在线时长 10 分钟
|
||||
model('Tasks')->tasks_complete($user_id,19);
|
||||
//任务:20-每日在线时长 15 分钟
|
||||
model('Tasks')->tasks_complete($user_id,20);
|
||||
|
||||
//获取房间的类型
|
||||
$room_type = db::name('vs_room')->where(['id' => $room_id])->value('type_id');
|
||||
//查询徒弟是否是首签的徒弟 sign_user_type:被签用户的类型:0-首次被签,1-签约过期,2-违约签
|
||||
$user_sign = db::name('vs_user_sign')
|
||||
->where(['sign_user_id' => $user_id,'sign_user_type' => 0,'end_time' => ['>',time()]])->field('parent_user_id,sign_user_id')->select();
|
||||
if($user_sign){
|
||||
foreach ($user_sign as $v){
|
||||
if($room_type == 2){
|
||||
//查询徒弟在不在房间
|
||||
$is_room = db::name('vs_room_visitor')
|
||||
->where(['user_id' => $v['sign_user_id'], 'room_id' => $room_id])->find();
|
||||
if($is_room){
|
||||
//任务:21-邀请徒弟在拍卖房停留(0/5)分钟,并送给徒弟(0/1 ,特殊礼物)
|
||||
model('Tasks')->tasks_complete($v['parent_user_id'], 21, 1,$v['sign_user_id']);
|
||||
}
|
||||
}
|
||||
if($room_type == 7){
|
||||
//查询徒弟在不在房间
|
||||
$is_room = db::name('vs_room_visitor')
|
||||
->where(['user_id' => $v['sign_user_id'], 'room_id' => $room_id])->find();
|
||||
if($is_room){
|
||||
//任务:23-邀请徒弟在交友房停留(0/5)分钟,并送给徒弟(0/1 ,特殊礼物)
|
||||
model('Tasks')->tasks_complete($v['parent_user_id'], 23, 1,$v['sign_user_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//是否有在限时时间内的Cp任务
|
||||
//查询是否已经存在Cp空间
|
||||
$rees = Db::name('user_cp_zone')->where(['user_id1' => $user_id,'status' => 1])->find();
|
||||
if(!$rees){
|
||||
$rees = Db::name('user_cp_zone')->where(['user_id2' => $user_id,'status' => 1])->find();
|
||||
}
|
||||
if($rees){
|
||||
//查询另一个 用户在不在 房间内
|
||||
if($rees['user_id1'] == $user_id){
|
||||
$UserId = $rees['user_id2'];
|
||||
}else{
|
||||
$UserId = $rees['user_id1'];
|
||||
}
|
||||
$is_room = db::name('vs_room_visitor')
|
||||
->where(['user_id' => $UserId, 'room_id' => $room_id])->find();
|
||||
if($is_room){
|
||||
//成为Cp的天数
|
||||
$createtime =Db::name('user_cp_zone')->where(['id' => $rees['id']])->value('createtime');
|
||||
$days = floor((time() - $createtime) / 86400);
|
||||
if($days <= 7){
|
||||
$is_time = Db::name('vs_user_cp_task')->where(['user_id' => $rees['user_id1'],'status' => 0,'day' => date('Y-m-d', time()),'delete_time' => 0])->find();
|
||||
$is_time2 = Db::name('vs_user_cp_task')->where(['user_id' => $rees['user_id2'],'status' => 0,'day' => date('Y-m-d', time()),'delete_time' => 0])->find();
|
||||
if($is_time && $is_time['need_time_value'] > $is_time['time_value']){
|
||||
$exo_value = ($is_time['time_value'] + 0.5) >= $is_time['need_time_value'] ? $is_time['need_time_value'] : ($is_time['time_value'] + 0.5);
|
||||
$data_cp = [
|
||||
'time_value' => $exo_value,
|
||||
];
|
||||
if($exo_value >= $is_time['need_time_value'] && $is_time['exp_value'] == $is_time['need_exp_value']){
|
||||
$data_cp['status'] = 1;
|
||||
}
|
||||
Db::name('vs_user_cp_task')->where(['id' => $is_time['id']])->update($data_cp);
|
||||
Db::name('vs_user_cp_task')->where(['id' => $is_time2['id']])->update($data_cp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//返回任务未领取奖励数
|
||||
$not_received_tasks_num = model('Tasks')->daily_tasks_unfinished_count($user_id);
|
||||
$return_data = [
|
||||
'not_received_tasks_num' => $not_received_tasks_num['data']['num']
|
||||
];
|
||||
return V(1, '成功', $return_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +114,4 @@ class Xintiao extends BaseCom
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -8,427 +8,404 @@ use think\Log;
|
||||
|
||||
use app\common\controller\Push;
|
||||
|
||||
class Xxiaoshi extends Controller
|
||||
class Xxiaoshi extends Controllers
|
||||
{
|
||||
|
||||
|
||||
public function send_gift()
|
||||
public function test()
|
||||
{
|
||||
//获取上一个小时的开始时间和结束时间
|
||||
$start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
|
||||
$end_time = strtotime(date('Y-m-d H:00:00'));
|
||||
echo "开始时间:" .$start_time."\n";
|
||||
echo "结束时间:" .$end_time."\n";
|
||||
//当前小时的前一个小时(24小时计时法,0-23)
|
||||
$pre_hour = date('H', strtotime('-1 hour'));
|
||||
echo "上个时间段:" .$pre_hour."\n";
|
||||
$is_open_time = db::name('vs_hour_ranking_config')->where('id', 1)->value('open_time');
|
||||
if ($is_open_time == 0) {
|
||||
echo "未开启时间段:" .$is_open_time."\n";
|
||||
return;
|
||||
$res = db::name('user_zone')->where(['is_delete'=> 2,'delete_time'=> ['<>', 0]])->select();
|
||||
if($res){
|
||||
foreach ($res as $v){
|
||||
//删除动态下的标签引用
|
||||
$top_zone = db::name('user_zone_topic')->where('zone_id',$v['id'])->select();
|
||||
if($top_zone){
|
||||
foreach ($top_zone as $vs){
|
||||
db::name('user_zone_topic')->where('id',$vs['id'])->delete();
|
||||
}
|
||||
//是否全局飘瓶
|
||||
$is_public_server = db::name('vs_hour_ranking_config')->where('id', 1)->value('is_public_server');
|
||||
if ($is_public_server == 1) {
|
||||
//全局飘瓶时间段
|
||||
$xlh_time_range = db::name('vs_hour_ranking_config')->where('id', 1)->value('broadcast_times');
|
||||
if($xlh_time_range){
|
||||
if($xlh_time_range == 25){
|
||||
$is_piao = 1;
|
||||
}else{
|
||||
|
||||
//当前的前一个小时是否在 $xlh_time_range中
|
||||
if (in_array($pre_hour, explode(',', $xlh_time_range))) {
|
||||
$is_piao = 1;
|
||||
} else {
|
||||
$is_piao = 0;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$is_piao = 0;
|
||||
}
|
||||
}else{
|
||||
$is_piao = 0;
|
||||
}
|
||||
|
||||
//获取上一个时间段的配置
|
||||
// $gift_list = db::name('vs_hour_ranking_gift_config')->where('time_id',$pre_hour)->group('ranking')->order('id', 'desc')->select();
|
||||
$gift_list = $this->get_hour_ranking($pre_hour);
|
||||
// echo "上个时间段的配置:" .json_encode($gift_list)."\n";
|
||||
// 提取所有有奖励的内容
|
||||
$allRewards = $this->extractAllRewards($gift_list);
|
||||
// 按index分组
|
||||
$groupedRewards = $this->groupRewardsByIndex($allRewards);
|
||||
// 按名次顺序分配奖励
|
||||
$distributionResult = $this->distributeByRank($groupedRewards);
|
||||
|
||||
//获取上个数组的个数,从而获取配置了多少个名次
|
||||
$count = count($distributionResult);
|
||||
echo "上个时间段的配置总数:" .$count."\n";
|
||||
//获取前一个小时的 前$count名房间排行
|
||||
$room_list = model('api/RoomHourRanking')->room_hour_ranking(1, $count, $start_time, $end_time);
|
||||
$room_owner = [];
|
||||
if ($room_list['code'] == 1) {
|
||||
//获取房间排行奖励最低值
|
||||
$min_price = db::name('vs_hour_ranking_config')->where('id', 1)->value('min_price');
|
||||
if ($room_list['data']['lists']) {
|
||||
echo "房间列表:" .json_encode($room_list['data']['lists'])."\n";
|
||||
foreach ($room_list['data']['lists'] as $v){
|
||||
if ($v['total_price'] >= $min_price) {
|
||||
$room_owner[] = [
|
||||
'user_id' => $v['user_id'],
|
||||
'room_name' => $v['room_name'],
|
||||
'room_id' => $v['room_id'],
|
||||
'total_price' => $v['total_price']
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($distributionResult && $room_owner) {
|
||||
$text_list_new = [];
|
||||
echo "礼物数:" .json_encode($distributionResult)."\n";
|
||||
echo "房主:" .json_encode($room_owner)."\n";
|
||||
foreach ($distributionResult as $k => $value) {
|
||||
//礼物全部给他偷偷放在装扮表及金额 中
|
||||
//有几个用户就发几个
|
||||
if(count($room_owner) > $k){
|
||||
// 为每个房间添加一个标志,表示是否已处理推送信息
|
||||
$hasProcessedPush = false;
|
||||
|
||||
foreach ($value['rewards'] as $v){
|
||||
// if($v['type'] == 0){//1金币2礼物3头像4坐骑
|
||||
// echo "发金币:" .$v['value'].'==>'.$room_owner[$k]['user_id']."\n";
|
||||
// $res = $this->add_coin($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao);
|
||||
// }elseif ($v['type'] == 1){
|
||||
// echo "发礼物:" .$v['value'].'==>'.$room_owner[$k]['user_id']."\n";
|
||||
// $res = $this->add_gift($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao);
|
||||
// }elseif ($v['type'] == 2){
|
||||
// $res = $this->add_decorate($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao,3);
|
||||
// }elseif ($v['type'] == 3){
|
||||
// $res = $this->add_decorate($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao,4);
|
||||
// }
|
||||
// 只有在第一次处理奖励时添加推送信息,避免重复推送
|
||||
if(!$hasProcessedPush && $is_piao == 1) {
|
||||
$room_name = $room_owner[$k]['room_name'];
|
||||
//推送礼物横幅
|
||||
if ($k == 0) {
|
||||
$text = '新科状元!【' . $room_name . '】独占鳌头!';
|
||||
} elseif ($k == 1) {
|
||||
$text = '金榜榜眼!【' . $room_name . '】才气逼人!';
|
||||
} elseif ($k == 2) {
|
||||
$text = '风采探花!【' . $room_name . '】实力绽放!';
|
||||
}
|
||||
|
||||
$text_list_new[] = [
|
||||
'text' => $text ?? '恭喜【' . $room_name . '】获得礼物!',
|
||||
'room_id' => $room_owner[$k]['room_id'],
|
||||
'room_name' => $room_name,
|
||||
'rank_number' => $k + 1,
|
||||
];
|
||||
|
||||
$hasProcessedPush = true; // 标记已处理推送
|
||||
//测试数据
|
||||
public function testData()
|
||||
{
|
||||
$res = db::name('vs_user_gift_pack')
|
||||
->field('gid,after_num')
|
||||
->where(['a.updatetime'=> ['<=', 1766332800]])
|
||||
->group('a.gid')
|
||||
->select();
|
||||
$total_price = 0;
|
||||
if($res){
|
||||
foreach ($res as $v){
|
||||
$gft_price = db::name('vs_gift')->where('gid',$v['gid'])->value('gift_price');
|
||||
$total_price += $gft_price * $v['after_num'];
|
||||
}
|
||||
}
|
||||
echo $total_price;
|
||||
echo '<br>';
|
||||
var_dump($res);
|
||||
|
||||
}
|
||||
}
|
||||
if(!empty($text_list_new)){
|
||||
$push = new Push();
|
||||
$push->hourRankingcs($text_list_new);
|
||||
Log::record("小时榜推送:".json_encode($text_list_new),"infos");
|
||||
}
|
||||
}
|
||||
echo "送礼-共" . count($room_owner) . "个房间房主获益\n";
|
||||
}
|
||||
|
||||
//添加金币到钱包
|
||||
// public function add_coin($coin,$user_id,$ranking,$room_id,$total_price,$is_piao){
|
||||
// if($coin > 0){
|
||||
// $data = [
|
||||
// 'user_id' => $user_id,
|
||||
// 'change_value' => $coin,
|
||||
// // 'room_id' => $room_ids,
|
||||
// 'money_type' => 1,
|
||||
// 'change_type' => 27,
|
||||
// 'from_id' => 0,
|
||||
// 'remarks' => '小时榜获得',
|
||||
// 'createtime' => time()
|
||||
|
||||
public function queryUserRecharge()
|
||||
{
|
||||
// 1. 构建键值对数组(左侧为键,右侧为对应的值列表)
|
||||
// $userTimeData = [
|
||||
// [21238, 1768437495],
|
||||
// [21238, 1768438042],
|
||||
// [21238, 1768537071],
|
||||
// [21238, 1768537086],
|
||||
// [21238, 1768537102],
|
||||
// [21238, 1768537116],
|
||||
// [21238, 1768537130],
|
||||
// [21263, 1768538654],
|
||||
// [21283, 1768538494],
|
||||
// [21283, 1768538505],
|
||||
// [21346, 1768620290],
|
||||
// [21355, 1768562702],
|
||||
// [21521, 1768480294],
|
||||
// [21521, 1768535126],
|
||||
// [21521, 1768559545],
|
||||
// [21521, 1768559583],
|
||||
// [21521, 1768561603],
|
||||
// [21521, 1768561942],
|
||||
// [21549, 1768472710],
|
||||
// [21549, 1768473170],
|
||||
// [22109, 1768576512],
|
||||
// [22215, 1768448033],
|
||||
// [22230, 1768453987],
|
||||
// [22230, 1768494691],
|
||||
// [22230, 1768606319],
|
||||
// [22247, 1768568982],
|
||||
// [22349, 1768463236],
|
||||
// [22349, 1768463510],
|
||||
// [22349, 1768498328],
|
||||
// [22349, 1768534547],
|
||||
// [22349, 1768575347],
|
||||
// [22349, 1768575906],
|
||||
// [22349, 1768576001],
|
||||
// [22349, 1768576134],
|
||||
// [22349, 1768576484],
|
||||
// [22353, 1768493303],
|
||||
// [22353, 1768493644],
|
||||
// [22367, 1768450215],
|
||||
// [22367, 1768450295],
|
||||
// [22367, 1768450411],
|
||||
// [22367, 1768556122],
|
||||
// [22367, 1768557842],
|
||||
// [22367, 1768560574],
|
||||
// [22397, 1768489651],
|
||||
// [22397, 1768489678],
|
||||
// [22403, 1768615100],
|
||||
// [22403, 1768615185],
|
||||
// [22474, 1768610625],
|
||||
// [22489, 1768539082],
|
||||
// [22513, 1768469607],
|
||||
// [22513, 1768622078], // 新增的时间戳
|
||||
// [22546, 1768467110],
|
||||
// [22546, 1768480214],
|
||||
// [22546, 1768480289],
|
||||
// [22546, 1768617480],
|
||||
// [22546, 1768619884],
|
||||
// [22765, 1768555869],
|
||||
// [22765, 1768613623],
|
||||
// [22960, 1768478779],
|
||||
// [22960, 1768562093],
|
||||
// [22960, 1768562790],
|
||||
// [23160, 1768495390],
|
||||
// [23273, 1768546462],
|
||||
// [23317, 1768445313],
|
||||
// [23317, 1768499667],
|
||||
// [23317, 1768500101],
|
||||
// [23317, 1768500124],
|
||||
// [23317, 1768500550],
|
||||
// [23317, 1768502888],
|
||||
// [23317, 1768580934],
|
||||
// [23317, 1768580952],
|
||||
// [23317, 1768582152],
|
||||
// [23381, 1768484820],
|
||||
// [23381, 1768558830],
|
||||
// [23381, 1768562317],
|
||||
// [23418, 1768546419],
|
||||
// [23418, 1768556020],
|
||||
// [23428, 1768615120],
|
||||
// [23620, 1768438590],
|
||||
// [23620, 1768446478],
|
||||
// [23620, 1768446636],
|
||||
// [23620, 1768446926],
|
||||
// [23620, 1768446971],
|
||||
// [23620, 1768446983],
|
||||
// [23620, 1768446994],
|
||||
// [23768, 1768500957],
|
||||
// [23934, 1768487148],
|
||||
// [23979, 1768483941],
|
||||
// [23979, 1768484887],
|
||||
// [23979, 1768485349],
|
||||
// [23979, 1768488207],
|
||||
// [23979, 1768606496],
|
||||
// [23996, 1768537785],
|
||||
// [23996, 1768583372],
|
||||
// [24049, 1768480652],
|
||||
// [24049, 1768574886],
|
||||
// [24049, 1768575149],
|
||||
// [24049, 1768575263],
|
||||
// [24049, 1768575306],
|
||||
// [24049, 1768576026],
|
||||
// [24049, 1768576057],
|
||||
// [24049, 1768576122],
|
||||
// [24049, 1768576324],
|
||||
// [24049, 1768576359],
|
||||
// [24049, 1768576411],
|
||||
// [24049, 1768576450],
|
||||
// [24049, 1768576547],
|
||||
// [24049, 1768576572],
|
||||
// [24049, 1768576752],
|
||||
// [24049, 1768576788],
|
||||
// [24049, 1768610848],
|
||||
// [24049, 1768610956],
|
||||
// [24123, 1768476419],
|
||||
// [24123, 1768563117],
|
||||
// [24208, 1768480841],
|
||||
// [24221, 1768621532], // 新增的user_id和时间戳
|
||||
// [24224, 1768434963],
|
||||
// [24239, 1768575140],
|
||||
// [24262, 1768474400],
|
||||
// [24268, 1768562981],
|
||||
// [24268, 1768563148],
|
||||
// [24376, 1768495419],
|
||||
// [24402, 1768573575],
|
||||
// [24402, 1768573664],
|
||||
// [24497, 1768611030],
|
||||
// [24497, 1768611043],
|
||||
// [24559, 1768573337],
|
||||
// [24619, 1768444049],
|
||||
// [24724, 1768436254],
|
||||
// [24724, 1768436335],
|
||||
// [24724, 1768436370],
|
||||
// [24724, 1768436566],
|
||||
// [24724, 1768463485],
|
||||
// [24724, 1768463533],
|
||||
// [24724, 1768485920],
|
||||
// [24724, 1768486241],
|
||||
// [24724, 1768559795],
|
||||
// [24724, 1768575533],
|
||||
// [24724, 1768575836],
|
||||
// [24724, 1768575846],
|
||||
// [24724, 1768576947],
|
||||
// [24724, 1768577192],
|
||||
// [24724, 1768584426],
|
||||
// [24724, 1768591790],
|
||||
// [24724, 1768592625],
|
||||
// [24809, 1768574941],
|
||||
// [24914, 1768469768],
|
||||
// [24914, 1768478779],
|
||||
// [24914, 1768529233],
|
||||
// [24914, 1768547882],
|
||||
// [24949, 1768446759],
|
||||
// [24949, 1768468114],
|
||||
// [24949, 1768471318],
|
||||
// [24949, 1768489660],
|
||||
// [24949, 1768489679],
|
||||
// [24949, 1768489694],
|
||||
// [24949, 1768489908],
|
||||
// [24949, 1768489995],
|
||||
// [24949, 1768491042],
|
||||
// [24949, 1768491189],
|
||||
// [24949, 1768495030],
|
||||
// [24949, 1768495287],
|
||||
// [24949, 1768528803],
|
||||
// [24949, 1768621300], // 新增的时间戳
|
||||
// [25102, 1768486444],
|
||||
// [25102, 1768492650],
|
||||
// [25264, 1768469925],
|
||||
// [25297, 1768482093],
|
||||
// [25297, 1768523171],
|
||||
// [25297, 1768524115],
|
||||
// [25356, 1768453712],
|
||||
// [25356, 1768564162],
|
||||
// [25436, 1768567177],
|
||||
// [25504, 1768445533],
|
||||
// [25504, 1768474538],
|
||||
// [25504, 1768474550],
|
||||
// [25504, 1768549836],
|
||||
// [25504, 1768550533],
|
||||
// [25504, 1768551277],
|
||||
// [25504, 1768611155],
|
||||
// [25614, 1768463575],
|
||||
// [25614, 1768493369],
|
||||
// [25668, 1768550315],
|
||||
// [25668, 1768550900],
|
||||
// [25668, 1768551157],
|
||||
// [25689, 1768534840],
|
||||
// [25689, 1768534859],
|
||||
// [25689, 1768535523],
|
||||
// [25689, 1768606149],
|
||||
// [25689, 1768606164],
|
||||
// [25782, 1768440770],
|
||||
// [25868, 1768441940],
|
||||
// [25884, 1768446752],
|
||||
// [25884, 1768453213],
|
||||
// [25884, 1768478849],
|
||||
// [25909, 1768451888],
|
||||
// [25909, 1768452147],
|
||||
// [25909, 1768452512],
|
||||
// [25909, 1768452685],
|
||||
// [25909, 1768453007],
|
||||
// [25977, 1768465353],
|
||||
// [25977, 1768466422],
|
||||
// [25977, 1768466948],
|
||||
// [25977, 1768495780],
|
||||
// [26002, 1768474369],
|
||||
// [26010, 1768563140],
|
||||
// [26260, 1768595503],
|
||||
// [26333, 1768480346],
|
||||
// [26471, 1768463341],
|
||||
// [26471, 1768535162],
|
||||
// [26685, 1768544823],
|
||||
// [26846, 1768467107],
|
||||
// [26865, 1768526248],
|
||||
// [26910, 1768495212],
|
||||
// [26910, 1768495674],
|
||||
// [26932, 1768451859],
|
||||
// [26932, 1768452304],
|
||||
// [26932, 1768467016],
|
||||
// [26932, 1768467086],
|
||||
// [26961, 1768551610],
|
||||
// [26961, 1768551630],
|
||||
// [26961, 1768551741],
|
||||
// [26961, 1768617367],
|
||||
// [27063, 1768595933],
|
||||
// [27152, 1768544596],
|
||||
// [27172, 1768453726],
|
||||
// [27306, 1768467885],
|
||||
// [27306, 1768480720],
|
||||
// [27619, 1768480089],
|
||||
// [27619, 1768547882],
|
||||
// [27619, 1768547902],
|
||||
// [27619, 1768564945],
|
||||
// [27848, 1768445845],
|
||||
// [27848, 1768446640],
|
||||
// [27980, 1768485183],
|
||||
// [28015, 1768463456],
|
||||
// [28015, 1768464122],
|
||||
// [28226, 1768539447],
|
||||
// [28226, 1768539558],
|
||||
// [28226, 1768539674],
|
||||
// [28226, 1768539800],
|
||||
// [28226, 1768539899],
|
||||
// [28226, 1768539972],
|
||||
// [28226, 1768540093],
|
||||
// [28226, 1768540167],
|
||||
// [28226, 1768540273],
|
||||
// [28304, 1768454349],
|
||||
// [28357, 1768441100],
|
||||
// [28443, 1768471092],
|
||||
// [28443, 1768538447],
|
||||
// [28443, 1768540270],
|
||||
// [28443, 1768547826],
|
||||
// [28443, 1768556907],
|
||||
// [28443, 1768557771],
|
||||
// [28443, 1768564068],
|
||||
// [28443, 1768564085],
|
||||
// [28551, 1768481077],
|
||||
// [28551, 1768481222],
|
||||
// [28551, 1768548678],
|
||||
// [28551, 1768580500],
|
||||
// [28551, 1768580517],
|
||||
// [28561, 1768449441],
|
||||
// [28769, 1768553650],
|
||||
// [28769, 1768553902],
|
||||
// [28855, 1768568390],
|
||||
// [28924, 1768472667],
|
||||
// [28924, 1768490582],
|
||||
// [28924, 1768490656],
|
||||
// [28924, 1768490721],
|
||||
// [28924, 1768490844],
|
||||
// [28924, 1768490949],
|
||||
// [28924, 1768491079],
|
||||
// [28924, 1768491176],
|
||||
// [28924, 1768491285],
|
||||
// [28924, 1768569855],
|
||||
// [28924, 1768570809],
|
||||
// [28993, 1768444688],
|
||||
// [29420, 1768491595],
|
||||
// [30113, 1768544251],
|
||||
// [30190, 1768457671],
|
||||
// [30190, 1768457788],
|
||||
// [30190, 1768457926],
|
||||
// [30190, 1768458180],
|
||||
// [30190, 1768458568],
|
||||
// [30190, 1768458786],
|
||||
// [30190, 1768458886],
|
||||
// [30190, 1768459131],
|
||||
// [30190, 1768459373],
|
||||
// [30442, 1768529725],
|
||||
// [30551, 1768580619]
|
||||
// ];
|
||||
|
||||
// //开启事务
|
||||
// Db::startTrans();
|
||||
// $res = Db::name('vs_user_money_log')->insert($data);
|
||||
// if(!$res){
|
||||
// Db::rollback();
|
||||
// }
|
||||
if(isset($userTimeData)){
|
||||
$userTimeData = [];
|
||||
}
|
||||
$dtae = [];
|
||||
// 2. 循环数组,遍历每个键对应的所有值
|
||||
foreach ($userTimeData as $item) {
|
||||
$userId = $item[0]; // 获取用户ID
|
||||
$timestamp = $item[1]; // 获取时间戳
|
||||
// 批量查询(推荐,减少数据库连接次数)
|
||||
$rechargeData = Db::name('vs_user_recharge')
|
||||
->field('updatetime, pay_status, user_id, money')
|
||||
->where(['updatetime' => $timestamp,'pay_status' => 2 ])
|
||||
->select(); // 转为普通数组方便处理
|
||||
|
||||
// //增加用户金币
|
||||
// $res1 = Db::name('user_wallet')->where(['user_id'=>$user_id])->setInc('coin',$coin);
|
||||
// if(!$res1){
|
||||
// Db::rollback();
|
||||
// }
|
||||
|
||||
// //添加到排行表
|
||||
// $start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
|
||||
// $end_time = strtotime(date('Y-m-d H:00:00')) - 1;
|
||||
// $res2 = db::name('vs_hour_ranking')->insert([
|
||||
// 'ranking' => $ranking,
|
||||
// 'room_id' => $room_id,
|
||||
// 'flowing_water' => $total_price,
|
||||
// 'coin' => $coin,
|
||||
// 'time_id' => date('H', strtotime('-1 hour')),
|
||||
// 'stime' => $start_time,
|
||||
// 'etime' => $end_time,
|
||||
// 'createtime' => time(),
|
||||
// 'updatetime' => time(),
|
||||
// 'is_public_server' => $is_piao
|
||||
// ]);
|
||||
// if(!$res2){
|
||||
// Db::rollback();
|
||||
// }
|
||||
// Db::commit();
|
||||
// }
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// //添加礼物到背包
|
||||
// public function add_gift($gift_id,$user_id,$ranking,$room_id,$total_price,$is_piao){
|
||||
// $res = model('api/UserGiftPack')->change_user_gift_pack($user_id,$gift_id,1,model('UserGiftPack')::HOUR_RANK_GET,"小时榜获得");
|
||||
// if($res['code'] == 0){
|
||||
// Log::record("小时榜获取礼物失败:".$res['msg'],"info");
|
||||
// }
|
||||
|
||||
// //添加到排行表
|
||||
// $start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
|
||||
// $end_time = strtotime(date('Y-m-d H:00:00')) - 1;
|
||||
// $res2 = db::name('vs_hour_ranking')->insert([
|
||||
// 'ranking' => $ranking,
|
||||
// 'room_id' => $room_id,
|
||||
// 'flowing_water' => $total_price,
|
||||
// 'gift_id' => $gift_id,
|
||||
// 'gift_type' => 2,
|
||||
// 'time_id' => date('H', strtotime('-1 hour')),
|
||||
// 'stime' => $start_time,
|
||||
// 'etime' => $end_time,
|
||||
// 'createtime' => time(),
|
||||
// 'updatetime' => time(),
|
||||
// 'is_public_server' => $is_piao
|
||||
// ]);
|
||||
// if(!$res2){
|
||||
// Log::record("小时榜礼物锁定失败","info");
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// //添加装扮到背包
|
||||
// public function add_decorate($avatar_id,$user_id,$ranking,$room_id,$total_price,$is_piao,$type){
|
||||
// $decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$avatar_id])->find();
|
||||
// if(empty($decorate_price_info)){
|
||||
// Log::record("小时榜获取装扮失败:没有找到装扮!".$avatar_id,"info");
|
||||
// }
|
||||
// $res = model('api/Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],2);
|
||||
// if($res['code'] == 0){
|
||||
// Log::record("小时榜获取装扮失败:".$res['msg']."-".$avatar_id,"info");
|
||||
// }
|
||||
// //添加到排行表
|
||||
// $start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
|
||||
// $end_time = strtotime(date('Y-m-d H:00:00')) - 1;
|
||||
// $res2 = db::name('vs_hour_ranking')->insert([
|
||||
// 'ranking' => $ranking,
|
||||
// 'room_id' => $room_id,
|
||||
// 'flowing_water' => $total_price,
|
||||
// 'gift_id' => $avatar_id,
|
||||
// 'gift_type' => $type,
|
||||
// 'time_id' => date('H', strtotime('-1 hour')),
|
||||
// 'stime' => $start_time,
|
||||
// 'etime' => $end_time,
|
||||
// 'createtime' => time(),
|
||||
// 'updatetime' => time(),
|
||||
// 'is_public_server' => $is_piao,
|
||||
// ]);
|
||||
// if(!$res2){
|
||||
// Log::record("小时榜咋装扮锁定失败","info");
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 提取所有有奖励的内容
|
||||
*/
|
||||
private function extractAllRewards($responseData)
|
||||
{
|
||||
$allRewards = [];
|
||||
|
||||
foreach ($responseData as $timeSlot) {
|
||||
foreach ($timeSlot['reward'] as $rewardItem) {
|
||||
$index = $rewardItem['index'];
|
||||
$content = $rewardItem['content'];
|
||||
|
||||
// 只处理有奖励内容的数据
|
||||
if (!empty($content)) {
|
||||
foreach ($content as $rewardContent) {
|
||||
$allRewards[] = [
|
||||
'index' => $index,
|
||||
'type' => $rewardContent['type'],
|
||||
'value' => $rewardContent['value'],
|
||||
'name' => $rewardContent['name'] ?? ''
|
||||
if($rechargeData){
|
||||
foreach ($rechargeData as $recharge){
|
||||
$dtae[] = [
|
||||
'p_user' => $userId,
|
||||
'user_id' => $recharge['user_id'],
|
||||
'createtime' => $recharge['updatetime'],
|
||||
'money' => $recharge['money'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $allRewards;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按index分组奖励
|
||||
*/
|
||||
private function groupRewardsByIndex($allRewards)
|
||||
{
|
||||
$grouped = [];
|
||||
|
||||
foreach ($allRewards as $reward) {
|
||||
$index = $reward['index'];
|
||||
if (!isset($grouped[$index])) {
|
||||
$grouped[$index] = [];
|
||||
}
|
||||
$grouped[$index][] = $reward;
|
||||
}
|
||||
|
||||
// 按index排序
|
||||
ksort($grouped);
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按名次顺序分配奖励
|
||||
*/
|
||||
private function distributeByRank($groupedRewards)
|
||||
{
|
||||
$distribution = [];
|
||||
$currentRank = 0; // 从第1名开始
|
||||
|
||||
// 按index顺序分配(index 0 = 第1名,index 1 = 第2名,以此类推)
|
||||
foreach ($groupedRewards as $index => $rewards) {
|
||||
// 确保名次连续,如果有空缺则填充空名次
|
||||
while ($currentRank < $index) {
|
||||
$distribution[] = [
|
||||
'rank' => $currentRank + 1,
|
||||
'rewards' => []
|
||||
];
|
||||
$currentRank++;
|
||||
}
|
||||
|
||||
// 分配当前名次的奖励
|
||||
$distribution[] = [
|
||||
'rank' => $currentRank + 1,
|
||||
'rewards' => $rewards
|
||||
];
|
||||
$currentRank++;
|
||||
}
|
||||
|
||||
return $distribution;
|
||||
}
|
||||
|
||||
public function get_hour_ranking($time){
|
||||
// 先按时间段和排名索引分组查询
|
||||
$timeRanges = db::name('vs_hour_ranking_gift_config')->distinct(true)
|
||||
->where('time_id', '=', $time)
|
||||
->order('time_id')
|
||||
->column('time_id');
|
||||
|
||||
$result = [];
|
||||
foreach ($timeRanges as $timeRange) {
|
||||
// 查询该时间段的所有数据
|
||||
$rewards = db::name('vs_hour_ranking_gift_config')->where('time_id', $timeRange)
|
||||
->field('ranking, gift_type, gift_id,coin,name')
|
||||
->order('ranking')
|
||||
->select();
|
||||
|
||||
$rewardMap = [];
|
||||
foreach ($rewards as $reward) {
|
||||
$rankIndex = $reward['ranking'];
|
||||
|
||||
if (!isset($rewardMap[$rankIndex])) {
|
||||
$rewardMap[$rankIndex] = [
|
||||
'index' => $rankIndex,
|
||||
// 'name' => $reward['rank_name'],
|
||||
'content' => []
|
||||
// var_dump($dtae);
|
||||
echo "\n";
|
||||
echo "=========";
|
||||
var_dump(count($dtae));
|
||||
echo "\n";
|
||||
$invite = [];
|
||||
$invited_draw_conf = get_system_config_value('invited_draw');//分成比例
|
||||
if($dtae){
|
||||
foreach ($dtae as $item){
|
||||
$invit = db::name('vs_user_invited')->where(['user_id' => $item['p_user'],'sub_user_id' => $item['user_id']])->find();
|
||||
if($invit){
|
||||
$invited_draw = $invited_draw_conf / 100;
|
||||
$invited_draw_money = $item['money'] * $invited_draw;
|
||||
//增加余额并记录日志
|
||||
// $wallet_update = model('api/UserWallet')->change_user_earnings_log($item['p_user'],$invited_draw_money,0,6,'邀请用户充值返利'.$item['createtime']);
|
||||
// if(!$wallet_update){
|
||||
// Log::record("邀请用户充值返利(补发)失败:".$item['p_user'],"info");
|
||||
// echo "邀请用户充值返利失败".$item['p_user'];
|
||||
// }
|
||||
sleep(1);
|
||||
$invite[] = [
|
||||
'p_user' => $item['p_user'],
|
||||
'user_id' => $item['user_id'],
|
||||
'createtime' => $item['createtime'],
|
||||
'money' => $item['money'],
|
||||
'invited_draw_money' => $invited_draw_money,
|
||||
];
|
||||
}
|
||||
|
||||
// 添加奖励内容到content数组
|
||||
if ($reward['gift_id'] != 0 || $reward['coin'] != 0) {
|
||||
if($reward['gift_id'] != 0){
|
||||
$rewardMap[$rankIndex]['content'][] = [
|
||||
'type' => $reward['gift_type'],
|
||||
'value' => $reward['gift_id'],
|
||||
// 'coin' => $reward['coin'],
|
||||
'name' => $reward['name'],
|
||||
];
|
||||
}
|
||||
if($reward['coin'] != 0){
|
||||
$rewardMap[$rankIndex]['content'][] = [
|
||||
'type' => $reward['gift_type'],
|
||||
'value' => $reward['coin'],
|
||||
'name' => $reward['name'],
|
||||
];
|
||||
}
|
||||
echo "=========";
|
||||
echo "\n";
|
||||
// var_dump($invite);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 按index排序
|
||||
ksort($rewardMap);
|
||||
|
||||
$result[] = [
|
||||
'time' => $timeRange,
|
||||
'reward' => array_values($rewardMap)
|
||||
];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function give_gifts(){
|
||||
$data = db::name('vs_give_gift')->where('from_id',5483)->select();
|
||||
$num = 0;
|
||||
$i=0;
|
||||
$j = 0;
|
||||
foreach($data as $v){
|
||||
$j += $v['total_price'];
|
||||
$nuu = db::name('vs_give_gift_ratio_log')->where('give_gift_id',$v['id'])->value('room_owner_earning');
|
||||
$id = db::name('vs_give_gift_ratio_log')->where('give_gift_id',$v['id'])->value('id');
|
||||
// echo $id."--".$nuu."\n";
|
||||
$num += $nuu;
|
||||
$i++;
|
||||
}
|
||||
echo $num;
|
||||
echo "==".$i."==".$j;
|
||||
|
||||
// echo db::name()->where(['user_id' => 10857,'money_type' =>2,'change_type' =>18])-sum('change_value');
|
||||
}
|
||||
|
||||
|
||||
public function room_liushui(){
|
||||
// $room = db::name('vs_give_gift')->where(['from_id' => ['<>',5418],'from' => 2])->group('from_id');
|
||||
$dd = db::name('vs_user_gift_pack')->alias('a')->join('vs_gift b','a.gid = b.gid')->field('a.gid,a.num,b.gift_price')->where(['a.num' =>['>',0]])->select();
|
||||
$count = 0;
|
||||
foreach ($dd as $v){
|
||||
$count += $v['gift_price'] * $v['num'];
|
||||
}
|
||||
echo $count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -239,7 +239,7 @@ class Activities extends Model
|
||||
// 添加活动记录
|
||||
$reslut = Db::name('vs_activities_receive')->insert([
|
||||
'user_id' => $user_id,
|
||||
'activities_id' => 1,
|
||||
'activities_id' => 7,
|
||||
'createtime' => time(),
|
||||
'updatetime' => time()
|
||||
]);
|
||||
@@ -252,4 +252,29 @@ class Activities extends Model
|
||||
}
|
||||
}
|
||||
|
||||
//获取礼包总价值
|
||||
public static function get_gift_bag_total_price($gift_bag_id){
|
||||
$gift_bag_detail = Db::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag_id])->select();
|
||||
$total_price = 0;
|
||||
foreach ($gift_bag_detail as $k=>$v){
|
||||
switch ($v['type']) {
|
||||
case 1: //金币
|
||||
$total_price += $v['quantity']*$v['gold'];
|
||||
break;
|
||||
case 2: //礼物 方法2:添加到用户礼物背包
|
||||
$gift_price = db::name('vs_gift')->where(['gid'=>$v['foreign_id']])->value('gift_price');
|
||||
$total_price += $gift_price * $v['quantity'];
|
||||
break;
|
||||
case 3: //坐骑 方法3:添加到用户装扮
|
||||
$decorate_price = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->value('price');
|
||||
$total_price += $decorate_price * $v['quantity'];
|
||||
break;
|
||||
case 4: //道具 方法5:钻石
|
||||
$total_price += $v['quantity']*$v['gold'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $total_price;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,8 +12,10 @@ class Banner extends Model
|
||||
1 => '引导页',
|
||||
2 => '启动页',
|
||||
3 => '首页轮播图',
|
||||
4 => '房间首页',
|
||||
5 => '工会列表页广告位'
|
||||
4 => '房间首页轮播图',
|
||||
5 => '工会列表页广告位',
|
||||
6 => '我的主页广告位',
|
||||
7 => '道具商城广告位'
|
||||
];
|
||||
//1纯展示 2文章 3房间 4个人主页 5外站'
|
||||
public $Type = [
|
||||
|
||||
240
application/api/model/BarRoom.php
Normal file
240
application/api/model/BarRoom.php
Normal file
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use think\Cache;
|
||||
use think\Model;
|
||||
use think\Db;
|
||||
|
||||
/*
|
||||
* 酒吧房
|
||||
*/
|
||||
class BarRoom extends Model
|
||||
{
|
||||
// 开启自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = true;
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 麦位时长配置
|
||||
protected $pitDuration = [
|
||||
'1' => 5,
|
||||
'2' => 10,
|
||||
'3' => 15,
|
||||
'4' => 20,
|
||||
'5' => 25,
|
||||
'6' => 30,
|
||||
];
|
||||
|
||||
//麦位时长列表
|
||||
public function get_pit_duration_list(){
|
||||
foreach ($this->pitDuration as $key => $value) {
|
||||
$list[] = [
|
||||
'time' => $value,
|
||||
'time_str' => $value.'分钟',
|
||||
];
|
||||
}
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $list];
|
||||
}
|
||||
|
||||
|
||||
|
||||
//设置房间麦位时长
|
||||
public function set_pit_duration($room_id,$time){
|
||||
$room = db::name('vs_room')->where(['id' => $room_id, 'delete_time' => 0, 'room_status' => 1])->find();
|
||||
if(!$room){
|
||||
return ['code' => 0, 'msg' => '房间不存在', 'data' => null];
|
||||
}
|
||||
$room_data = db::name('vs_room_bar')->where('id',$room['id'])->find();
|
||||
if($room_data){
|
||||
if($room_data['pit_time'] != $time){
|
||||
db::name('vs_room_bar')->where('id',$room_id)->update(['pit_time' => $time]);
|
||||
}
|
||||
}else{
|
||||
db::name('vs_room_bar')->insert([
|
||||
'id' => $room_id,
|
||||
'pit_time' => $time,
|
||||
]);
|
||||
}
|
||||
//推送麦位时长
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
}
|
||||
|
||||
|
||||
|
||||
//上麦选择礼物
|
||||
public function join_pit_choose_gift($user_id,$room_id,$gift_id){
|
||||
$pit_gift = db::name('vs_room_bar_pit_gift')->where(['room_id' => $room_id,'user_id' => $user_id])->find();
|
||||
$pit_time = db::name('vs_room_bar')->where('id',$room_id)->value('pit_time')??5;
|
||||
$end_time = time() + ($pit_time * 60);
|
||||
if($pit_gift){
|
||||
// 使用WHERE条件和影响行数验证确保并发安全
|
||||
$result = db::name('vs_room_bar_pit_gift')
|
||||
->where(['id' => $pit_gift['id']])
|
||||
->update([
|
||||
'gift_id' => $gift_id,
|
||||
'end_time' => $end_time,
|
||||
'updatetime' => time(),
|
||||
'delete_time' => 0,
|
||||
]);
|
||||
} else{
|
||||
// 执行插入操作
|
||||
$result = db::name('vs_room_bar_pit_gift')->insert([
|
||||
'room_id' => $room_id,
|
||||
'user_id' => $user_id,
|
||||
'gift_id' => $gift_id,
|
||||
'end_time' => $end_time,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
}
|
||||
if(!$result){
|
||||
return ['code' => 0, 'msg' => '失败', 'data' => null];
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
}
|
||||
|
||||
|
||||
|
||||
//约Ta礼物详情
|
||||
public function get_gift_info_ta($room_id,$to_user_id,$user_id){
|
||||
$return_data = [];
|
||||
$pit_gift = db::name('vs_room_bar_pit_gift')->where(['room_id' => $room_id,'user_id' => $to_user_id, 'delete_time' => 0])->find();
|
||||
if($pit_gift){
|
||||
$gift = db::name('vs_gift')->where(['gid' => $pit_gift['gift_id'], 'delete_time' => 0])->find();
|
||||
if(empty($gift)){
|
||||
return ['code' => 0, 'msg' => '礼物不存在', 'data' => null];
|
||||
}
|
||||
//当前用户钱包余额(金币)
|
||||
$wallet_coin = db::name('user_wallet_coin')->where(['user_id' => $user_id])->value('coin') ?? 0;
|
||||
$return_data = [
|
||||
'gift_id' => $pit_gift['gift_id'],
|
||||
'gift_name' => $gift['gift_name'],
|
||||
'base_image' => $gift['base_image'],
|
||||
'gift_price' => $gift['gift_price'],
|
||||
'user_wallet_coin' => $wallet_coin,
|
||||
];
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => $return_data];
|
||||
}
|
||||
|
||||
|
||||
|
||||
//撩TA
|
||||
public function liao_ta($room_id,$user_id,$to_user_id){
|
||||
//查询撩TA礼物
|
||||
$liao_ta_gif = $this->get_liao_ta_gift();
|
||||
$liao_ta_gif_id = $liao_ta_gif['gid']??0;
|
||||
//调用送礼接口
|
||||
$re = model("api/SendGift")->send_gift($user_id,$to_user_id,$liao_ta_gif_id,1,1,$room_id);
|
||||
if($re['code'] != 1){
|
||||
return ['code' => 0, 'msg' => $re['msg'], 'data' => null];
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
}
|
||||
|
||||
|
||||
|
||||
//一键全撩
|
||||
public function one_key_liao_ta($room_id,$user_id){
|
||||
//查询撩TA礼物
|
||||
$liao_ta_gif = $this->get_liao_ta_gift();
|
||||
$liao_ta_gif_id = $liao_ta_gif['gid']??0;
|
||||
//查询麦上用户
|
||||
$room_pit_Users = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => ['<',7],'user_id'=>['>',0],'status' => 1])->column('user_id');
|
||||
if(empty($room_pit_Users)){
|
||||
return ['code' => 0, 'msg' => '没有麦上用户', 'data' => null];
|
||||
}
|
||||
$to_user_ids = [];
|
||||
|
||||
foreach ($room_pit_Users as $key => $value) {
|
||||
if($user_id == $value){//自己
|
||||
continue;
|
||||
}
|
||||
//调用送礼接口
|
||||
$to_user_ids[] = $value;
|
||||
}
|
||||
|
||||
$to_user_ids = implode(',',$to_user_ids);
|
||||
$re = model("api/SendGift")->send_gift($user_id,$to_user_ids,$liao_ta_gif_id,1,1,$room_id);
|
||||
if($re['code'] != 1){
|
||||
return ['code' => 0, 'msg' => $re['msg'], 'data' => null];
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
}
|
||||
|
||||
|
||||
//获取撩TA礼物
|
||||
public function get_liao_ta_gift(){
|
||||
$cache_key = 'gift_list_17';
|
||||
//2,缓存获取
|
||||
$gift_data = json_decode(Cache::get($cache_key), true);
|
||||
//获取到就返回
|
||||
if($gift_data){
|
||||
return $gift_data;
|
||||
}
|
||||
//查询撩TA礼物
|
||||
$where = [];
|
||||
$where['type'] = 6;
|
||||
$where['label'] = 17;
|
||||
$where['is_show'] = 1;
|
||||
$where['is_can_buy'] = 1;
|
||||
$where['delete_time'] = 0;
|
||||
$gift_data = db::name('vs_gift')->where($where)->order('gid desc')->find();
|
||||
//设置缓存
|
||||
Cache::set($cache_key, json_encode($gift_data), 3600*24);
|
||||
return $gift_data;
|
||||
}
|
||||
|
||||
|
||||
//约TA
|
||||
public function meeting_ta($user_id,$room_id,$meet_user_id,$gift_id){
|
||||
//走送礼流程
|
||||
$res = model("api/SendGift")->send_gift($user_id,$meet_user_id,$gift_id,1,1,$room_id);
|
||||
if($res['code'] != 1){
|
||||
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
|
||||
}
|
||||
|
||||
//预测版块 上线前注释掉 ======👇======
|
||||
//获取 房间ID
|
||||
// $room_last_id = db::name('vs_room')->order('id desc')->value('id');
|
||||
// if($room_last_id >= 19998){
|
||||
// return ['code' => 0, 'msg' =>'房间已满,暂时不能创建房间,请联系运营或管理', 'data' => null];
|
||||
// }
|
||||
//预测版块 上线前注释掉======👆======
|
||||
|
||||
|
||||
//创建私密房间 并告知前端拉谁进入
|
||||
$room_ids = model('api/Room')->user_create_room($user_id,'酒吧私密房',get_system_config_value('web_site').'/data/avatar/head_pic.png','酒吧房产生的一次性房间',11);
|
||||
if($room_ids['code'] != 1){
|
||||
return ['code' => 0, 'msg' => $room_ids['msg'], 'data' => null];
|
||||
}else{
|
||||
//记录小房间
|
||||
$datda = [
|
||||
'room_id' => $room_ids['data'],
|
||||
'p_room_id' => $room_id,
|
||||
'user_id' => $user_id,
|
||||
'meet_user_id' => $meet_user_id,
|
||||
'end_time' => time() + get_system_config_value('bar_room_timea') * 60,
|
||||
'createtime' => time(),
|
||||
'status' => 1 //1-正常,2-结束
|
||||
];
|
||||
db::name('vs_room_bar_movie')->insert($datda);
|
||||
|
||||
$text['text'] = '约TA并创建房间';
|
||||
$text['room_id'] = $room_ids['data'];//前端用来让用户跳转的房间id
|
||||
$text['user_id'] = $user_id;
|
||||
$text['meet_user_id'] = $meet_user_id;
|
||||
model('api/Chat')->sendMsg(1201,$room_id,$text);
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
}
|
||||
|
||||
|
||||
|
||||
//小黑屋列表
|
||||
public function black_room_list($room_id){
|
||||
$list = db::name('vs_room_bar_movie')->where(['p_room_id' => $room_id,'status' => 1,'end_time' => ['>',time()]])->select();
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => $list];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -75,29 +75,30 @@ class BlindBoxTurntableGift extends Model
|
||||
*/
|
||||
public function gift_send($send_id){
|
||||
try{
|
||||
$blind_box_turntable = db('vs_blind_box_turntable_log')->where(['id'=>$send_id,'is_sued'=>0])->find();
|
||||
$blind_box_turntable = Db::name('vs_blind_box_turntable_log')->where(['id'=>$send_id,'is_sued'=>0])->find();
|
||||
if(!$blind_box_turntable){
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
}
|
||||
if(in_array($blind_box_turntable['gift_bag_id'],[11,12])){
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
}
|
||||
$room_id = $blind_box_turntable['room_id'];
|
||||
$blind_box_turntable_log = db('vs_blind_box_turntable_results_log')->where(['tid'=>$send_id])->select();
|
||||
$blind_box_turntable_log = Db::name('vs_blind_box_turntable_results_log')->where(['tid'=>$send_id])->select();
|
||||
if(!$blind_box_turntable_log){
|
||||
return ['code' => 0, 'msg' => '数据不存在','data' => null];
|
||||
}
|
||||
$room_name = Db::name('vs_room')->where(['id' => $room_id, 'apply_status' => 2])->value('room_name');
|
||||
$FromUserInfo = Db::name('user')->where(['id'=>$blind_box_turntable['user_id']])->find();
|
||||
$FromUserInfo['user_id'] = $FromUserInfo['id'];
|
||||
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($blind_box_turntable['user_id']);//财富图标
|
||||
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($blind_box_turntable['user_id']);//魅力图标
|
||||
$FromUserInfo['chat_bubble'] = model('Decorate')->user_decorate_detail($blind_box_turntable['user_id'],9);//聊天气泡
|
||||
$user_nickname = $FromUserInfo['nickname'];
|
||||
$textMessage = $user_nickname;
|
||||
$text_message = [];
|
||||
$userGiftMap = [];
|
||||
$ToUserInfo = [];
|
||||
foreach ($blind_box_turntable_log as $key => $value) {
|
||||
$ToUserInfo = Db::name('user')->where(['id' => $value['gift_user_id']])->field('id as user_id,nickname,avatar,sex')->find();
|
||||
$draw_gift = Db::name('vs_gift')->where(['gid'=>$value['gift_id']])->find();
|
||||
$textMessage = $textMessage . ' 送给 ' . $ToUserInfo['nickname']. ' 盲盒转盘礼物 ' . $draw_gift['gift_name'].' x ' .$value['count']."\n";
|
||||
$play_image[] = $draw_gift['play_image'];
|
||||
$gift_names[] = $draw_gift['gift_name'];
|
||||
|
||||
$text_message = $user_nickname . '在' . $room_name . '房间送给了' . $ToUserInfo['nickname'] . $draw_gift['gift_name'] . 'X' . $value['count']."\n";
|
||||
if($draw_gift['is_public_server'] == 1) {
|
||||
$text_list_new[] = [
|
||||
@@ -111,34 +112,80 @@ class BlindBoxTurntableGift extends Model
|
||||
'number' => $value['count'],
|
||||
];
|
||||
}
|
||||
$ToUserInfosList[$value['gift_user_id']] = $ToUserInfo;
|
||||
|
||||
$userId = $value['gift_user_id'];
|
||||
if (!isset($userGiftMap[$userId])) {
|
||||
$userGiftMap[$userId] = [
|
||||
'userInfo' => $ToUserInfo,
|
||||
'gifts' => []
|
||||
];
|
||||
}
|
||||
$userGiftMap[$userId]['gifts'][] = [
|
||||
'gift_id' => $draw_gift['gid'],
|
||||
'gift_name' => $draw_gift['gift_name'],
|
||||
'count' => $value['count'],
|
||||
'play_image' => $draw_gift['play_image'],
|
||||
'base_image' => $draw_gift['base_image']
|
||||
];
|
||||
}
|
||||
|
||||
// 为每个用户单独推送消息
|
||||
foreach($userGiftMap as $userId => $userData) {
|
||||
$userInfo = $userData['userInfo'];
|
||||
$gifts = $userData['gifts'];
|
||||
|
||||
// 构建用户专属文本消息,接收者名字只出现一次
|
||||
$userTextMessage = $user_nickname . ' 送给 ' . $userInfo['nickname'];
|
||||
// 添加该用户收到的所有礼物
|
||||
$giftCount = [];
|
||||
foreach ($gifts as $gift) {
|
||||
$userTextMessage .= ' 盲盒转盘礼物 ' . $gift['gift_name'].' x ' .$gift['count'];
|
||||
// 统计相同礼物的数量
|
||||
$giftCount[] = [
|
||||
'gift_info' => $gift,
|
||||
'count' => $gift['count']
|
||||
];
|
||||
|
||||
}
|
||||
foreach($ToUserInfosList as &$userInfo) {
|
||||
$userInfo['icon'][0] = model('UserData')->user_wealth_icon($userInfo['user_id']);//财富图标
|
||||
$userInfo['icon'][1] = model('UserData')->user_charm_icon($userInfo['user_id']);//魅力图标
|
||||
$userInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $userInfo['user_id'],'room_id' => $room_id])->value('charm');//魅力
|
||||
$ToUserInfos[] = $userInfo;
|
||||
}
|
||||
$text = [
|
||||
|
||||
$userInfo['icon'][0] = model('UserData')->user_wealth_icon($userInfo['user_id']);
|
||||
$userInfo['icon'][1] = model('UserData')->user_charm_icon($userInfo['user_id']);
|
||||
$userInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $userInfo['user_id'],'room_id' => $room_id])->value('charm');
|
||||
|
||||
$userText = [
|
||||
'FromUserInfo' => $FromUserInfo,
|
||||
'ToUserInfos' => $ToUserInfos,
|
||||
'GiftInfo' => [
|
||||
'play_image' => implode(',',$play_image),
|
||||
'gift_name' => implode(',',$gift_names),
|
||||
],
|
||||
'text' => rtrim($textMessage, "\n")
|
||||
'ToUserInfo' => $userInfo,
|
||||
'GiftInfos' => array_values($gifts),
|
||||
'text' => $userTextMessage
|
||||
];
|
||||
//聊天室推送系统消息
|
||||
model('Chat')->sendMsg(1005,$room_id,$text);
|
||||
|
||||
// 聊天室推送系统消息给每个用户
|
||||
model('Chat')->sendMsg(1038,$room_id,$userText);
|
||||
|
||||
foreach ($giftCount as $giftData) {
|
||||
$gift_inf = $giftData['gift_info'];
|
||||
$count = $giftData['count'];
|
||||
|
||||
// 推送礼物特效消息
|
||||
$effectData = [
|
||||
'FromUserInfo' => $FromUserInfo,
|
||||
'ToUserInfo' => $userInfo,
|
||||
'GiftInfo' => $gift_inf,
|
||||
'gift_num' => $count,
|
||||
'text' => null
|
||||
];
|
||||
|
||||
// 聊天室推送礼物特效消息
|
||||
model('Chat')->sendMsg(1005,$room_id,$effectData);
|
||||
}
|
||||
}
|
||||
$roomtype = Db::name('vs_room')->where(['id' => $room_id])->value('type_id');
|
||||
if($roomtype == 6){
|
||||
//推送消息
|
||||
$hot_value = db::name('vs_give_gift')->where('from_id', $room_id)->where('from',6)
|
||||
->sum('total_price');
|
||||
$hot_value = db::name('vs_room')->where('id', $room_id)->value('hot_value');
|
||||
$text1 = [
|
||||
'room_id' => $room_id,
|
||||
'hot_value' => $hot_value * 10,
|
||||
'hot_value' => $hot_value,
|
||||
'text' => '房间心动值变化'
|
||||
];
|
||||
//聊天室推送系统消息
|
||||
@@ -153,7 +200,7 @@ class BlindBoxTurntableGift extends Model
|
||||
db::name('vs_blind_box_turntable_log')->where('id', $send_id)->update(['is_sued' => 1, 'updatetime' => time()]);
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
} catch (\Exception $e) {
|
||||
return ['code' => 0, 'msg' => "网络请求错误,请重试!", 'data' => null];
|
||||
return ['code' => 0, 'msg' => "网络请求错误,请重试!".$e->getMessage(), 'data' => null];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -236,23 +283,26 @@ class BlindBoxTurntableGift extends Model
|
||||
$pan_xlh = db::name('vs_room_pan_xlh')->where(['send_time'=>0,'end_time'=>['>',time()]])->order('id desc')->find();
|
||||
$xlh_periods_num = Cache::get("xlh_periods_num") ?? 0;
|
||||
if(empty($pan_xlh)){
|
||||
if($xlh_periods_num >= $xlh_ext['open_condition']['start_num']){
|
||||
$xlh_periods = Cache::get("this_xlh_periods") ?? 0;
|
||||
$pan_xlh_id = db::name('vs_room_pan_xlh')->insertGetId([
|
||||
'room_id' => $room_id,
|
||||
'gift_id' => $xlh_ext['locking_condition']['locking_gift_id'],
|
||||
'homeowner_gift_id' => $xlh_ext['locking_condition']['give_homeowner_gift_id'],
|
||||
'periods' => $xlh_periods+1,
|
||||
'num' => 0,
|
||||
'end_time' => time() + $xlh_ext['locking_time']['end_time'] * 60,
|
||||
'createtime' => time()
|
||||
]);
|
||||
Cache::set("this_xlh_periods", $xlh_periods+1, 0);//修改巡乐会期数
|
||||
$pan_xlh = db::name('vs_room_pan_xlh')->where(['id'=>$pan_xlh_id])->find();
|
||||
}else{
|
||||
return ['code' => 0, 'msg' => '巡乐会已结束', 'data' => null];
|
||||
}
|
||||
}
|
||||
// if(empty($pan_xlh)){
|
||||
// if($xlh_periods_num >= $xlh_ext['open_condition']['start_num']){
|
||||
// $xlh_periods = Cache::get("this_xlh_periods") ?? 0;
|
||||
// $pan_xlh_id = db::name('vs_room_pan_xlh')->insertGetId([
|
||||
// 'room_id' => $room_id,
|
||||
// 'gift_id' => $xlh_ext['locking_condition']['locking_gift_id'],
|
||||
// 'homeowner_gift_id' => $xlh_ext['locking_condition']['give_homeowner_gift_id'],
|
||||
// 'periods' => $xlh_periods+1,
|
||||
// 'num' => 0,
|
||||
// 'end_time' => time() + $xlh_ext['locking_time']['end_time'] * 60,
|
||||
// 'createtime' => time()
|
||||
// ]);
|
||||
// Cache::set("this_xlh_periods", $xlh_periods+1, 0);//修改巡乐会期数
|
||||
// $pan_xlh = db::name('vs_room_pan_xlh')->where(['id'=>$pan_xlh_id])->find();
|
||||
// }else{
|
||||
// return ['code' => 0, 'msg' => '巡乐会已结束', 'data' => null];
|
||||
// }
|
||||
// }
|
||||
$xlh_user_data= null;
|
||||
$room_user_data = null;
|
||||
if($pan_xlh && $pan_xlh['user_id']){
|
||||
@@ -413,4 +463,30 @@ class BlindBoxTurntableGift extends Model
|
||||
];
|
||||
}
|
||||
|
||||
//盲盒转盘开启状态
|
||||
public function blind_box_status(){
|
||||
$gift_bag_ids = [11,12];
|
||||
$gift_bag = db::name('vs_gift_bag')->where(['id'=>['in',$gift_bag_ids]])->select();
|
||||
foreach ($gift_bag as $bag){
|
||||
if($bag['status'] == 1){
|
||||
$result_data[] = [
|
||||
'gift_bag_id' => $bag['id'],
|
||||
'name' => $bag['name'],
|
||||
'status' => 1,
|
||||
'status_str' => '开启中',
|
||||
'icon' => $bag['icon'],
|
||||
];
|
||||
}else{
|
||||
$result_data[] = [
|
||||
'gift_bag_id' => $bag['id'],
|
||||
'name' => $bag['name'],
|
||||
'status' => 0,
|
||||
'status_str' => '未开启',
|
||||
'icon' => $bag['icon'],
|
||||
];
|
||||
}
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => $result_data];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1944
application/api/model/BlindBoxTurntableGiftDrawWorldNew.php
Normal file
1944
application/api/model/BlindBoxTurntableGiftDrawWorldNew.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -124,6 +124,43 @@ class Chat extends Model
|
||||
//红包领完推送
|
||||
// RedPacketComplete = 1061,
|
||||
|
||||
//点歌房推送信息
|
||||
//当前歌曲发生变化
|
||||
// SongChange = 1070,
|
||||
//下一首歌曲发生变化
|
||||
// SongNextChange = 1071,
|
||||
//歌曲数量发生变化
|
||||
// SongCountChange = 1072,
|
||||
|
||||
//CP房间推送信息
|
||||
// CP进入房间触发特效
|
||||
// CPRoomEffect = 1080,
|
||||
|
||||
//签约房推送信息
|
||||
//开始签约
|
||||
// SignRoomStart = 1090,
|
||||
//签约房签约出价最高用户
|
||||
// SignRoomSignUser = 1091,
|
||||
//签约房间结束
|
||||
// SignRoomEnd = 1092,
|
||||
//签约延时
|
||||
// SignRoomDelay = 1093,
|
||||
//签约房 邀请用户上签约麦位
|
||||
// SignRoomInviteUser = 1094,
|
||||
|
||||
//爆币房推送信息
|
||||
// BlindCoinRoom = 1100,
|
||||
|
||||
//酒吧房撩TA推送
|
||||
// BarRoomLiaoTa = 1200,
|
||||
//酒吧房开私密房
|
||||
// BarRoomOpenPrivateRoom = 1201,
|
||||
//酒吧房抱麦
|
||||
// BarRoomUpSeat = 1202,
|
||||
//酒吧房上麦后设置自定义礼物设置
|
||||
// BarRoomSetCustomGift = 1203,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -85,8 +85,9 @@ class DailyTasks extends Model
|
||||
$reslut['tasks']['daily_tasks'] = [];//每日任务1
|
||||
$reslut['tasks']['daily_tasks_special'] = [];//每日特殊任务2
|
||||
$reslut['tasks']['usual_tasks'] = [];//平台常规任务3
|
||||
$reslut['tasks']['teacher_tasks'] = [];//师徒任务4
|
||||
$data = db::name('vs_daily_tasks')
|
||||
->field('task_id,icon,task_name,gold_reward,target_quantity,task_type')
|
||||
->field('task_id,icon,task_name,gold_reward,target_quantity,task_type,reward_type')
|
||||
->where('delete_time',0)
|
||||
->where('is_active',1)
|
||||
->order('sort asc')->select();
|
||||
@@ -99,10 +100,26 @@ class DailyTasks extends Model
|
||||
->where('task_id',$v['task_id'])
|
||||
->whereTime('createtime', 'today')
|
||||
->find();
|
||||
}elseif($v['task_id'] == 17){
|
||||
//师徒任务
|
||||
//师傅签约返还
|
||||
$user_sign_task = Db::name('vs_user_sign_task')->where(['user_id'=>$user_id,'day'=>date('Y-m-d')])->find();
|
||||
if(empty($user_sign_task)){
|
||||
continue;
|
||||
}
|
||||
$v['gold_reward'] = $user_sign_task['value'];
|
||||
}else{
|
||||
$user_daily_tasks = Db::name('vs_user_daily_tasks')->where('user_id',$user_id)->where('task_id',$v['task_id'])->find();
|
||||
}
|
||||
$progress = isset($user_daily_tasks['current_progress']) ? $user_daily_tasks['current_progress'] : 0;
|
||||
if($v['task_id'] == 17){
|
||||
if($user_sign_task['status']==1){
|
||||
$progress = $user_sign_task['times'] ?? 0;
|
||||
}else{
|
||||
$progress = $user_sign_task['times']-1 ?? 0;
|
||||
}
|
||||
|
||||
}
|
||||
$quantity_str = "";
|
||||
if($v['target_quantity']!=1){
|
||||
$quantity_str= "({$progress}/{$v['target_quantity']})";
|
||||
@@ -129,6 +146,15 @@ class DailyTasks extends Model
|
||||
$v['task_type_str'] = "去签到";
|
||||
}
|
||||
}
|
||||
if($v['task_id'] == 17){
|
||||
if($user_sign_task['status'] == 0){
|
||||
$v['task_status'] = 2;
|
||||
$v['task_type_str'] = "领取钻石";
|
||||
}else{
|
||||
$v['task_status'] = 3;
|
||||
$v['task_type_str'] = "已领取";
|
||||
}
|
||||
}
|
||||
$v['from_id'] = 0;
|
||||
$v['is_time'] = 0;
|
||||
if(in_array($v['task_id'],[8,9])){
|
||||
@@ -152,15 +178,18 @@ class DailyTasks extends Model
|
||||
$reslut['tasks']['daily_tasks'][] = $v;
|
||||
}elseif ($v['task_type']==2) {
|
||||
$reslut['tasks']['daily_tasks_special'][] = $v;
|
||||
}else{
|
||||
}elseif ($v['task_type']==3) {
|
||||
$reslut['tasks']['usual_tasks'][] = $v;
|
||||
}elseif ($v['task_type']==4) {
|
||||
$reslut['tasks']['teacher_tasks'][] = $v;
|
||||
}
|
||||
|
||||
}
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $reslut];
|
||||
}
|
||||
//完成每日任务
|
||||
public function tasks_complete($user_id,$task_id){
|
||||
//废弃
|
||||
return ['code' => 1, 'msg' => '操作成功','data' => ['is_completed'=>0]];
|
||||
//查询任务
|
||||
$task_info = Db::name('vs_daily_tasks')->where('task_id',$task_id)->where('delete_time',0)->where('is_active',1)->find();
|
||||
if(empty($task_info)){
|
||||
@@ -220,16 +249,27 @@ class DailyTasks extends Model
|
||||
|
||||
//领取每日任务金币奖励
|
||||
public function daily_tasks_receive($user_id,$task_id){
|
||||
//废弃
|
||||
return ['code' => 1, 'msg' => "领取成功", 'data' => null];
|
||||
//查询是否实名认证
|
||||
$is_real = model('UserData')->real_name_info($user_id);
|
||||
if($is_real['code']==0){
|
||||
return ['code' => 0, 'msg' => '请先实名认证','data' => null];
|
||||
}else{
|
||||
if($is_real['data']['is_real'] !=1){
|
||||
return ['code' => 0, 'msg' => '请先实名认证','data' => null];
|
||||
}
|
||||
}
|
||||
$task_info = Db::name('vs_daily_tasks')->where('task_id',$task_id)->find();
|
||||
if (!$task_info) {
|
||||
return ['code' => 0, 'msg' => '任务不存在','data' => null];
|
||||
}
|
||||
if($task_id!=17){
|
||||
if($task_info['task_type']==3){
|
||||
$user_daily_tasks = Db::name('vs_user_daily_tasks')->where('user_id',$user_id)->where('task_id',$task_id)->find();
|
||||
}else{
|
||||
$user_daily_tasks = Db::name('vs_user_daily_tasks')->where('user_id',$user_id)->where('task_id',$task_id)->whereTime('createtime', 'today')->find();
|
||||
}
|
||||
|
||||
if (!$user_daily_tasks) {
|
||||
return ['code' => 0, 'msg' => '请完成该任务','data' => null];
|
||||
}
|
||||
@@ -239,8 +279,38 @@ class DailyTasks extends Model
|
||||
if ($user_daily_tasks['is_claimed'] == 1) {
|
||||
return ['code' => 0, 'msg' => '您已领取该奖励','data' => null];
|
||||
}
|
||||
}else{
|
||||
//师徒任务
|
||||
//师傅签约返还
|
||||
$user_sign_task = Db::name('vs_user_sign_task')->where(['user_id'=>$user_id,'day'=>date('Y-m-d')])->find();
|
||||
if (!$user_sign_task) {
|
||||
return ['code' => 0, 'msg' => '任务不存在或已结束','data' => null];
|
||||
}
|
||||
if($user_sign_task['status']==1){
|
||||
return ['code' => 0, 'msg' => '您已领取该奖励','data' => null];
|
||||
}
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
if($task_id==17){
|
||||
//师徒任务
|
||||
$reslut = Db::name('vs_user_sign_task')->where('id',$user_sign_task['id'])->update([
|
||||
'status' => 1
|
||||
]);
|
||||
if ($reslut) {
|
||||
//操作用户钻石
|
||||
if ($reslut) {
|
||||
$res = model('common/UserWallet')->change_user_money($user_id, $user_sign_task['value'], model('common/UserWallet')::MONEYTYPEARNINGS, model('common/UserWallet')::SIGN_MASTER_DAILY_RETURN,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::SIGN_MASTER_DAILY_RETURN)." 第".$user_sign_task['times']."天");
|
||||
if ($res['code'] != 1) {
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
|
||||
}
|
||||
} else {
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$reslut = Db::name('vs_user_daily_tasks')->where('id',$user_daily_tasks['id'])->update([
|
||||
'is_claimed' => 1,
|
||||
'updatetime' => time(),
|
||||
@@ -250,12 +320,13 @@ class DailyTasks extends Model
|
||||
$res = model('common/UserWallet')->change_user_money($user_id, $user_daily_tasks['gold_reward'], model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::DAILY_TASKS_REWARD,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::DAILY_TASKS_REWARD)."( ".$task_info['task_name'].")");
|
||||
if ($res['code'] != 1) {
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => $reslut['msg'], 'data' => null];
|
||||
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
|
||||
}
|
||||
} else {
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
// 提交事务
|
||||
Db::commit();
|
||||
return ['code' => 1, 'msg' => "领取成功", 'data' => null];
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use think\Cache;
|
||||
use think\Model;
|
||||
use think\Db;
|
||||
use think\Session;
|
||||
@@ -16,8 +18,8 @@ class Decorate extends Model
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 定义字段类型 1头像框 2坐骑 3麦圈 6个人靓号 7房间靓号 8公会靓号
|
||||
public $TypeArray = [1=>'头像框',2=>'坐骑',3=>'麦圈',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号'];
|
||||
protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送',8=>'新人充值好礼'];
|
||||
public $TypeArray = [1=>'头像框',12=>'降身卡',2=>'坐骑',9=>'聊天气泡',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号',3=>'麦圈',10=>'CP特效',11=>'CP装扮'];
|
||||
protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送',8=>'新人充值好礼',9=>'爵位购买赠送',10=>'任务奖励',11=>"每日签到"];
|
||||
public function __construct($data = [])
|
||||
{
|
||||
parent::__construct($data);
|
||||
@@ -27,6 +29,7 @@ class Decorate extends Model
|
||||
//获取装扮类型
|
||||
public function get_type_list($have_hot = 0)
|
||||
{
|
||||
$no_show_ids = [7,8,3,10,11];
|
||||
$label = $this->TypeArray;
|
||||
if ($have_hot) {
|
||||
$label = [100 => '热门'] + array_filter($this->TypeArray, fn($key) => $key != 100, ARRAY_FILTER_USE_KEY);
|
||||
@@ -34,6 +37,9 @@ class Decorate extends Model
|
||||
$data = [];
|
||||
$i = 0;
|
||||
foreach ($label as $k => $v) {
|
||||
if (in_array($k, $no_show_ids)) {
|
||||
continue;
|
||||
}
|
||||
$data[$i]['id'] = $k;
|
||||
$data[$i]['name'] = $v;
|
||||
++$i;
|
||||
@@ -71,11 +77,33 @@ class Decorate extends Model
|
||||
'a.type' => $type,
|
||||
];
|
||||
}
|
||||
$list = DB::name($this->table)->alias('a')->join('fa_vs_decorate_price b', 'a.did = b.did')->field('a.did,a.title,a.type,a.base_image,a.play_image,min(b.price) as price,special_num')->where($map)->group('b.did')->order('price asc')->select();
|
||||
if($type == 12){
|
||||
$map = [
|
||||
'type' => 12,
|
||||
'delete_time' => 0,
|
||||
'show_status' => 1,
|
||||
'is_buy' => 1
|
||||
];
|
||||
$list = DB::name($this->table)->where($map)->field('did,title,type,base_image,play_image,price')
|
||||
->order('price asc')
|
||||
->select();
|
||||
}else{
|
||||
$list = DB::name($this->table)
|
||||
->alias('a')->join('fa_vs_decorate_price b', 'a.did = b.did')
|
||||
->field('a.did,a.title,a.type,a.base_image,a.play_image,min(b.price) as price,special_num,b.original_price,b.discount')->where($map)->group('b.did')->order('price asc')->select();
|
||||
}
|
||||
foreach ($list as $k => &$v) {
|
||||
$v['base_image'] = localpath_to_netpath($v['base_image']);
|
||||
$v['play_image'] = localpath_to_netpath($v['play_image']);
|
||||
$v['price'] = (int)$v['price'];
|
||||
if(isset($v['discount'])){
|
||||
if($v['discount']<=0 || $v['discount']>=10){
|
||||
$v['discount'] = 0;
|
||||
$v['discount_str'] = "无折扣";
|
||||
}else{
|
||||
$v['discount_str'] = $v['discount']."折";
|
||||
}
|
||||
}
|
||||
}
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $list];
|
||||
}
|
||||
@@ -86,6 +114,11 @@ class Decorate extends Model
|
||||
if (!$decorate) {
|
||||
return ['code' => 0, 'msg' => '参数错误'];
|
||||
}
|
||||
if($decorate['type'] == 12){
|
||||
$result['title'] = $decorate['title'];
|
||||
$result['price'] = (int)$decorate['price'];
|
||||
$result['base_image'] = localpath_to_netpath($decorate['base_image']);
|
||||
}else{
|
||||
$decorate_price = DB::name('vs_decorate_price')->where(['did' => $did, 'is_delete' => 1])->order('day asc')->select();
|
||||
if (!$decorate_price) {
|
||||
return ['code' => 0, 'msg' => '参数错误'];
|
||||
@@ -93,6 +126,7 @@ class Decorate extends Model
|
||||
$result['title'] = $decorate['title'];
|
||||
foreach ($decorate_price as $k => $v) {
|
||||
$result['price_list'][$k]['price'] = (int)$v['price'];
|
||||
$result['price_list'][$k]['original_price'] = $v['original_price'];
|
||||
$result['price_list'][$k]['discount'] = $v['discount'];
|
||||
$result['price_list'][$k]['day'] = $v['day'];
|
||||
//月
|
||||
@@ -100,6 +134,7 @@ class Decorate extends Model
|
||||
//有效期至
|
||||
$result['price_list'][$k]['end_time'] = date('Y-m-d',strtotime("+".$v['day']." day"));
|
||||
}
|
||||
}
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $result];
|
||||
}
|
||||
|
||||
@@ -113,7 +148,12 @@ class Decorate extends Model
|
||||
* @param $log_remark 日志备注
|
||||
*
|
||||
*/
|
||||
public function pay_decorate($uid, $did, $day,$from_type=1,$give_uid=0,$log_remark=""){
|
||||
public function pay_decorate($uid, $did, $day=0,$from_type=1,$give_uid=0,$log_remark="",$num=1){
|
||||
if(empty($day) && $from_type == 12){
|
||||
$day = 0;
|
||||
}else{
|
||||
$day = db::name('vs_decorate_price')->where(['did'=>$did])->order('day asc')->value('day');
|
||||
}
|
||||
if(empty($log_remark)){
|
||||
$log_remark = $this->FromType[$from_type];
|
||||
}
|
||||
@@ -131,6 +171,7 @@ class Decorate extends Model
|
||||
if(!$decorate_info){
|
||||
return ['code' => 0, 'msg' => '该装扮不存在'.$did, 'data' => null];
|
||||
}
|
||||
if($decorate_info['type'] != 12){
|
||||
//该天数是否存在
|
||||
$map = [];
|
||||
$map = [
|
||||
@@ -151,6 +192,12 @@ class Decorate extends Model
|
||||
if($decorate_info['type'] == 8 && $decorate_info['is_user_buy'] == 1){
|
||||
return ['code' => 0, 'msg' => '该公会靓号已被购买', 'data' => null];
|
||||
}
|
||||
}else{
|
||||
$decorate_price_info = [
|
||||
'price' => $decorate_info['price'] * $num,
|
||||
'day' => 0
|
||||
];
|
||||
}
|
||||
$start_time = $now_time = time();
|
||||
Db::startTrans();
|
||||
try {
|
||||
@@ -193,21 +240,30 @@ class Decorate extends Model
|
||||
if($decorate_price_info['day'] == 0){//如果礼物购买配置的天数为0,则永久有效
|
||||
$data['is_using'] = 1;
|
||||
$data['end_time'] = 0;
|
||||
$data['is_perpetual'] = 1;
|
||||
}else{
|
||||
$change_time = $day * 24 * 3600;
|
||||
$data['is_using'] = 2;
|
||||
$data['end_time'] = $now_time + $change_time;
|
||||
}
|
||||
$data['createtime'] = $now_time;
|
||||
$data['special_num'] = $decorate_info['special_num'];
|
||||
$data['special_num'] = $decorate_info['special_num'] ?? '';
|
||||
$data['num'] = 1;
|
||||
$result = db::name('vs_user_decorate')->insert($data);
|
||||
}else{
|
||||
if($decorate_info['type'] == 12){
|
||||
$result = db::name('vs_user_decorate')->where('udid', $user_decorate_data['udid'])->update([
|
||||
'is_using' => 2,
|
||||
'num' => $user_decorate_data['num'] + $num,
|
||||
'end_time' => 0
|
||||
]);
|
||||
}else{
|
||||
if($decorate_price_info['day'] > 0){//是不是永久礼物
|
||||
if($decorate_price_info['price']<=0 && $user_decorate_data['end_time'] > $now_time + $change_time){
|
||||
return ['code' => 0, 'msg' => '您已购买过此装扮,请勿重复购买', 'data' => null];
|
||||
}
|
||||
if($user_decorate_data['end_time'] < $now_time){
|
||||
$user_decorate_data['end_time'] = 0;
|
||||
$user_decorate_data['end_time'] = time();
|
||||
}
|
||||
$change_time = $day * 24 * 3600;
|
||||
$update['is_using'] = 2;
|
||||
@@ -216,6 +272,7 @@ class Decorate extends Model
|
||||
$start_time = $update['end_time'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$result){
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
|
||||
@@ -252,13 +309,22 @@ class Decorate extends Model
|
||||
}catch (\Exception $e) {
|
||||
// 回滚事务
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => "请重试", 'data' => null];
|
||||
return ['code' => 0, 'msg' => "请重试".$e->getMessage(), 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
//用户装扮列表
|
||||
public function user_decorate($uid, $type,$page=1, $limit=10){
|
||||
|
||||
if($type == 12){
|
||||
$reslut = db::name('vs_user_decorate')
|
||||
->alias('ud')->join('vs_decorate d', 'ud.did = d.did')
|
||||
->field('ud.udid,ud.user_id,ud.is_using,ud.end_time,ud.is_perpetual,ud.special_num,d.title,d.base_image,d.play_image,d.type,ud.num,d.ext_value')
|
||||
->where('ud.user_id', $uid)
|
||||
->where('ud.type', $type)
|
||||
->where(['ud.num'=>[">",0]])
|
||||
->page($page, $limit)
|
||||
->select();
|
||||
}else{
|
||||
$reslut = db::name('vs_user_decorate')
|
||||
->alias('ud')->join('vs_decorate d', 'ud.did = d.did')
|
||||
->field('ud.udid,ud.user_id,ud.is_using,ud.end_time,ud.is_perpetual,ud.special_num,d.title,d.base_image,d.play_image,d.type')
|
||||
@@ -275,7 +341,7 @@ class Decorate extends Model
|
||||
//剩余天数 取整
|
||||
$v['remaining_day'] = $v['is_perpetual']==1 ? '永久' :$remaining_day;
|
||||
$v['end_time'] = date('Y-m-d H:i:s', $v['end_time']);
|
||||
|
||||
}
|
||||
}
|
||||
return ['code' => 1, 'msg' => "获取成功", 'data' => $reslut];
|
||||
}
|
||||
@@ -292,10 +358,15 @@ class Decorate extends Model
|
||||
if (empty($info)) {
|
||||
return ['code' => 0, 'msg' => '装扮不存在', 'data' => null];
|
||||
}
|
||||
if($info['type'] == 12){
|
||||
if ($info['num']-1 < 0) {
|
||||
return ['code' => 0, 'msg' => '无可用装扮', 'data' => null];
|
||||
}
|
||||
}else{
|
||||
if ($info['end_time'] < time()) {
|
||||
return ['code' => 0, 'msg' => '装扮已过期', 'data' => null];
|
||||
}
|
||||
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
//清理该类型装扮使用状态
|
||||
@@ -320,6 +391,9 @@ class Decorate extends Model
|
||||
$data = [];
|
||||
$data['is_using'] = 1;
|
||||
$data['updatetime'] = time();
|
||||
if($info['type'] == 12){
|
||||
$data['num'] = $info['num'] - 1;
|
||||
}
|
||||
$reslut = Db::name('vs_user_decorate')->where($map)->update($data);
|
||||
if (!$reslut) {
|
||||
Db::rollback();
|
||||
@@ -327,6 +401,32 @@ class Decorate extends Model
|
||||
}
|
||||
// 提交事务
|
||||
Db::commit();
|
||||
if($info['type'] == 12){
|
||||
//使用降身卡,降低用户身价
|
||||
$reduce_ratio = db::name('vs_decorate')->where(['did' => $info['did']])->value('ext_value') ?? 0;
|
||||
$market_value = db::name('user')->where(['id' => $uid])->value('market_value');
|
||||
if($reduce_ratio){
|
||||
$reduce_market_value = $market_value * ($reduce_ratio / 100);
|
||||
}else{
|
||||
$reduce_market_value = 0;
|
||||
}
|
||||
if($reduce_market_value > 0){
|
||||
$up_market_value = $market_value - $reduce_market_value;
|
||||
if($up_market_value < 1){
|
||||
$up_market_value = 1;
|
||||
}
|
||||
db::name('user')->where(['id' => $uid])->update(['market_value' => $up_market_value]);
|
||||
//记录一条日志
|
||||
db::name('vs_user_market_value_log')->insert([
|
||||
'user_id' => $uid,
|
||||
'before' => $market_value,
|
||||
'change_value'=> $reduce_market_value,
|
||||
'afterwards'=> $up_market_value,
|
||||
'type' => 2,
|
||||
'createtime'=> time()
|
||||
]);
|
||||
}
|
||||
}else{
|
||||
//推送信息去所在房间
|
||||
//查询当前所在房间
|
||||
$room_id = db::name('vs_room_visitor')->where(['user_id' => $uid])->order('id' , 'desc')->value('room_id');
|
||||
@@ -336,11 +436,16 @@ class Decorate extends Model
|
||||
$text['jia_jia'] = model('Decorate')->user_decorate_detail($uid,2);
|
||||
$text['FromUserInfo'] = db::name('user')->where('id',$uid)->field('id as user_id,nickname,avatar,sex')->find();
|
||||
$text['FromUserInfo']['dress'] = model('Decorate')->user_decorate_detail($uid,1);
|
||||
$text['FromUserInfo']['mic_dress'] = model('Decorate')->user_decorate_detail($uid,4);
|
||||
$text['FromUserInfo']['mic_cycle'] = model('Decorate')->user_decorate_detail($uid,3);
|
||||
$text['FromUserInfo']['chat_dress'] = model('Decorate')->user_decorate_detail($uid,5);
|
||||
$text['text'] = '用户 ' . $text['FromUserInfo']['nickname'] .' 修改了信息';
|
||||
model('Chat')->sendMsg(1035,$room_id,$text,$uid);
|
||||
}
|
||||
}
|
||||
//更新装备缓存
|
||||
$cache_key = 'user_base_info_'.$uid;
|
||||
Cache::rm($cache_key);
|
||||
|
||||
return ['code' => 1, 'msg' => "设置成功", 'data' => null];
|
||||
} catch (\Exception $e) {
|
||||
// 回滚事务
|
||||
@@ -363,7 +468,9 @@ class Decorate extends Model
|
||||
if (!$reslut) {
|
||||
return ['code' => 0, 'msg' => "取消装扮失败", 'data' => null];
|
||||
}
|
||||
|
||||
//更新装备缓存
|
||||
$cache_key = 'user_base_info_'.$uid;
|
||||
Cache::rm($cache_key);
|
||||
return ['code' => 1, 'msg' => "取消成功", 'data' => null];
|
||||
}
|
||||
|
||||
@@ -375,48 +482,67 @@ class Decorate extends Model
|
||||
public function user_decorate_detail($id, $type){
|
||||
//根据$type 组装查询条件
|
||||
$reslut = "";
|
||||
$map = [
|
||||
'type' => $type,
|
||||
'is_using' => 1
|
||||
];
|
||||
if($type == 7){//7房间靓号 8工会靓号
|
||||
$room = db::name('vs_room')->where('id', $id)->field('user_id,room_number')->find();
|
||||
if(empty($room)){
|
||||
return $reslut;
|
||||
}
|
||||
$map = [
|
||||
'user_id' => $room['user_id']??0,
|
||||
'type' => $type,
|
||||
'is_using' => 1
|
||||
];
|
||||
$reslut = db::name('vs_user_decorate')->where($map)->where('end_time',['>=',time()],'or')->value('special_num') ?? $room['room_number'];
|
||||
$map['user_id'] = $room['user_id'];
|
||||
$user_decorate = db::name('vs_user_decorate')->where($map)->order('createtime', 'desc')->find();
|
||||
if(empty($user_decorate)){
|
||||
return $room['room_number'];
|
||||
}
|
||||
if($user_decorate['is_perpetual']==2 && $user_decorate['end_time'] < time()){
|
||||
return $room['room_number'];
|
||||
}
|
||||
$reslut = $user_decorate['special_num'] ?? $room['room_number'];
|
||||
}elseif($type == 8){
|
||||
$guild = db::name('vs_guild')->where('id', $id)->field('user_id,guild_special_id')->find();
|
||||
$map = [
|
||||
'user_id' => $guild['user_id']??0,
|
||||
'type' => $type,
|
||||
'is_using' => 1
|
||||
];
|
||||
$reslut = db::name('vs_user_decorate')->where($map)->where('end_time',['>=',time()],'or')->value('special_num') ?? $guild['guild_special_id'];
|
||||
if(empty($guild)){
|
||||
return $reslut;
|
||||
}
|
||||
$map['user_id'] = $guild['user_id'];
|
||||
$user_decorate = db::name('vs_user_decorate')->where($map)->order('createtime', 'desc')->find();
|
||||
if(empty($user_decorate)){
|
||||
return $guild['guild_special_id'];
|
||||
}
|
||||
if($user_decorate['is_perpetual']==2 && $user_decorate['end_time'] < time()){
|
||||
return $guild['guild_special_id'];
|
||||
}
|
||||
$reslut = $user_decorate['special_num'] ?? $guild['guild_special_id'];
|
||||
}elseif($type == 6){
|
||||
$map = [
|
||||
'user_id' => $id??0,
|
||||
'type' => $type,
|
||||
'is_using' => 1
|
||||
];
|
||||
$user_code = db::name('user')->where('id', $id)->value('user_code');
|
||||
$reslut = db::name('vs_user_decorate')->where($map)->where('end_time',['>=',time()],'or')->value('special_num') ?? $user_code;
|
||||
if(empty($user_code)){
|
||||
return $reslut;
|
||||
}
|
||||
$map['user_id'] = $id;
|
||||
$user_decorate = db::name('vs_user_decorate')->where($map)->order('createtime', 'desc')->find();
|
||||
if(empty($user_decorate)){
|
||||
return $user_code;
|
||||
}
|
||||
if($user_decorate['is_perpetual']==2 && $user_decorate['end_time'] < time()){
|
||||
return $user_code;
|
||||
}
|
||||
$reslut = $user_decorate['special_num'] ?? $user_code;
|
||||
}else{
|
||||
$map = [
|
||||
'user_id' => $id??0,
|
||||
'type' => $type,
|
||||
'is_using' => 1
|
||||
];
|
||||
$did = db::name('vs_user_decorate')->where($map)->where('end_time',['>=',time()],'or')->value('did');
|
||||
if(empty($did)){
|
||||
$reslut = '';//返回数据
|
||||
$map['user_id'] = $id;
|
||||
$user_decorate = db::name('vs_user_decorate')->where($map)->order('createtime', 'desc')->find();
|
||||
if(empty($user_decorate)){
|
||||
return $reslut;
|
||||
}
|
||||
if($user_decorate['is_perpetual']==2 && $user_decorate['end_time'] < time()){
|
||||
return $reslut;
|
||||
}
|
||||
if(in_array($type, [9,12])){
|
||||
$reslut = db::name('vs_decorate')->where('did', $user_decorate['did'])->value('base_image');
|
||||
}else{
|
||||
$reslut = db::name('vs_decorate')->where('did', $did)->value('play_image');
|
||||
$reslut = db::name('vs_decorate')->where('did', $user_decorate['did'])->value('play_image');
|
||||
}
|
||||
}
|
||||
return $reslut;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
179
application/api/model/Family.php
Normal file
179
application/api/model/Family.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
use think\Model;
|
||||
|
||||
class Family extends Model
|
||||
{
|
||||
/*
|
||||
* 创建家族
|
||||
* @param $name string 家族名称
|
||||
* @param $user_id int 用户id
|
||||
*/
|
||||
public function createFamily($user_id)
|
||||
{
|
||||
$name = db::name('user')->where('id', $user_id)->value('nickname').'的家族';
|
||||
$data = [
|
||||
'name' => $name,
|
||||
'user_id' => $user_id,
|
||||
'type' => 1,
|
||||
'createtime' => time(),
|
||||
];
|
||||
//开启事务
|
||||
db::startTrans();
|
||||
$id = db::name('vs_family')->insertGetId($data);
|
||||
if (!$id) {
|
||||
db::rollback();
|
||||
return ['code' => 0, 'msg' => '创建失败', 'data' => null];
|
||||
}
|
||||
$reslut = model('api/Tencent')->create_group($user_id,'f'.$id,"Public","",$name);
|
||||
if ($reslut['code'] == 0) {
|
||||
db::rollback();
|
||||
return ['code' => 0, 'msg' => '创建失败,请稍后再试!', 'data' => null];
|
||||
}
|
||||
//发送系统消息
|
||||
model('api/Tencent')->send_group_system_notification('f'.$id,"家族创建成功");
|
||||
//查找他是否有签约 用户
|
||||
$sign_user = db::name('vs_user_sign')->where(['parent_user_id' => $user_id, 'end_time' => ['>',time()]])->select();
|
||||
if($sign_user){
|
||||
//拉入群聊
|
||||
foreach ($sign_user as $k => $v){
|
||||
model('api/Tencent')->add_group_member('f'.$id, $v['sign_user_id']);
|
||||
$data[$k] = [
|
||||
'name' => $name,
|
||||
'pid' => $user_id,
|
||||
'user_id' => $v['sign_user_id'],
|
||||
'createtime' => time(),
|
||||
];
|
||||
db::name('vs_family')->insert($data[$k]);
|
||||
}
|
||||
//发送系统消息
|
||||
model('api/Tencent')->send_group_system_notification('f'.$id,"欢迎加入家族");
|
||||
}
|
||||
|
||||
db::commit();
|
||||
return ['code' => 1, 'msg' => '创建成功', 'data' => ['id' => $id]];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 我的家族
|
||||
* @param $user_id int 用户id(创建者id)
|
||||
*/
|
||||
public function myFamily($user_id)
|
||||
{
|
||||
$myFamily['group_owner_info'] = db::name('user')->where('id',$user_id)->field('nickname,avatar')->find();
|
||||
$myFamily['group_owner_info']['dress'] = model('api/Decorate')->user_decorate_detail($user_id,1);
|
||||
$myFamily['group_owner_info']['user_code'] = model('api/Decorate')->user_decorate_detail($user_id,6);
|
||||
$myFamily['group_owner_info']['icon'][0] = model('api/UserData')->user_wealth_icon($user_id);//财富图标
|
||||
$myFamily['group_owner_info']['icon'][1] = model('api/UserData')->user_charm_icon($user_id);//魅力图标
|
||||
//判断是否是歌手 如果是 返回等级图标
|
||||
$isSinger = db::name('vs_singer')->where(['user_id' => $user_id,'status' => 1])->find();
|
||||
if($isSinger){
|
||||
$myFamily['group_owner_info']['icon'][2] = db::name('vs_singer_level')->where(['level' => $isSinger['level'],'deletetime' => 0])
|
||||
->value('image');//等级图标
|
||||
}
|
||||
|
||||
$Nobility = model('api/Nobility')->getUserNobilityInfo($user_id);
|
||||
$myFamily['group_owner_info']['mic_cycle'] = model('api/Decorate')->user_decorate_detail($user_id,3);
|
||||
$myFamily['group_owner_info']['nobility_image'] = $Nobility['play_image'];
|
||||
$myFamily['group_owner_info']['nickname_color'] = $Nobility['nick_name_color'];
|
||||
|
||||
$myFamily['group_members_num'] = db::name('vs_user_sign')->where(['parent_user_id' => $user_id])->count();
|
||||
$myFamily['group_earnings'] = round(db::name('vs_user_sign_earnings')->where('user_id',$user_id)->sum('earnings'),4);
|
||||
|
||||
$myFamilys = db::name('vs_family')->where(['user_id' => $user_id,'type' => 1])->find();
|
||||
|
||||
if($myFamilys){
|
||||
$lists= db::name('vs_family')->alias('a')
|
||||
->join('user b','a.user_id = b.id')
|
||||
->join('vs_user_sign c','a.user_id = c.sign_user_id')
|
||||
->field('b.is_online,b.market_value,b.nickname,b.avatar,b.user_code,c.type,c.end_time,c.sign_user_type,a.user_id,a.createtime')
|
||||
->where(['a.pid' => $myFamilys['user_id'],'a.deletetime' => 0,'a.type' => 0,'c.end_time' => ['>',time()]])
|
||||
->order('c.end_time asc')
|
||||
->select();
|
||||
if($lists){
|
||||
foreach ($lists as $k => $v){
|
||||
$lists[$k]['dress'] = model('api/Decorate')->user_decorate_detail($v['user_id'],1);
|
||||
$lists[$k]['user_code'] = model('api/Decorate')->user_decorate_detail($v['user_id'],6);
|
||||
$lists[$k]['icon'][0] = model('api/UserData')->user_wealth_icon($v['user_id']);//财富图标
|
||||
$lists[$k]['icon'][1] = model('api/UserData')->user_charm_icon($v['user_id']);//魅力图标
|
||||
//判断是否是歌手 如果是 返回等级图标
|
||||
$isSinger = db::name('vs_singer')->where(['user_id' => $v['user_id'],'status' => 1])->find();
|
||||
if($isSinger){
|
||||
$lists[$k]['icon'][2] = db::name('vs_singer_level')->where(['level' => $isSinger['level'],'deletetime' => 0])
|
||||
->value('image');//等级图标
|
||||
}
|
||||
|
||||
$Nobility = model('api/Nobility')->getUserNobilityInfo($v['user_id']);
|
||||
$lists[$k]['mic_cycle'] = model('api/Decorate')->user_decorate_detail($v['user_id'],3);
|
||||
$lists[$k]['nobility_image'] = $Nobility['play_image'];
|
||||
$lists[$k]['nickname_color'] = $Nobility['nick_name_color'];
|
||||
if($v['sign_user_type'] == 0){
|
||||
$lists[$k]['free_renewal'] = max((3 - $v['type']), 0);
|
||||
}else{
|
||||
$lists[$k]['free_renewal'] = 0;
|
||||
}
|
||||
|
||||
// 优化今日收益计算逻辑
|
||||
$todayStart = strtotime(date('Y-m-d'));
|
||||
if($v['createtime'] < $todayStart){
|
||||
$lists[$k]['today_earnings'] = round(db::name('user_earnings_log')
|
||||
->where(['user_id' => $v['user_id'],'change_type' =>11,'createtime' => ['between',[$todayStart,time()]]])
|
||||
->sum('earnings'), 4);//今日收益
|
||||
}else{
|
||||
$lists[$k]['today_earnings'] = round(db::name('user_earnings_log')
|
||||
->where(['user_id' => $v['user_id'],'change_type' =>11,'createtime' => ['between',[$v['createtime'],time()]]])
|
||||
->sum('earnings'), 4);//今日收益
|
||||
}
|
||||
|
||||
// 昨日收益计算逻辑优化
|
||||
$yesterdayStart = strtotime(date('Y-m-d', strtotime('-1 day')));
|
||||
$yesterdayEnd = strtotime(date('Y-m-d'));
|
||||
if($v['createtime'] <= $todayStart) {
|
||||
$lists[$k]['yesterday_earnings'] = round(db::name('user_earnings_log')
|
||||
->where(['user_id' => $v['user_id'], 'change_type' => 11, 'createtime' => ['between', [$yesterdayStart, $yesterdayEnd]]])
|
||||
->sum('earnings'), 4);
|
||||
}else{
|
||||
$lists[$k]['yesterday_earnings'] = 0;
|
||||
}
|
||||
$lists[$k]['is_show_sign'] = $v['end_time'] - time() < 48*3600 ? 1 : 0;
|
||||
$lists[$k]['sign_times'] = get_system_config_value('sign_times');//非首签签约时长
|
||||
$lists[$k]['free_re_sign_day'] = get_system_config_value('free_re_sign_day');//免费续签时间
|
||||
$lists[$k]['sign_user_ratio'] = get_system_config_value('sign_user_ratio');//签约者身价的百分比
|
||||
//end_time 换算为天数,不足1天,按小时显示
|
||||
$remaining_time = $v['end_time'] - time();
|
||||
if ($remaining_time > 0) {
|
||||
$days = ceil($remaining_time / (24 * 3600));
|
||||
if ($days > 0) {
|
||||
$lists[$k]['end_day'] = $days . '天';
|
||||
} else {
|
||||
$hours = ceil($remaining_time / 3600);
|
||||
$lists[$k]['end_day'] = $hours . '小时';
|
||||
}
|
||||
} else {
|
||||
$lists[$k]['end_day'] = '已过期';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$myFamily['group_members_lists'] = $lists ;
|
||||
$myFamily['group_id'] = 'f'.$myFamilys['id'];
|
||||
$myFamily['name'] = $myFamilys['name'];
|
||||
$myFamily['user_id'] = $myFamilys['user_id'];
|
||||
}else{
|
||||
$myFamily['group_id'] = null;
|
||||
$myFamily['group_members_lists'] = null ;
|
||||
$myFamily['name'] = null;
|
||||
$myFamily['user_id'] = null;
|
||||
}
|
||||
|
||||
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => $myFamily];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -113,15 +113,17 @@ class Friend extends Model
|
||||
$return['user2_nickname'] = db::name('user')->where(['id'=>$originalPairs['user2_id']])->value('nickname');
|
||||
$return['heart_value'] = $originalPairs['heart_value'];
|
||||
$return['heart_id'] = $originalPairs['id'];
|
||||
$room_updatatime = db::name('vs_room')->where(['id' => $room_id,'step' => $step])->value('updatetime');
|
||||
if($room_updatatime){ //60秒内没操作 则创建关系无
|
||||
if(time() - $room_updatatime > 60){
|
||||
// $room_updatatime = db::name('vs_room')->where(['id' => $room_id,'step' => $step])->value('updatetime');
|
||||
$room_updatatime = db::name('vs_user_friending')->where(['id' => $id])->value('update_time');
|
||||
if($room_updatatime){ //180秒内没操作 则创建关系无(元旦 泽喜 说的)
|
||||
if(time() - $room_updatatime > 180){
|
||||
$this->createRelation(0,$room_id,$id,$return['user1_id'],$return['user2_id'],0);
|
||||
return ['code' => 1, 'msg' => '操作成功!', 'data' => $return];
|
||||
}
|
||||
}else{
|
||||
// 修改当前交友阶段
|
||||
db::name('vs_room')->where(['id' => $room_id])->update(['step' => $step,'updatetime' => time()]);
|
||||
db::name('vs_user_friending')->where(['id' => $id])->update(['update_time' => time()]);
|
||||
}
|
||||
}else{
|
||||
$step = 1;//结束下一轮
|
||||
@@ -131,7 +133,7 @@ class Friend extends Model
|
||||
$on_pit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => ['<',7],'user_id' => ['<>',0]])->select();
|
||||
if($on_pit){
|
||||
foreach ($on_pit as $pit){
|
||||
model('RoomPit')->DownPit($pit['user_id'], $room_id,$pit['pit_number']);
|
||||
model('api/RoomPit')->DownPit($pit['user_id'], $room_id,$pit['pit_number']);
|
||||
}
|
||||
}
|
||||
$return = null;
|
||||
@@ -139,7 +141,7 @@ class Friend extends Model
|
||||
|
||||
//结束交友游戏
|
||||
if($step == 1){
|
||||
db::name('vs_user_friending')->where(['id' => $id])->update(['status' => 2]);
|
||||
db::name('vs_user_friending')->where(['id' => $id])->update(['status' => 2,'update_time' => time()]);
|
||||
}
|
||||
//推送给前端消息
|
||||
$text['text'] = $step == 1 ? '交友结束' : '牵手良缘';
|
||||
@@ -147,7 +149,7 @@ class Friend extends Model
|
||||
$text['friend_user'] = $return;
|
||||
$text['friend_id'] = $id;
|
||||
model('api/Chat')->sendMsg(1049,$room_id,$text);
|
||||
model('Room')->clear_user_charm(db::name('vs_room')->where(['id' => $room_id])->value('user_id'), $room_id);
|
||||
model('api/Room')->clear_user_charm(db::name('vs_room')->where(['id' => $room_id])->value('user_id'), $room_id);
|
||||
return ['code' => 1, 'msg' => '操作成功!', 'data' => $return];
|
||||
}
|
||||
|
||||
@@ -155,7 +157,7 @@ class Friend extends Model
|
||||
public function createRelation($user_id,$room_id,$friend_id,$user1_id,$user2_id,$friending_config_id){
|
||||
|
||||
if (!$user1_id || !$user2_id || !$friend_id || !$room_id) {
|
||||
return ['code' => 0, 'msg' => '参数有误!', 'data' => null];
|
||||
return ['code' => 0, 'msg' => '参数有误!!', 'data' => null];
|
||||
}
|
||||
|
||||
$user1 = min($user1_id, $user2_id);
|
||||
@@ -166,8 +168,24 @@ class Friend extends Model
|
||||
$originalPairs = db::name('vs_user_friending_heart')
|
||||
->where(['id'=>$friending_heart['id']])
|
||||
->update(['status' => 3,'friend_config_id' =>$friending_config_id]);
|
||||
|
||||
$msg = '';
|
||||
|
||||
if ($originalPairs) {
|
||||
// 修改当前交友阶段
|
||||
$res = db::name('vs_room')->where(['id' => $room_id])->update(['step' => 1]);
|
||||
if($res){
|
||||
$res2 = db::name('vs_user_friending')->where(['id' => $friend_id])->update(['status' => 2,'update_time' => time()]);
|
||||
}
|
||||
|
||||
//所有人下麦
|
||||
$on_pit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => ['<',7],'user_id' => ['<>',0]])->select();
|
||||
if($on_pit){
|
||||
foreach ($on_pit as $pit){
|
||||
model('RoomPit')->DownPit($pit['user_id'], $room_id,$pit['pit_number']);
|
||||
}
|
||||
}
|
||||
|
||||
$relation = db::name('vs_relation')->where('id',$friending_config_id)->value('name');
|
||||
if($friending_heart['heart_value'] >= get_system_config_value('friend_heart_create_room') && $friending_config_id > 0){
|
||||
//创建小房间
|
||||
@@ -196,6 +214,7 @@ class Friend extends Model
|
||||
}else{
|
||||
$text['text'] = '交友结束未创建房间';
|
||||
}
|
||||
|
||||
$text['relation_name'] = $relation;
|
||||
$text['user1_id'] = $user1;
|
||||
$text['user2_id'] = $user2;
|
||||
@@ -205,17 +224,6 @@ class Friend extends Model
|
||||
$text['user2_nickname'] = db::name('user')->where(['id'=>$user2])->value('nickname');
|
||||
model('api/Chat')->sendMsg(1051,$room_id,$text);
|
||||
|
||||
// 修改当前交友阶段
|
||||
db::name('vs_room')->where(['id' => $room_id])->update(['step' => 1]);
|
||||
db::name('vs_user_friending')->where(['id' => $friend_id])->update(['status' => 2]);
|
||||
//所有人下麦
|
||||
$on_pit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => ['<',7],'user_id' => ['<>',0]])->select();
|
||||
if($on_pit){
|
||||
foreach ($on_pit as $pit){
|
||||
model('RoomPit')->DownPit($pit['user_id'], $room_id,$pit['pit_number']);
|
||||
}
|
||||
}
|
||||
|
||||
$shijian = floor($friending_heart['heart_value']/get_system_config_value('friend_heart_value')) * get_system_config_value('friend_heart_times');
|
||||
$friendendtime = time() + $shijian * 3600;
|
||||
|
||||
@@ -226,44 +234,67 @@ class Friend extends Model
|
||||
$room_auction = model('RoomAuction')->room_auction_create_or_add($user1_id,$user2_id,$friending_config_id,$shijian*3600,0);
|
||||
|
||||
//推送给前端消息
|
||||
$text1['text'] = '交友结束';
|
||||
$text1['step'] = 1;//1 等待邂逅 2 心动连线 3 牵手良缘
|
||||
model('api/Chat')->sendMsg(1049,$room_id,$text1);
|
||||
//查询是否第一次创建关系
|
||||
$friend_count1 = db::name('vs_user_friending_heart')
|
||||
->where('status', 3)
|
||||
->where(function($query) use ($user1) {
|
||||
$query->where('user1_id', $user1)
|
||||
->whereOr('user2_id', $user1);
|
||||
})
|
||||
->count();
|
||||
if($friend_count1 == 1){
|
||||
//任务:10-第一次星球房卡关系(互娱房)
|
||||
model('Tasks')->tasks_complete($user1,10);
|
||||
}
|
||||
$friend_count2 = db::name('vs_user_friending_heart')
|
||||
->where('status', 3)
|
||||
->where(function($query) use ($user2) {
|
||||
$query->where('user1_id', $user2)
|
||||
->whereOr('user2_id', $user2);
|
||||
})
|
||||
->count();
|
||||
if($friend_count2 == 1){
|
||||
//任务:10-第一次星球房卡关系(互娱房)
|
||||
model('Tasks')->tasks_complete($user2,10);
|
||||
}
|
||||
|
||||
return ['code' => 1, 'msg' => '创建关系成功!'.$msg, 'data' => null];
|
||||
} else {
|
||||
$re2s = db::name('vs_room')->where(['id' => $room_id])->update(['step' => 1]);
|
||||
$ress = 0;
|
||||
if($re2s){
|
||||
$ress = db::name('vs_user_friending')->where(['id' => $friend_id])->update(['status' => 2,'update_time' => time()]);
|
||||
}
|
||||
|
||||
//推送给前端消息
|
||||
$text['status1'] = $ress.'<=>'.$re2s.'<=>'.$originalPairs;
|
||||
$text['text'] = '交友结束';
|
||||
$text['step'] = 1;//1 等待邂逅 2 心动连线 3 牵手良缘
|
||||
model('api/Chat')->sendMsg(1049,$room_id,$text);
|
||||
|
||||
return ['code' => 1, 'msg' => '创建关系成功!'.$msg, 'data' => null];
|
||||
} else {
|
||||
//推送给前端消息
|
||||
$text['text'] = '交友结束';
|
||||
$text['step'] = 1;//1 等待邂逅 2 心动连线 3 牵手良缘
|
||||
model('api/Chat')->sendMsg(1049,$room_id,$text);
|
||||
db::name('vs_user_friending')->where(['id' => $friend_id])->update(['status' => 2]);
|
||||
return ['code' => 0, 'msg' => '创建关系失败!', 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//退出私密房间
|
||||
public function outRoom($user_id,$room_id){
|
||||
public function outRoom($type,$room_id){
|
||||
//推送给前端消息
|
||||
$text['text'] = '退出私密小屋';
|
||||
model('api/Chat')->sendMsg(1055,$room_id,$text);
|
||||
|
||||
|
||||
// //查询在房间的用户
|
||||
// $users = db::name('vs_room_visitor')->where(['room_id'=>$room_id])->select();
|
||||
// if($users){
|
||||
// //退出房间
|
||||
// foreach ($users as $v){
|
||||
// //退出房间
|
||||
// model('Room')->quit_room($v['user_id'], $room_id,$v['user_id']);
|
||||
// }
|
||||
// }else{
|
||||
// model('Room')->quit_room($user_id, $room_id,$user_id);
|
||||
// }
|
||||
|
||||
//注销房间
|
||||
db::name('vs_room')->where(['id'=>$room_id])->update(['room_status'=>3]);
|
||||
if($type){//交友、拍卖
|
||||
db::name('vs_room_cp_movie')->where(['room_id'=>$room_id])->update(['status'=>4]);
|
||||
}else{//酒吧房私密
|
||||
db::name('vs_room_bar_movie')->where(['room_id'=>$room_id])->update(['status'=>2]);
|
||||
}
|
||||
//删除腾讯群组
|
||||
model('api/Tencent')->delete_group('room'.$room_id);
|
||||
|
||||
return ['code' => 1, 'msg' => '退出成功!', 'data' => null];
|
||||
@@ -283,16 +314,12 @@ class Friend extends Model
|
||||
* @param $room_id 房间id
|
||||
* @param $pit_number 坑位
|
||||
*/
|
||||
public function room_give_gift($uid, $to_uid, $gift_id, $gift_num, $from_type, $type, $room_id, $pit_number, $heart_id,$give_gift_ext)
|
||||
public function room_give_gift($uid, $to_uid,$room_id,$res,$heart_id = 0)
|
||||
{
|
||||
$res = model('GiveGift')->give_gift($uid, $to_uid, $gift_id, $gift_num, $from_type, $type, $room_id, $pit_number,0,$give_gift_ext);
|
||||
if($res['code'] != 1){
|
||||
return $res;
|
||||
}
|
||||
|
||||
//送礼成功后续操作
|
||||
//查看当前时间是否在交友表的创建时间和结束时间段内 用来区分是否要拉取心动值高的用户上麦
|
||||
$friend = db::name('vs_user_friending')->where(['room_id' => $room_id,'status' => 1])->order('id desc')->find();
|
||||
|
||||
//查看当前时间是否在交友表的创建时间和结束时间段内 用来区分是否要拉取心动值高的用户上麦
|
||||
if($friend && time() >= $friend['create_time'] && time() <= $friend['end_time']){
|
||||
$heart_exp = get_system_config_value('coin_charm_exp');//金币与魅力值转换比
|
||||
$sumPrice = $res['data']['gift_total'] * $heart_exp;
|
||||
@@ -300,7 +327,7 @@ class Friend extends Model
|
||||
|
||||
if($heart_id){//有这个值就是助力 不参加抢麦操作
|
||||
db::name('vs_user_friending_heart')->where(['id' => $heart_id])->setInc('heart_value', $sumPrice);
|
||||
$this->pullHeartChange($room_id,$friend['id']);//聊天室心动值变化通知
|
||||
// $this->pullHeartChange($room_id,$friend['id']);//聊天室心动值变化通知 注释掉是因为下面那个函数会处理
|
||||
//生成新排名 判断抱上麦 还是换麦
|
||||
$this->pullUserPit($room_id,$friend['id']);
|
||||
}else{
|
||||
@@ -308,7 +335,7 @@ class Friend extends Model
|
||||
$host = $this->is_host($uid,$to_uid,$room_id);
|
||||
$user_idd = explode(",", $user_idd); // 将字符串转换为数组
|
||||
//判断是否是主持
|
||||
if($host['is_preside'] == 1){
|
||||
if($host && $host['is_preside'] == 1){
|
||||
if(!in_array($uid,$host['is_preside_user'])){//主持不是当前送礼人,那就是在收礼人中
|
||||
//从数组中剔除主持人 && $is_preside_user!= UID
|
||||
$user_idd = array_diff($user_idd, $host['is_preside_user']); // 从数组中移除
|
||||
@@ -329,7 +356,7 @@ class Friend extends Model
|
||||
}
|
||||
}
|
||||
}
|
||||
return ['code' => 1, 'msg' => '送礼成功', 'data' => null];
|
||||
return ['code' => 1, 'msg' => '送礼成功', 'data' => $res['data']];
|
||||
}
|
||||
|
||||
//是否主持
|
||||
@@ -344,13 +371,13 @@ class Friend extends Model
|
||||
foreach ($user_ids as $value) {
|
||||
//判断收礼人是否是主持
|
||||
if (in_array($value, $host)) {
|
||||
$is_preside = 1;
|
||||
$is_preside = 1;//是主持
|
||||
$is_preside_user[] = $value;
|
||||
}
|
||||
}
|
||||
//送礼人是主持或嘉宾
|
||||
if (in_array($uid, $host)) {
|
||||
$is_preside = 1;
|
||||
$is_preside = 1;//是嘉宾
|
||||
$is_preside_user[] = $uid;
|
||||
}
|
||||
return ['is_preside' =>$is_preside,'is_preside_user' => $is_preside_user];
|
||||
@@ -681,6 +708,7 @@ class Friend extends Model
|
||||
$data_users[$key_data]['dress'] = model('Decorate')->user_decorate_detail($value_data['user_id'],1);
|
||||
$data_users[$key_data]['charm'] = $charm??0;
|
||||
$data_users[$key_data]['pit_number'] = $value_data['pit_number'];
|
||||
$data_users[$key_data]['is_online'] = db::name('vs_room_visitor')->where(['user_id' => $value_data['user_id'],'room_id' => $room_id])->value('is_online');
|
||||
}
|
||||
//推送给前端消息
|
||||
$text['text'] = '房间换麦位';
|
||||
@@ -722,7 +750,7 @@ class Friend extends Model
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//获取此阶段的1-6麦位 全部返给前端 前端比对 里面没有自己 则闭麦……
|
||||
$getRoomNullPit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => ['<',7]])->select();
|
||||
$data_users = [];
|
||||
foreach($getRoomNullPit as $key_data => $value_data){
|
||||
@@ -738,6 +766,7 @@ class Friend extends Model
|
||||
$data_users[$key_data]['dress'] = model('Decorate')->user_decorate_detail($value_data['user_id'],1);
|
||||
$data_users[$key_data]['charm'] = $charm??0;
|
||||
$data_users[$key_data]['pit_number'] = $value_data['pit_number'];
|
||||
$data_users[$key_data]['is_online'] = db::name('vs_room_visitor')->where(['user_id' => $value_data['user_id'],'room_id' => $room_id])->value('is_online');
|
||||
}
|
||||
//推送给前端消息
|
||||
$text['text'] = '房间换麦位';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
use think\Cache;
|
||||
use think\Model;
|
||||
use think\Db;
|
||||
use think\Session;
|
||||
@@ -19,6 +20,7 @@ class Gift extends Model
|
||||
//获取礼物类型
|
||||
public function get_gift_label()
|
||||
{
|
||||
$giftType = [];
|
||||
$giftTypeData = db::name('vs_gift_label')->where('delete_time',0)->where('tid',1)->order("sort asc,id desc")->select();
|
||||
foreach ($giftTypeData as $key => $value) {
|
||||
$giftType[$key]['id'] = $value['id'];
|
||||
@@ -27,9 +29,30 @@ class Gift extends Model
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $giftType];
|
||||
}
|
||||
|
||||
//拉去礼物列表
|
||||
public function get_gift_list($label=0,$room_id=0)
|
||||
//拉取礼物列表
|
||||
public function get_gift_list($label = 0,$room_id = 0,$user_id = 0)
|
||||
{
|
||||
$is_lock = 0;
|
||||
if ($label == 13) { // 专属礼物
|
||||
$Nobility = model('api/Nobility')->getUserNobilityInfo($user_id);
|
||||
$power_list_ids = array_column($Nobility['power_list'],'id');
|
||||
if(!in_array(5,$power_list_ids)){
|
||||
$is_lock = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//先从缓存获取
|
||||
if($is_lock){
|
||||
$cache_key = 'gift_list_'.$label.'_'.$is_lock;
|
||||
}else{
|
||||
$cache_key = 'gift_list_'.$label;
|
||||
}
|
||||
$list = json_decode(Cache::get($cache_key), true);
|
||||
|
||||
if($list){
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $list];
|
||||
}
|
||||
|
||||
$map['delete_time'] = 0;
|
||||
$where['is_show'] = 1;
|
||||
if ($label && $label != 99) {
|
||||
@@ -38,12 +61,14 @@ class Gift extends Model
|
||||
if ($label == 99) {
|
||||
$gift_price = get_system_config_value('room_love_auction_cion');
|
||||
$where['gift_price'] = ['>',$gift_price];
|
||||
$where['label'] = ['<>',2];
|
||||
}
|
||||
$is_open_blind_box_turntable = 0;
|
||||
if($room_id){
|
||||
$is_open_blind_box_turntable = Db::name('vs_room')->where(['id'=>$room_id])->value('is_open_blind_box_turntable');
|
||||
}
|
||||
$list = $this->field('gid as gift_id,gift_name,base_image,gift_price')->where($map)->where($where)->order('sort asc, gift_price asc')->select();
|
||||
|
||||
$is_open_blind_box_turntable = 1;
|
||||
// if($room_id){
|
||||
// $is_open_blind_box_turntable = Db::name('vs_room')->where(['id'=>$room_id])->value('is_open_blind_box_turntable');
|
||||
// }
|
||||
$list = $this->field('gid as gift_id,gift_name,base_image,gift_price,icon')->where($map)->where($where)->order('sort desc, gift_price asc')->select();
|
||||
if($label==2){
|
||||
$list_data = [];
|
||||
foreach ($list as &$v) {
|
||||
@@ -60,6 +85,15 @@ class Gift extends Model
|
||||
break;
|
||||
}
|
||||
}
|
||||
//爆币
|
||||
$pool_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
if($pool_gift_id == $v['gift_id']){
|
||||
$v['gift_bag_name'] = "幸运币活动";
|
||||
$v['rule'] = "幸运羽币";
|
||||
$v['rule_url'] = get_system_config_value('web_site')."/api/Page/page_show?id=35";
|
||||
$v['activities_id'] = 88;
|
||||
$v['gift_bag'] = 0;
|
||||
}
|
||||
}
|
||||
foreach ($list as $gift) {
|
||||
if($is_open_blind_box_turntable == 1){
|
||||
@@ -70,11 +104,43 @@ class Gift extends Model
|
||||
}
|
||||
}
|
||||
}
|
||||
usort($list_data, function($a, $b) {
|
||||
return $a['gift_id'] <=> $b['gift_id'];
|
||||
});
|
||||
// usort($list_data, function($a, $b) {
|
||||
// return $a['gift_id'] <=> $b['gift_id'];
|
||||
// });
|
||||
$list = $list_data;
|
||||
}
|
||||
|
||||
//获取配置里面的CP礼物
|
||||
$cp_gift_ids = explode(',', get_system_config_value('cp_gift_id'));
|
||||
$teacher_gift_ids = explode(',', get_system_config_value('master_special_gift'));
|
||||
$cp_gift = [];
|
||||
$teacher_gift = [];
|
||||
foreach ($list as $key =>&$v) {
|
||||
$v['is_lock'] = $is_lock;
|
||||
if (in_array($v['gift_id'], $cp_gift_ids)) {
|
||||
$v['is_cp'] = 1;
|
||||
$cp_gift[] = $v;
|
||||
unset($list[$key]);
|
||||
}else{
|
||||
$v['is_cp'] = 0;
|
||||
}
|
||||
if (in_array($v['gift_id'], $teacher_gift_ids)) {
|
||||
$v['is_teacher'] = 1;
|
||||
$teacher_gift[] = $v;
|
||||
unset($list[$key]);
|
||||
}else{
|
||||
$v['is_teacher'] = 0;
|
||||
}
|
||||
}
|
||||
//如果有CP礼物 则放在最前面
|
||||
if ($cp_gift) {
|
||||
array_unshift($list, ...$cp_gift);
|
||||
}
|
||||
if ($teacher_gift) {
|
||||
array_unshift($list, ...$teacher_gift);
|
||||
}
|
||||
//设置缓存
|
||||
Cache::set($cache_key, json_encode($list), 3600);
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $list];
|
||||
}
|
||||
}
|
||||
|
||||
184
application/api/model/GiftNew.php
Normal file
184
application/api/model/GiftNew.php
Normal file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use think\Cache;
|
||||
use think\Model;
|
||||
use think\Db;
|
||||
|
||||
class GiftNew extends Model
|
||||
{
|
||||
/*
|
||||
* 获取礼物列表
|
||||
* @param int $label 礼物标签
|
||||
* @param int $type 类型:1-房间送礼礼物,2-排麦设置插麦礼物,3-拍卖位选择拍卖礼物,4-歌手添加歌单礼物,5-动态打赏礼物, 6-酒吧房
|
||||
*/
|
||||
public function get_gift_list($user_id, $type, $label)
|
||||
{
|
||||
$is_lock = 0;
|
||||
if ($label == 13) { // 专属礼物
|
||||
$Nobility = model('api/Nobility')->getUserNobilityInfo($user_id);
|
||||
$power_list_ids = array_column($Nobility['power_list'],'id');
|
||||
if(!in_array(5,$power_list_ids)){
|
||||
$is_lock = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//1,先从缓存获取
|
||||
if($is_lock){//根据这个判断是不是爵位礼物 创建不同的key
|
||||
$cache_key = 'gift_list_'.$label.'_'.$is_lock;
|
||||
}else{
|
||||
$cache_key = 'gift_list_'.$label;
|
||||
}
|
||||
//2,缓存获取
|
||||
$list = json_decode(Cache::get($cache_key), true);
|
||||
//获取到就返回
|
||||
if($list){
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $list];
|
||||
}
|
||||
|
||||
//================================从这里开始写逻辑==================================
|
||||
//根据type的值分析拉起礼物的场合 加$label的条件 给出对应的列表
|
||||
|
||||
//根据类型组装查询条件
|
||||
$where['is_show'] = 1;
|
||||
$where['delete_time'] = 0;
|
||||
if ($label == 99) {
|
||||
$gift_price = get_system_config_value('room_love_auction_cion');
|
||||
$where['gift_price'] = ['>',$gift_price];
|
||||
$where['label'] = ['<>',2];
|
||||
}
|
||||
switch ($type) {
|
||||
case 1:
|
||||
$where['label'] = $label;
|
||||
break;
|
||||
case 2:
|
||||
$where['label'] = 5;
|
||||
break;
|
||||
case 3:
|
||||
$where['type'] = 1;
|
||||
//爆币id
|
||||
$bb_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
$where['gid'] = ['<>',$bb_gift_id];//拍卖位选礼物 不能是爆币这个礼物
|
||||
break;
|
||||
case 4:
|
||||
$where['type'] = 1;
|
||||
$where['gift_price'] = ['>',128];//歌单礼物价格要大于128 老板26年1月2号提的要求
|
||||
break;
|
||||
case 5:
|
||||
$where['type'] = 1;
|
||||
break;
|
||||
case 6:
|
||||
$where['type'] = 6;
|
||||
$where['label'] = $label;
|
||||
break;
|
||||
}
|
||||
$list = db::name('vs_gift')
|
||||
->field('gid as gift_id,gift_name,base_image,gift_price,icon')
|
||||
->where($where)->order('sort desc, gift_price asc')->select();
|
||||
|
||||
if($label==2){
|
||||
foreach ($list as &$v) {
|
||||
//获取盲盒列表
|
||||
$box_list = Db::name('vs_gift_bag')->where(['status'=>1])->where(['activities_id'=>["in",[4,5]]])->select();
|
||||
foreach ($box_list as $key =>$box) {
|
||||
$ext = json_decode($box['ext'],true);
|
||||
if ($ext['gift_id'] == $v['gift_id']) {
|
||||
$v['gift_bag_name'] = $box['name'];
|
||||
$v['rule'] = $ext['description'];
|
||||
$v['rule_url'] = get_system_config_value('web_site')."/api/Page/get_gift_box_rule?box_id=".$box["id"];
|
||||
$v['activities_id'] = $box['activities_id'];
|
||||
$v['gift_bag'] = $box['id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
//爆币
|
||||
$pool_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
if($pool_gift_id == $v['gift_id']){
|
||||
$v['gift_bag_name'] = "幸运币活动";
|
||||
$v['rule'] = "幸运羽币";
|
||||
$v['rule_url'] = get_system_config_value('web_site')."/api/Page/page_show?id=35";
|
||||
$v['activities_id'] = 88;
|
||||
$v['gift_bag'] = 0;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
foreach ($list as $key =>&$v) {
|
||||
$v['is_lock'] = $is_lock;
|
||||
if($label==14){ //酒吧房自定义礼物 自定义
|
||||
$gift_remark_name =db::name('vs_user_custom_gift')->where(['user_id' => $user_id,'gift_id'=>$v['gift_id'],'delete_time'=>0])->value('gift_remark_name');
|
||||
$v['gift_remark_name'] = $gift_remark_name ?? '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//================================到这里结束逻辑==================================
|
||||
if($label!=14) {//非自定义礼物走缓存
|
||||
//设置缓存
|
||||
Cache::set($cache_key, json_encode($list), 3600);
|
||||
}
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $list];
|
||||
}
|
||||
|
||||
|
||||
//自定义礼物设置
|
||||
public function set_custom_gift($user_id, $gift_id, $room_id, $gift_remark_name){
|
||||
$gift_info = db::name('vs_gift')->where(['gid' => $gift_id, 'delete_time' => 0, 'is_show' => 1])->find();
|
||||
if(!$gift_info){
|
||||
return ['code' => 0, 'msg' => '礼物不存在','data' =>null];
|
||||
}
|
||||
|
||||
$user_custom_gift = db::name('vs_user_custom_gift')->where(['user_id' => $user_id,'gift_id'=>$gift_id])->find();
|
||||
if($user_custom_gift){
|
||||
db::name('vs_user_custom_gift')->where(['id' => $user_custom_gift['id']])->update(['gift_remark_name'=>$gift_remark_name,'updatetime'=>time()]);
|
||||
}else{
|
||||
$res = db::name('vs_user_custom_gift')->insert([
|
||||
'user_id' => $user_id,
|
||||
'gift_id'=>$gift_id,
|
||||
'gift_remark_name'=>$gift_remark_name,
|
||||
'createtime'=>time()
|
||||
]);
|
||||
if(!$res){
|
||||
return ['code' => 0, 'msg' => '设置失败','data' =>null];
|
||||
}
|
||||
}
|
||||
|
||||
$user_custom_gift_count = db::name('vs_user_custom_gift')->where(['user_id' => $user_id,'gift_remark_name' => ['<>', '']])->count();
|
||||
|
||||
if($user_custom_gift_count == 0){
|
||||
$type = 0;//删除
|
||||
}else{
|
||||
$type = 1;
|
||||
}
|
||||
|
||||
if(!$room_id){
|
||||
$room_id = db::name('vs_room_visitor')->where(['user_id' => $user_id])->order('id desc')->value('room_id');
|
||||
}
|
||||
|
||||
$user_on_pit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $user_id])->value('pit_number');
|
||||
if($user_on_pit){
|
||||
$text['text'] = '设置自定义礼物';
|
||||
$text['type'] = $type;
|
||||
$text['user_id'] = $user_id;
|
||||
$text['pit_number'] = $user_on_pit;
|
||||
//聊天室推送系统消息
|
||||
model('api/Chat')->sendMsg(1203,$room_id,$text);
|
||||
}
|
||||
return ['code' => 1, 'msg' => '设置成功','data' =>null];
|
||||
}
|
||||
|
||||
|
||||
|
||||
//自定义礼物列表
|
||||
public function get_custom_gift_list($user_id){
|
||||
$list = db::name('vs_user_custom_gift')
|
||||
->alias('a')
|
||||
->join('vs_gift b','a.gift_id = b.gid')
|
||||
->field('a.id,b.gid as gift_id,a.gift_remark_name,b.gift_name,b.base_image,b.gift_price,b.icon')
|
||||
->where(['a.user_id' => $user_id,'a.delete_time'=>0,'a.gift_remark_name'=>['<>','']])
|
||||
->order('a.sort desc ,a.updatetime desc')
|
||||
->select();
|
||||
return ['code' => 1, 'msg' => '获取成功','data' =>$list];
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
468
application/api/model/GiveGiftBases.php
Normal file
468
application/api/model/GiveGiftBases.php
Normal file
@@ -0,0 +1,468 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use app\common\model\GiveGiftBase;
|
||||
use think\Cache;
|
||||
use think\Log;
|
||||
use think\Model;
|
||||
|
||||
class GiveGiftBases extends Model
|
||||
{
|
||||
|
||||
protected $giftModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->giftModel = new GiveGiftBase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取送礼记录
|
||||
*/
|
||||
|
||||
public function getGiftRecords($params,$ext_params=[])
|
||||
{
|
||||
// $params = $this->request->param();
|
||||
|
||||
$where = [];
|
||||
$options = [];
|
||||
|
||||
// 构建查询条件
|
||||
if (!empty($params['from_id'])) {
|
||||
$where['from_id'] = $params['from_id'];
|
||||
}
|
||||
if (!empty($params['user_id'])) {
|
||||
$where['user_id'] = $params['user_id'];
|
||||
}
|
||||
if (!empty($params['gift_user'])) {
|
||||
$where['gift_user'] = $params['gift_user'];
|
||||
}
|
||||
if (!empty($params['gift_id'])) {
|
||||
$where['gift_id'] = $params['gift_id'];
|
||||
}
|
||||
if (!empty($params['type'])) {
|
||||
$where['type'] = $params['type'];
|
||||
}
|
||||
if (!empty($params['from'])) {
|
||||
$where['from'] = $params['from'];
|
||||
}
|
||||
if (!empty($params['gift_type'])) {
|
||||
$where['gift_type'] = $params['gift_type'];
|
||||
}
|
||||
|
||||
// 时间范围
|
||||
if (!empty($ext_params)) {
|
||||
if (!empty($ext_params['start_time'])) {
|
||||
$options['start_time'] = $ext_params['start_time'];
|
||||
}
|
||||
if (!empty($ext_params['end_time'])) {
|
||||
$options['end_time'] = $ext_params['end_time'];
|
||||
}
|
||||
}else{
|
||||
if (!empty($params['start_time'])) {
|
||||
$options['start_time'] = strtotime($params['start_time']);
|
||||
}
|
||||
if (!empty($params['end_time'])) {
|
||||
$options['end_time'] = strtotime($params['end_time'] . ' 23:59:59');
|
||||
}
|
||||
}
|
||||
|
||||
// 分页参数
|
||||
$options['page'] = $params['page'] ?? 1;
|
||||
$options['limit'] = min($params['limit'] ?? 20, 100); // 限制最大100条
|
||||
|
||||
// 排序
|
||||
if (!empty($params['order'])) {
|
||||
$options['order'] = $params['order'];
|
||||
}
|
||||
|
||||
// 查询数据
|
||||
$result = $this->giftModel->getGiftRecords($where, $options);
|
||||
|
||||
Log::info("查询送礼记录,条件: " . json_encode($where) . ", 结果数: " . count($result['data']));
|
||||
|
||||
// $this->success('获取成功', $result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 房间送礼统计
|
||||
*/
|
||||
public function getRoomStatistics($params)
|
||||
{
|
||||
$fromId = $this->request->param('from_id/d', 0);
|
||||
$startTime = $this->request->param('start_time/d', strtotime('-7 days'));
|
||||
$endTime = $this->request->param('end_time/d', time());
|
||||
|
||||
if (!$fromId) {
|
||||
$this->error('房间ID不能为空');
|
||||
}
|
||||
|
||||
// 尝试从缓存获取
|
||||
$cacheKey = "gift:room:stats:{$fromId}:" . date('Ymd', $startTime) . '-' . date('Ymd', $endTime);
|
||||
$cachedData = Cache::get($cacheKey);
|
||||
|
||||
if ($cachedData !== false) {
|
||||
Log::info("从缓存获取房间统计: {$cacheKey}");
|
||||
$this->success('获取成功', $cachedData);
|
||||
}
|
||||
|
||||
$where = ['from_id' => $fromId];
|
||||
$options = [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
];
|
||||
|
||||
// 统计房间总数据
|
||||
$totalStats = $this->giftModel->getGiftStatistics($where, $options);
|
||||
|
||||
// 按送礼人分组统计
|
||||
$userStats = $this->giftModel->getGiftStatistics($where, array_merge($options, [
|
||||
'group_by' => 'user_id'
|
||||
]));
|
||||
|
||||
// 按收礼人分组统计
|
||||
$receiverStats = $this->giftModel->getGiftStatistics($where, array_merge($options, [
|
||||
'group_by' => 'gift_user'
|
||||
]));
|
||||
|
||||
$result = [
|
||||
'room_id' => $fromId,
|
||||
'time_range' => [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
'start_date' => date('Y-m-d H:i:s', $startTime),
|
||||
'end_date' => date('Y-m-d H:i:s', $endTime),
|
||||
],
|
||||
'total_stats' => $totalStats,
|
||||
'user_stats' => $userStats,
|
||||
'receiver_stats' => $receiverStats,
|
||||
];
|
||||
|
||||
// 缓存5分钟
|
||||
Cache::set($cacheKey, $result, 300);
|
||||
|
||||
Log::info("房间统计计算完成: {$fromId}, 送礼人数: " . count($userStats) . ", 收礼人数: " . count($receiverStats));
|
||||
|
||||
$this->success('获取成功', $result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户送礼统计
|
||||
*/
|
||||
public function getUserStatistics($params,$type)
|
||||
{
|
||||
if($type==1){
|
||||
$userId = $params['user_id'];
|
||||
}else{
|
||||
$userId = $params['gift_user'];
|
||||
}
|
||||
|
||||
$startTime = $params['start_time'];
|
||||
$endTime = $params['end_time'];
|
||||
|
||||
if (!$userId) {
|
||||
return ['code'=>0,'msg'=>'用户ID不能为空','data'=>null];
|
||||
}
|
||||
|
||||
if($type==1){
|
||||
$where = ['user_id' => $userId];
|
||||
}else{
|
||||
$where = ['gift_user' => $userId];
|
||||
}
|
||||
|
||||
$options = [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
];
|
||||
|
||||
// 用户总送礼统计
|
||||
$totalStats = $this->giftModel->getGiftStatistics($where, $options);
|
||||
|
||||
// 按房间分组统计
|
||||
$roomStats = $this->giftModel->getGiftStatistics($where, array_merge($options, [
|
||||
'group_by' => 'from_id'
|
||||
]));
|
||||
|
||||
// 按收礼人分组统计
|
||||
$receiverStats = $this->giftModel->getGiftStatistics($where, array_merge($options, [
|
||||
'group_by' => 'gift_user'
|
||||
]));
|
||||
|
||||
$result = [
|
||||
'user_id' => $userId,
|
||||
'time_range' => [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
'start_date' => date('Y-m-d H:i:s', $startTime),
|
||||
'end_date' => date('Y-m-d H:i:s', $endTime),
|
||||
],
|
||||
'total_stats' => $totalStats,
|
||||
'room_stats' => $roomStats,
|
||||
'receiver_stats' => $receiverStats,
|
||||
];
|
||||
|
||||
// 缓存5分钟
|
||||
// Cache::set($cacheKey, $result, 300);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 收礼统计
|
||||
*/
|
||||
public function getReceiveStatistics()
|
||||
{
|
||||
$giftUser = $this->request->param('gift_user/d', 0);
|
||||
$startTime = $this->request->param('start_time/d', strtotime('-30 days'));
|
||||
$endTime = $this->request->param('end_time/d', time());
|
||||
|
||||
if (!$giftUser) {
|
||||
$this->error('用户ID不能为空');
|
||||
}
|
||||
|
||||
$cacheKey = "gift:receive:stats:{$giftUser}:" . date('Ymd', $startTime) . '-' . date('Ymd', $endTime);
|
||||
$cachedData = Cache::get($cacheKey);
|
||||
|
||||
if ($cachedData !== false) {
|
||||
Log::info("从缓存获取收礼统计: {$cacheKey}");
|
||||
$this->success('获取成功', $cachedData);
|
||||
}
|
||||
|
||||
$where = ['gift_user' => $giftUser];
|
||||
$options = [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
];
|
||||
|
||||
// 总收礼统计
|
||||
$totalStats = $this->giftModel->getGiftStatistics($where, $options);
|
||||
|
||||
// 按房间分组统计
|
||||
$roomStats = $this->giftModel->getGiftStatistics($where, array_merge($options, [
|
||||
'group_by' => 'from_id'
|
||||
]));
|
||||
|
||||
// 按送礼人分组统计
|
||||
$giverStats = $this->giftModel->getGiftStatistics($where, array_merge($options, [
|
||||
'group_by' => 'user_id'
|
||||
]));
|
||||
|
||||
$result = [
|
||||
'gift_user' => $giftUser,
|
||||
'time_range' => [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime,
|
||||
'start_date' => date('Y-m-d H:i:s', $startTime),
|
||||
'end_date' => date('Y-m-d H:i:s', $endTime),
|
||||
],
|
||||
'total_stats' => $totalStats,
|
||||
'room_stats' => $roomStats,
|
||||
'giver_stats' => $giverStats,
|
||||
];
|
||||
|
||||
// 缓存5分钟
|
||||
Cache::set($cacheKey, $result, 300);
|
||||
|
||||
Log::info("收礼统计计算完成: {$giftUser}, 房间数: " . count($roomStats) . ", 送礼人数: " . count($giverStats));
|
||||
|
||||
$this->success('获取成功', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取送礼趋势
|
||||
*/
|
||||
public function getGiftTrend()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
|
||||
$startTime = $params['start_time'] ?? strtotime('-7 days');
|
||||
$endTime = $params['end_time'] ?? time();
|
||||
$interval = $params['interval'] ?? 'day';
|
||||
|
||||
if (!in_array($interval, ['day', 'week', 'month'])) {
|
||||
$interval = 'day';
|
||||
}
|
||||
|
||||
$cacheKey = "gift:trend:" . date('Ymd', $startTime) . '-' . date('Ymd', $endTime) . ":{$interval}";
|
||||
$cachedData = Cache::get($cacheKey);
|
||||
|
||||
if ($cachedData !== false) {
|
||||
$this->success('获取成功', $cachedData);
|
||||
}
|
||||
|
||||
$trendData = $this->giftModel->getTrendStatistics($startTime, $endTime, $interval);
|
||||
|
||||
// 缓存10分钟
|
||||
Cache::set($cacheKey, $trendData, 600);
|
||||
|
||||
$this->success('获取成功', [
|
||||
'trend_data' => $trendData,
|
||||
'interval' => $interval,
|
||||
'time_range' => [
|
||||
'start_time' => $startTime,
|
||||
'end_time' => $endTime
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function getGiftList()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
|
||||
$where = [];
|
||||
$options = [];
|
||||
|
||||
// 构建查询条件
|
||||
$searchFields = ['from_id', 'user_id', 'gift_user', 'gift_id', 'type', 'from', 'gift_type'];
|
||||
foreach ($searchFields as $field) {
|
||||
if (!empty($params[$field])) {
|
||||
$where[$field] = $params[$field];
|
||||
}
|
||||
}
|
||||
|
||||
// 时间范围
|
||||
if (!empty($params['start_time'])) {
|
||||
$options['start_time'] = strtotime($params['start_time']);
|
||||
}
|
||||
if (!empty($params['end_time'])) {
|
||||
$options['end_time'] = strtotime($params['end_time']);
|
||||
}
|
||||
|
||||
// 搜索关键词
|
||||
if (!empty($params['search'])) {
|
||||
// 可以扩展搜索逻辑
|
||||
}
|
||||
|
||||
// 分页参数
|
||||
$options['page'] = $params['page'] ?? 1;
|
||||
$options['limit'] = $params['limit'] ?? $this->pageSize;
|
||||
|
||||
// 查询数据
|
||||
$result = $this->giftModel->getGiftRecords($where, $options);
|
||||
|
||||
// 转换时间格式
|
||||
foreach ($result['data'] as &$item) {
|
||||
$item['createtime_text'] = $item['createtime'] ? date('Y-m-d H:i:s', $item['createtime']) : '';
|
||||
$item['updatetime_text'] = $item['updatetime'] ? date('Y-m-d H:i:s', $item['updatetime']) : '';
|
||||
}
|
||||
|
||||
$total = $result['total'];
|
||||
$data = $result['data'];
|
||||
$result = array("total" => $total, "rows" => $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取送礼排行
|
||||
*/
|
||||
|
||||
public function getGiftRanking($params,$type)
|
||||
{
|
||||
$where = [];
|
||||
$options = [];
|
||||
|
||||
// 时间范围
|
||||
if (!empty($params['start_time'])) {
|
||||
$options['start_time'] = $params['start_time'];
|
||||
}
|
||||
if (!empty($params['end_time'])) {
|
||||
$options['end_time'] = $params['end_time'];
|
||||
}
|
||||
|
||||
// 分页参数
|
||||
$options['page'] = $params['page'] ?? 1;
|
||||
$options['limit'] = min($params['limit'] ?? 20, 100); // 限制最大100条
|
||||
|
||||
if($type == 1){
|
||||
$options['group_by'] = 'user_id';
|
||||
}else{
|
||||
$options['group_by'] = 'gift_user';
|
||||
}
|
||||
|
||||
|
||||
// 查询数据
|
||||
$result = $this->giftModel->getGiftStatisticsRanking($where, $options);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计收礼用户 的送礼用户的分组和
|
||||
*/
|
||||
|
||||
public function getToUserStatistics($params)
|
||||
{
|
||||
$where = [];
|
||||
$options = [];
|
||||
|
||||
// 时间范围
|
||||
if (!empty($params['start_time'])) {
|
||||
$options['start_time'] = $params['start_time'];
|
||||
}
|
||||
if (!empty($params['end_time'])) {
|
||||
$options['end_time'] = $params['end_time'];
|
||||
}
|
||||
if (!empty($params['from_id'])) {
|
||||
$where['from_id'] = $params['from_id'];
|
||||
}
|
||||
if (!empty($params['gift_user'])) {
|
||||
$where['gift_user'] = $params['gift_user'];
|
||||
}
|
||||
|
||||
// 分页参数
|
||||
$options['page'] = $params['page'] ?? 1;
|
||||
$options['limit'] = min($params['limit'] ?? 20, 100); // 限制最大100条
|
||||
|
||||
$options['group_by'] = 'user_id';
|
||||
|
||||
// 查询数据
|
||||
$result = $this->giftModel->getToUserStatistics($where, $options);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取房间内送礼排行
|
||||
*/
|
||||
|
||||
public function getRoomGiftRanking($params,$type)
|
||||
{
|
||||
$where = [];
|
||||
$options = [];
|
||||
|
||||
// 时间范围
|
||||
if (!empty($params['start_time'])) {
|
||||
$options['start_time'] = $params['start_time'];
|
||||
}
|
||||
if (!empty($params['end_time'])) {
|
||||
$options['end_time'] = $params['end_time'];
|
||||
}
|
||||
// 构建查询条件
|
||||
if (!empty($params['from_id'])) {
|
||||
$where['from_id'] = $params['from_id'];
|
||||
}
|
||||
|
||||
// 分页参数
|
||||
$options['page'] = $params['page'] ?? 1;
|
||||
$options['limit'] = min($params['limit'] ?? 20, 100); // 限制最大100条
|
||||
|
||||
if($type == 1){
|
||||
$options['group_by'] = 'user_id';
|
||||
}else{
|
||||
$options['group_by'] = 'gift_user';
|
||||
}
|
||||
|
||||
|
||||
// 查询数据
|
||||
$result = $this->giftModel->getGiftStatisticsRanking($where, $options);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,8 +20,11 @@ class Guild extends Model
|
||||
public function get_guild_list($page,$page_limit,$search='',$user_id=0)
|
||||
{
|
||||
$where =[];
|
||||
if ($search) {
|
||||
//判断是不是数字
|
||||
if (is_numeric($search)) {
|
||||
$where = ['guild_special_id'=>['like',$search.'%']]; //通过工会ID搜索
|
||||
}else{
|
||||
$where = ['guild_name'=>['like',$search.'%']];
|
||||
}
|
||||
$list = [];
|
||||
$list = Db::name('vs_guild')
|
||||
@@ -29,6 +32,7 @@ class Guild extends Model
|
||||
->where(['is_show'=>1,'delete_time'=>0])
|
||||
->where($where)
|
||||
->page($page, $page_limit)
|
||||
->order('num desc')
|
||||
->select();
|
||||
$count = Db::name('vs_guild')
|
||||
->where(['is_show'=>1,'delete_time'=>0])
|
||||
@@ -111,30 +115,36 @@ class Guild extends Model
|
||||
/*
|
||||
* 加入工会申请
|
||||
*/
|
||||
public function join_guild($guild_id,$user_id=0)
|
||||
public function join_guild_apply($guild_id,$user_id=0)
|
||||
{
|
||||
$user_info = model('User')->get_user_info($user_id);
|
||||
if(!$user_info){
|
||||
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
|
||||
}
|
||||
if($user_info['is_real']!=1 || empty($user_info['card_id'])){
|
||||
//查询是否实名认证
|
||||
$is_real = model('api/UserData')->real_name_info($user_id);
|
||||
if($is_real['code']==0){
|
||||
return ['code' => 0, 'msg' => '请先实名认证','data' => null];
|
||||
}else{
|
||||
if($is_real['data']['is_real'] !=1){
|
||||
return ['code' => 0, 'msg' => '请先实名认证','data' => null];
|
||||
}
|
||||
}
|
||||
//公会是否存在
|
||||
$guild_info = db::name('vs_guild')->where(['id'=>$guild_id,'delete_time'=>0])->find();
|
||||
if(!$guild_info){
|
||||
return ['code' => 0, 'msg' => '该公会不存在', 'data' => null];
|
||||
}
|
||||
$is_check_join = Db::name('vs_guild_user')->where(['user_id'=>$user_id,'delete_time'=>0])->find();
|
||||
if($is_check_join && $is_check_join['guild_id']!=$guild_id){
|
||||
return ['code'=>0,'msg'=>'您已加入别的工会,请先退出公会再加入', 'data' => null];
|
||||
}
|
||||
$is_check_join = Db::name('vs_guild_user')->where(['user_id'=>$user_id,'delete_time'=>0])->order('id desc')->find();
|
||||
if($is_check_join && $is_check_join['guild_id']==$guild_id && $is_check_join['status']==1){
|
||||
return ['code'=>0,'msg'=>'您已加入该工会', 'data' => null];
|
||||
}
|
||||
if($is_check_join && $is_check_join['guild_id']==$guild_id && $is_check_join['status']==2){
|
||||
return ['code'=>0,'msg'=>'您已提交申请,请耐心等待', 'data' => null];
|
||||
}
|
||||
if($is_check_join && $is_check_join['guild_id']!=$guild_id && $is_check_join['status']==1){
|
||||
return ['code'=>0,'msg'=>'您已加入别的工会,请先退出公会再加入', 'data' => null];
|
||||
}
|
||||
if($is_check_join && $is_check_join['guild_id']!=$guild_id && $is_check_join['status']==2){
|
||||
$other_guild_name = Db::name('vs_guild')->where(['id'=>$is_check_join['guild_id']])->value('guild_name');
|
||||
return ['code'=>0,'msg'=>'您已申请加入工会'.$other_guild_name.',请等待会长审核', 'data' => null];
|
||||
}
|
||||
//是否被踢出过
|
||||
$ti_chu = db::name('vs_guild_user')->where(['user_id'=>$user_id,'guild_id'=>$guild_id,'delete_time'=>['<>',0],'quit_type'=>2])->find();
|
||||
if(!empty($ti_chu)){
|
||||
@@ -158,7 +168,7 @@ class Guild extends Model
|
||||
}
|
||||
//是否有房间
|
||||
$rid = 0;
|
||||
$room_info = db::name('vs_room')->where('user_id', $user_id)->find();
|
||||
$room_info = db::name('vs_room')->where(['user_id'=>$user_id,'delete_time'=>0,'type_id'=>['<>',6]])->find();
|
||||
if($room_info){
|
||||
$rid = $room_info['id'];
|
||||
}
|
||||
@@ -166,18 +176,18 @@ class Guild extends Model
|
||||
$insert_data['user_id'] = $user_id;
|
||||
$insert_data['guild_id'] = $guild_id;
|
||||
$insert_data['room_id'] = $rid;
|
||||
$insert_data['status'] = 1;
|
||||
$insert_data['status'] = 2;
|
||||
$insert_data['is_deacon'] = 2;
|
||||
$insert_data['createtime'] = time();
|
||||
$update_data['apply_time'] = time();
|
||||
// $update_data['apply_time'] = time();
|
||||
$insert_data['is_show_room'] = 1;
|
||||
$reslut = db::name('vs_guild_user')->insert($insert_data);
|
||||
if($reslut){
|
||||
//增加公会人数
|
||||
db::name('vs_guild')->where('id', $guild_info['id'])->setInc('num', 1);
|
||||
//拉用户进入工会群聊
|
||||
model('Tencent')->add_group_member('g'.$guild_id, $user_id);
|
||||
// model('Tencent')->send_group_system_notification('g'.$guild_id,"欢迎".$user_info['nickname'].'加入公会');
|
||||
// model('api/Tencent')->add_group_member('g'.$guild_id, $user_id);
|
||||
// model('api/Tencent')->send_group_system_notification('g'.$guild_id,"欢迎".$user_info['nickname'].'加入公会');
|
||||
|
||||
return ['code' => 1, 'msg' => '提交成功', 'data' => null];
|
||||
}else{
|
||||
@@ -207,7 +217,7 @@ class Guild extends Model
|
||||
'a.guild_id' => $guild_id,
|
||||
'a.status' => 2
|
||||
];
|
||||
$count = db::name('vs_guild_user')-alias('a')->join('user b', 'a.user_id = b.id')->where($map)->count();
|
||||
$count = db::name('vs_guild_user')->alias('a')->join('user b', 'a.user_id = b.id')->where($map)->count();
|
||||
$list = db::name('vs_guild_user')->alias('a')->join('user b', 'a.user_id = b.id')
|
||||
->field('a.id, a.user_id, a.guild_id, a.room_id, a.status, b.nickname, b.avatar,b.user_code')
|
||||
->where($map)
|
||||
@@ -230,11 +240,13 @@ class Guild extends Model
|
||||
/*
|
||||
* 同意,拒绝申请
|
||||
*/
|
||||
public function operate_guild($uid, $apply_id, $type){
|
||||
public function operate_guild($apply_id, $type,$uid=0,$remarks=""){
|
||||
if($uid != 0){
|
||||
$user_info = db::name('user')->find($uid);
|
||||
if(!$user_info){
|
||||
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
|
||||
}
|
||||
}
|
||||
//该申请是否已被操作
|
||||
$is_operate = db::name('vs_guild_user')->where(['id'=>$apply_id,'status'=>2])->find();
|
||||
if(!$is_operate){
|
||||
@@ -244,7 +256,7 @@ class Guild extends Model
|
||||
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
|
||||
}
|
||||
$guild_info = db::name('vs_guild')->where('id', $is_operate['guild_id'])->find();
|
||||
if($uid != $guild_info['user_id']){
|
||||
if($uid!=0 && $uid != $guild_info['user_id']){
|
||||
return ['code' => 0, 'msg' => '您没有权限操作', 'data' => null];
|
||||
}
|
||||
//审核通过
|
||||
@@ -262,20 +274,44 @@ class Guild extends Model
|
||||
$update_data['updatetime'] = time();
|
||||
$update_data['is_show_room'] = 1;
|
||||
$update_data['apply_time'] = time();
|
||||
$update_data['remarks'] = $remarks;
|
||||
//结算比例
|
||||
$configs = get_system_config();
|
||||
//未加入工会的收益
|
||||
$ratiogr = $configs['room_gift_ratio'];
|
||||
//收益增加 加入工会的收益
|
||||
$ratiog = $configs['room_gift_guild_ratio'];
|
||||
//收礼人最终的收益比例
|
||||
$ratio = $ratiogr + $ratiog;
|
||||
$update_data['settlement_ratio'] = $ratio;
|
||||
$reslut = db::name('vs_guild_user')->where(['id'=>$apply_id])->update($update_data);
|
||||
if(!$reslut){
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
|
||||
}
|
||||
|
||||
//增加公会人数
|
||||
db::name('vs_guild')->where('id', $guild_info['id'])->setInc('num', 1);
|
||||
//拉用户进入工会群聊
|
||||
$user_nickname = db::name('user')->where('id', $is_operate['user_id'])->value('nickname');
|
||||
if($is_operate['guild_id']<=95){ //事故处理-114以前的群被删了
|
||||
$guild_id = "g".$is_operate['guild_id'];
|
||||
}else{
|
||||
$guild_id = $is_operate['guild_id'];
|
||||
}
|
||||
model('api/Tencent')->add_group_member('g'.$guild_id, $is_operate['user_id']);
|
||||
model('api/Tencent')->send_group_system_notification('g'.$guild_id,"欢迎".$user_nickname.'加入公会');
|
||||
//发系统信息
|
||||
$content = "恭喜加入{$guild_info['guild_name']}工会,您的个人收益增加{$ratiog}%,目前总收益{$ratio}%";
|
||||
model('api/UserMessage')->send_system_message($is_operate['user_id'], "加入公会成功通知", $content, 1);
|
||||
//处理新手任务
|
||||
model('api/Tasks')->tasks_complete($is_operate['user_id'],11);
|
||||
}else if($type == 2){//拒绝
|
||||
$update_data = [];
|
||||
$update_data['status'] = 3;
|
||||
$update_data['updatetime'] = time();
|
||||
$update_data['apply_time'] = time();
|
||||
$reslut = db::name('user_guild')->where(['id'=>$apply_id])->update($update_data);
|
||||
$update_data['remarks'] = $remarks;
|
||||
$reslut = db::name('vs_guild_user')->where(['id'=>$apply_id])->update($update_data);
|
||||
if(!$reslut){
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
|
||||
@@ -328,7 +364,7 @@ class Guild extends Model
|
||||
if($reslut){
|
||||
//减少公会人数
|
||||
db::name('vs_guild')->where('id', $guild_info['id'])->setDec('num');
|
||||
model('Tencent')->delete_group_member('g'.$guild_id, $user_id);
|
||||
model('api/Tencent')->delete_group_member('g'.$guild_id, $user_id);
|
||||
return ['code' => 1, 'msg' => '踢出成功','data' => null];
|
||||
}else{
|
||||
return ['code' => 0, 'msg' => '踢出失败','data' => null];
|
||||
@@ -337,6 +373,9 @@ class Guild extends Model
|
||||
|
||||
//退出公会
|
||||
public function quit_guild($uid, $guild_id,$type){
|
||||
//去除字符里的g
|
||||
$guild_id = str_replace('g', '', $guild_id);
|
||||
$guild_id = intval($guild_id);
|
||||
$config = get_system_config();
|
||||
$user_info = db::name('user')->find($uid);
|
||||
if(!$user_info){
|
||||
@@ -384,9 +423,32 @@ class Guild extends Model
|
||||
Db::rollback();
|
||||
return ['code' => 0, '' => '退出失败', 'data' => null];
|
||||
}
|
||||
//加入审核表
|
||||
$insert_data = [];
|
||||
$insert_data['guid'] = $user_guild_info['id'];
|
||||
$insert_data['user_id'] = $uid;
|
||||
$insert_data['guild_id'] = $guild_id;
|
||||
$insert_data['status'] = 1;
|
||||
$insert_data['type'] = 2;
|
||||
$insert_data['createtime'] = time();
|
||||
$insert_data['updatetime'] = time();
|
||||
$res = db::name('vs_guild_user_quit_log')->insert($insert_data);
|
||||
if(!$res){
|
||||
Db::rollback();
|
||||
return ['code' => 0, '' => '退出失败', 'data' => null];
|
||||
}
|
||||
//减少公会人数
|
||||
db::name('vs_guild')->where('id', $guild_info['id'])->setDec('num');
|
||||
model('Tencent')->delete_group_member('g'.$guild_id, $uid);
|
||||
if($guild_info['id']<=95){
|
||||
$guild_id = "g".$guild_info['id'];
|
||||
}else{
|
||||
$guild_id = $guild_info['id'];
|
||||
}
|
||||
model('api/Tencent')->delete_group_member('g'.$guild_id, $uid);
|
||||
|
||||
//付费退出费用给公会长
|
||||
$res = model('common/UserWallet')->change_user_money($guild_info['user_id'], $quit_guild_gold, model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::GUILD_EXIT_DEACON_INCOME,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::GUILD_EXIT_DEACON_INCOME));
|
||||
|
||||
Db::commit();
|
||||
return ['code' => 1, 'msg' => '退出成功', 'data' => null];
|
||||
}else{
|
||||
@@ -400,6 +462,7 @@ class Guild extends Model
|
||||
$insert_data['user_id'] = $uid;
|
||||
$insert_data['guild_id'] = $guild_id;
|
||||
$insert_data['status'] = 0;
|
||||
$insert_data['type'] = 1;
|
||||
$insert_data['createtime'] = time();
|
||||
$insert_data['updatetime'] = time();
|
||||
$res = db::name('vs_guild_user_quit_log')->insert($insert_data);
|
||||
@@ -492,8 +555,13 @@ class Guild extends Model
|
||||
return ['code' => 0, 'msg' => '审核失败', 'data' => null];
|
||||
}
|
||||
//减少公会人数
|
||||
db::name('vs_guild')->where('id', $apply_id)->setDec('num');
|
||||
model('Tencent')->delete_group_member('g'.$apply_id, $apply_info['user_id']);
|
||||
db::name('vs_guild')->where('id', $apply_info['guild_id'])->setDec('num');
|
||||
if($apply_info['guild_id']['id']<=95){
|
||||
$guild_id = "g".$apply_info['guild_id']['id'];
|
||||
}else{
|
||||
$guild_id = $apply_info['guild_id']['id'];
|
||||
}
|
||||
model('api/Tencent')->delete_group_member('g'.$guild_id, $apply_info['user_id']);
|
||||
} else {
|
||||
$update_data = [];
|
||||
$update_data['status'] = 2;
|
||||
@@ -509,7 +577,7 @@ class Guild extends Model
|
||||
}catch (\Exception $e) {
|
||||
// 回滚事务
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '解散失败', 'data' => null];
|
||||
return ['code' => 0, 'msg' => '审核失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,7 +594,12 @@ class Guild extends Model
|
||||
//解散公会
|
||||
db::name('vs_guild')->where('id',$guild_id)->update(['delete_time'=>time(),'status'=>2]);
|
||||
//解散群
|
||||
model('Tencent')->delete_group('g'.$guild_id);
|
||||
if($guild_id<=95){
|
||||
$guild_id = "g".$guild_id;
|
||||
}else{
|
||||
$guild_id = $guild_id;
|
||||
}
|
||||
model('api/Tencent')->delete_group('g'.$guild_id);
|
||||
Db::commit();
|
||||
return ['code' => 1, 'msg' => '解散成功!', 'data' => null];
|
||||
}catch (\Exception $e) {
|
||||
@@ -622,25 +695,29 @@ class Guild extends Model
|
||||
//本周流水
|
||||
//本周的第一天
|
||||
$week = strtotime(date('Y-m-d 00:00:00', strtotime('this week Monday')));
|
||||
$guild_user = db::name('vs_guild_user')->where(['guild_id' => $guild_id])->select();
|
||||
$transaction = 0;
|
||||
foreach ($guild_user as $k => $v){
|
||||
$week_start_time_seach = $week;
|
||||
$week_end_time_seach = time();
|
||||
if($v['createtime'] && $week_start_time_seach < $v['createtime']){
|
||||
$week_start_time_seach = $v['createtime'];
|
||||
}
|
||||
if($v['quit_time'] && ($week_end_time_seach > $v['quit_time'])){
|
||||
$week_end_time_seach = $v['quit_time'];
|
||||
}
|
||||
$transaction_one = db::name('vs_give_gift')
|
||||
->whereIn('from_id',$v['room_id'])
|
||||
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$week_start_time_seach, $week_end_time_seach]]])
|
||||
->sum('total_price');
|
||||
$transaction += $transaction_one;
|
||||
|
||||
}
|
||||
$total_transaction = $transaction;
|
||||
// $guild_user = db::name('vs_guild_user')->where(['guild_id' => $guild_id])->select();
|
||||
// $transaction = 0;
|
||||
// foreach ($guild_user as $k => $v){
|
||||
// $week_start_time_seach = $week;
|
||||
// $week_end_time_seach = time();
|
||||
// if($v['createtime'] && $week_start_time_seach < $v['createtime']){
|
||||
// $week_start_time_seach = $v['createtime'];
|
||||
// }
|
||||
// if($v['quit_time'] && ($week_end_time_seach > $v['quit_time'])){
|
||||
// $week_end_time_seach = $v['quit_time'];
|
||||
// }
|
||||
// $transaction_one = db::name('vs_give_gift')
|
||||
// ->whereIn('from_id',$v['room_id'])
|
||||
// ->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$week_start_time_seach, $week_end_time_seach]]])
|
||||
// ->sum('total_price');
|
||||
// $transaction += $transaction_one;
|
||||
//
|
||||
// }
|
||||
// $total_transaction = $transaction;
|
||||
$total_transaction = db::name('vs_guild_flow')
|
||||
->where(['guild_id' => $guild_id])
|
||||
->where(['createtime' => ['between', [$week, time()]]])
|
||||
->sum('flow_price');
|
||||
$ss = 0;
|
||||
if($total_transaction){
|
||||
//根据工会流水 获取补贴比例 单位%
|
||||
@@ -757,37 +834,40 @@ class Guild extends Model
|
||||
* 工会流水查询
|
||||
* @return array
|
||||
*/
|
||||
public function get_guild_transaction($guild_id,$start_time=0,$end_time=0,$page=1,$page_limit=20){
|
||||
public function get_guild_transaction($guild_id,$seach_start_time,$seach_end_time,$page,$page_limit){
|
||||
$guild_info = db::name('vs_guild')->where(['id'=>$guild_id,'delete_time'=>0])->find();
|
||||
if(empty($guild_info)){
|
||||
return ['code' => 0, 'msg' => '公会不存在!', 'data' => null];
|
||||
}
|
||||
//工会总流水
|
||||
$all_guild_room = db::name('vs_guild_user')->where(['guild_id' => $guild_id,'status'=>1,"delete_time"=>0])->select();
|
||||
$total_transaction = 0;
|
||||
foreach ($all_guild_room as $key => $value) {
|
||||
if(!$start_time){
|
||||
$start_time_all = $value['createtime'];
|
||||
$end_time_all = time();
|
||||
}else{
|
||||
$start_time_all = strtotime($start_time." 00:00:00");
|
||||
$end_time_all = strtotime($end_time." 23:59:59");
|
||||
}
|
||||
if($value['createtime'] && $start_time_all < $value['createtime']){
|
||||
$start_time_all = $value['createtime'];
|
||||
}
|
||||
if($value['quit_time'] && ($end_time_all > $value['quit_time'])){
|
||||
$end_time_all = $value['quit_time'];
|
||||
}
|
||||
$transaction = db::name('vs_give_gift')
|
||||
->where('from_id',$value['room_id'])
|
||||
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$start_time_all, $end_time_all]]])
|
||||
->sum('total_price');
|
||||
$total_transaction = $total_transaction+$transaction;
|
||||
}
|
||||
// $all_guild_room = db::name('vs_guild_user')->where(['guild_id' => $guild_id,'status'=>1,"delete_time"=>0])->select();
|
||||
// $total_transaction = 0;
|
||||
// foreach ($all_guild_room as $key => $value) {
|
||||
// $start_time = $seach_start_time;
|
||||
// $end_time = $seach_end_time;
|
||||
// if(!$start_time){
|
||||
// $start_time_all = $value['createtime'];
|
||||
// $end_time_all = time();
|
||||
// }else{
|
||||
// $start_time_all = strtotime($start_time." 00:00:00");
|
||||
// $end_time_all = strtotime($end_time." 23:59:59");
|
||||
// }
|
||||
// if($value['createtime'] && $start_time_all < $value['createtime']){
|
||||
// $start_time_all = $value['createtime'];
|
||||
// }
|
||||
// if($value['quit_time'] && ($end_time_all > $value['quit_time'])){
|
||||
// $end_time_all = $value['quit_time'];
|
||||
// }
|
||||
// $transaction = db::name('vs_give_gift')
|
||||
// ->where('from_id',$value['room_id'])
|
||||
// ->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$start_time_all, $end_time_all]]])
|
||||
// ->sum('total_price');
|
||||
// $total_transaction = $total_transaction+$transaction;
|
||||
// }
|
||||
|
||||
//查询工会所有房间流水
|
||||
$list = db::name('vs_guild_user')->where(['guild_id'=>$guild_id,'delete_time'=>0,'status'=>1,'room_id'=>['<>',0]])
|
||||
->order('coin desc')
|
||||
->order('id asc')
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
|
||||
@@ -795,29 +875,31 @@ class Guild extends Model
|
||||
$room_data = [];
|
||||
$i=0;
|
||||
foreach ($list as $k=>$v){
|
||||
if(!$start_time){
|
||||
$start_time_seach = $value['createtime'];
|
||||
$end_time_seach = time();
|
||||
}else{
|
||||
$start_time_seach = strtotime($start_time." 00:00:00");
|
||||
$end_time_seach = strtotime($end_time." 23:59:59");
|
||||
}
|
||||
if($value['createtime'] && $start_time_all < $value['createtime']){
|
||||
$start_time_seach = $value['createtime'];
|
||||
}
|
||||
if($value['quit_time'] && ($end_time_all > $value['quit_time'])){
|
||||
$end_time_seach = $value['quit_time'];
|
||||
}
|
||||
// $start_time = $seach_start_time;
|
||||
// $end_time = $seach_end_time;
|
||||
// if(!$start_time){
|
||||
// $start_time_seach = $value['createtime'];
|
||||
// $end_time_seach = time();
|
||||
// }else{
|
||||
// $start_time_seach = strtotime($start_time." 00:00:00");
|
||||
// $end_time_seach = strtotime($end_time." 23:59:59");
|
||||
// }
|
||||
// if($value['createtime'] && $start_time_all < $value['createtime']){
|
||||
// $start_time_seach = $value['createtime'];
|
||||
// }
|
||||
// if($value['quit_time'] && ($end_time_all > $value['quit_time'])){
|
||||
// $end_time_seach = $value['quit_time'];
|
||||
// }
|
||||
$room_info = db::name('vs_room')->where(['id'=>$v['room_id'],'room_status'=>1,'delete_time'=>0])->find();
|
||||
if($room_info){
|
||||
$room_data[$i]['room_id'] = $room_info['id'];
|
||||
$room_data[$i]['room_number'] = model('Decorate')->user_decorate_detail($room_info['id'],7);
|
||||
$room_data[$i]['room_name'] = $room_info['room_name'];
|
||||
$room_data[$i]['room_cover'] = localpath_to_netpath($room_info['room_cover']);
|
||||
$room_data[$i]['total_price'] = db::name('vs_give_gift')
|
||||
->where('from_id',$v['room_id'])
|
||||
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$start_time_seach, $end_time_seach]]])
|
||||
->sum('total_price');
|
||||
$room_data[$i]['total_price'] = db::name('vs_guild_flow')
|
||||
->where('room_id',$v['room_id'])
|
||||
->where(['createtime' => ['between', [$seach_start_time, $seach_end_time]]])
|
||||
->sum('flow_price');
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -827,7 +909,7 @@ class Guild extends Model
|
||||
'page' => $page,
|
||||
'limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'total_transaction' => $total_transaction ? $total_transaction : 0,
|
||||
'total_transaction' => $guild_info['income'] ? $guild_info['income'] : 0,
|
||||
'list' => $room_data,
|
||||
];
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $return_data];
|
||||
@@ -840,37 +922,84 @@ class Guild extends Model
|
||||
* @return array
|
||||
*/
|
||||
public function user_is_join($user_id){
|
||||
$guild_id = Db::name('vs_guild_user')->where(['user_id'=>$user_id,'status'=>1,'delete_time'=>0])->value('guild_id');
|
||||
if(empty($guild_id)){
|
||||
$guild = Db::name('vs_guild_user')->where(['user_id'=>$user_id,'delete_time'=>0])->order('id desc,apply_time desc')->find();
|
||||
if(empty($guild)){
|
||||
return 0;
|
||||
}else{
|
||||
return $guild_id;
|
||||
$guild_data['guild_id'] = $guild['guild_id'];
|
||||
$guild_data['status'] = $guild['status'];
|
||||
//1已通过 2已提交 3已拒绝
|
||||
$guild_data['status_str'] = $guild['status'] == 1 ? '已通过' : ($guild['status'] == 2 ? '已提交' : '已拒绝');
|
||||
$guild_data['is_deacon'] = $guild['is_deacon'];
|
||||
return $guild_data;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取公会成员列表
|
||||
*/
|
||||
public function get_guild_user_list($guild_id,$user_id,$page=1,$page_limit=30){
|
||||
public function get_guild_user_list($guild_ids,$user_id,$page=1,$page_limit=30,$seach=""){
|
||||
//获取$guild_id的第一个字母
|
||||
$guild_id_first_letter = substr($guild_ids, 0, 1);
|
||||
|
||||
if (substr($guild_ids, 0, 2) === 'gg') {
|
||||
$guild_id = substr($guild_ids, 2);
|
||||
|
||||
} elseif (substr($guild_ids, 0, 1) === 'g') {
|
||||
$guild_id = substr($guild_ids, 1);
|
||||
|
||||
} else {
|
||||
$guild_id = substr($guild_ids, 1);
|
||||
}
|
||||
|
||||
$seach_where = [];
|
||||
if($seach){
|
||||
if(is_numeric($seach)){
|
||||
$seach_where = ['b.user_code' => ['like', $seach . '%']];
|
||||
}else{
|
||||
$seach_where = ['b.nickname' => ['like', '%' . $seach . '%']];
|
||||
}
|
||||
}
|
||||
if($guild_id_first_letter == 'g'){
|
||||
$count = Db::name('vs_guild_user')
|
||||
->alias('a')
|
||||
->join('user b','a.user_id = b.id')
|
||||
->where($seach_where)
|
||||
->where(['a.guild_id'=>$guild_id,'a.status'=>1,'a.delete_time'=>0])
|
||||
->count();
|
||||
$list = Db::name('vs_guild_user')
|
||||
->alias('a')
|
||||
->join('user b', 'a.user_id = b.id')
|
||||
->field('a.id, a.user_id, a.guild_id, b.nickname, b.avatar, b.user_code, a.createtime')
|
||||
->where($seach_where)
|
||||
->where(['a.guild_id' => $guild_id, 'a.status' => 1,'a.delete_time' => 0])
|
||||
->order('a.id asc')
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
}else{
|
||||
$myFamilyPid = db::name('vs_family')->where(['id' => $guild_id])->value('user_id');
|
||||
$list = db::name('vs_family')->alias('a')
|
||||
->join('user b','a.user_id = b.id')
|
||||
->field('b.is_online,b.market_value,b.nickname,b.avatar,b.user_code,a.user_id,a.createtime')
|
||||
->where($seach_where)
|
||||
->where(['a.pid' => $myFamilyPid,'a.deletetime' => 0,'a.type' => 0])
|
||||
->order('a.id asc')
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
|
||||
$count = db::name('vs_family')->alias('a')
|
||||
->join('user b','a.user_id = b.id')
|
||||
->where($seach_where)
|
||||
->where(['a.pid' => $myFamilyPid,'a.deletetime' => 0,'a.type' => 0])
|
||||
->count();
|
||||
}
|
||||
if($list){
|
||||
$member_array = array_column($list, 'user_id');
|
||||
$member_array_str = [];
|
||||
foreach ($member_array as $k=> $v){
|
||||
$member_array_str[] = 'u' . $v;
|
||||
}
|
||||
$group_member_info = model('Tencent')->get_group_member_info('g' .$guild_id,$member_array_str);
|
||||
$group_member_info = model('api/Tencent')->get_group_member_info($guild_ids,$member_array_str);
|
||||
if($group_member_info['code'] == 0){
|
||||
return V($group_member_info['code'],$group_member_info['msg'], $group_member_info['data']);
|
||||
}
|
||||
@@ -885,6 +1014,12 @@ class Guild extends Model
|
||||
'Member'=>'普通群成员',
|
||||
'NotMember'=>'非群成员'
|
||||
];
|
||||
//禁言用户列表
|
||||
$mute_list = model('api/Tencent')->get_group_mute_list($guild_ids);
|
||||
$mute_user_list = [];
|
||||
if($mute_list['code'] == 1){
|
||||
$mute_user_list = array_column($mute_list['data'], 'Member_Account');
|
||||
}
|
||||
foreach ($list as $key => $value) {
|
||||
if($user_id == $value['user_id']){
|
||||
$list[$key]['is_self'] = 1;
|
||||
@@ -904,40 +1039,80 @@ class Guild extends Model
|
||||
->where(['a.user_id' => $value['user_id'], 'a.is_delete' => 1])
|
||||
->find();
|
||||
$list[$key]['in_room_id'] = $in_room['room_id'] ?? 0;
|
||||
//用户是否被禁言
|
||||
if(in_array('u'.$value['user_id'], $mute_user_list)){
|
||||
$list[$key]['is_mute'] = 1;
|
||||
}else{
|
||||
$list[$key]['is_mute'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$return_data =[
|
||||
'page' => $page,
|
||||
'limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'list' => $list,
|
||||
];
|
||||
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $return_data];
|
||||
|
||||
}
|
||||
/*
|
||||
* 群聊详情
|
||||
*/
|
||||
public function guild_info($guild_id,$user_id=0){
|
||||
if(!$guild_id){
|
||||
public function guild_info($guild_ids,$user_id=0){
|
||||
if(!$guild_ids){
|
||||
return ['code' => 0, 'msg' => '参数错误'];
|
||||
}
|
||||
if (substr($guild_ids, 0, 2) === 'gg') {
|
||||
$guild_id = substr($guild_ids, 2);
|
||||
$guild_info = db::name('vs_guild')->where(['id'=>$guild_id,'status'=>1,'delete_time'=>0])->find();
|
||||
$group_member_info = model('Tencent')->get_group_info('g'.$guild_id);
|
||||
$cover = $guild_info['cover'] ?? "";
|
||||
} elseif (substr($guild_ids, 0, 1) === 'g') {
|
||||
$guild_id = substr($guild_ids, 1);
|
||||
$guild_info = db::name('vs_guild')->where(['id'=>$guild_id,'status'=>1,'delete_time'=>0])->find();
|
||||
$cover = $guild_info['cover'] ?? "";
|
||||
} else {
|
||||
$guild_id = substr($guild_ids, 1);
|
||||
$guild_info = db::name('vs_family')->where(['id'=>$guild_id])->find();
|
||||
$cover = db::name('user')->where(['id'=>$guild_info['user_id']])->value('avatar');
|
||||
}
|
||||
//获取字符串里有几个g
|
||||
// $guild_id_count = substr_count($guild_ids, 'g');
|
||||
// $guild_id_first_letter = substr($guild_ids, 0, 1);
|
||||
// if($guild_id_count == 2){
|
||||
// //获取$guild_id的第一个字母
|
||||
// $guild_id = substr($guild_ids, 2);
|
||||
// }else{
|
||||
// //获取$guild_id的第一个字母
|
||||
// $guild_id = substr($guild_ids, 1);
|
||||
// }
|
||||
// if($guild_id_first_letter == 'g'){
|
||||
// $guild_info = db::name('vs_guild')->where(['id'=>$guild_id,'status'=>1,'delete_time'=>0])->find();
|
||||
// $cover = $guild_info['cover'] ?? "";
|
||||
// }else{
|
||||
// $guild_info = db::name('vs_family')->where(['id'=>$guild_id])->find();
|
||||
// $cover = db::name('user')->where(['id'=>$guild_info['user_id']])->value('avatar');
|
||||
// }
|
||||
|
||||
$group_member_info = model('api/Tencent')->get_group_info($guild_ids);
|
||||
if($group_member_info['code']!=1){
|
||||
return ['code' => 0, 'msg' => '群聊不存在',null];
|
||||
}
|
||||
$user_list = $this->get_guild_user_list($guild_id,0,1,10);
|
||||
$user_list = $this->get_guild_user_list($guild_ids,0,1,10);
|
||||
$is_deacon = 2;
|
||||
if($guild_info['user_id'] ==$user_id){
|
||||
$is_deacon = 1;
|
||||
}
|
||||
$return_data =[
|
||||
'guild_id' => $guild_id,
|
||||
'guild_cover' => $guild_info['cover'],
|
||||
'guild_id' => $guild_ids,
|
||||
'guild_cover' => $cover,
|
||||
'is_deacon' => $is_deacon,
|
||||
'user_list' => $user_list['data']['list'],
|
||||
'name' => $group_member_info['data'][0]['Name'],
|
||||
'notification' => $group_member_info['data'][0]['Notification']
|
||||
'notification' => $group_member_info['data'][0]['Notification'],
|
||||
'mute_all_member' => $group_member_info['data'][0]['MuteAllMember'] == 'On' ? 1 : 0,
|
||||
];
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $return_data];
|
||||
|
||||
@@ -946,7 +1121,280 @@ class Guild extends Model
|
||||
* 设置群聊信息
|
||||
*/
|
||||
public function set_guild_info($guild_id,$name,$notice,$avatar){
|
||||
$return = model('Tencent')->modify_group_base_info('g'.$guild_id, $name,$avatar, $notice);
|
||||
$guild_id = 'g'.$guild_id;
|
||||
$return = model('api/Tencent')->modify_group_base_info($guild_id, $name,$avatar, $notice);
|
||||
return ['code' => $return['code'], 'msg' => $return['msg'], 'data' => $return['data']];
|
||||
}
|
||||
|
||||
/*
|
||||
* 我的公会
|
||||
* @param $id
|
||||
* @param $user_id
|
||||
*/
|
||||
public function my_guild($user_id)
|
||||
{
|
||||
$guild_user = Db::name('vs_guild_user')->where(['user_id'=>$user_id,'status'=>1,'delete_time'=>0])
|
||||
->order('createtime desc')
|
||||
->find();
|
||||
if(empty($guild_user)){
|
||||
return ['code' => 0, 'msg' => '您没有加入任何公会', 'data'=>null];
|
||||
}
|
||||
$info = Db::name('vs_guild')
|
||||
->field('id,guild_special_id,user_id,guild_name,cover,num,intro,createtime,income')
|
||||
->where(['id'=>$guild_user['guild_id'],'is_show'=>1,'delete_time'=>0])
|
||||
->find();
|
||||
$guild_data = [];
|
||||
if($info){
|
||||
//用户信息
|
||||
$user_data = Db::name('user')->where(['id'=>$user_id])->field('id,nickname,avatar')->find();
|
||||
$guild_data['user_id'] = $user_data['id'];
|
||||
$guild_data['user_nickname'] = $user_data['nickname'];
|
||||
$guild_data['user_code'] = model('Decorate')->user_decorate_detail($user_id, 6);
|
||||
$guild_data['user_avatar'] = localpath_to_netpath($user_data['avatar']);
|
||||
$guild_data['is_leader'] = $info['user_id'] == $user_id ? 1 : 0;//当前用户是否是会长
|
||||
$guild_data['guild_id'] = $info['id'];
|
||||
$guild_data['guild_code'] = $info['guild_special_id'];
|
||||
$guild_data['guild_name'] = $info['guild_name'];
|
||||
//加入公会时间
|
||||
$guild_data['join_time'] = date('Y-m-d H:i:s',$guild_user['apply_time']);
|
||||
//本周金额
|
||||
//本周的第一天
|
||||
$week = strtotime(date('Y-m-d 00:00:00', strtotime('this week Monday')));
|
||||
$week_end_time = time();
|
||||
$guild_data['week_income'] = db::name('vs_guild_flow')->where(['guild_id'=>$info['id']])
|
||||
->where(['createtime' => ['between', [$week, $week_end_time]]])
|
||||
->sum('flow_price');
|
||||
//厅主收益
|
||||
$guild_data['room_author_ratio'] = $guild_user['room_id']==0 ? 0 : get_system_config_value('room_author_ratio');
|
||||
//礼物分成
|
||||
$guild_data['settlement_ratio'] = $guild_user['settlement_ratio'];
|
||||
//付费退出公会所需金
|
||||
$guild_data['quit_guild_gold'] = get_system_config_value('quit_guild_gold');
|
||||
//工会群组ID
|
||||
if($info['id']<=95){
|
||||
$guild_id = "g".$info['id'];
|
||||
}else{
|
||||
$guild_id = $info['id'];
|
||||
}
|
||||
$guild_data['guild_group_id'] = $guild_id;
|
||||
$guild_data['guild_id'] = $guild_id;
|
||||
//工会基础信息
|
||||
$guild_data_info = Db::name('vs_guild_data')->where(['guild_id'=>$info['id']])->find();
|
||||
$guild_data['agreement'] = $guild_data_info['agreement'] ?? '';
|
||||
}
|
||||
return ['code'=>1,'msg'=>'获取成功','data'=>$guild_data];
|
||||
}
|
||||
|
||||
/*
|
||||
* 加入工会——不用申请直接加入
|
||||
*/
|
||||
public function join_guild($guild_id,$user_id=0,$settlement_ratio = 0)
|
||||
{
|
||||
$user_info = db::name('user')->where(['id'=>$user_id])->find();
|
||||
if(!$user_info){
|
||||
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
|
||||
}
|
||||
//查询是否实名认证
|
||||
$is_real = model('api/UserData')->real_name_info($user_id);
|
||||
if($is_real['code']==0){
|
||||
return ['code' => 0, 'msg' => '请先实名认证','data' => null];
|
||||
}else{
|
||||
if($is_real['data']['is_real'] !=1){
|
||||
return ['code' => 0, 'msg' => '请先实名认证','data' => null];
|
||||
}
|
||||
}
|
||||
//公会是否存在
|
||||
$guild_info = db::name('vs_guild')->where(['id'=>$guild_id,'delete_time'=>0])->find();
|
||||
if(!$guild_info){
|
||||
return ['code' => 0, 'msg' => '该公会不存在', 'data' => null];
|
||||
}
|
||||
$is_check_join = Db::name('vs_guild_user')->where(['user_id'=>$user_id,'delete_time'=>0])->find();
|
||||
if($is_check_join && $is_check_join['guild_id']==$guild_id && $is_check_join['status']==1){
|
||||
return ['code'=>0,'msg'=>'您已加入该工会', 'data' => null];
|
||||
}
|
||||
if($is_check_join && $is_check_join['guild_id']==$guild_id && $is_check_join['status']==2){
|
||||
return ['code'=>0,'msg'=>'您已提交申请,请耐心等待', 'data' => null];
|
||||
}
|
||||
if($is_check_join && $is_check_join['guild_id']!=$guild_id && $is_check_join['status']==1){
|
||||
return ['code'=>0,'msg'=>'您已加入别的工会,请先退出公会再加入', 'data' => null];
|
||||
}
|
||||
if($is_check_join && $is_check_join['guild_id']!=$guild_id && $is_check_join['status']==2){
|
||||
$other_guild_name = Db::name('vs_guild')->where(['id'=>$is_check_join['guild_id']])->value('guild_name');
|
||||
return ['code'=>0,'msg'=>'您已申请加入工会'.$other_guild_name.',请等待会长审核', 'data' => null];
|
||||
}
|
||||
//是否被踢出过
|
||||
// $ti_chu = db::name('vs_guild_user')->where(['user_id'=>$user_id,'guild_id'=>$guild_id,'delete_time'=>['<>',0],'quit_type'=>2])->find();
|
||||
// if(!empty($ti_chu)){
|
||||
// return ['code' => 0, 'msg' => '已被踢出,禁止加入!', 'data' => null];
|
||||
// }
|
||||
//退出公会是否超过30天
|
||||
$map = [];
|
||||
$map['user_id'] = $user_id;
|
||||
$map['delete_time'] = ['<>',0];
|
||||
$map['quit_type'] = 1;
|
||||
$quit_guild_info = Db::name('vs_guild_user')->where($map)->order('quit_time', 'desc')->field('quit_time,guild_id,quit_type')->find();
|
||||
if(!empty($quit_guild_info)) {
|
||||
$quit_time = empty($quit_guild_info['quit_time']) ? 0 : $quit_guild_info['quit_time'];
|
||||
$quit_type = $quit_guild_info['quit_type'];
|
||||
if($quit_guild_info['guild_id'] != $guild_id) {
|
||||
$last_time = 30 * 24 * 3600;
|
||||
if((time() - $last_time) <= $quit_time) {
|
||||
return ['code' => 0, 'msg' => '退出公会未超过30天,不能重新加入其他公会', 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
//是否有房间
|
||||
$rid = 0;
|
||||
$room_info = db::name('vs_room')->where(['user_id'=>$user_id,'delete_time'=>0,'type_id'=>['<>',6]])->find();
|
||||
if($room_info){
|
||||
$rid = $room_info['id'];
|
||||
}
|
||||
$insert_data = [];
|
||||
$insert_data['user_id'] = $user_id;
|
||||
$insert_data['guild_id'] = $guild_id;
|
||||
$insert_data['room_id'] = $rid;
|
||||
$insert_data['status'] = 1;
|
||||
$insert_data['is_deacon'] = 2;
|
||||
$insert_data['createtime'] = time();
|
||||
$insert_data['apply_time'] = time();
|
||||
$insert_data['is_show_room'] = 1;
|
||||
//结算比例
|
||||
$configs = get_system_config();
|
||||
//收礼人最终的收益比例 = 未加入工会的收益 + 加入工会的收益
|
||||
if($settlement_ratio){
|
||||
$insert_data['settlement_ratio'] = $settlement_ratio;
|
||||
}else{
|
||||
$insert_data['settlement_ratio'] = $configs['room_gift_ratio'] + $configs['room_gift_guild_ratio'];
|
||||
}
|
||||
$reslut = db::name('vs_guild_user')->insert($insert_data);
|
||||
if($reslut){
|
||||
//增加公会人数
|
||||
db::name('vs_guild')->where('id', $guild_info['id'])->setInc('num', 1);
|
||||
//拉用户进入工会群聊
|
||||
if($guild_id<=95){ //事故处理-114以前的群被删了
|
||||
$guild_id = "g".$guild_id;
|
||||
}
|
||||
model('api/Tencent')->add_group_member('g'.$guild_id, $user_id);
|
||||
model('api/Tencent')->send_group_system_notification('g'.$guild_id,"欢迎".$user_info['nickname'].'加入公会');
|
||||
//发系统信息
|
||||
$content = "恭喜加入{$guild_info['guild_name']}工会,您的个人收益增加{$configs['room_gift_guild_ratio']}%,目前总收益{$insert_data['settlement_ratio']}%";
|
||||
model('api/UserMessage')->send_system_message($user_id, "加入公会成功通知", $content, 1);
|
||||
//处理新手任务
|
||||
model('api/Tasks')->tasks_complete($user_id,11);
|
||||
return ['code' => 1, 'msg' => '提交成功', 'data' => null];
|
||||
}else{
|
||||
return ['code' => 0, 'msg' => '提交失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
//工会邀请用户处理
|
||||
public function guild_invite_handle($user_id,$message_id,$status){
|
||||
$guild_user_invited = Db::name('vs_guild_user_invited')->where(['message_id'=>$message_id,'delete_time'=>0])->find();
|
||||
if(empty($guild_user_invited)){
|
||||
return ['code' => 0, 'msg' => '邀请信息不存在', 'data' => null];
|
||||
}
|
||||
if($user_id != $guild_user_invited['user_id']){
|
||||
return ['code' => 0, 'msg' => '您没有权限处理此信息', 'data' => null];
|
||||
}
|
||||
if($guild_user_invited['status'] != 0){
|
||||
return ['code' => 0, 'msg' => '此邀请信息已处理过', 'data' => null];
|
||||
}
|
||||
if($status == 1){
|
||||
//加入工会
|
||||
$res = $this->join_guild($guild_user_invited['guild_id'],$guild_user_invited['user_id'],$guild_user_invited['settlement_ratio']);
|
||||
if($res['code'] != 1){
|
||||
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
|
||||
}
|
||||
$guild_user_invited_data = [
|
||||
'status' => 1,
|
||||
'apply_time' => time(),
|
||||
'updatetime' => time(),
|
||||
];
|
||||
}else{
|
||||
$guild_user_invited_data = [
|
||||
'status' => 2,
|
||||
'apply_time' => time(),
|
||||
'updatetime' => time(),
|
||||
];
|
||||
}
|
||||
$guild_user_invited_res = Db::name('vs_guild_user_invited')->where(['message_id'=>$message_id,'delete_time'=>0])->update($guild_user_invited_data);
|
||||
if($guild_user_invited_res){
|
||||
return ['code' => 1, 'msg' => '处理成功', 'data' => null];
|
||||
}else{
|
||||
return ['code' => 0, 'msg' => '处理失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
//公会调整收益审核接口
|
||||
public function user_ratio_up_apply($user_id,$message_id,$status){
|
||||
$guild_user_ratio_up = Db::name('vs_guild_user_ratio_up_log')->where(['message_id'=>$message_id,'delete_time'=>0])->find();
|
||||
if(empty($guild_user_ratio_up)){
|
||||
return ['code' => 0, 'msg' => '邀请信息不存在', 'data' => null];
|
||||
}
|
||||
if($user_id != $guild_user_ratio_up['user_id']){
|
||||
return ['code' => 0, 'msg' => '您没有权限处理此信息', 'data' => null];
|
||||
}
|
||||
if($guild_user_ratio_up['status'] != 0){
|
||||
return ['code' => 0, 'msg' => '此邀请信息已处理过', 'data' => null];
|
||||
}
|
||||
if($status == 1){
|
||||
//处理结算比例
|
||||
$res = db::name('vs_guild_user')->where(['id'=>$guild_user_ratio_up['guild_user_id']])->update(['settlement_ratio'=>$guild_user_ratio_up['settlement_ratio']]);
|
||||
if($res){
|
||||
$data = [
|
||||
'status' => 1,
|
||||
'apply_time' => time(),
|
||||
'updatetime' => time(),
|
||||
];
|
||||
$guild_user_res = Db::name('vs_guild_user_ratio_up_log')->where(['message_id'=>$message_id,'delete_time'=>0])->update($data);
|
||||
if($guild_user_res){
|
||||
return ['code' => 1, 'msg' => '处理成功', 'data' => null];
|
||||
}else{
|
||||
return ['code' => 0, 'msg' => '处理失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
$data = [
|
||||
'status' => 2,
|
||||
'apply_time' => time(),
|
||||
'updatetime' => time(),
|
||||
];
|
||||
$guild_user_res = Db::name('vs_guild_user_ratio_up_log')->where(['message_id'=>$message_id,'delete_time'=>0])->update($data);
|
||||
if($guild_user_res){
|
||||
return ['code' => 1, 'msg' => '处理成功', 'data' => null];
|
||||
}else{
|
||||
return ['code' => 0, 'msg' => '处理失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//公会流水记录
|
||||
public function guild_flow($room_id,$flow_price,$give_gift_id=0){
|
||||
if($room_id<=0 || $flow_price<=0){
|
||||
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
|
||||
}
|
||||
$guild_user_info = Db::name('vs_guild_user')->where(['room_id' => $room_id, 'delete_time' => 0, 'status' => 1, 'quit_time' => 0])->find();
|
||||
if ($guild_user_info) {
|
||||
//记录流水
|
||||
$data = [
|
||||
'guild_id' => $guild_user_info['guild_id'],
|
||||
'room_id' => $guild_user_info['room_id'],
|
||||
'give_gift_id' => $give_gift_id,
|
||||
'flow_price' => $flow_price,
|
||||
'day' => date('Y-m-d'),
|
||||
'createtime' => time(),
|
||||
'updatetime' => time(),
|
||||
];
|
||||
$res = Db::name('vs_guild_flow')->insert($data);
|
||||
if (!$res) {
|
||||
return ['code' => 0, 'msg' => '提交失败', 'data' => null];
|
||||
}
|
||||
//增加用户公会流水
|
||||
Db::name('vs_guild_user')->where(['id' => $guild_user_info['id']])->setInc('coin', $flow_price);
|
||||
//增加公会总流水
|
||||
Db::name('vs_guild')->where(['id' => $guild_user_info['guild_id']])->setInc('income', $flow_price);
|
||||
return ['code' => 1, 'msg' => '提交成功', 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class HeadLine extends Model
|
||||
}
|
||||
}
|
||||
//检测用户余额
|
||||
$user_coin = model('UserWallet')->where('user_id' ,$uid)->value('coin');
|
||||
$user_coin = db::name('user_wallet_coin')->where('user_id' ,$uid)->value('coin');
|
||||
if($user_coin < $money) {
|
||||
return ['code' => 0, 'msg' => '余额不足!', 'data' => null];
|
||||
}
|
||||
@@ -81,26 +81,13 @@ class HeadLine extends Model
|
||||
}
|
||||
|
||||
//扣除用户余额
|
||||
$res4 = model('UserWallet')->where('user_id' ,$uid)->setDec('coin', $money);
|
||||
if(!$res4) {
|
||||
$wallet_update = model('api/UserWallet')->change_user_cion_log($uid,$money,$room_id,20,'发布头条');
|
||||
if(!$wallet_update){
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '扣除用户余额失败!', 'data' => null];
|
||||
return ['code' => 0, 'msg' => '网络错误-1', 'data' => null];
|
||||
}
|
||||
//记录扣除用户余额
|
||||
$res5 =db::name('vs_user_money_log')->insert([
|
||||
'user_id' => $uid,
|
||||
'change_type' => 20,
|
||||
'money_type' => 1,
|
||||
'change_value' => $money,
|
||||
'from_id' => $res3,
|
||||
'remarks' => '发布头条扣除余额',
|
||||
'createtime' => time(),
|
||||
]);
|
||||
if(!$res5) {
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '记录扣除用户余额失败!', 'data' => null];
|
||||
}
|
||||
//给所有直播间发送消息 这个接口是要钱的 需要购买 暂时先藏起来
|
||||
|
||||
//给所有直播间发送消息
|
||||
$ToUserInfo = Db::name('user')->where(['id' => $uid])->field('id as user_id,nickname,avatar,sex')->find();
|
||||
$text = [
|
||||
'type' => 1,
|
||||
|
||||
@@ -57,36 +57,25 @@ class Invited extends Model
|
||||
}
|
||||
|
||||
//下级充值推荐人收益计算
|
||||
public function invited_reward($sub_user_id,$money){
|
||||
//查询上级
|
||||
$invited_user_id = $this->where('sub_user_id', $sub_user_id)->value('user_id');
|
||||
if(!$invited_user_id){
|
||||
return ['code' => 0, 'msg' => "未绑定上级用户", 'data' => null];
|
||||
public function invited_reward($sub_user_id,$money,$invited_user_id){
|
||||
//查询下级用户充值总金额
|
||||
$sub_user_all_money = db::name('vs_user_recharge')
|
||||
->where('user_id', $sub_user_id)
|
||||
->where('pay_status',2)->sum('money');
|
||||
if($sub_user_all_money > 1000){
|
||||
return ['code' => 1, 'msg' => "下级充值金额大于1000元不需返利", 'data' => null];
|
||||
}
|
||||
|
||||
$invited_draw_conf = get_system_config_value('invited_draw');//分成比例
|
||||
$invited_draw = $invited_draw_conf / 100;
|
||||
$invited_draw_money = $money * $invited_draw;
|
||||
$invited_draw_money = $invited_draw_money / intval(get_system_config_value('rmb_coin_ratio')); //金币换算成钻石
|
||||
//修改用户资金
|
||||
$reslut = model('common/UserWallet')->change_user_money($invited_user_id, $invited_draw_money, model('common/UserWallet')::MONEYTYPEARNINGS, model('common/UserWallet')::OPERATION_INVITE_REBATE, '邀请用户充值返利');
|
||||
if($reslut['code'] == 1){
|
||||
//记录日志
|
||||
$data = [];
|
||||
$data['user_id'] = $invited_user_id;
|
||||
$data['sub_user_id'] = $sub_user_id;
|
||||
$data['coin'] = $money;
|
||||
$data['earnings'] = $invited_draw_money;
|
||||
$data['proportion'] = $invited_draw_conf;
|
||||
$data['createtime'] = time();
|
||||
$data['updatetime'] = time();
|
||||
$res = Db::name('vs_user_invited_income_log')->insert($data);
|
||||
if ($res) {
|
||||
//增加余额并记录日志
|
||||
$wallet_update = model('api/UserWallet')->change_user_earnings_log($invited_user_id,$invited_draw_money,0,6,'邀请用户充值返利');
|
||||
if(!$wallet_update){
|
||||
return ['code' => 0, 'msg' => "邀请给上级返利失败", 'data' => null];
|
||||
}
|
||||
return ['code' => 1, 'msg' => "操作成功", 'data' => null];
|
||||
}
|
||||
}else{
|
||||
return ['code' => $reslut['code'], 'msg' => $reslut['code'], 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
//账单明细
|
||||
public function get_bill_list($user_id,$page=1,$page_size=10){
|
||||
|
||||
@@ -62,7 +62,7 @@ class Level extends Model
|
||||
//获取等级
|
||||
// 获取用户当前等级
|
||||
$currentUserLevel = $user['charm_level'];
|
||||
if($currentUserLevel == 1){
|
||||
if($currentUserLevel == 0){
|
||||
$level = Db::name('vs_charm_level')
|
||||
->where('status', 1)
|
||||
->order('level', 'asc')
|
||||
@@ -152,7 +152,7 @@ class Level extends Model
|
||||
//获取等级
|
||||
// 获取用户当前等级
|
||||
$currentUserLevel = $user['wealth_level'];
|
||||
if($currentUserLevel == 1){
|
||||
if($currentUserLevel == 0){
|
||||
$level = Db::name('vs_wealth_level')
|
||||
->where('status', 1)
|
||||
->order('level', 'asc')
|
||||
@@ -277,6 +277,44 @@ class Level extends Model
|
||||
return $return;
|
||||
}
|
||||
|
||||
/*
|
||||
* 通过等级获取魅力等级信息
|
||||
*
|
||||
*/
|
||||
public function get_singer_level_to_level($level){
|
||||
$return = [];
|
||||
$level_data = Db::name('vs_singer_level')->where('level', $level)->find();
|
||||
$next_level_data = Db::name('vs_singer_level')->where('level', $level+1)->find();
|
||||
if($level_data){
|
||||
$return['level'] = $level_data['level'];
|
||||
$return['level_name'] = $level_data['name'];
|
||||
$return['exp'] = $level_data['change_value'];
|
||||
$return['level_icon'] = $level_data['image'];
|
||||
$return['rights_icon'] = $level_data['rights_icon'];
|
||||
}else{
|
||||
$return['level'] = 0;
|
||||
$return['level_name'] = '';
|
||||
$return['exp'] = 0;
|
||||
$return['level_icon'] = '';
|
||||
$return['rights_icon'] = "";
|
||||
}
|
||||
|
||||
if($next_level_data){
|
||||
$return['next_level'] = $next_level_data['level'];
|
||||
$return['next_level_name'] = $next_level_data['name'];
|
||||
$return['next_level_exp'] = $next_level_data['change_value'];
|
||||
$return['next_level_icon'] = $next_level_data['image'];
|
||||
$return['next_rights_icon'] = $next_level_data['rights_icon'];
|
||||
}else{
|
||||
$return['next_level'] = $level_data['level'];
|
||||
$return['next_level_name'] = $level_data['name'];
|
||||
$return['next_level_exp'] = $level_data['change_value'];
|
||||
$return['next_level_icon'] = $level_data['image'];
|
||||
$return['next_rights_icon'] = $level_data['rights_icon'];
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/*
|
||||
* 用户财富/魅力等级更新
|
||||
* @param uid 用ID
|
||||
@@ -459,4 +497,103 @@ class Level extends Model
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
//歌手等级
|
||||
public function get_singer_level($uid){
|
||||
//经验值兑换金币比例
|
||||
$return['singer_coin_exp'] = get_system_config_value('singer_coin_exp');
|
||||
//用户信息
|
||||
$user = model('User')->get_user_info($uid);
|
||||
//用户头像
|
||||
$return['user']['user_avatar'] = $user['avatar'];
|
||||
//当前用户等级信息
|
||||
$singer = db::name('vs_singer')->where(['user_id' => $uid])->find();
|
||||
if(empty($singer)){
|
||||
$singer['level'] = 0;
|
||||
$singer['exp'] = 0;
|
||||
$singer['status'] = 0;
|
||||
$singer['level_name'] = '非歌手';
|
||||
}
|
||||
$user_level = $this->get_singer_level_to_level($singer['level']);
|
||||
if(!$user_level){
|
||||
return ['code' => 0, 'msg' => "数据配置有误 请联系管理员", 'data' => null];
|
||||
}
|
||||
// 获取最后等级
|
||||
$level_last = Db::name('vs_singer_level')
|
||||
->where('deletetime',0)
|
||||
->order('level', 'desc')
|
||||
->value('level');
|
||||
//用户当前经验
|
||||
$return['user']['level'] = $singer['level'];
|
||||
$return['user']['level_str'] = 'Lv.'.$singer['level'];
|
||||
$return['user']['exp'] = $singer['exp'];
|
||||
$return['user']['rights_icon'] = $user_level['rights_icon'];
|
||||
if($singer['level'] ==$level_last ){
|
||||
//距离下个等级需要的经验
|
||||
$return['user']['next_level'] = 0;
|
||||
$return['user']['next_level_str'] = "满级";
|
||||
$return['user']['next_exp'] = 0;
|
||||
$return['user']['next_rights_icon'] = "";
|
||||
}else{
|
||||
//距离下个等级需要的经验
|
||||
$return['user']['next_level'] = $user_level['next_level'];
|
||||
$return['user']['next_level_str'] = 'Lv.'.$return['user']['next_level'];
|
||||
$next_exp = $user_level['next_level_exp'] - $singer['exp'];
|
||||
$return['user']['next_exp'] = $next_exp <= 0 ? 0 : $next_exp;
|
||||
$return['user']['next_rights_icon'] = $user_level['next_rights_icon'];
|
||||
}
|
||||
//获取等级
|
||||
// 获取用户当前等级
|
||||
$currentUserLevel = $singer['level'];
|
||||
if($currentUserLevel == 0){
|
||||
$level = Db::name('vs_singer_level')
|
||||
->where('deletetime',0)
|
||||
->order('level', 'asc')
|
||||
->limit(3)
|
||||
->select();
|
||||
}elseif($currentUserLevel == $level_last){
|
||||
$limit_s = $level_last-2;
|
||||
if($limit_s < 0){
|
||||
$limit_s = 0;
|
||||
}
|
||||
$level = Db::name('vs_singer_level')
|
||||
->where('deletetime',0)
|
||||
->order('level', 'asc')
|
||||
->limit($limit_s,3)
|
||||
->select();
|
||||
}else{
|
||||
$level = Db::name('vs_singer_level')
|
||||
->where('deletetime',0)
|
||||
->where('level', 'in', [$currentUserLevel - 1, $currentUserLevel, $currentUserLevel + 1])
|
||||
->order('level', 'asc')
|
||||
->select();
|
||||
}
|
||||
$return['level'] = [];
|
||||
if($level) {
|
||||
foreach ($level as $key => $value) {
|
||||
$return['level'][$key]['level'] = $value['level'];
|
||||
$return['level'][$key]['image'] = $value['image'];
|
||||
$return['level'][$key]['bg_image'] = $value['bg_image'];
|
||||
$return['level'][$key]['color'] = $value['color'];
|
||||
$return['level'][$key]['name'] = $value['name'];
|
||||
$return['level'][$key]['change_value'] = $value['change_value'];
|
||||
//当前用户距离当前段位的距离
|
||||
$return['level'][$key]['distance'] = $value['change_value'] - $singer['exp'];
|
||||
$return['level'][$key]['rights_icon'] = $value['rights_icon'];
|
||||
}
|
||||
}
|
||||
$level_list = Db::name('vs_singer_level')
|
||||
->where('deletetime',0)
|
||||
->order('level', 'asc')
|
||||
->select();
|
||||
$return['level_list'] = [];
|
||||
$exp_s = 0;
|
||||
foreach ($level_list as $key => $value) {
|
||||
$return['level_list'][$key]['level'] = 'LV.'.$value['level'];
|
||||
$return['level_list'][$key]['exp_str'] = $exp_s.'-'.$value['change_value'];
|
||||
$return['level_list'][$key]['image'] = $value['image'];
|
||||
$exp_s = $value['change_value'];
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => $return];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace app\api\model;
|
||||
use fast\Http;
|
||||
use think\Db;
|
||||
use think\Model;
|
||||
use think\facade\Env;
|
||||
use app\common\library\Token as TokenLib;
|
||||
|
||||
class Login extends Model
|
||||
{
|
||||
@@ -17,12 +17,27 @@ class Login extends Model
|
||||
if ($block) {
|
||||
return ['code' => 0, 'msg' => '设备已被封禁', 'data' => null];
|
||||
}
|
||||
$ip = request()->ip();
|
||||
$block = db::name('block')->where(['type_text' => $ip,'type' => 3])->find();
|
||||
//获取请求ip
|
||||
$login_ip = request()->server('HTTP_X_REAL_IP') ?: request()->server('HTTP_X_FORWARDED_FOR') ?: request()->ip();
|
||||
if (empty($login_ip)) {
|
||||
return ['code' => 0, 'msg' => '无法获取客户端IP地址', 'data' => null];
|
||||
}
|
||||
|
||||
$block = db::name('block')->where(['type_text' => $login_ip,'type' => 3])->find();
|
||||
if ($block) {
|
||||
return ['code' => 0, 'msg' => 'ip已被封禁', 'data' => null];
|
||||
}
|
||||
|
||||
if($user_name){
|
||||
$config_time = get_system_config_value('cancel_no_login');
|
||||
$is_del = db::name('user')->where(['mobile' => $user_name,'delete_time' => ['<>', 0]])->find();
|
||||
if ($is_del) {
|
||||
if (time() - $is_del['delete_time'] < $config_time * 24 * 3600) {//30天内注销过
|
||||
return V(0, '注销30天内,不可操作。');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$user_code = $this->get_user_code(); //获取用户code_id 过滤靓号
|
||||
|
||||
@@ -30,10 +45,10 @@ class Login extends Model
|
||||
$data['username'] = $user_name;
|
||||
$data['mobile'] = $user_name;
|
||||
$data['nickname'] = '游客'.$user_code;
|
||||
$data['joinip'] = request()->ip();
|
||||
$data['birthday'] = date('Y-m-d');
|
||||
$data['joinip'] = $login_ip;
|
||||
$data['birthday'] = '1990-01-01';
|
||||
$data['avatar'] = get_system_config_value('web_site').'/data/avatar/head_pic.png';
|
||||
$data['profile'] = '这个人很懒,什么都没写';
|
||||
$data['profile'] = '这个人很佛系,什么都没写';
|
||||
$data['system'] = $system;
|
||||
$data['login_device'] = $login_device;
|
||||
$data['createtime'] = time();
|
||||
@@ -96,6 +111,11 @@ class Login extends Model
|
||||
$return_res[0]['auth'] = 0;
|
||||
$return_res[0]['icon'][0] = model('UserData')->user_wealth_icon($user_id);//财富图标
|
||||
$return_res[0]['icon'][1] = model('UserData')->user_charm_icon($user_id);//魅力图标
|
||||
//判断是否是歌手 如果是 返回等级图标
|
||||
$isSinger = db::name('vs_singer')->where(['user_id' => $user_id,'status' => 1])->find();
|
||||
if($isSinger){
|
||||
$return_res[0]['icon'][2] = db::name('vs_singer_level')->where(['level' => $isSinger['level'],'deletetime' => 0])->value('image');//等级图标
|
||||
}
|
||||
|
||||
return ['code' => 1, 'msg' => '登录成功', 'data' => $return_res];
|
||||
}
|
||||
@@ -133,7 +153,7 @@ class Login extends Model
|
||||
}
|
||||
}
|
||||
}
|
||||
$ip = request()->ip();
|
||||
$ip = request()->server('HTTP_X_REAL_IP') ?: request()->server('HTTP_X_FORWARDED_FOR') ?: request()->ip();
|
||||
$block = db::name('block')->where(['type_text' => $ip,'type' => 3])->find();
|
||||
if ($block) {
|
||||
if($block['block_time'] != 0 && $block['block_time'] <= time()){
|
||||
@@ -183,9 +203,10 @@ class Login extends Model
|
||||
$save_data['system'] = $system;
|
||||
$save_data['login_device'] = $login_device;
|
||||
$save_data['logintime'] = time();
|
||||
$save_data['loginip'] = request()->ip();
|
||||
$save_data['loginip'] = $ip;
|
||||
$save_data['updatetime'] = time();
|
||||
$save_data['prevtime'] = $user_info['logintime'];//上次登录时间
|
||||
$save_data['is_online'] = 1;
|
||||
$reslut = model('User')->update($save_data);
|
||||
|
||||
if (!$reslut) {
|
||||
@@ -202,6 +223,14 @@ class Login extends Model
|
||||
$return_res[0]['mobile'] = $user_info['mobile'];
|
||||
$return_res[0]['icon'][0] = model('UserData')->user_wealth_icon($user_info['id']);//财富图标
|
||||
$return_res[0]['icon'][1] = model('UserData')->user_charm_icon($user_info['id']);//魅力图标
|
||||
//判断是否是歌手 如果是 返回等级图标
|
||||
$isSinger = db::name('vs_singer')->where(['user_id' => $user_info['id'],'status' => 1])->find();
|
||||
if($isSinger){
|
||||
$return_res[0]['icon'][2] = db::name('vs_singer_level')->where(['level' => $isSinger['level'],'deletetime' => 0])->value('image');//等级图标
|
||||
}
|
||||
|
||||
$return_res[0]['dress'] = model('Decorate')->user_decorate_detail($user_info['id'],1);
|
||||
$return_res[0]['chat_bubble'] = model('Decorate')->user_decorate_detail($user_info['id'],9);//聊天气泡
|
||||
|
||||
$isAuth = 0;
|
||||
if($user_info['mobile']){
|
||||
@@ -219,7 +248,6 @@ class Login extends Model
|
||||
$return_res[0]['is_can_chat'] = 1;
|
||||
}
|
||||
$return_res[0]['can_chat_money'] = $config_money;
|
||||
|
||||
return ['code' => 1, 'msg' => '登录成功', 'data' => $return_res];
|
||||
}else{
|
||||
return ['code' => 0, 'msg' => '登录失败,账号失效', 'data' => null];
|
||||
@@ -363,21 +391,21 @@ class Login extends Model
|
||||
if($type == 'wx'){
|
||||
$openid = $userinfo['openid'];
|
||||
$user_info_data = model('UserData')->where(['wx_openid' => $openid,'deletetime'=>0])->find();
|
||||
$config_time = get_system_config_value('cancel_to_reset_reg');
|
||||
$config_time = get_system_config_value('cancel_no_login');
|
||||
if(isset($user_info_data) && $user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
|
||||
}
|
||||
}elseif ($type == 'ali'){
|
||||
$ali_userid = $userinfo['open_id'];
|
||||
$user_info_data = model('UserData')->where(['ali_userid' => $ali_userid,'deletetime'=>0])->find();
|
||||
$config_time = get_system_config_value('cancel_to_reset_reg');
|
||||
$config_time = get_system_config_value('cancel_no_login');
|
||||
if(isset($user_info_data) && $user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
|
||||
}
|
||||
}elseif ($type == 'ios'){
|
||||
$apple_id = $userinfo;
|
||||
$user_info_data = model('UserData')->where(['apple_id' => $userinfo,'deletetime'=>0])->find();
|
||||
$config_time = get_system_config_value('cancel_to_reset_reg');
|
||||
$config_time = get_system_config_value('cancel_no_login');
|
||||
if(isset($user_info_data) && $user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
|
||||
}
|
||||
@@ -402,6 +430,12 @@ class Login extends Model
|
||||
$return_res[0]['auth'] = 0;
|
||||
$return_res[0]['icon'][0] = model('UserData')->user_wealth_icon($user_info_data['user_id']);//财富图标
|
||||
$return_res[0]['icon'][1] = model('UserData')->user_charm_icon($user_info_data['user_id']);//魅力图标
|
||||
//判断是否是歌手 如果是 返回等级图标
|
||||
$isSinger = db::name('vs_singer')->where(['user_id' => $user_info_data['user_id'],'status' => 1])->find();
|
||||
if($isSinger){
|
||||
$return_res[0]['icon'][2] = db::name('vs_singer_level')->where(['level' => $isSinger['level'],'deletetime' => 0])
|
||||
->value('image');//等级图标
|
||||
}
|
||||
return ['code' => 1, 'msg' => '登录成功', 'data' => $return_res];
|
||||
}
|
||||
|
||||
@@ -434,9 +468,19 @@ class Login extends Model
|
||||
|
||||
//退出登录
|
||||
public function logout($token){
|
||||
$user_info = model('UserToken')->where('token', $token)->find();
|
||||
$user_info = db::name('user_token')->where('token', $token)->find();
|
||||
if($user_info){
|
||||
model('UserToken')->where('id', $user_info['id'])->update(['token' => 1]);
|
||||
db::name('user_token')->where('id', $user_info['id'])->update(['token' => 1]);
|
||||
//断线
|
||||
db::name('user')->where('id',$user_info['user_id'])->update(['is_online'=>2]);
|
||||
//是否在房间内
|
||||
$room_id = db::name('vs_room_visitor')->where('user_id',$user_info['user_id'])->order('id desc')->value('room_id');
|
||||
if($room_id){
|
||||
$text['text'] = '掉线!';
|
||||
$text['user_id'] = $user_info['user_id'];
|
||||
$text['type'] = 2;
|
||||
model('Chat')->sendMsg(1058,$room_id,$text);
|
||||
}
|
||||
return ['code' => 1, 'msg' => '退出成功', 'data' => null];
|
||||
}else{
|
||||
return ['code' => 0, 'msg' => '退出失败', 'data' => null];
|
||||
@@ -444,7 +488,7 @@ class Login extends Model
|
||||
}
|
||||
|
||||
//注销
|
||||
public function cancel($token){
|
||||
public function cancel($token,$system,$login_device){
|
||||
$user_info = model('UserToken')->where('token', $token)->find();
|
||||
//用户注册时间
|
||||
$register_time = db::name('user')->where('id', $user_info['user_id'])->value('createtime');
|
||||
@@ -452,40 +496,46 @@ class Login extends Model
|
||||
if(time() - $register_time < 86400 * $config_time){
|
||||
return ['code' => 0, 'msg' => '注册'.$config_time.'天内不能注销!', 'data' => null];
|
||||
}
|
||||
|
||||
if($user_info){
|
||||
model('UserToken')->where('id', $user_info['id'])->update(['token' => 1]);
|
||||
$isstatus = model('User')->where('id', $user_info['user_id'])->update(['status' => 0]);
|
||||
$isstatus = model('User')->where('id', $user_info['user_id'])->update([
|
||||
'status' => 0,
|
||||
'delete_time' => time(),
|
||||
'login_device' => $login_device,
|
||||
'system' =>$system,
|
||||
'avatar' => get_system_config_value('delete_avatar'),
|
||||
'nickname' => '注销用户'
|
||||
]);
|
||||
if($isstatus){
|
||||
//查询用户所在房间
|
||||
$room_list = db::name('vs_room_visitor')->where('user_id', $user_info['user_id'])->select();
|
||||
if($room_list){
|
||||
foreach ($room_list as &$value) {
|
||||
foreach ($room_list as $value) {
|
||||
model('Room')->quit_room($user_info['user_id'], $value['room_id'],$user_info['user_id']);
|
||||
}
|
||||
}
|
||||
//删除用户
|
||||
// model('Tencent')->account_delete($user_info['user_id']);
|
||||
model('User')->where('id', $user_info['user_id'])->update(['delete_time' => time()]);
|
||||
model('User')->where('id', $user_info['user_id'])->update(['avatar' => get_system_config_value('delete_avatar')]);
|
||||
|
||||
model('UserData')->where('user_id', $user_info['user_id'])->update(['deletetime' => time()]);
|
||||
//查询创建的房间
|
||||
$room_list = db::name('vs_room')->where('user_id', $user_info['user_id'])->select();
|
||||
if($room_list){
|
||||
foreach ($room_list as &$value) {
|
||||
foreach ($room_list as $value) {
|
||||
db::name('vs_room')->where('id', $value['id'])->update(['room_status' => 3]);
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
return ['code' => 0, 'msg' => '注销失败', 'data' => null];
|
||||
}
|
||||
|
||||
//查询绑定的手机号
|
||||
$mob = db::name('user')->where('id', $user_info['user_id'])->value('mobile');
|
||||
$mobile = db::name('user')->where(['mobile' => $mob,'status' => ['<>',0]])->select();
|
||||
if(isset($mobile) && count($mobile) < 2){
|
||||
db::name('user_auth')->where('mobile', $mob)->delete();
|
||||
}
|
||||
}else{
|
||||
return ['code' => 0, 'msg' => '注销失败', 'data' => null];
|
||||
}
|
||||
// 删除这个Token,使其失效
|
||||
TokenLib::delete($token);
|
||||
|
||||
return ['code' => 1, 'msg' => '注销成功', 'data' => null];
|
||||
}else{
|
||||
|
||||
207
application/api/model/Lottery.php
Normal file
207
application/api/model/Lottery.php
Normal file
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use app\common\controller\Push;
|
||||
use app\common\service\LotteryService;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use think\Log;
|
||||
use think\Model;
|
||||
|
||||
class Lottery extends Model
|
||||
{
|
||||
/**
|
||||
* 送礼参与抽奖接口
|
||||
* @return json
|
||||
*/
|
||||
public function gift($send_uid, $recv_uid,$gift_id, $room_id, $num)
|
||||
{
|
||||
if (ceil($num) != $num) {
|
||||
return ['code' => 0, 'msg' => '打赏礼物数量必须为整数', 'data' => null];
|
||||
}
|
||||
$toarray = explode(',',$recv_uid);
|
||||
if(in_array($send_uid,$toarray)){
|
||||
return ['code' => 0, 'msg' => '收礼人不能包含自己', 'data' => null];
|
||||
}
|
||||
|
||||
//获取礼物信息
|
||||
$gift_info = Db::name('vs_gift')->where(['gid'=>$gift_id])
|
||||
->field('gid as gift_id,gift_name,gift_price,file_type,base_image,play_image,gift_type,label,is_public_server')->find();
|
||||
$gift_info['play_image'] = '';//不要特效
|
||||
|
||||
//送给所有人的总价格
|
||||
$all_gift_price = $gift_info['gift_price'] * $num * count($toarray);
|
||||
//判断是否有足够的金币
|
||||
$user_waller = db::name('user_wallet_coin')->where(['user_id'=>$send_uid])->find();
|
||||
if ($user_waller['coin'] < $all_gift_price) {
|
||||
return ['code' => 0, 'msg' => '用户金币不足', 'data' => null];
|
||||
}
|
||||
|
||||
//获取送礼用户昵称
|
||||
$FromUserInfo = db::name('user')->where('id',$send_uid)->field('id as user_id,nickname,avatar,sex')->find();
|
||||
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($send_uid);//财富图标
|
||||
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($send_uid);//魅力图标
|
||||
$FromUserInfo['chat_bubble'] = model('Decorate')->user_decorate_detail($send_uid,9);//聊天气泡
|
||||
|
||||
//送礼 开启事务
|
||||
Db::startTrans();
|
||||
//扣除用户金币并记录日志
|
||||
// $wallet_update = model('api/GiveGift')->change_user_cion_or_earnings_log($send_uid,$all_gift_price,$room_id,1,10,'用户金币购买幸运币礼物');
|
||||
$wallet_update = model('api/UserWallet')->change_user_cion_log($send_uid, $all_gift_price, $room_id, 10, '用户金币购买幸运币礼物');
|
||||
if(!$wallet_update){
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '扣除用户金币失败', 'data' => null];
|
||||
}
|
||||
//用户财富等级更新
|
||||
$user_level = model('api/Level')->user_level_data_update($send_uid,$all_gift_price,1,$room_id);
|
||||
if(!$user_level){
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '用户等级更新失败', 'data' => null];
|
||||
}
|
||||
|
||||
//送给一人礼物的总价格(扣除用户的数额)
|
||||
$gift_price = $gift_info['gift_price'] * $num;
|
||||
|
||||
foreach ($toarray as $k => $to_id){
|
||||
// 1. 记录礼物赠送
|
||||
$giftRecord = [
|
||||
'send_uid' => $send_uid,
|
||||
'recv_uid' => $to_id,
|
||||
'gift_id' => $gift_id,
|
||||
'gift_gold' => $gift_price,
|
||||
'recv_gold' => $gift_price /2 ,
|
||||
'small_pool_add' => $gift_price /2 ,
|
||||
'create_time' => time()
|
||||
];
|
||||
$giftId = Db::name('bb_lottery_gift_record')->insertGetId($giftRecord);
|
||||
|
||||
//收礼记录行为日志
|
||||
$give_gift = model('api/SendGift')->change_user_give_gift_log($send_uid,$gift_id,$gift_price,$num,$to_id,2,1,0,'送幸运币');
|
||||
if(!$give_gift){
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '送礼失败', 'data' => null];
|
||||
}
|
||||
//计算收礼人得益
|
||||
$receiver_earnings = $gift_price /2/get_system_config_value('rmb_coin_ratio');
|
||||
//增加收益并记录日志
|
||||
// $receiver = model('api/GiveGift') -> change_user_cion_or_earnings_log($to_id,$receiver_earnings,$room_id,2,11,'收幸运币礼增加收益');
|
||||
$receiver = model('api/UserWallet')->change_user_earnings_log($to_id,$receiver_earnings,$room_id,11,'收幸运币礼增加收益');
|
||||
|
||||
// //用户魅力等级更新
|
||||
// $user_level = model('api/Level')->user_level_data_update($to_id,$gift_price,2,$room_id);
|
||||
// if(!$user_level){
|
||||
// Db::rollback();
|
||||
// return ['code' => 0, 'msg' => '用户等级更新失败', 'data' => null];
|
||||
// }
|
||||
//增加房间幸运值
|
||||
db::name('vs_room')->where(['id' => $room_id])->setInc('luck_value',$gift_price);
|
||||
db::name('vs_room_luck_value')->insert( [
|
||||
'room_id' => $room_id,
|
||||
'send_uid' => $send_uid,
|
||||
'recv_uid' => $to_id,
|
||||
'gift_id' => $gift_id,
|
||||
'num' => $num,
|
||||
'luck_value' => $gift_price,
|
||||
'createtime' => time()
|
||||
]);
|
||||
|
||||
$ToUserInfo = Db::name('user')->where(['id' => $to_id])->field('id as user_id,nickname,avatar,sex')->find();
|
||||
$ToUserInfo['icon'][0] = model('UserData')->user_wealth_icon($to_id);//财富图标
|
||||
$ToUserInfo['icon'][1] = model('UserData')->user_charm_icon($to_id);//魅力图标
|
||||
$ToUserInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $to_id,'room_id' => $room_id])->value('charm');//魅力
|
||||
$text = $FromUserInfo['nickname'] . ' 送给 ' . $ToUserInfo['nickname'].' 礼物 ' .$gift_info['gift_name'].' x ' .$num;
|
||||
$text = [
|
||||
'FromUserInfo' => $FromUserInfo,
|
||||
'ToUserInfo' => $ToUserInfo,
|
||||
'GiftInfo' => $gift_info,
|
||||
'gift_num' => $num,
|
||||
'text' => $text
|
||||
];
|
||||
//聊天室推送系统消息
|
||||
model('api/Chat')->sendMsg(1005,$room_id,$text);
|
||||
}
|
||||
Db::commit();
|
||||
|
||||
//计算爆币
|
||||
$nums = $num * count($toarray);
|
||||
$ress = $this->lottery($send_uid,$gift_info['gift_price'],$nums,$room_id,$gift_id,$FromUserInfo,$gift_info);
|
||||
if($ress['code'] == 0){
|
||||
return ['code' => 0, 'msg' => $ress['msg'], 'data' => null];
|
||||
}
|
||||
|
||||
return ['code' => 1, 'msg' => '送礼成功', 'data' => null];
|
||||
}
|
||||
|
||||
|
||||
//抽奖
|
||||
public function lottery($send_uid,$gift_price,$num,$room_id,$giftId,$fromUserInfo=null,$gift_info=null)
|
||||
{
|
||||
$big_prize_play_image = db::name('bb_lottery_config')->where(['key' => 'big_prize_play_image'])->value('value');
|
||||
$small_prize_play_image = db::name('bb_lottery_config')->where(['key' => 'small_prize_play_image'])->value('value');
|
||||
try {
|
||||
for($i=0;$i<$num;$i++){
|
||||
$gift_gold = $gift_price;
|
||||
$service = new LotteryService();
|
||||
$reslut = $service->handleGift($send_uid, $gift_gold, $giftId);
|
||||
if ($reslut['code'] == 1) {
|
||||
$result = $reslut['data'];
|
||||
//(未开奖时)
|
||||
if ($result['is_small_prize'] == 0) {
|
||||
//不做处理
|
||||
} else {//开奖
|
||||
// 大奖
|
||||
if ($result['is_big_prize'] == 1) {//$result['big_prize_amount'],//中奖金额
|
||||
$beilv = floor($result['big_prize_amount'] / $gift_price);
|
||||
// $wallet_update = model('api/GiveGift')->change_user_cion_or_earnings_log($send_uid,$result['big_prize_amount'],$room_id,1,58,'参与幸运币活动获得'.$beilv.'倍');
|
||||
$wallet_update = model('api/UserWallet')->change_user_cion_log($send_uid,$result['big_prize_amount'],$room_id,58,'参与幸运币活动获得'.$beilv.'倍');
|
||||
if(!$wallet_update){
|
||||
return ['code' => 0, 'msg' => '流水记录失败', 'data' => null];
|
||||
}
|
||||
|
||||
$tet['text'] = '恭喜用户'.$fromUserInfo['nickname'].'在幸运币活动中获得幸运币'.$beilv.'倍';
|
||||
$tet['type'] = 1;
|
||||
$tet['beilv'] = $beilv;
|
||||
$tet['play_image'] = $big_prize_play_image;
|
||||
} else { // 小奖 $result['small_prize_amount'],//中奖金额
|
||||
$beilv = floor($result['small_prize_amount'] / $gift_price);
|
||||
// $wallet_update = model('api/GiveGift')->change_user_cion_or_earnings_log($send_uid,$result['small_prize_amount'],$room_id,1,58,'参与幸运币活动获得'.$beilv.'倍');
|
||||
$wallet_update = model('api/UserWallet')->change_user_cion_log($send_uid,$result['small_prize_amount'],$room_id,58,'参与幸运币活动获得'.$beilv.'倍');
|
||||
if(!$wallet_update){
|
||||
return ['code' => 0, 'msg' => '流水记录失败', 'data' => null];
|
||||
}
|
||||
|
||||
$tet['text'] = '恭喜用户'.$fromUserInfo['nickname'].'在幸运币活动中获得幸运币'.$beilv.'倍';
|
||||
$tet['type'] = 2;
|
||||
$tet['beilv'] = $beilv;
|
||||
$tet['play_image'] = $small_prize_play_image;
|
||||
}
|
||||
$tet['FromUserInfo'] = $fromUserInfo;
|
||||
$tet['user_id'] = $send_uid;
|
||||
model('api/Chat')->sendMsg(1100,$room_id,$tet);
|
||||
|
||||
$push = new Push($send_uid, $room_id);
|
||||
$room_name = Db::name('vs_room')->where(['id' => $room_id, 'apply_status' => 2])->value('room_name');
|
||||
$text = '恭喜'.$fromUserInfo['nickname'] . '在' . $room_name . '房间获得幸运币'. $beilv . '倍';
|
||||
$text_list_new[] = [
|
||||
'text' => $text,
|
||||
'gift_picture' => $gift_info['base_image'],
|
||||
'room_id' => $room_id,
|
||||
'fromUserName' => $fromUserInfo['nickname'],
|
||||
'toUserName' => '',
|
||||
'giftName' => '',
|
||||
'roomId' => $room_id,
|
||||
'number' => 1,
|
||||
];
|
||||
$push->giftBanner($text_list_new);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ['code' => 1, 'msg' => '送礼成功', 'data' => null];
|
||||
} catch (Exception $e) {
|
||||
Log::error('抽奖处理失败:' . $e->getMessage());
|
||||
return ['code' => 0, 'msg' => $e->getMessage(), 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
58
application/api/model/MarketValue.php
Normal file
58
application/api/model/MarketValue.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use think\Db;
|
||||
use think\Model;
|
||||
|
||||
class MarketValue extends Model
|
||||
{
|
||||
/*
|
||||
* 身价变化
|
||||
* @param int $user_id 用户id
|
||||
* @param int $change_value 身价变化值
|
||||
* @param int $type 0-收礼升值,1-系统降身价,2-使用降身卡,3-签约溢价 涨身价
|
||||
* * @return array
|
||||
*/
|
||||
public function change($user_id,$change_value,$type){
|
||||
$change_value = abs($change_value);
|
||||
$before = db::name('user')->where('id',$user_id)->value('market_value');
|
||||
if($type == 0 || $type == 3){
|
||||
$result = db::name('user')->where('id',$user_id)->setInc('market_value',$change_value);
|
||||
if($result){
|
||||
//记录一条日志
|
||||
db::name('vs_user_market_value_log')->insert([
|
||||
'user_id' => $user_id,
|
||||
'before' => $before,
|
||||
'change_value' => $change_value,
|
||||
'afterwards' => $before + $change_value,
|
||||
'type' => $type,
|
||||
'createtime' => time()
|
||||
]);
|
||||
}
|
||||
}else{
|
||||
//降身价
|
||||
$change = $before-$change_value;
|
||||
if($change <= 1){
|
||||
$afterwards = 1;
|
||||
$result = db::name('user')->where('id',$user_id)->update(['market_value' => 1]);
|
||||
}else{
|
||||
$afterwards = $change;
|
||||
$result = db::name('user')->where('id',$user_id)->setDec('market_value',$change_value);
|
||||
}
|
||||
|
||||
if($result){
|
||||
//记录一条日志
|
||||
db::name('vs_user_market_value_log')->insert([
|
||||
'user_id' => $user_id,
|
||||
'before' => $before,
|
||||
'change_value' => $change_value,
|
||||
'afterwards' => $afterwards,
|
||||
'type' => $type,
|
||||
'createtime' => time()
|
||||
]);
|
||||
}
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功'];
|
||||
}
|
||||
}
|
||||
395
application/api/model/Nobility.php
Normal file
395
application/api/model/Nobility.php
Normal file
@@ -0,0 +1,395 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
use think\Cache;
|
||||
use think\Db;
|
||||
use think\Model;
|
||||
use think\Session;
|
||||
|
||||
class Nobility extends Model
|
||||
{
|
||||
|
||||
// 开启自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
|
||||
public static function init()
|
||||
{
|
||||
self::beforeWrite(function ($row) {
|
||||
});
|
||||
}
|
||||
|
||||
//爵位列表
|
||||
public static function getNobilityList($user_id){
|
||||
//爵位列表
|
||||
$nobility_list = db::name('vs_nobility')
|
||||
->field('lid,name,image,images,pay_price,renew_price,pay_coin,renew_coin,day,power_ids')
|
||||
->where('delete_time', 0)
|
||||
->select();
|
||||
//爵位特权
|
||||
$power_count = db::name('vs_nobility_power')
|
||||
->field('id,name,image')
|
||||
->where('delete_time', 0)
|
||||
->count();
|
||||
$return = [];
|
||||
foreach ($nobility_list as $key => $value) {
|
||||
$power_ids = explode(',', $value['power_ids']);
|
||||
$return[$key]['lid'] = $value['lid'];
|
||||
$return[$key]['name'] = $value['name'];
|
||||
$return[$key]['image'] = $value['image'];
|
||||
$return[$key]['pay_price'] = $value['pay_price'];
|
||||
$return[$key]['day'] = $value['day'];
|
||||
$power_list = db::name('vs_nobility_power')
|
||||
->field('id,name,content,image')
|
||||
->whereIn('id', $power_ids)
|
||||
->where('delete_time', 0)
|
||||
->select();
|
||||
$return[$key]['power']['power_count'] = $power_count;
|
||||
$return[$key]['power']['this_power_count'] = count($power_list);
|
||||
$return[$key]['power']['count_str'] = count($power_list)."/".$power_count;
|
||||
$return[$key]['power']['list'] = $power_list;
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => $return];
|
||||
}
|
||||
|
||||
//爵位详情
|
||||
public static function getNobilityInfo($user_id){
|
||||
$user_info = db::name('user')
|
||||
->field('id as user_id,nickname,avatar')
|
||||
->where('delete_time', 0)
|
||||
->where('id', $user_id)
|
||||
->find();
|
||||
$user_nobility_info = db::name('vs_user_nobility')
|
||||
->field('id,user_id,lid,end_time')
|
||||
->where('delete_time', 0)
|
||||
->where(['end_time'=>['>',time()]])
|
||||
->where('user_id', $user_id)
|
||||
->find();
|
||||
$return = [];
|
||||
$return['user_info'] = $user_info; //用户信息
|
||||
$return['nobility_info'] = []; //爵位信息
|
||||
$return['nobility_info']['status'] = 0; //去开通
|
||||
$return['nobility_info']['end_time'] = '';
|
||||
if($user_nobility_info){
|
||||
$nobility_info = db::name('vs_nobility')
|
||||
->field('lid,name,image,images,pay_price,renew_price,pay_coin,renew_coin,day,power_ids')
|
||||
->where('delete_time', 0)
|
||||
->where('lid', $user_nobility_info['lid'])
|
||||
->find();
|
||||
$return['nobility_info']['status'] = 1; //去续费
|
||||
$return['nobility_info']['end_time'] = date('Y-m-d H:i:s', $user_nobility_info['end_time']);
|
||||
}
|
||||
$return['nobility_info']['lid'] = $nobility_info['lid'] ?? 0;
|
||||
$return['nobility_info']['name'] = $nobility_info['name'] ?? '';
|
||||
$return['nobility_info']['image'] = $nobility_info['image'] ?? '';
|
||||
|
||||
|
||||
$return['nobility_power_list'] = [];
|
||||
//爵位列表
|
||||
$nobility_list = db::name('vs_nobility')
|
||||
->field('lid,name,power_ids,nick_name_color,nick_name_color_name')
|
||||
->where('delete_time', 0)
|
||||
->select();
|
||||
//权限列表
|
||||
$power_list = db::name('vs_nobility_power')
|
||||
->field('id,name,image')
|
||||
->where('delete_time', 0)
|
||||
->select();
|
||||
$nobility_list_zw = [
|
||||
'lid' => 0,
|
||||
'name' => '特权',
|
||||
'power_ids' => '',
|
||||
'nick_name_color' => '无',
|
||||
'nick_name_color_name' => '无',
|
||||
];
|
||||
array_unshift($nobility_list, $nobility_list_zw);
|
||||
foreach ($nobility_list as $key => &$value) {
|
||||
$return['nobility_power_list'][$key] = $value;
|
||||
$power_ids = explode(',', $value['power_ids']);
|
||||
foreach ($power_list as $k => $v) {
|
||||
if (in_array($v['id'], $power_ids)) {
|
||||
$v['status'] = 1; //是
|
||||
}else{
|
||||
$v['status'] = 0; //否
|
||||
}
|
||||
$v['type'] = 1;
|
||||
$v['value'] = '';
|
||||
if($v['id']==2){
|
||||
$v['type'] = 2;
|
||||
$v['value'] = $value['nick_name_color_name'];
|
||||
$v['nick_name_color'] = $value['nick_name_color'];
|
||||
$v['nick_name_color_name'] = $value['nick_name_color_name'];
|
||||
}
|
||||
$return['nobility_power_list'][$key]['nobility_list'][$k] = $v;
|
||||
}
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => $return];
|
||||
}
|
||||
|
||||
//购买爵位
|
||||
public function buyNobility($user_id,$lid){
|
||||
$nobility_info = db::name('vs_nobility')
|
||||
->field('lid,name,pay_price,renew_price,pay_coin,day,renew_coin')
|
||||
->where('delete_time', 0)
|
||||
->where('lid', $lid)
|
||||
->find();
|
||||
if (!$nobility_info) {
|
||||
return ['code' => 0, 'msg' => '爵位不存在', 'data' => null];
|
||||
}
|
||||
$user_info = db::name('user')
|
||||
->field('id,nickname,avatar')
|
||||
->where('delete_time', 0)
|
||||
->where('id', $user_id)
|
||||
->find();
|
||||
if (!$user_info) {
|
||||
return ['code' => 0, 'msg' => '用户不存在', 'data' => null];
|
||||
}
|
||||
$user_nobility_info = db::name('vs_user_nobility')
|
||||
->field('id,user_id,lid,end_time')
|
||||
->where('delete_time', 0)
|
||||
->where(['end_time'=>['>',time()]])
|
||||
->where('user_id', $user_id)
|
||||
->find();
|
||||
if ($user_nobility_info) { //已购买过 续费
|
||||
if($user_nobility_info['lid'] == $lid){//续费
|
||||
$is_renew = 1;
|
||||
if($user_nobility_info['end_time'] > time()){
|
||||
$old_end_time = $user_nobility_info['end_time'];
|
||||
}else{
|
||||
$old_end_time = time();
|
||||
}
|
||||
$end_time = $old_end_time + $nobility_info['day'] * 86400;
|
||||
//判断是否可以续费
|
||||
$end_time_to_day = floor(($end_time - time()) / 86400);
|
||||
if($end_time_to_day > $nobility_info['day'] * 2){
|
||||
return ['code' => 0, 'msg' => '已超过2倍有效期,无需续费', 'data' => null];
|
||||
}
|
||||
$data = [
|
||||
'end_time' => $end_time,
|
||||
'updatetime' => time(),
|
||||
];
|
||||
$re = db::name('vs_user_nobility')->where('id', $user_nobility_info['id'])->update($data);
|
||||
if (!$re) {
|
||||
return ['code' => 0, 'msg' => '失败', 'data' => null];
|
||||
}
|
||||
|
||||
}else{ //升级
|
||||
$is_renew = 2;
|
||||
// if($user_nobility_info['end_time'] > time()){
|
||||
// $old_end_time = $user_nobility_info['end_time'];
|
||||
// }else{
|
||||
// $old_end_time = time();
|
||||
// }
|
||||
$end_time = time() + $nobility_info['day'] * 86400; //结束时间重置
|
||||
$data = [
|
||||
'lid' => $lid,
|
||||
'user_id' => $user_id,
|
||||
'end_time' => $end_time,
|
||||
'createtime' => time(),
|
||||
];
|
||||
db::name('vs_user_nobility')->where('id', $user_nobility_info['id'])->update(['delete_time'=>time()]);
|
||||
$re = db::name('vs_user_nobility')->insert($data);
|
||||
if (!$re) {
|
||||
return ['code' => 0, 'msg' => '失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}else{ //未购买 新购
|
||||
$is_renew = 0;
|
||||
$end_time = time() + $nobility_info['day'] * 86400;
|
||||
$data = [
|
||||
'user_id' => $user_id,
|
||||
'lid' => $lid,
|
||||
'end_time' => $end_time,
|
||||
'createtime' => time(),
|
||||
];
|
||||
$re = db::name('vs_user_nobility')->insert($data);
|
||||
if (!$re) {
|
||||
return ['code' => 0, 'msg' => '失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
//记录日志
|
||||
$log_data = [
|
||||
'user_id' => $user_id,
|
||||
'lid' => $lid,
|
||||
'day' => $nobility_info['day'],
|
||||
'end_time' => $end_time,
|
||||
'is_renew' => $is_renew,
|
||||
'createtime' => time(),
|
||||
];
|
||||
db::name('vs_user_nobility_log')->insert($log_data);
|
||||
|
||||
//发放金币
|
||||
if($is_renew == 1){
|
||||
$pay_coin = $nobility_info['renew_coin'] ?? 0;
|
||||
}elseif($is_renew ==2){
|
||||
//剩余时间
|
||||
$old_nobility_info = db::name('vs_nobility')
|
||||
->field('pay_coin')
|
||||
->where('delete_time', 0)
|
||||
->where('lid', $user_nobility_info['lid'])
|
||||
->find();
|
||||
$surplus_time = $user_nobility_info['end_time'] - time();
|
||||
if($surplus_time > 0){
|
||||
//小时
|
||||
$surplus_time_hour = floor($surplus_time / 3600); //向下取整
|
||||
if($nobility_info['pay_coin']!=0 && $nobility_info['day']!=0){
|
||||
$pay_coin = $nobility_info['pay_coin'] - bcmul($surplus_time_hour * (($old_nobility_info['pay_coin'] / $nobility_info['day']) / 24),1,2); //一小时的价格算
|
||||
}
|
||||
}else{
|
||||
$pay_coin = $nobility_info['pay_coin'] ?? 0;
|
||||
}
|
||||
$pay_coin = floor($pay_coin);
|
||||
}else{
|
||||
$pay_coin = $nobility_info['pay_coin'] ?? 0;
|
||||
}
|
||||
if($pay_coin > 0){
|
||||
$reslut = model('common/UserWallet')->change_user_money($user_id, $pay_coin, model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::NOBILITY_PURCHASE_COIN,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::NOBILITY_PURCHASE_COIN));
|
||||
if (!$reslut) {
|
||||
return ['code' => 0, 'msg' => '失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
//发放装扮
|
||||
$nobility_decorate = db::name('vs_nobility_decorate')
|
||||
->field('id,did,dpid,day')
|
||||
->where('delete_time', 0)
|
||||
->where('lid', $lid)
|
||||
->select();
|
||||
if($nobility_decorate){
|
||||
foreach ($nobility_decorate as $key => $value) {
|
||||
model('api/Decorate')->pay_decorate($user_id,$value['did'],$value['day'],9);
|
||||
}
|
||||
}
|
||||
//更新装备缓存
|
||||
$cache_key = 'user_base_info_'.$user_id;
|
||||
Cache::rm($cache_key);
|
||||
return ['code' => 1, 'msg' => '成功'];
|
||||
}
|
||||
|
||||
//购买爵位价格
|
||||
public function buyNobilityPrice($user_id,$lid){
|
||||
$nobility_info = db::name('vs_nobility')
|
||||
->field('lid,name,image,pay_price,renew_price,day,power_ids')
|
||||
->where('delete_time', 0)
|
||||
->where('lid', $lid)
|
||||
->find();
|
||||
if (!$nobility_info) {
|
||||
return ['code' => 0, 'msg' => '爵位不存在', 'data' => null];
|
||||
}
|
||||
$user_info = db::name('user')
|
||||
->field('id,nickname,avatar')
|
||||
->where('delete_time', 0)
|
||||
->where('id', $user_id)
|
||||
->find();
|
||||
if (!$user_info) {
|
||||
return ['code' => 0, 'msg' => '用户不存在', 'data' => null];
|
||||
}
|
||||
$user_nobility_info = db::name('vs_user_nobility')
|
||||
->field('id,user_id,lid,end_time')
|
||||
->where('delete_time', 0)
|
||||
->where(['end_time'=>['>',time()]])
|
||||
->where('user_id', $user_id)
|
||||
->find();
|
||||
$price = 0;
|
||||
if ($user_nobility_info) { //已购买过 续费
|
||||
if($user_nobility_info['lid'] == $lid){ //续费
|
||||
$price = $nobility_info['renew_price'];
|
||||
$end_time = $user_nobility_info['end_time'] + $nobility_info['day'] * 86400;
|
||||
//判断是否可以续费
|
||||
$end_time_to_day = floor(($end_time - time()) / 86400);
|
||||
if($end_time_to_day > $nobility_info['day'] * 2){
|
||||
return ['code' => 0, 'msg' => '已超过2倍有效期,无需续费', 'data' => null];
|
||||
}
|
||||
}else{ //升级
|
||||
$old_nobility_info = db::name('vs_nobility')
|
||||
->field('lid,name,pay_price,pay_coin,day')
|
||||
->where('delete_time', 0)
|
||||
->where('lid', $user_nobility_info['lid'])
|
||||
->find();
|
||||
$old_end_time = $user_nobility_info['end_time'];
|
||||
//剩余时间
|
||||
$surplus_time = $old_end_time - time();
|
||||
if($surplus_time > 0){
|
||||
//小时
|
||||
$surplus_time_hour = floor($surplus_time / 3600); //向下取整
|
||||
if($surplus_time_hour / 24 > $old_nobility_info['day']*2){
|
||||
return ['code' => 0, 'msg' => '已超过2倍有效期,无法升级', 'data' => null];
|
||||
// $surplus_time_hour = $old_nobility_info['day'] * 24 * 2;
|
||||
}
|
||||
if($nobility_info['pay_price']!=0 && $old_nobility_info['day']!=0){
|
||||
$price = $nobility_info['pay_price'] - bcmul($surplus_time_hour * (($old_nobility_info['pay_price'] / $old_nobility_info['day']) / 24),1,2); //一小时的价格算
|
||||
}
|
||||
}else{
|
||||
$price = $nobility_info['pay_price'];
|
||||
}
|
||||
$end_time = time() + $nobility_info['day'] * 86400;
|
||||
}
|
||||
}else{ //未购买 新购
|
||||
$price = $nobility_info['pay_price'];
|
||||
$end_time = time() + $nobility_info['day'] * 86400;
|
||||
}
|
||||
$power_ids = explode(',', $nobility_info['power_ids']);
|
||||
$power_list = db::name('vs_nobility_power')
|
||||
->field('id,content')
|
||||
->where('delete_time', 0)
|
||||
->where('id', 'in', $power_ids)
|
||||
->select();
|
||||
if(ceil($price) <= 0){
|
||||
return ['code' => 0, 'msg' => "当前权限暂时无法购买此爵位,请升级更高爵位", 'data' => null];
|
||||
}
|
||||
$return = [
|
||||
'lid' => $nobility_info['lid'],
|
||||
'nobility_name' => $nobility_info['name'],
|
||||
'nobility_image' => $nobility_info['image'],
|
||||
'price' => ceil($price),
|
||||
'pay_price' => $nobility_info['pay_price'],
|
||||
'day' => $nobility_info['day'],
|
||||
'power_list' => $power_list,
|
||||
'end_time' => date('Y-m-d H:i:s', $end_time),
|
||||
];
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => $return];
|
||||
}
|
||||
|
||||
//获取用户爵位信息
|
||||
public function getUserNobilityInfo($user_id){
|
||||
$user_nobility_info = db::name('vs_user_nobility')
|
||||
->field('id,user_id,lid,end_time')
|
||||
->where('delete_time', 0)
|
||||
->where('user_id', $user_id)
|
||||
->where('end_time', '>=', time())
|
||||
->find();
|
||||
if($user_nobility_info){
|
||||
$nobility_info = db::name('vs_nobility')
|
||||
->field('lid,name,image,pay_price,renew_price,day,power_ids,nick_name_color,nick_name_color_name,play_image,enter_image')
|
||||
->where('delete_time', 0)
|
||||
->where('lid', $user_nobility_info['lid'])
|
||||
->find();
|
||||
//权限
|
||||
$power_ids = [];
|
||||
if($nobility_info){
|
||||
$power_ids = explode(',', $nobility_info['power_ids']);
|
||||
}
|
||||
$power_list = db::name('vs_nobility_power')
|
||||
->field('id,name,content')
|
||||
->where('delete_time', 0)
|
||||
->where('id', 'in', $power_ids)
|
||||
->select();
|
||||
}
|
||||
$return = [
|
||||
'lid' => $user_nobility_info['lid'] ?? 0,
|
||||
'level' => $user_nobility_info['level'] ?? 0,
|
||||
'nobility_name' => $nobility_info['name'] ?? '',
|
||||
'nobility_image' => $nobility_info['image'] ?? '',
|
||||
'nobility_images' => $nobility_info['images'] ?? '',
|
||||
'nick_name_color' => $nobility_info['nick_name_color'] ?? '',
|
||||
'nick_name_color_name' => $nobility_info['nick_name_color_name'] ?? '',
|
||||
'play_image' => $nobility_info['play_image'] ?? '',
|
||||
'enter_image' => $nobility_info['enter_image'] ?? '',
|
||||
'end_time' => $user_nobility_info['end_time'] ?? 0,
|
||||
'power_list' => $power_list ?? [],
|
||||
];
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
@@ -41,116 +41,107 @@ class Ranking extends Model
|
||||
public function ranking($ranking_type)
|
||||
{
|
||||
$where['a.createtime'] = ['between', [$this->begin_time, $this->end_time]];
|
||||
|
||||
$params['start_time']=$this->begin_time;
|
||||
$params['end_time']=$this->end_time;
|
||||
|
||||
if($ranking_type == 1){//1财富榜
|
||||
$lists = model('GiveGiftBases')->getGiftRanking($params,1);
|
||||
//把$lists 根据total倒序并只取前20名
|
||||
usort($lists, function($a, $b) {
|
||||
return $b['total'] <=> $a['total']; // 按total降序排序
|
||||
});
|
||||
$lists = array_slice($lists, 0, 20); // 取前20名
|
||||
|
||||
if($lists){
|
||||
$my_ranking = [];
|
||||
foreach ($lists as $key => &$value) {
|
||||
$value['total'] = $value['total'] * 10;
|
||||
$value['nickname'] = db::name('user')->where('id',$value['user_id'])->value('nickname');
|
||||
$value['user_code'] = db::name('user')->where('id',$value['user_id'])->value('user_code');
|
||||
$value['avatar'] = db::name('user')->where('id',$value['user_id'])->value('avatar');
|
||||
$lists[$key]['rank'] = $key + 1;
|
||||
if ($this->user_id == $value['user_id']) {
|
||||
$my_ranking = $lists[$key];
|
||||
$my_ranking['diff'] = $key == 0 ? 0 : ($lists[$key - 1]['total'] - $value['total']);
|
||||
}
|
||||
}
|
||||
|
||||
//自己不在前20名
|
||||
if (!$my_ranking) {
|
||||
$lists_last_number = $lists[count($lists) - 1]['total'] ?? 0;
|
||||
//获取自己的送礼记录
|
||||
$params['user_id'] = $this->user_id;
|
||||
$my_ranking_datas = model('GiveGiftBases')->getUserStatistics($params,1);
|
||||
|
||||
$my_ranking['user_id'] = $my_ranking_datas['user_id'];
|
||||
$my_ranking['total'] = $my_ranking_datas['total_price']??0;
|
||||
$my_ranking['nickanme'] = db::name('user')->where('id',$this->user_id)->value('nickname');
|
||||
$my_ranking['user_code'] = db::name('user')->where('id',$this->user_id)->value('user_code');
|
||||
$my_ranking['avatar'] = db::name('user')->where('id',$this->user_id)->value('avatar');
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['diff'] = numberFormat($lists_last_number - ($my_ranking['total'] ?: 0));
|
||||
}
|
||||
}else{
|
||||
$my_ranking = db::name('user')
|
||||
->field('user_code,avatar,nickname,id as user_id,user_code,sex')
|
||||
->field('user_code,avatar,nickname,id as user_id,sex')
|
||||
->where('id',$this->user_id)->find();
|
||||
$my_ranking['icon'][0] = model('UserData')->user_wealth_icon($my_ranking['user_id']);//财富图标
|
||||
|
||||
$my_ranking['total'] = 0;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['diff'] = 0;
|
||||
if($ranking_type == 1){//1财富榜,2魅力榜
|
||||
$lists = db::name('vs_give_gift')->alias('a')
|
||||
->join('user b', 'a.user_id = b.id')
|
||||
->field('a.user_id,b.nickname,b.avatar,b.user_code,sum(a.total_price) * 10 as total')
|
||||
->where($where)
|
||||
->order('total desc')
|
||||
->group('a.user_id')
|
||||
// ->page($this->page, $this->page_limit)
|
||||
->select();
|
||||
}
|
||||
|
||||
//2魅力榜
|
||||
}else{
|
||||
$lists = model('GiveGiftBases')->getGiftRanking($params,2);
|
||||
|
||||
//把$lists 根据total倒序并只取前20名
|
||||
usort($lists, function($a, $b) {
|
||||
return $b['total'] <=> $a['total']; // 按total降序排序
|
||||
});
|
||||
$lists = array_slice($lists, 0, 20); // 取前20名
|
||||
|
||||
if($lists){
|
||||
$my_ranking = [];
|
||||
foreach ($lists as $key => &$value) {
|
||||
$lists[$key]['icon'][0] = model('UserData')->user_wealth_icon($value['user_id']);//财富图标
|
||||
$lists[$key]['icon'][1] = model('UserData')->user_charm_icon($value['user_id']);//魅力图标
|
||||
$value['nickname'] = db::name('user')->where('id',$value['gift_user'])->value('nickname');
|
||||
$value['user_code'] = db::name('user')->where('id',$value['gift_user'])->value('user_code');
|
||||
$value['avatar'] = db::name('user')->where('id',$value['gift_user'])->value('avatar');
|
||||
$value['user_id'] = $value['gift_user'];
|
||||
$lists[$key]['rank'] = $key + 1;
|
||||
if ($this->user_id == $value['user_id']) {
|
||||
if ($this->user_id == $value['gift_user']) {
|
||||
$my_ranking = $lists[$key];
|
||||
$my_ranking['diff'] = $key == 0 ? 0 : ($lists[$key - 1]['total'] - $value['total']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$my_ranking && $lists && defined('UID')) {
|
||||
$my_ranking_data = db::name('vs_give_gift')->alias('a')
|
||||
->join('user b', 'a.user_id = b.id')
|
||||
->field('a.user_id,b.nickname,b.avatar,b.user_code,sum(a.total_price) * 10 as total')
|
||||
->where($where)
|
||||
->where('a.user_id',$this->user_id)
|
||||
->page($this->page, $this->page_limit)
|
||||
->select();
|
||||
$my_ranking_data['icon'][0] = model('UserData')->user_wealth_icon($my_ranking_data['user_id']);//财富图标
|
||||
$my_ranking_data['icon'][1] = model('UserData')->user_charm_icon($my_ranking_data['user_id']);//魅力图标
|
||||
//自己不在前20名
|
||||
if (!$my_ranking) {
|
||||
$lists_last_number = $lists[count($lists) - 1]['total'] ?? 0;
|
||||
//获取自己的收礼记录
|
||||
$params['gift_user'] = $this->user_id;
|
||||
$my_ranking_datas = model('GiveGiftBases')->getUserStatistics($params,2);
|
||||
|
||||
if (!isset($my_ranking_data['user_id']) || !$my_ranking_data['user_id']) {
|
||||
$my_ranking['user_id'] = $my_ranking_datas['user_id'];
|
||||
$my_ranking['total'] = $my_ranking_datas['total_price']??0;
|
||||
$my_ranking['nickname'] = db::name('user')->where('id',$this->user_id)->value('nickname');
|
||||
$my_ranking['user_code'] = db::name('user')->where('id',$this->user_id)->value('user_code');
|
||||
$my_ranking['avatar'] = db::name('user')->where('id',$this->user_id)->value('avatar');
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['diff'] = numberFormat($lists_last_number - ($my_ranking['total'] ?: 0));
|
||||
}
|
||||
}else{
|
||||
$my_ranking = db::name('user')
|
||||
->field('user_code,avatar,nickname,id as user_id,user_code,sex')
|
||||
->field('user_code,avatar,nickname,id as user_id,sex')
|
||||
->where('id',$this->user_id)->find();
|
||||
$my_ranking['icon'][0] = model('UserData')->user_wealth_icon($my_ranking['user_id']);//财富图标
|
||||
|
||||
$my_ranking['total'] = 0;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['diff'] = numberFormat($lists_last_number);
|
||||
} else {
|
||||
$my_ranking = $my_ranking_data;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['total'] = numberFormat($my_ranking['total']);
|
||||
$my_ranking['diff'] = numberFormat($lists_last_number - ($my_ranking_data['total'] ?: 0));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$lists = db::name('vs_give_gift')->alias('a')
|
||||
->join('user b', 'a.gift_user = b.id')
|
||||
->field('a.gift_user as user_id,b.nickname,b.avatar,b.user_code,sum(a.total_price) * 10 as total')
|
||||
->where($where)
|
||||
->order('total desc')
|
||||
->group('a.gift_user')
|
||||
// ->page($this->page, $this->page_limit)
|
||||
->select();
|
||||
|
||||
if($lists){
|
||||
foreach ($lists as $key => &$value) {
|
||||
$lists[$key]['icon'][0] = model('UserData')->user_wealth_icon($value['user_id']);//财富图标
|
||||
$lists[$key]['icon'][1] = model('UserData')->user_charm_icon($value['user_id']);//魅力图标
|
||||
$lists[$key]['rank'] = $key + 1;
|
||||
if ($this->user_id == $value['user_id']) {
|
||||
$my_ranking = $lists[$key];
|
||||
$my_ranking['diff'] = $key == 0 ? 0 : ($lists[$key - 1]['total'] - $value['total']);
|
||||
}
|
||||
$my_ranking['diff'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$my_ranking && $lists && defined('UID')) {
|
||||
$my_ranking_data = db::name('vs_give_gift')->alias('a')
|
||||
->join('user b', 'a.gift_user = b.id')
|
||||
->field('a.gift_user as user_id,b.nickname,b.avatar,b.user_code,sum(a.total_price) * 10 as total')
|
||||
->where($where)
|
||||
->where('a.gift_user',$this->user_id)
|
||||
->select();
|
||||
|
||||
$my_ranking_data['icon'][0] = model('UserData')->user_wealth_icon($my_ranking_data['user_id']);//财富图标
|
||||
$my_ranking_data['icon'][1] = model('UserData')->user_charm_icon($my_ranking_data['user_id']);//魅力图标
|
||||
$lists_last_number = $lists[count($lists) - 1]['total'] ?? 0;
|
||||
|
||||
if (!isset($my_ranking_data['user_id']) || !$my_ranking_data['user_id']) {
|
||||
$my_ranking = db::name('user')
|
||||
->field('user_code,avatar,nickname,id as user_id,user_code,sex')
|
||||
->where('id',$this->user_id)->find();
|
||||
$my_ranking['icon'][0] = model('UserData')->user_wealth_icon($my_ranking['user_id']);//财富图标
|
||||
|
||||
$my_ranking['total'] = 0;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['diff'] = numberFormat($lists_last_number);
|
||||
} else {
|
||||
$my_ranking = $my_ranking_data;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['total'] = numberFormat($my_ranking['total']);
|
||||
$my_ranking['diff'] = numberFormat($lists_last_number - ($my_ranking_data['total'] ?: 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
//截取20条
|
||||
$lists = array_slice($lists,0,20);
|
||||
$data = [
|
||||
'my_ranking' => $my_ranking,
|
||||
'lists' => $lists
|
||||
@@ -159,92 +150,55 @@ class Ranking extends Model
|
||||
return ['code'=>1,'msg'=>'获取成功','data'=>$data];
|
||||
}
|
||||
|
||||
|
||||
|
||||
//房间榜
|
||||
public function room_ranking()
|
||||
{
|
||||
//金币与魅力比例
|
||||
$ratio = get_system_config_value('coin_charm_exp');
|
||||
$where['a.createtime'] = ['between', [$this->begin_time, $this->end_time]];
|
||||
$where['b.type_id'] = ['<>', 6];
|
||||
$where['b.room_status'] = 1;
|
||||
$field = ['sum(a.total_price) *'.$ratio.' as total,b.room_name,a.from_id as room_id,b.room_cover,b.room_number'];
|
||||
$lists = db::name('vs_give_gift')->alias('a')
|
||||
->join('vs_room b','a.from_id = b.id','left')
|
||||
->where($where)->field($field)->group('a.from_id')
|
||||
->order('total desc')
|
||||
// ->page($this->page, $this->page_limit)
|
||||
->select();
|
||||
$my_ranking = null;
|
||||
if($lists){
|
||||
//时间转为天
|
||||
$begin_time = date('Y-m-d',$this->begin_time);
|
||||
$end_time = date('Y-m-d',$this->end_time);
|
||||
|
||||
//获取当前用户的房间id
|
||||
$myRoom = db::name('vs_room')->where(['user_id' => UID ,'room_status' => 1])->find();
|
||||
if($myRoom){
|
||||
$my_ranking['rank'] = -1;
|
||||
$totla = db::name('room_daily_income')
|
||||
->where(['room_id' => $myRoom['id'],'date' => ['between', [$begin_time, $end_time]]])->sum('income')??0 ;
|
||||
$my_ranking['total'] = $totla * $ratio;
|
||||
$my_ranking['diff'] = 0;
|
||||
$my_ranking['room_name'] = $myRoom['room_name'];
|
||||
$my_ranking['room_cover'] = $myRoom['room_cover'];
|
||||
}else{
|
||||
$myRoom['id'] = 0;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['total'] = 0;
|
||||
$my_ranking['diff'] = 0;
|
||||
$my_ranking['room_name'] = '';
|
||||
$my_ranking['room_cover'] = '';
|
||||
}
|
||||
|
||||
$lists = db::name('room_daily_income')->alias('a')
|
||||
->join('vs_room b','a.room_id = b.id','left')
|
||||
->field('a.room_id,sum(a.income) * ' . $ratio . ' as total,b.room_name,b.room_cover,b.room_number')
|
||||
->where(['a.date' => ['between', [$begin_time, $end_time]]])
|
||||
->group('a.room_id')
|
||||
->order('total desc')
|
||||
->limit(20)
|
||||
->select();
|
||||
// var_dump($lists);exit;
|
||||
if($lists){
|
||||
foreach ($lists as $key => $value) {
|
||||
$lists[$key]['rank'] = $key + 1;
|
||||
if ($myRoom['id'] == $value['room_id']) {
|
||||
$my_ranking = $lists[$key];
|
||||
$my_ranking['diff'] = $key == 0 ? 0 : ($lists[$key - 1]['total'] - $value['total']);
|
||||
}
|
||||
// $lists[$key]['total'] = numberFormat($value['total']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$my_ranking && $lists && defined('UID')) {
|
||||
$where1['a.createtime'] = ['between', [$this->begin_time, $this->end_time]];
|
||||
$where1['b.type_id'] = ['<>', 6];
|
||||
$my_ranking_data = db::name('vs_give_gift')->alias('a')
|
||||
->join('vs_room b','a.from_id = b.id','left')
|
||||
->where(['a.from_id' => $myRoom['id']])
|
||||
->where($where1)
|
||||
->field('a.from_id as room_id,sum(a.total_price) as total,b.room_name,b.room_cover,b.room_number')->find();
|
||||
$lists_last_number = $lists[count($lists) - 1]['total'] ?? 0;
|
||||
$diff = numberFormat($lists_last_number - ($my_ranking_data['total'] ?: 0));
|
||||
$diff = $diff<=0 ? 0 : $diff;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['total'] = numberFormat($my_ranking_data['total']);
|
||||
$my_ranking['diff'] = $diff;
|
||||
$my_ranking['room_name'] = $my_ranking_data['room_name'];
|
||||
$my_ranking['room_cover'] = $my_ranking_data['room_cover'];
|
||||
if(!$my_ranking_data['room_name']){
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['total'] = 0;
|
||||
$my_ranking['diff'] = $diff;
|
||||
$my_ranking['room_name'] = $myRoom['room_name'];
|
||||
$my_ranking['room_cover'] = $myRoom['room_cover'];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
foreach ($lists as $key => $value) {
|
||||
$lists[$key]['rank'] = $key + 1;
|
||||
}
|
||||
$lists_last_number = $lists[count($lists) - 1]['total'] ?? 0;
|
||||
//获取当前用户的房间id
|
||||
$myRoom = db::name('vs_room')->where(['user_id' => UID ,'room_status' => 1])->find();
|
||||
if($myRoom){
|
||||
$my_ranking['room_name'] = $myRoom['room_name'];
|
||||
$my_ranking['room_cover'] = $myRoom['room_cover'];
|
||||
$my_ranking['total'] = 0;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['diff'] = numberFormat($lists_last_number);
|
||||
}else{
|
||||
$my_ranking['room_name'] = '';
|
||||
$my_ranking['room_cover'] = '';
|
||||
$my_ranking['total'] = 0;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['diff'] = numberFormat($lists_last_number);
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
//获取当前用户的房间id
|
||||
$myRoom = db::name('vs_room')->where(['user_id' => UID ,'room_status' => 1])->find();
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['total'] = 0;
|
||||
$my_ranking['diff'] = 0;
|
||||
$my_ranking['room_name'] = $myRoom['room_name'];
|
||||
$my_ranking['room_cover'] = $myRoom['room_cover'];
|
||||
}
|
||||
//截取20条
|
||||
$lists = array_slice($lists,0,20);
|
||||
$data = [
|
||||
'my_ranking' => $my_ranking,
|
||||
'lists' => $lists
|
||||
@@ -252,178 +206,51 @@ class Ranking extends Model
|
||||
return ['code'=>1,'msg'=>'获取成功','data'=>$data];
|
||||
}
|
||||
|
||||
//公会榜
|
||||
public function guild_ranking()
|
||||
{
|
||||
$where['createtime'] = ['between', [$this->begin_time, $this->end_time]];
|
||||
|
||||
//所有工会
|
||||
$guilds = db::name('vs_guild')->where(['status' => 1])->select();
|
||||
if($guilds){
|
||||
foreach ($guilds as $k=>$value){
|
||||
$total = 0;
|
||||
$roomids[$k] = db::name('vs_guild_user')->where(['guild_id' => $value['id']])->field('room_id')->select();
|
||||
if($roomids[$k]){
|
||||
foreach ($roomids[$k] as $key => $value1){
|
||||
$toomType = db::name('vs_room')->where(['id' => $value1['room_id']])->where($where)->value('type_id');
|
||||
if($toomType == 6){
|
||||
continue;
|
||||
}
|
||||
$total += db::name('vs_give_gift')->where(['from_id' => $value1['room_id']])->sum('total_price');
|
||||
}
|
||||
}
|
||||
$guilds[$k]['total'] = $total;
|
||||
}
|
||||
//剔除$guilds[$k]['total'] = 0的
|
||||
$guilds = array_filter($guilds, function ($value) {
|
||||
return $value['total'] > 0;
|
||||
});
|
||||
//根据$guilds[$k]['total']排序
|
||||
array_multisort(array_column($guilds, 'total'), SORT_DESC, $guilds);
|
||||
}
|
||||
|
||||
$lists = $guilds ;
|
||||
// $my_ranking = null;
|
||||
$my_ranking['guild_name'] = '';
|
||||
$my_ranking['cover'] = '';
|
||||
$my_ranking['total'] = 0;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['diff'] = 0;
|
||||
if($lists){
|
||||
//获取当前用户的工会
|
||||
$myGuild = db::name('vs_guild_user')->where(['user_id' => UID])->find();
|
||||
if($myGuild){
|
||||
foreach ($lists as $key => $value) {
|
||||
$lists[$key]['rank'] = $key + 1;
|
||||
// $lists[$key]['total'] = numberFormat($value['total']);
|
||||
if ($myGuild['guild_id'] == $value['id']) {
|
||||
$my_ranking = $lists[$key];
|
||||
$my_ranking['diff'] = $key == 0 ? 0 : ($lists[$key - 1]['total'] - $value['total']);
|
||||
}
|
||||
}
|
||||
if (!$my_ranking && $lists && defined('UID')) {
|
||||
$my_rankings = null;
|
||||
//当前工会的所有房间
|
||||
$myguildroom = db::name('vs_guild_user')->where(['guild_id' => $myGuild['guild_id']])->field('room_id')->select();
|
||||
foreach ($myguildroom as $key => $gvalue1){
|
||||
$my_rankings['total'] += db::name('vs_give_gift')->where(['from_id' => $gvalue1['room_id']])->where($where)->sum('total_price');
|
||||
}
|
||||
|
||||
$lists_last_number = $lists[count($lists) - 1]['total'] ?? 0;
|
||||
$diff = numberFormat($lists_last_number - ($my_rankings['total'] ?: 0));
|
||||
$diff = $diff<=0 ? 0 : $diff;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['total'] = numberFormat($my_rankings['total']);
|
||||
$my_ranking['diff'] = $diff;
|
||||
$my_ranking['guild_name'] = $myGuild['room_name'];
|
||||
$my_ranking['cover'] = $myGuild['cover'];
|
||||
if(!$my_rankings){
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['total'] = 0;
|
||||
$my_ranking['diff'] = $diff;
|
||||
$my_ranking['guild_name'] = '';
|
||||
$my_ranking['cover'] = '';
|
||||
}
|
||||
}
|
||||
}else{
|
||||
foreach ($lists as $key => $value) {
|
||||
$lists[$key]['rank'] = $key + 1;
|
||||
}
|
||||
$lists_last_number = $lists[count($lists) - 1]['total'] ?? 0;
|
||||
//获取当前用户所在工会
|
||||
$myGuild = db::name('vs_guild_user')->where(['user_id' => UID])->find();
|
||||
if($myGuild){
|
||||
$my_ranking['guild_name'] = db::name('vs_guild')->where(['id' => $myGuild['guild_id']])->value('guild_name');
|
||||
$my_ranking['cover'] = db::name('vs_guild')->where(['id' => $myGuild['guild_id']])->value('cover');
|
||||
$my_ranking['total'] = 0;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['diff'] = numberFormat($lists_last_number);
|
||||
}else{
|
||||
$my_ranking['guild_name'] = '';
|
||||
$my_ranking['cover'] = '';
|
||||
$my_ranking['total'] = 0;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['diff'] = numberFormat($lists_last_number);
|
||||
}
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'my_ranking' => $my_ranking,
|
||||
'lists' => $lists
|
||||
];
|
||||
return ['code'=>1,'msg'=>'获取成功','data'=>$data];
|
||||
}
|
||||
|
||||
//真爱榜
|
||||
public function love_ranking()
|
||||
public function love_rankings()
|
||||
{
|
||||
$where['c.createtime'] = ['between', [$this->begin_time, $this->end_time]];
|
||||
$where['a.status'] = 1;
|
||||
$field = ['a.user_id,a.user_id1,sum(c.total_price) as total,a.room_id,b.room_cover,b.room_intro as room_name'];
|
||||
$lists = db::name('vs_room_cp_movie')->alias('a')
|
||||
->join('vs_room b','a.room_id = b.id','left')
|
||||
->join('vs_give_gift c','a.room_id = c.from_id','left')
|
||||
->where($where)->field($field)->group('a.room_id')
|
||||
->order('total desc')
|
||||
$lists = db::name('user_cp_zone')->alias('a')
|
||||
->join('user b','a.user_id1 = b.id','left')
|
||||
->join('user c','a.user_id2 = c.id','left')
|
||||
->where(['a.status' => 1])
|
||||
->field('a.exp,a.id,a.level as total,a.user_id1,a.user_id2 as user_id,b.nickname as nickname1,c.nickname as nickname,b.avatar as user_avatar1,c.avatar as user_avatar')
|
||||
->order('a.level desc')
|
||||
->page($this->page, $this->page_limit)
|
||||
->select();
|
||||
$my_ranking = null;
|
||||
if($lists){
|
||||
//获取当前用户的房间id $this->user_id
|
||||
$myRoom = db::name('vs_room_cp_movie')->where(['user_id' => UID ,'status' => 1])->find();
|
||||
$myRoom = db::name('user_cp_zone')->where(['user_id1' => UID ,'status' => 1])->find();
|
||||
if(!$myRoom){
|
||||
$myRoom = db::name('vs_room_cp_movie')->where(['user_id1' => UID ,'status' => 1])->find();
|
||||
$myRoom = db::name('user_cp_zone')->where(['user_id2' => UID ,'status' => 1])->find();
|
||||
}
|
||||
if($myRoom){
|
||||
foreach ($lists as $key => $value) {
|
||||
$lists[$key]['rank'] = $key + 1;
|
||||
$lists[$key]['user_avatar'] = db::name('user')->where(['id' => $value['user_id']])->value('avatar');
|
||||
$lists[$key]['user_avatar1'] = db::name('user')->where(['id' => $value['user_id1']])->value('avatar');
|
||||
$lists[$key]['nickname'] = db::name('user')->where(['id' => $value['user_id']])->value('nickname');
|
||||
$lists[$key]['nickname1'] = db::name('user')->where(['id' => $value['user_id1']])->value('nickname');
|
||||
if ($myRoom['room_id'] == $value['room_id']) {
|
||||
if ($myRoom['id'] == $value['id']) {
|
||||
$my_ranking = $lists[$key];
|
||||
$my_ranking['diff'] = $key == 0 ? 0 : ($lists[$key - 1]['total'] - $value['total']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$my_ranking && $lists && defined('UID')) {
|
||||
$where1['c.createtime'] = ['between', [$this->begin_time, $this->end_time]];
|
||||
$where1['a.status'] = 1;
|
||||
$my_ranking_data = db::name('vs_room_cp_movie')->alias('a')
|
||||
->join('vs_room b','a.room_id = b.id','left')
|
||||
->join('vs_give_gift c','a.room_id = c.from_id','left')
|
||||
->where(['c.from_id' => $myRoom['room_id']])
|
||||
->where($where1)
|
||||
->field('a.user_id,a.user_id1,a.room_id,sum(c.total_price) as total,b.room_intro as room_name,b.room_cover')->find();
|
||||
$lists_last_number = $lists[count($lists) - 1]['total'] ?? 0;
|
||||
$diff = numberFormat($lists_last_number - ($my_ranking_data['total'] ?: 0));
|
||||
$diff = $diff<=0 ? 0 : $diff;
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['total'] = numberFormat($my_ranking_data['total']);
|
||||
$my_ranking['diff'] = $diff;
|
||||
$my_ranking['room_name'] = $my_ranking_data['room_name'];
|
||||
$my_ranking['room_cover'] = $my_ranking_data['room_cover'];
|
||||
$my_ranking['user_avatar'] = db::name('user')->where(['id' => $my_ranking_data['user_id']])->value('avatar');
|
||||
$my_ranking['user_avatar1'] = db::name('user')->where(['id' => $my_ranking_data['user_id1']])->value('avatar');
|
||||
|
||||
if(!$my_ranking_data['room_name']){
|
||||
$my_ranking['rank'] = -1;
|
||||
$my_ranking['total'] = 0;
|
||||
$my_ranking['diff'] = $diff;
|
||||
$my_ranking['room_name'] = '';
|
||||
$my_ranking['room_cover'] = '';
|
||||
$my_ranking['diff'] = $key == 0 ? 0 : ($lists[$key - 1]['exp'] - $value['exp']);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
foreach ($lists as $key => $value) {
|
||||
$lists[$key]['rank'] = $key + 1;
|
||||
$lists[$key]['user_avatar'] = db::name('user')->where(['id' => $value['user_id']])->value('avatar');
|
||||
$lists[$key]['user_avatar1'] = db::name('user')->where(['id' => $value['user_id1']])->value('avatar');
|
||||
$lists[$key]['nickname'] = db::name('user')->where(['id' => $value['user_id']])->value('nickname');
|
||||
$lists[$key]['nickname1'] = db::name('user')->where(['id' => $value['user_id1']])->value('nickname');
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$my_ranking = [
|
||||
'user_id' => UID,
|
||||
'user_id1' => 0,
|
||||
'nickname' => db::name('user')->where(['id' => UID])->value('nickname'),
|
||||
'nickname1' => '',
|
||||
'user_avatar' => db::name('user')->where(['id' => UID])->value('avatar'),
|
||||
'user_avatar1' => '',
|
||||
'exp' => 0,
|
||||
'diff' => 0,
|
||||
'rank' => -1,
|
||||
'total' => 0
|
||||
];
|
||||
}
|
||||
$data = [
|
||||
'my_ranking' => $my_ranking,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user