Compare commits
1525 Commits
1.0.0
...
f259bab4ed
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| 026559ecaa | |||
| 54ca0e0207 | |||
| dc0a271adf | |||
| a4858d47fc | |||
| e73091cdf3 | |||
| c8773c8c45 | |||
| 598302925b | |||
| 1870f3d9b6 | |||
| 58fd97511e | |||
| c826edcbc1 | |||
| ea07b49995 | |||
| aa05ca0043 | |||
| 1c5a3b2c08 | |||
| 3a2e51027f | |||
| 9671f2e37f | |||
| 330e2772a9 | |||
| 9f6892f973 | |||
| f09db7aa97 | |||
| 7c8d5432ba | |||
| 5b61c68811 | |||
| 4d09418cfd | |||
| 9991a4bdd8 | |||
| 266c90cd09 | |||
| 7f7dca16c0 | |||
| ccf52a6623 | |||
| 5e798e7f05 | |||
| 28fbc40f70 | |||
| ea881adbd2 | |||
| 314e519937 | |||
| 3fc247e8e5 | |||
| ebdfd04105 | |||
| 4fc571e5e2 | |||
| 3957e831f9 | |||
| eef23f6bba | |||
| c7fb6078a9 | |||
| a0ea15ef2a | |||
| f635515d61 | |||
| a3b3bd04ef | |||
| f9d9a1bf5c | |||
| 06c5df0207 | |||
| 917d95f5f3 | |||
| 89e6c023db | |||
| d2baceadea | |||
| 93d75a4ef3 | |||
| 07d631a7bb | |||
| c232caf2f0 | |||
| 20a6ecffa6 | |||
| 08cc1dabd8 | |||
| 3741278825 | |||
| 4a77c59baf | |||
| 96f236a433 | |||
| fca4eb5fd1 | |||
| 92a63551c6 | |||
| 11ada68d54 | |||
| d3003db0f8 | |||
| e233c814e7 | |||
| 026e8d23a5 | |||
| ca1fed3588 |
29
.env
29
.env
@@ -1,24 +1,28 @@
|
|||||||
[app]
|
[app]
|
||||||
|
# local:本地调试 test:测试环境 prod:生产环境
|
||||||
|
system_type = test
|
||||||
debug = ture
|
debug = ture
|
||||||
trace = false
|
trace = false
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
; hostname = 127.0.0.1
|
#测试
|
||||||
; database = super_chat
|
hostname = 1.13.181.248
|
||||||
; username = root
|
database = yusheng
|
||||||
; password = 1111111
|
username = yusheng
|
||||||
; hostport = 3306
|
password = GEDYGj3HbZfKYBjp
|
||||||
; prefix = fa_
|
|
||||||
|
|
||||||
hostname = 81.70.45.221
|
|
||||||
database = super_chat
|
|
||||||
username = super_chat
|
|
||||||
password = c7NXx8KMPaTX4N5W
|
|
||||||
hostport = 3306
|
hostport = 3306
|
||||||
prefix = fa_
|
prefix = fa_
|
||||||
|
|
||||||
|
#正式
|
||||||
|
#hostname = 1.13.20.30
|
||||||
|
#database = yusheng
|
||||||
|
#username = yusheng
|
||||||
|
#password = GEDYGj3HbZfKYBjp
|
||||||
|
#hostport = 3306
|
||||||
|
#prefix = fa_
|
||||||
|
|
||||||
[mqtt]
|
[mqtt]
|
||||||
mqtt_server = 81.70.45.221
|
mqtt_server = 1.13.181.248
|
||||||
mqtt_port = 1883
|
mqtt_port = 1883
|
||||||
mqtt_username = admin
|
mqtt_username = admin
|
||||||
mqtt_password = public
|
mqtt_password = public
|
||||||
@@ -32,6 +36,7 @@ dxb_temp = "【羽声语音】您的验证码是{code}。如非本人操作,
|
|||||||
[wechatpay]
|
[wechatpay]
|
||||||
mch_id = 1719907761
|
mch_id = 1719907761
|
||||||
appid = wxc7681513be9f926b
|
appid = wxc7681513be9f926b
|
||||||
|
#下面具体是V2秘钥
|
||||||
api_v3_key = "5826Qxhs456453614dsjkfhdsf53g4op"
|
api_v3_key = "5826Qxhs456453614dsjkfhdsf53g4op"
|
||||||
serial_no = "51FAD3F779271A865040771BEC14A825638E9484"
|
serial_no = "51FAD3F779271A865040771BEC14A825638E9484"
|
||||||
private_key = "epay/certs/apiclient_key.pem"
|
private_key = "epay/certs/apiclient_key.pem"
|
||||||
|
|||||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,9 +1,7 @@
|
|||||||
/thinkphp/
|
|
||||||
/vendor/
|
|
||||||
/runtime/*
|
/runtime/*
|
||||||
/public/uploads/*
|
/public/uploads/*
|
||||||
.idea
|
.idea
|
||||||
*.log
|
*.log
|
||||||
.env
|
.env
|
||||||
.htaccess
|
.node_modules
|
||||||
nginx.htaccess
|
node_modules/
|
||||||
|
|||||||
1
addons/.htaccess
Normal file
1
addons/.htaccess
Normal file
@@ -0,0 +1 @@
|
|||||||
|
deny from all
|
||||||
1
application/.htaccess
Normal file
1
application/.htaccess
Normal file
@@ -0,0 +1 @@
|
|||||||
|
deny from all
|
||||||
@@ -60,7 +60,7 @@ class Auth extends \fast\Auth
|
|||||||
}
|
}
|
||||||
$admin->loginfailure = 0;
|
$admin->loginfailure = 0;
|
||||||
$admin->logintime = time();
|
$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->token = Random::uuid();
|
||||||
$admin->save();
|
$admin->save();
|
||||||
Session::set("admin", $admin->toArray());
|
Session::set("admin", $admin->toArray());
|
||||||
@@ -229,6 +229,7 @@ class Auth extends \fast\Auth
|
|||||||
if ($this->logined) {
|
if ($this->logined) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$admin = Session::get('admin');
|
$admin = Session::get('admin');
|
||||||
if (!$admin) {
|
if (!$admin) {
|
||||||
$admin = Cache::get("admin_" . $token);
|
$admin = Cache::get("admin_" . $token);
|
||||||
@@ -239,6 +240,7 @@ class Auth extends \fast\Auth
|
|||||||
// Session::set("admin.safecode", $this->getEncryptSafecode($admin));
|
// Session::set("admin.safecode", $this->getEncryptSafecode($admin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$admin) {
|
if (!$admin) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -246,6 +248,7 @@ class Auth extends \fast\Auth
|
|||||||
if (!$my) {
|
if (!$my) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//校验安全码,可用于判断关键信息发生了变更需要重新登录
|
//校验安全码,可用于判断关键信息发生了变更需要重新登录
|
||||||
// if (!isset($admin['safecode']) || $this->getEncryptSafecode($my) !== $admin['safecode']) {
|
// if (!isset($admin['safecode']) || $this->getEncryptSafecode($my) !== $admin['safecode']) {
|
||||||
// $this->logout();
|
// $this->logout();
|
||||||
@@ -259,12 +262,13 @@ class Auth extends \fast\Auth
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//判断管理员IP是否变动
|
//判断管理员IP是否变动
|
||||||
if (Config::get('fastadmin.loginip_check')) {
|
// if (Config::get('fastadmin.loginip_check')) {
|
||||||
if (!isset($admin['loginip']) || $admin['loginip'] != request()->ip()) {
|
// if (!isset($admin['loginip']) || $admin['loginip'] != request()->ip()) {
|
||||||
$this->logout();
|
// $this->logout();
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
//
|
||||||
|
// }
|
||||||
$this->logined = true;
|
$this->logined = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ class AdminLog extends Model
|
|||||||
}
|
}
|
||||||
$title = implode(' / ', $title);
|
$title = implode(' / ', $title);
|
||||||
}
|
}
|
||||||
|
$login_ip = request()->server('HTTP_X_REAL_IP') ?: request()->server('HTTP_X_FORWARDED_FOR') ?: request()->ip();
|
||||||
self::create([
|
self::create([
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'content' => !is_scalar($content) ? json_encode($content, JSON_UNESCAPED_UNICODE) : $content,
|
'content' => !is_scalar($content) ? json_encode($content, JSON_UNESCAPED_UNICODE) : $content,
|
||||||
@@ -84,7 +85,7 @@ class AdminLog extends Model
|
|||||||
'admin_id' => $admin_id,
|
'admin_id' => $admin_id,
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
'useragent' => substr(request()->server('HTTP_USER_AGENT'), 0, 255),
|
'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()))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,8 +40,9 @@ class Activities extends adminApi
|
|||||||
public function first_charge_lists(){
|
public function first_charge_lists(){
|
||||||
$page = input('page', 1);
|
$page = input('page', 1);
|
||||||
$page_limit = input('page_limit', 30);
|
$page_limit = input('page_limit', 30);
|
||||||
|
$activities_id = input('activities_id', 1);
|
||||||
$where = [];
|
$where = [];
|
||||||
$where['activities_id'] = 1;
|
$where['activities_id'] = $activities_id;
|
||||||
$where['delete_time'] = 0;
|
$where['delete_time'] = 0;
|
||||||
$count = db($this->table)->where($where)->count();
|
$count = db($this->table)->where($where)->count();
|
||||||
$lists = db($this->table)->where($where)->page($page, $page_limit)->select();
|
$lists = db($this->table)->where($where)->page($page, $page_limit)->select();
|
||||||
@@ -76,11 +77,12 @@ class Activities extends adminApi
|
|||||||
$title1 = input('title1', '');
|
$title1 = input('title1', '');
|
||||||
$title2 = input('title2', '');
|
$title2 = input('title2', '');
|
||||||
$money = input('money', '');
|
$money = input('money', '');
|
||||||
|
$activities_id = input('activities_id', 1);
|
||||||
$return_data = [
|
$return_data = [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
'activities_id' => 1,
|
'activities_id' => $activities_id,
|
||||||
];
|
];
|
||||||
$ext = [
|
$ext = [
|
||||||
'title1' => $title1,
|
'title1' => $title1,
|
||||||
@@ -167,11 +169,12 @@ class Activities extends adminApi
|
|||||||
$page_limit = input('page_limit', 30);
|
$page_limit = input('page_limit', 30);
|
||||||
$user_id = input('user_id', '');
|
$user_id = input('user_id', '');
|
||||||
$gift_bag_id = input('gift_bag_id', '');
|
$gift_bag_id = input('gift_bag_id', '');
|
||||||
|
$activities_id = input('activities_id', 1);
|
||||||
$where = [];
|
$where = [];
|
||||||
if($user_id){
|
if($user_id){
|
||||||
$where['user_id'] = $user_id;
|
$where['user_id'] = $user_id;
|
||||||
}
|
}
|
||||||
$gift_bag = db('vs_gift_bag')->where(['activities_id'=>1,'delete_time'=>0])->select();
|
$gift_bag = db('vs_gift_bag')->where(['activities_id'=>$activities_id,'delete_time'=>0])->select();
|
||||||
|
|
||||||
if($gift_bag_id){
|
if($gift_bag_id){
|
||||||
$where['gift_bag_id'] = $gift_bag_id;
|
$where['gift_bag_id'] = $gift_bag_id;
|
||||||
@@ -360,6 +363,7 @@ class Activities extends adminApi
|
|||||||
'foreign_id' => $gift_id,
|
'foreign_id' => $gift_id,
|
||||||
'name' => $gift['gift_name'],
|
'name' => $gift['gift_name'],
|
||||||
'quantity' => $num,
|
'quantity' => $num,
|
||||||
|
'gold' => $gift['gift_price'],
|
||||||
];
|
];
|
||||||
} elseif($type == 3){
|
} elseif($type == 3){
|
||||||
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$gift_id])->find();
|
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$gift_id])->find();
|
||||||
@@ -373,6 +377,7 @@ class Activities extends adminApi
|
|||||||
'foreign_id' => $gift_id,
|
'foreign_id' => $gift_id,
|
||||||
'name' => $gift['title'],
|
'name' => $gift['title'],
|
||||||
'days' => $decorate_price['day'],
|
'days' => $decorate_price['day'],
|
||||||
|
'gold' => $decorate_price['price'],
|
||||||
];
|
];
|
||||||
} elseif($type == 4){
|
} elseif($type == 4){
|
||||||
$data = [
|
$data = [
|
||||||
@@ -419,6 +424,7 @@ class Activities extends adminApi
|
|||||||
'money' => $ext['money'],
|
'money' => $ext['money'],
|
||||||
'money_str' => $ext['money_str'],
|
'money_str' => $ext['money_str'],
|
||||||
'diamond' => $ext['diamond'],
|
'diamond' => $ext['diamond'],
|
||||||
|
'activity_end_time' => $ext['activity_end_time'],
|
||||||
];
|
];
|
||||||
return V(1,"成功",$data);
|
return V(1,"成功",$data);
|
||||||
}
|
}
|
||||||
@@ -433,17 +439,20 @@ class Activities extends adminApi
|
|||||||
$money = input('money', '');
|
$money = input('money', '');
|
||||||
$money_str = input('money_str', '');
|
$money_str = input('money_str', '');
|
||||||
$diamond = input('diamond', '');
|
$diamond = input('diamond', '');
|
||||||
|
$activity_end_time = input('activity_end_time', '');
|
||||||
$id = input('id', 6);
|
$id = input('id', 6);
|
||||||
$data = [
|
$data = [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'status' => $status
|
'status' => $status,
|
||||||
|
'money' => $money,
|
||||||
];
|
];
|
||||||
$ext = [
|
$ext = [
|
||||||
'counter' => $counter,
|
'counter' => $counter,
|
||||||
'money_str' => $money_str,
|
'money_str' => $money_str,
|
||||||
'diamond' => $diamond,
|
'diamond' => $diamond,
|
||||||
'money' => $money
|
'money' => $money,
|
||||||
|
'activity_end_time' => $activity_end_time
|
||||||
];
|
];
|
||||||
$data['ext'] = json_encode($ext);
|
$data['ext'] = json_encode($ext);
|
||||||
$res = db::name($this->table)->where(['id'=>$id])->update($data);
|
$res = db::name($this->table)->where(['id'=>$id])->update($data);
|
||||||
@@ -498,6 +507,7 @@ class Activities extends adminApi
|
|||||||
$meet = input('meet','');
|
$meet = input('meet','');
|
||||||
$num = input('num', 0);
|
$num = input('num', 0);
|
||||||
$content = input('content', 0);
|
$content = input('content', 0);
|
||||||
|
$title = input('title', "");
|
||||||
if($gift_bag_id==""){
|
if($gift_bag_id==""){
|
||||||
return V(0,"请选择礼包类型");
|
return V(0,"请选择礼包类型");
|
||||||
}
|
}
|
||||||
@@ -516,6 +526,7 @@ class Activities extends adminApi
|
|||||||
'num' => $num
|
'num' => $num
|
||||||
];
|
];
|
||||||
$data['ext'] = json_encode($ext);
|
$data['ext'] = json_encode($ext);
|
||||||
|
$data['title'] = $title;
|
||||||
$res = db::name($this->table)->where(['id'=>$gift_bag_id])->update($data);
|
$res = db::name($this->table)->where(['id'=>$gift_bag_id])->update($data);
|
||||||
if(!$res){
|
if(!$res){
|
||||||
return V(0,"失败");
|
return V(0,"失败");
|
||||||
@@ -587,14 +598,21 @@ class Activities extends adminApi
|
|||||||
$lists[$key]['box_name'] = $bag_data['name'];
|
$lists[$key]['box_name'] = $bag_data['name'];
|
||||||
$lists[$key]['gift_type'] = $value['type'];
|
$lists[$key]['gift_type'] = $value['type'];
|
||||||
$lists[$key]['gift_type_str'] = $this->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_id'] = $value['foreign_id'];
|
||||||
$lists[$key]['gift_name'] = $value['name'];
|
$lists[$key]['gift_name'] = $value['name'];
|
||||||
$gift_data = db::name('vs_gift')->where(['gid' => $value['foreign_id']])->find();
|
$gift_data = db::name('vs_gift')->where(['gid' => $value['foreign_id']])->find();
|
||||||
$lists[$key]['base_image'] = $gift_data['base_image'];
|
$lists[$key]['base_image'] = $gift_data['base_image']??"";
|
||||||
$lists[$key]['quantity'] = $value['quantity'];
|
$lists[$key]['quantity'] = $value['quantity'];
|
||||||
$lists[$key]['quantity_str'] = $value['quantity']."个";
|
$lists[$key]['quantity_str'] = $value['quantity']."个";
|
||||||
$lists[$key]['gift_price'] = $gift_data['gift_price'];
|
$lists[$key]['gift_price'] = $gift_data['gift_price']?? "";
|
||||||
}elseif ($value['type'] == 3){
|
}elseif ($value['type'] == 3){
|
||||||
$lists[$key]['gift_id'] = $value['foreign_id'];
|
$lists[$key]['gift_id'] = $value['foreign_id'];
|
||||||
$lists[$key]['gift_name'] = $value['name'];
|
$lists[$key]['gift_name'] = $value['name'];
|
||||||
@@ -607,10 +625,10 @@ class Activities extends adminApi
|
|||||||
}else{
|
}else{
|
||||||
$lists[$key]['gift_id'] = "--";
|
$lists[$key]['gift_id'] = "--";
|
||||||
$lists[$key]['gift_name'] = "--";
|
$lists[$key]['gift_name'] = "--";
|
||||||
$lists[$key]['base_image'] = "--";
|
$lists[$key]['base_image'] = localpath_to_netpath("static/image/icon/diamond.png");
|
||||||
$lists[$key]['quantity'] = 0;
|
$lists[$key]['quantity'] = $value['quantity'];
|
||||||
$lists[$key]['quantity_str'] = "0";
|
$lists[$key]['quantity_str'] = $value['quantity']."个";
|
||||||
$lists[$key]['gift_price'] = $value['gold'];
|
$lists[$key]['gift_price'] = $value['gold']*$value['quantity'];
|
||||||
}
|
}
|
||||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||||
|
|
||||||
@@ -689,15 +707,26 @@ class Activities extends adminApi
|
|||||||
* 装扮列表
|
* 装扮列表
|
||||||
*/
|
*/
|
||||||
public function decorate_list(){
|
public function decorate_list(){
|
||||||
|
$type = input('type', '');
|
||||||
|
$where = [];
|
||||||
|
if($type){
|
||||||
|
$where['b.type'] = $type;
|
||||||
|
}
|
||||||
$decorate_list = db::name('vs_decorate_price')->alias('a')
|
$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')
|
->field('a.id,a.did,b.type,a.day,a.price,b.title,b.base_image')
|
||||||
->where('b.delete_time',0)
|
->where('b.delete_time',0)
|
||||||
|
->where($where)
|
||||||
->join('vs_decorate b','a.did = b.did')
|
->join('vs_decorate b','a.did = b.did')
|
||||||
->select();
|
->select();
|
||||||
$return_data = [];
|
$return_data = [];
|
||||||
foreach ($decorate_list as $key => $value) {
|
foreach ($decorate_list as $key => $value) {
|
||||||
$return_data[$key]['id'] = $value['id'];
|
$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_data[$key]['day'] = $value['day'];
|
||||||
}
|
}
|
||||||
return V(1,"成功", $return_data);
|
return V(1,"成功", $return_data);
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ class Admin extends adminApi
|
|||||||
{
|
{
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
$params = $this->request->post();
|
$params = $this->request->post();
|
||||||
$group = $params['group'];
|
$group = $params['group']?? [];
|
||||||
unset($params['group']);
|
unset($params['group']);
|
||||||
unset($params['__token__']);
|
unset($params['__token__']);
|
||||||
if ($params) {
|
if ($params) {
|
||||||
@@ -196,21 +196,21 @@ class Admin extends adminApi
|
|||||||
return V(0,"失败", []);
|
return V(0,"失败", []);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 先移除所有权限
|
if(!empty($group)){
|
||||||
model('admin/AuthGroupAccess')->where('uid', $params['id'])->delete();
|
// 先移除所有权限
|
||||||
|
model('admin/AuthGroupAccess')->where('uid', $params['id'])->delete();
|
||||||
|
// 过滤不允许的组别,避免越权
|
||||||
|
$group = array_intersect($this->childrenGroupIds, $group);
|
||||||
|
if (!$group) {
|
||||||
|
return V(0,"失败", []);
|
||||||
|
}
|
||||||
|
|
||||||
|
$dataset = [];
|
||||||
// 过滤不允许的组别,避免越权
|
foreach ($group as $value) {
|
||||||
$group = array_intersect($this->childrenGroupIds, $group);
|
$dataset[] = ['uid' => $params['id'], 'group_id' => $value];
|
||||||
if (!$group) {
|
}
|
||||||
return V(0,"失败", []);
|
model('admin/AuthGroupAccess')->saveAll($dataset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dataset = [];
|
|
||||||
foreach ($group as $value) {
|
|
||||||
$dataset[] = ['uid' => $params['id'], 'group_id' => $value];
|
|
||||||
}
|
|
||||||
model('admin/AuthGroupAccess')->saveAll($dataset);
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return V(1,"成功", []);
|
return V(1,"成功", []);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@@ -52,10 +52,10 @@ class Adminlog extends adminApi
|
|||||||
$where['createtime'] = ['>=', strtotime($search_stime)];
|
$where['createtime'] = ['>=', strtotime($search_stime)];
|
||||||
}
|
}
|
||||||
if ($search_etime) {
|
if ($search_etime) {
|
||||||
$where['createtime'] = ['<=', strtotime($search_etime.' 23:59:59')];
|
$where['createtime'] = ['<=', strtotime($search_etime)];
|
||||||
}
|
}
|
||||||
if(!empty($search_stime) && !empty($search_etime)){
|
if(!empty($search_stime) && !empty($search_etime)){
|
||||||
$where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime.' 23:59:59')]];
|
$where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
|
||||||
}
|
}
|
||||||
|
|
||||||
$list_data = $this->model->where($where)->where('admin_id', 'in', $this->childrenAdminIds)->order('createtime', 'desc')->paginate($page_limit, false, ['page' => $page]);
|
$list_data = $this->model->where($where)->where('admin_id', 'in', $this->childrenAdminIds)->order('createtime', 'desc')->paginate($page_limit, false, ['page' => $page]);
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ class Banner extends adminApi
|
|||||||
$image = input('image', '');
|
$image = input('image', '');
|
||||||
$show_status = input('show_status', '');
|
$show_status = input('show_status', '');
|
||||||
$remarks = input('remarks', '');
|
$remarks = input('remarks', '');
|
||||||
$content = input('content', '');
|
$content =$_POST['content']??"";
|
||||||
if (!$id){
|
if (!$id){
|
||||||
return V(0,"ID不能为空");
|
return V(0,"ID不能为空");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use think\Db;
|
|||||||
use think\Hook;
|
use think\Hook;
|
||||||
use think\Session;
|
use think\Session;
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
use think\Cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 盲盒
|
* 盲盒
|
||||||
@@ -18,7 +19,7 @@ class BlindBox extends adminApi
|
|||||||
{
|
{
|
||||||
|
|
||||||
protected $noNeedLogin = [];
|
protected $noNeedLogin = [];
|
||||||
protected $noNeedRight = ['blind_box_type','blind_box_gifts'];
|
protected $noNeedRight = ['blind_box_type','blind_box_gifts','xunlehui_rule_detail','xunlehui_set_rule','blind_box_turntable_lists','blind_box_turntable_open_record','xlh_lock_record'];
|
||||||
|
|
||||||
protected $table = 'vs_gift_bag_detail';
|
protected $table = 'vs_gift_bag_detail';
|
||||||
|
|
||||||
@@ -40,7 +41,8 @@ class BlindBox extends adminApi
|
|||||||
if(empty($gift_bag_id)){
|
if(empty($gift_bag_id)){
|
||||||
return V(0,"请选择盲盒类型");
|
return V(0,"请选择盲盒类型");
|
||||||
}
|
}
|
||||||
$bag_list = db::name("vs_gift_bag")->field('id,name')->where(['activities_id'=>4,'status'=>1])->select();
|
$bag_data = db::name("vs_gift_bag")->find($gift_bag_id);
|
||||||
|
$bag_list = db::name("vs_gift_bag")->field('id,name')->where(['activities_id'=>$bag_data['activities_id'],'status'=>1])->select();
|
||||||
foreach ($bag_list as &$v) {
|
foreach ($bag_list as &$v) {
|
||||||
$v['default'] = $gift_bag_id == $v['id'] ? 1 : 0;
|
$v['default'] = $gift_bag_id == $v['id'] ? 1 : 0;
|
||||||
}
|
}
|
||||||
@@ -60,15 +62,21 @@ class BlindBox extends adminApi
|
|||||||
$lists[$key]['gift_id'] = $value['foreign_id'];
|
$lists[$key]['gift_id'] = $value['foreign_id'];
|
||||||
$lists[$key]['gift_name'] = $value['name'];
|
$lists[$key]['gift_name'] = $value['name'];
|
||||||
$gift_data = db::name('vs_gift')->where(['gid'=>$value['foreign_id']])->find();
|
$gift_data = db::name('vs_gift')->where(['gid'=>$value['foreign_id']])->find();
|
||||||
$lists[$key]['base_image'] = $gift_data['base_image'];
|
$lists[$key]['base_image'] = $gift_data['base_image'] ?? "";
|
||||||
$lists[$key]['gift_price'] = $gift_data['gift_price'];
|
$lists[$key]['gift_price'] = $gift_data['gift_price'] ?? 0;
|
||||||
$lists[$key]['quantity'] = $value['quantity'];
|
$lists[$key]['quantity'] = $value['quantity'] ?? 0;
|
||||||
$lists[$key]['remaining_number'] = $value['remaining_number'];
|
$lists[$key]['remaining_number'] = $value['remaining_number'] ?? 0;
|
||||||
$lists[$key]['is_public_screen'] = $gift_data['is_public_screen'];
|
$lists[$key]['is_public_screen'] = $gift_data['is_public_screen'] ?? 0;
|
||||||
$lists[$key]['is_public_server'] = $gift_data['is_public_server'];
|
$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']);
|
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//$lists 按gift_price 降序排序
|
||||||
|
usort($lists, function($a, $b) {
|
||||||
|
return $b['gift_price'] - $a['gift_price'];
|
||||||
|
});
|
||||||
//统计
|
//统计
|
||||||
$total_data = [];
|
$total_data = [];
|
||||||
//每期总次数
|
//每期总次数
|
||||||
@@ -83,9 +91,14 @@ class BlindBox extends adminApi
|
|||||||
//每期总抽奖花费(支出)
|
//每期总抽奖花费(支出)
|
||||||
$bag_data = db::name("vs_gift_bag")->field('id,name,ext')->where(['id'=>$gift_bag_id])->find();
|
$bag_data = db::name("vs_gift_bag")->field('id,name,ext')->where(['id'=>$gift_bag_id])->find();
|
||||||
$ext = json_decode($bag_data['ext'],true);
|
$ext = json_decode($bag_data['ext'],true);
|
||||||
$c_gift_id = $ext['gift_id'];
|
|
||||||
$c_gift_data = db::name('vs_gift')->where(['gid'=>$c_gift_id])->find();
|
if($gift_bag_id == 13){
|
||||||
$gift_price = $c_gift_data['gift_price']??0;
|
$gift_price = $ext['xlh_box_price']??0;
|
||||||
|
}else{
|
||||||
|
$c_gift_id = $ext['gift_id'];
|
||||||
|
$c_gift_data = db::name('vs_gift')->where(['gid'=>$c_gift_id])->find();
|
||||||
|
$gift_price = $c_gift_data['gift_price']??0;
|
||||||
|
}
|
||||||
$total_cost = $total_count * $gift_price;
|
$total_cost = $total_count * $gift_price;
|
||||||
//每期统计(收入/支出)
|
//每期统计(收入/支出)
|
||||||
if($total_cost==0 || $total_price==0){
|
if($total_cost==0 || $total_price==0){
|
||||||
@@ -131,6 +144,8 @@ class BlindBox extends adminApi
|
|||||||
$gift_id = input('gift_id', '');
|
$gift_id = input('gift_id', '');
|
||||||
$gift_bag_id = input('gift_bag_id', '');
|
$gift_bag_id = input('gift_bag_id', '');
|
||||||
$quantity = input('quantity', 0);
|
$quantity = input('quantity', 0);
|
||||||
|
$weight = input('weight', 0);
|
||||||
|
$is_world_show = input('is_world_show', 0);
|
||||||
if(empty($gift_id)){
|
if(empty($gift_id)){
|
||||||
return V(0,"请选择礼物");
|
return V(0,"请选择礼物");
|
||||||
}
|
}
|
||||||
@@ -153,6 +168,9 @@ class BlindBox extends adminApi
|
|||||||
$data['quantity'] = $quantity;
|
$data['quantity'] = $quantity;
|
||||||
$data['remaining_number'] = $quantity;
|
$data['remaining_number'] = $quantity;
|
||||||
$data['createtime'] = time();
|
$data['createtime'] = time();
|
||||||
|
$data['weight'] = $weight;
|
||||||
|
$data['is_world_show'] = $is_world_show;
|
||||||
|
|
||||||
$res = db::name($this->table)->insert($data);
|
$res = db::name($this->table)->insert($data);
|
||||||
if($res){
|
if($res){
|
||||||
return V(1,"成功");
|
return V(1,"成功");
|
||||||
@@ -165,7 +183,15 @@ class BlindBox extends adminApi
|
|||||||
*/
|
*/
|
||||||
public function blind_box_gifts(){
|
public function blind_box_gifts(){
|
||||||
$type = input('type', 2);
|
$type = input('type', 2);
|
||||||
$list = db::name("vs_gift")->where(['type'=>$type,'delete_time'=>0])->order('sort','asc')->select();
|
$label = input('label', 0);
|
||||||
|
$where['delete_time'] = 0;
|
||||||
|
if($type){
|
||||||
|
$where['type'] = $type;
|
||||||
|
}
|
||||||
|
if($label){
|
||||||
|
$where['label'] = $label;
|
||||||
|
}
|
||||||
|
$list = db::name("vs_gift")->where($where)->order('sort','asc')->select();
|
||||||
$list_data = [];
|
$list_data = [];
|
||||||
foreach ($list as $k=>$v){
|
foreach ($list as $k=>$v){
|
||||||
$list_data[$k]['gid'] = $v['gid'];
|
$list_data[$k]['gid'] = $v['gid'];
|
||||||
@@ -181,9 +207,12 @@ class BlindBox extends adminApi
|
|||||||
public function blind_box_edit(){
|
public function blind_box_edit(){
|
||||||
$id = input('id', '');
|
$id = input('id', '');
|
||||||
$quantity = input('quantity', 0);
|
$quantity = input('quantity', 0);
|
||||||
|
$is_world_show = input('is_world_show', 0);
|
||||||
|
$gift_id = input('gift_id', 0);
|
||||||
if(empty($id)){
|
if(empty($id)){
|
||||||
return V(0,"参数错误");
|
return V(0,"参数错误");
|
||||||
}
|
}
|
||||||
|
$weight = input('weight', 0);
|
||||||
$gift_bag = db::name($this->table)->where('id',$id)->find();
|
$gift_bag = db::name($this->table)->where('id',$id)->find();
|
||||||
// if($gift_bag['remaining_number']>0){
|
// if($gift_bag['remaining_number']>0){
|
||||||
// return V(0,"该礼包已开售");
|
// return V(0,"该礼包已开售");
|
||||||
@@ -191,6 +220,13 @@ class BlindBox extends adminApi
|
|||||||
$data = [];
|
$data = [];
|
||||||
$data['quantity'] = $quantity;
|
$data['quantity'] = $quantity;
|
||||||
$data['remaining_number'] = $quantity;
|
$data['remaining_number'] = $quantity;
|
||||||
|
$data['is_world_show'] = $is_world_show;
|
||||||
|
$data['weight'] = $weight;
|
||||||
|
if(!empty($gift_id)){
|
||||||
|
$gift = db::name('vs_gift')->where(['gid'=>$gift_id])->find();
|
||||||
|
$data['foreign_id'] = $gift_id;
|
||||||
|
$data['name'] = $gift['gift_name'];
|
||||||
|
}
|
||||||
$res = db::name($this->table)->where(['id'=>$id])->update($data);
|
$res = db::name($this->table)->where(['id'=>$id])->update($data);
|
||||||
if($res){
|
if($res){
|
||||||
return V(1,"成功");
|
return V(1,"成功");
|
||||||
@@ -217,18 +253,113 @@ class BlindBox extends adminApi
|
|||||||
*/
|
*/
|
||||||
public function reset_set(){
|
public function reset_set(){
|
||||||
$gift_bag_id = input('gift_bag_id', 0);
|
$gift_bag_id = input('gift_bag_id', 0);
|
||||||
|
$room_id = input('room_id', 0);
|
||||||
if(empty($gift_bag_id)){
|
if(empty($gift_bag_id)){
|
||||||
return V(0,"请选择盲盒类型");
|
return V(0,"请选择盲盒类型");
|
||||||
}
|
}
|
||||||
$gift_bag_detail = db::name($this->table)->where(['gift_bag_id'=>$gift_bag_id])->select();
|
$gift_bag_detail = db::name($this->table)->where(['gift_bag_id'=>$gift_bag_id])->select();
|
||||||
|
// if(in_array($gift_bag_id,[10,11,12,13])){
|
||||||
|
// $periods = 1;
|
||||||
|
// $target_room_ids = [];
|
||||||
|
// if(!empty($room_id)){
|
||||||
|
// // 处理单个房间
|
||||||
|
// $room_pan_detail = db::name('vs_room_pan')
|
||||||
|
// ->where(['gift_bag_id'=>$gift_bag_id,'room_id'=>$room_id])
|
||||||
|
// ->order('id desc')
|
||||||
|
// ->find();
|
||||||
|
//
|
||||||
|
// if($room_pan_detail){
|
||||||
|
// $periods = $room_pan_detail['periods'];
|
||||||
|
// }
|
||||||
|
// // 删除指定房间的数据
|
||||||
|
// db::name('vs_room_pan')
|
||||||
|
// ->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])
|
||||||
|
// ->delete();
|
||||||
|
//
|
||||||
|
// $target_room_ids = [$room_id];
|
||||||
|
// }else{
|
||||||
|
// // 处理所有房间
|
||||||
|
// db::name('vs_room_pan')
|
||||||
|
// ->where(['gift_bag_id'=>$gift_bag_id])
|
||||||
|
// ->delete();
|
||||||
|
//
|
||||||
|
// $target_room_ids = db::name('vs_room')
|
||||||
|
// ->where(['is_open_blind_box_turntable'=>1,'room_status'=>1])
|
||||||
|
// ->column('id');
|
||||||
|
// }
|
||||||
|
// // 批量插入数据
|
||||||
|
// $insert_data = [];
|
||||||
|
// $update_data = [];
|
||||||
|
// foreach ($gift_bag_detail as $v){
|
||||||
|
// if(!empty($room_id)) {
|
||||||
|
// // 单个房间更新或插入
|
||||||
|
// $existing = db::name('vs_room_pan')
|
||||||
|
// ->where([
|
||||||
|
// 'room_id' => $room_id,
|
||||||
|
// 'gift_bag_detail_id' => $v['id']
|
||||||
|
// ])
|
||||||
|
// ->find();
|
||||||
|
//
|
||||||
|
// if($existing) {
|
||||||
|
// $update_data[] = [
|
||||||
|
// 'id' => $existing['id'],
|
||||||
|
// 'remaining_number' => $v['quantity'],
|
||||||
|
// 'periods' => $periods
|
||||||
|
// ];
|
||||||
|
// } else {
|
||||||
|
// $insert_data[] = [
|
||||||
|
// 'room_id' => $room_id,
|
||||||
|
// 'gift_bag_id' => $gift_bag_id,
|
||||||
|
// 'gift_bag_detail_id' => $v['id'],
|
||||||
|
// 'remaining_number' => $v['quantity'],
|
||||||
|
// 'periods' => $periods,
|
||||||
|
// 'createtime' => time(),
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// // 多个房间批量插入
|
||||||
|
// foreach ($target_room_ids as $mid){
|
||||||
|
// $insert_data[] = [
|
||||||
|
// 'room_id' => $mid,
|
||||||
|
// 'gift_bag_id' => $gift_bag_id,
|
||||||
|
// 'gift_bag_detail_id' => $v['id'],
|
||||||
|
// 'remaining_number' => $v['quantity'],
|
||||||
|
// 'periods' => $periods,
|
||||||
|
// 'createtime' => time(),
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 执行批量插入
|
||||||
|
// if(!empty($insert_data)) {
|
||||||
|
// db::name('vs_room_pan')->insertAll($insert_data);
|
||||||
|
// }
|
||||||
|
// // 执行批量更新
|
||||||
|
// if(!empty($update_data)) {
|
||||||
|
// foreach($update_data as $update_item) {
|
||||||
|
// db::name('vs_room_pan')
|
||||||
|
// ->where(['id' => $update_item['id']])
|
||||||
|
// ->update([
|
||||||
|
// 'remaining_number' => $update_item['remaining_number'],
|
||||||
|
// 'periods' => $update_item['periods']
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// 更新盲盒详情的剩余数量
|
||||||
foreach ($gift_bag_detail as $k=>$v){
|
foreach ($gift_bag_detail as $k=>$v){
|
||||||
$bag_data = db::name($this->table)->where(['id'=>$v['id']])->update(['remaining_number'=>$v['quantity']]);
|
$bag_data = db::name($this->table)->where(['id'=>$v['id']])->update(['remaining_number'=>$v['quantity']]);
|
||||||
}
|
}
|
||||||
if($bag_data){
|
// 清除缓存
|
||||||
return V(1,"成功");
|
Cache::rm("pan_gift_bag".$gift_bag_id);
|
||||||
}else{
|
Cache::rm("pan_gift_bag_detail".$gift_bag_id);
|
||||||
return V(0,"失败");
|
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,"成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -241,6 +372,8 @@ class BlindBox extends adminApi
|
|||||||
}
|
}
|
||||||
$gift_id = input('gift_id', '');
|
$gift_id = input('gift_id', '');
|
||||||
$description = input('description', '');
|
$description = input('description', '');
|
||||||
|
$status = input('status', 1);
|
||||||
|
|
||||||
$introd =$_POST['introd']??"";
|
$introd =$_POST['introd']??"";
|
||||||
if(empty($gift_id)){
|
if(empty($gift_id)){
|
||||||
return V(0,"请配置礼物");
|
return V(0,"请配置礼物");
|
||||||
@@ -255,7 +388,10 @@ class BlindBox extends adminApi
|
|||||||
'introd' => $introd,
|
'introd' => $introd,
|
||||||
];
|
];
|
||||||
$ext = json_encode($ext);
|
$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){
|
if($res){
|
||||||
return V(1,"成功");
|
return V(1,"成功");
|
||||||
}else{
|
}else{
|
||||||
@@ -275,6 +411,7 @@ class BlindBox extends adminApi
|
|||||||
'gift_id' => $ext_data['gift_id'],
|
'gift_id' => $ext_data['gift_id'],
|
||||||
'description' => $ext_data['description'],
|
'description' => $ext_data['description'],
|
||||||
'introd' => stripcslashes($ext_data['introd']),
|
'introd' => stripcslashes($ext_data['introd']),
|
||||||
|
'status' => $gift_bag['status'],
|
||||||
];
|
];
|
||||||
if($gift_bag){
|
if($gift_bag){
|
||||||
return V(1,"成功",$ext);
|
return V(1,"成功",$ext);
|
||||||
@@ -309,6 +446,8 @@ class BlindBox extends adminApi
|
|||||||
}
|
}
|
||||||
if($gift_bag_id){
|
if($gift_bag_id){
|
||||||
$where['gift_bag_id'] = $gift_bag_id;
|
$where['gift_bag_id'] = $gift_bag_id;
|
||||||
|
}else{
|
||||||
|
$where['gift_bag_id'] = ['in',[7,8,9]];
|
||||||
}
|
}
|
||||||
if($periods){
|
if($periods){
|
||||||
$where['periods'] = $periods;
|
$where['periods'] = $periods;
|
||||||
@@ -317,10 +456,10 @@ class BlindBox extends adminApi
|
|||||||
$where['createtime'] = ['>=', strtotime($stime)];
|
$where['createtime'] = ['>=', strtotime($stime)];
|
||||||
}
|
}
|
||||||
if($etime!==""){
|
if($etime!==""){
|
||||||
$where['createtime'] = ['<=', strtotime($etime.'23:59:59')];
|
$where['createtime'] = ['<=', strtotime($etime)];
|
||||||
}
|
}
|
||||||
if($stime!=="" && $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();
|
$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();
|
$lists_data = db::name('vs_gift_bag_receive_log')->where($where)->page($page, $page_limit)->order("id desc")->select();
|
||||||
@@ -401,5 +540,385 @@ class BlindBox extends adminApi
|
|||||||
$bag_list = db::name("vs_gift_bag")->field('id,name')->where(['activities_id'=>$activities_id,'status'=>1])->select();
|
$bag_list = db::name("vs_gift_bag")->field('id,name')->where(['activities_id'=>$activities_id,'status'=>1])->select();
|
||||||
return V(1,"成功", $bag_list);
|
return V(1,"成功", $bag_list);
|
||||||
}
|
}
|
||||||
|
//--------------------------盲盒转盘与巡乐会-------------------------------------------------------
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 巡乐会规则详情
|
||||||
|
*/
|
||||||
|
public function xunlehui_rule_detail(){
|
||||||
|
$gift_bag_id = 13;
|
||||||
|
$gift_bag = db::name('vs_gift_bag')->where(['id'=>$gift_bag_id])->find();
|
||||||
|
$ext_data = json_decode($gift_bag['ext'],true);
|
||||||
|
$ext_data['introd'] = stripcslashes($ext_data['introd']);
|
||||||
|
$bag_list = db::name("vs_gift_bag")->field('id,name')->where(['activities_id'=>5,'status'=>1])->select();
|
||||||
|
foreach ($bag_list as &$value) {
|
||||||
|
$value['is_default'] = 0;
|
||||||
|
if($value['id'] == $ext_data['inlet_bag_id']){
|
||||||
|
$value['is_default'] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ext_data['bag_list'] = $bag_list;
|
||||||
|
if($gift_bag){
|
||||||
|
return V(1,"成功",$ext_data);
|
||||||
|
}else{
|
||||||
|
return V(0,"失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 巡乐会规则设置
|
||||||
|
*/
|
||||||
|
public function xunlehui_set_rule(){
|
||||||
|
$gift_bag_id = 13;
|
||||||
|
$inlet_bag_id = input('inlet_bag_id', '');
|
||||||
|
$waiting_start_num = input('waiting_start_num', '');
|
||||||
|
$start_num = input('start_num', '');
|
||||||
|
$selected_gift_id = input('selected_gift_id', '');
|
||||||
|
$locking_gift_id = input('locking_gift_id', '');
|
||||||
|
$give_homeowner_gift_id = input('give_homeowner_gift_id', '');
|
||||||
|
$end_time = input('end_time', '');
|
||||||
|
$tow_no_locking_time = input('tow_no_locking_time', '');
|
||||||
|
$next_time = input('next_time', '');
|
||||||
|
$introd =$_POST['introd']??"";
|
||||||
|
$price = input('price', '');
|
||||||
|
if(empty($inlet_bag_id)){
|
||||||
|
return V(0,"请选择巡乐会绑定入口");
|
||||||
|
}
|
||||||
|
$ext =[
|
||||||
|
'inlet_bag_id' => $inlet_bag_id,
|
||||||
|
'gift_id' => $selected_gift_id,
|
||||||
|
'xlh_box_price' => $price,
|
||||||
|
'open_condition' => [
|
||||||
|
'waiting_start_num' => $waiting_start_num,
|
||||||
|
'start_num' => $start_num,
|
||||||
|
],
|
||||||
|
'locking_condition' => [
|
||||||
|
'selected_gift_id' => $selected_gift_id,
|
||||||
|
'locking_gift_id' => $locking_gift_id,
|
||||||
|
'give_homeowner_gift_id' => $give_homeowner_gift_id,
|
||||||
|
],
|
||||||
|
'locking_time' => [
|
||||||
|
'end_time' => $end_time,
|
||||||
|
'tow_no_locking_time' => $tow_no_locking_time,
|
||||||
|
'next_time' => $next_time,
|
||||||
|
],
|
||||||
|
'introd' => $introd,
|
||||||
|
];
|
||||||
|
$ext = json_encode($ext);
|
||||||
|
$res = db::name('vs_gift_bag')->where(['id'=>$gift_bag_id])->update(['ext'=>$ext]);
|
||||||
|
if($res){
|
||||||
|
//删除缓存
|
||||||
|
$cacheKey = "xlh_config_13";
|
||||||
|
cache::rm($cacheKey);
|
||||||
|
return V(1,"成功");
|
||||||
|
}else{
|
||||||
|
return V(0,"失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 盲盒转盘统计
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function blind_box_turntable_lists(){
|
||||||
|
$page = input('page', 1);
|
||||||
|
$page_limit = input('page_limit', 30);
|
||||||
|
$gift_id = input('gift_id', '');
|
||||||
|
$gift_name = input('gift_name', '');
|
||||||
|
$gift_bag_id = input('gift_bag_id', 10);
|
||||||
|
$room_id = input('room_id', '');
|
||||||
|
if(empty($gift_bag_id)){
|
||||||
|
return V(0,"请选择盲盒类型");
|
||||||
|
}
|
||||||
|
$room = db::name('vs_room')->where(['id'=>$room_id])->find();
|
||||||
|
if(empty($room)){
|
||||||
|
return V(0,"房间不存在");
|
||||||
|
}
|
||||||
|
if($room['is_open_blind_box_turntable'] !=1){
|
||||||
|
return V(0,"该房间未开启盲盒转盘");
|
||||||
|
}
|
||||||
|
$bag_data = db::name("vs_gift_bag")->find($gift_bag_id);
|
||||||
|
$bag_list = db::name("vs_gift_bag")->field('id,name')->where(['activities_id'=>$bag_data['activities_id'],'status'=>1])->select();
|
||||||
|
foreach ($bag_list as &$v) {
|
||||||
|
$v['default'] = $gift_bag_id == $v['id'] ? 1 : 0;
|
||||||
|
}
|
||||||
|
$where=[];
|
||||||
|
$where['gift_bag_id'] = $gift_bag_id;
|
||||||
|
if($gift_id!==''){
|
||||||
|
$where['foreign_id'] =$gift_id;
|
||||||
|
}
|
||||||
|
if($gift_name!==''){
|
||||||
|
$where['name'] = ['like', '%'.$gift_name.'%'];
|
||||||
|
}
|
||||||
|
$count = db::name($this->table)->where($where)->count();
|
||||||
|
$lists_data = db::name($this->table)->where($where)->page($page, $page_limit)->order("id desc")->select();
|
||||||
|
$lists = [];
|
||||||
|
$periods =1;
|
||||||
|
foreach ($lists_data as $key => $value) {
|
||||||
|
$lists[$key]['id'] = $value['id'];
|
||||||
|
$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();
|
||||||
|
$lists[$key]['base_image'] = $gift_data['base_image'];
|
||||||
|
$lists[$key]['gift_price'] = $gift_data['gift_price'];
|
||||||
|
$lists[$key]['quantity'] = $value['quantity'];
|
||||||
|
$room_pan = db::name('vs_room_pan')->where(['room_id'=>$room_id,'gift_bag_detail_id'=>$value['id']])->find();
|
||||||
|
$lists[$key]['remaining_number'] = $room_pan['remaining_number'] ?? 0;
|
||||||
|
$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]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||||
|
$periods = $room_pan['periods']??1;
|
||||||
|
}
|
||||||
|
//统计
|
||||||
|
$total_data = [];
|
||||||
|
//每期总次数
|
||||||
|
$total_count = db::name($this->table)->where(['gift_bag_id'=>$gift_bag_id])->sum('quantity');
|
||||||
|
//每期总礼物价值
|
||||||
|
$total_price_data = db::name($this->table)->alias('a')
|
||||||
|
->field('a.quantity,b.gift_price,b.gift_price * a.quantity as total_price')
|
||||||
|
->join('vs_gift b','a.foreign_id = b.gid')
|
||||||
|
->where(['a.gift_bag_id'=>$gift_bag_id])
|
||||||
|
->select();
|
||||||
|
$total_price = array_sum(array_column($total_price_data,'total_price'));
|
||||||
|
//每期总抽奖花费(支出)
|
||||||
|
$bag_data = db::name("vs_gift_bag")->field('id,name,ext')->where(['id'=>$gift_bag_id])->find();
|
||||||
|
$ext = json_decode($bag_data['ext'],true);
|
||||||
|
$c_gift_id = $ext['gift_id'];
|
||||||
|
$c_gift_data = db::name('vs_gift')->where(['gid'=>$c_gift_id])->find();
|
||||||
|
$gift_price = $c_gift_data['gift_price']??0;
|
||||||
|
$total_cost = $total_count * $gift_price;
|
||||||
|
//每期统计(收入/支出)
|
||||||
|
if($total_cost==0 || $total_price==0){
|
||||||
|
$profit_loss_ratio = 0;
|
||||||
|
}else{
|
||||||
|
$profit_loss_ratio =round(($total_price / $total_cost ),2);
|
||||||
|
}
|
||||||
|
//今天抽奖人数
|
||||||
|
$today_count_user = db::name('vs_gift_bag_receive_log')
|
||||||
|
->where(['gift_bag_id'=>$gift_bag_id,'createtime'=>['between',[strtotime(date('Y-m-d')),time()]]])
|
||||||
|
->group('user_id')
|
||||||
|
->count();
|
||||||
|
//今日抽奖总次数
|
||||||
|
$today_total_count = db::name('vs_gift_bag_receive_log')
|
||||||
|
->where(['gift_bag_id'=>$gift_bag_id,'createtime'=>['between',[strtotime(date('Y-m-d')),time()]]])
|
||||||
|
->count();
|
||||||
|
//今日抽奖收入
|
||||||
|
$today_total_price = db::name('vs_gift_bag_receive_log')
|
||||||
|
->where(['gift_bag_id'=>$gift_bag_id,'createtime'=>['between',[strtotime(date('Y-m-d')),time()]]])
|
||||||
|
->sum('bag_price');
|
||||||
|
$return_data = [
|
||||||
|
'page' =>$page,
|
||||||
|
'page_limit' => $page_limit,
|
||||||
|
'count' => $count,
|
||||||
|
'lists' => $lists,
|
||||||
|
'bag_list' => $bag_list,
|
||||||
|
'total_data' => [
|
||||||
|
'blind_box_turntable_periods' => $periods, //当前期数
|
||||||
|
'remaining_number' => db::name('vs_room_pan')->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])->sum('remaining_number')??'0',
|
||||||
|
'total_count' => $total_count,
|
||||||
|
'total_price' => $total_price,
|
||||||
|
'total_cost' => $total_cost,
|
||||||
|
'profit_loss_ratio' => $profit_loss_ratio,
|
||||||
|
'today_count_user' => $today_count_user,
|
||||||
|
'today_total_count' => $today_total_count,
|
||||||
|
'today_total_price' => $today_total_price,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return V(1,"成功", $return_data);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 盲盒转盘开奖记录
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function blind_box_turntable_open_record(){
|
||||||
|
$page = input('page', 1);
|
||||||
|
$page_limit = input('page_limit', 30);
|
||||||
|
$gift_id = input('gift_id', '');
|
||||||
|
$user_id = input('user_id', '');
|
||||||
|
$room_id = input('room_id', '');
|
||||||
|
$gift_bag_id = input('gift_bag_id', '');
|
||||||
|
$periods = input('periods', '');
|
||||||
|
$stime = input('stime', date('Y-m-d'));
|
||||||
|
$etime = input('etime', date('Y-m-d h:i:s', time()));
|
||||||
|
$where = [];
|
||||||
|
if($room_id){
|
||||||
|
$where['room_number'] = $room_id;
|
||||||
|
}
|
||||||
|
if($gift_id){
|
||||||
|
$where['gift_id'] = $gift_id;
|
||||||
|
}
|
||||||
|
if($user_id){
|
||||||
|
$user_id = db::name('user')->where('user_code', $user_id)->value('id');
|
||||||
|
$where['user_id'] = $user_id;
|
||||||
|
}
|
||||||
|
if($gift_bag_id){
|
||||||
|
$where['gift_bag_id'] = $gift_bag_id;
|
||||||
|
}else{
|
||||||
|
$where['gift_bag_id'] = ['in',[10,11,12]];
|
||||||
|
}
|
||||||
|
if($periods){
|
||||||
|
$where['periods'] = $periods;
|
||||||
|
}
|
||||||
|
if($stime!==""){
|
||||||
|
$where['createtime'] = ['>=', strtotime($stime)];
|
||||||
|
}
|
||||||
|
if($etime!==""){
|
||||||
|
$where['createtime'] = ['<=', strtotime($etime)];
|
||||||
|
}
|
||||||
|
if($stime!=="" && $etime!==""){
|
||||||
|
$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();
|
||||||
|
$lists = [];
|
||||||
|
foreach ($lists_data as $key => $value) {
|
||||||
|
$lists[$key]['id'] = $value['id'];
|
||||||
|
$lists[$key]['user_id'] = $value['user_id'];
|
||||||
|
$user = db::name('user')->where('id',$value['user_id'])->find();
|
||||||
|
$lists[$key]['user_name'] = "";
|
||||||
|
if($user){
|
||||||
|
$lists[$key]['user_name'] = $user['user_code'].'-'.$user['nickname'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$lists[$key]['gift_user_id'] = $value['gift_user_id'];
|
||||||
|
$gift_user = db::name('user')->where('id',$value['gift_user_id'])->find();
|
||||||
|
$lists[$key]['gift_user_name'] = "";
|
||||||
|
if($gift_user){
|
||||||
|
$lists[$key]['gift_user_name'] = $gift_user['user_code'].'-'.$gift_user['nickname'];
|
||||||
|
}
|
||||||
|
$lists[$key]['gift_bag_type'] = db::name('vs_gift_bag')->where('id',$value['gift_bag_id'])->value('name');
|
||||||
|
$lists[$key]['periods'] = $value['periods'];
|
||||||
|
$room = db::name('vs_room')->where('id',$value['room_id'])->find();
|
||||||
|
$lists[$key]['room_name'] = "";
|
||||||
|
if($room){
|
||||||
|
$lists[$key]['room_name'] = $room['room_number']."-".$room['room_name'];
|
||||||
|
}
|
||||||
|
$lists[$key]['bag_price'] = $value['bag_price']*$value['num'];
|
||||||
|
$lists[$key]['gift_id'] = $value['gift_id'];
|
||||||
|
$lists[$key]['gift_name'] = db::name('vs_gift')->where('gid',$value['gift_id'])->value('gift_name');
|
||||||
|
$lists[$key]['gift_price'] = $value['gift_price'];
|
||||||
|
$lists[$key]['gift_num'] = $value['num'];
|
||||||
|
$lists[$key]['createtime'] = date('Y-m-d H:i:s',$value['createtime']);
|
||||||
|
}
|
||||||
|
$all_lists_data = db::name('vs_gift_bag_receive_pan_log')->where($where)->order("id desc")->select();
|
||||||
|
$total =0;
|
||||||
|
$total_gift_money = 0;
|
||||||
|
$total_money = 0;
|
||||||
|
foreach ($all_lists_data as $key => $value) {
|
||||||
|
$total += $value['num'];//总抽奖次数
|
||||||
|
$total_gift_money += $value['gift_price'] * $value['num']; //总礼物价值(收入)
|
||||||
|
$total_money += $value['bag_price'] * $value['num']; //总抽奖金额(支出)
|
||||||
|
}
|
||||||
|
//统计
|
||||||
|
if($total_gift_money==0 || $total_money==0){
|
||||||
|
$ratio = 0;
|
||||||
|
}else{
|
||||||
|
$ratio =round(($total_gift_money / $total_money),3);
|
||||||
|
}
|
||||||
|
//用户盈亏
|
||||||
|
$profit_loss = $total_gift_money - $total_money;
|
||||||
|
//平台盈亏
|
||||||
|
$platform_profit_loss = $total_money - $total_gift_money;
|
||||||
|
if($profit_loss==0 || $total_money==0){
|
||||||
|
$profit_loss_ratio = 0;
|
||||||
|
$platform_profit_loss_ratio = 0;
|
||||||
|
}else{
|
||||||
|
// 盈亏比
|
||||||
|
$profit_loss_ratio = round(($profit_loss / $total_money),3);
|
||||||
|
//平台盈亏比
|
||||||
|
$platform_profit_loss_ratio = round(($platform_profit_loss / $total_money),3);
|
||||||
|
}
|
||||||
|
$return_data = [
|
||||||
|
'page' =>$page,
|
||||||
|
'page_limit' => $page_limit,
|
||||||
|
'count' => $count,
|
||||||
|
'lists' => $lists,
|
||||||
|
'total_data' => [
|
||||||
|
'total' => $total,
|
||||||
|
'total_money' => $total_money,
|
||||||
|
'total_gift_money' => $total_gift_money,
|
||||||
|
'ratio' => $ratio,
|
||||||
|
'profit_loss' => $profit_loss,
|
||||||
|
'profit_loss_ratio' => $profit_loss_ratio,
|
||||||
|
'platform_profit_loss' => $platform_profit_loss,
|
||||||
|
'platform_profit_loss_ratio' => $platform_profit_loss_ratio,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return V(1,"成功", $return_data);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 寻乐会锁定记录
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function xlh_lock_record(){
|
||||||
|
$page = input('page', 1);
|
||||||
|
$page_limit = input('page_limit', 30);
|
||||||
|
$gift_id = input('gift_id', '');
|
||||||
|
$user_id = input('user_id', '');
|
||||||
|
$room_id = input('room_id', 0);
|
||||||
|
$periods = input('periods', '');
|
||||||
|
$where = [];
|
||||||
|
if($room_id){
|
||||||
|
$where['b.room_id'] = $room_id;
|
||||||
|
}
|
||||||
|
if($gift_id){
|
||||||
|
$where['b.gift_id'] = $gift_id;
|
||||||
|
}
|
||||||
|
if($user_id){
|
||||||
|
$user_id = db::name('user')->where('user_code', $user_id)->value('id');
|
||||||
|
$where['a.user_id'] = $user_id;
|
||||||
|
}
|
||||||
|
if($periods){
|
||||||
|
$where['b.periods'] = $periods;
|
||||||
|
}
|
||||||
|
|
||||||
|
$count = db::name('vs_room_pan_xlh_log')->alias('a')
|
||||||
|
->join('vs_room_pan_xlh b', 'a.xlh_id = b.id')
|
||||||
|
->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.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")
|
||||||
|
->select();
|
||||||
|
$lists = [];
|
||||||
|
foreach ($lists_data as $key => $value) {
|
||||||
|
$lists[$key]['id'] = $value['id'];
|
||||||
|
$lists[$key]['periods'] = $value['periods'];
|
||||||
|
$user = db::name('user')->field('user_code,nickname')->where('id',$value['user_id'])->find();
|
||||||
|
$lists[$key]['user'] = $user['user_code']."-".$user['nickname'];
|
||||||
|
//支付价格
|
||||||
|
$lists[$key]['pay_price'] = $value['pay_price'];
|
||||||
|
$gift = db::name('vs_gift')->field('gid,gift_name,gift_price')->where('gid',$value['locking_gift_id'])->find();
|
||||||
|
$lists[$key]['gift_id'] = $value['locking_gift_id'];
|
||||||
|
$lists[$key]['gift_name'] = $gift['gift_name']??"";
|
||||||
|
$lists[$key]['gift_price'] = $gift['gift_price']??0;
|
||||||
|
$lists[$key]['locking_num'] = $value['num'];
|
||||||
|
$lists[$key]['is_send'] = $value['is_send'];
|
||||||
|
$lists[$key]['is_send_str'] = $value['is_send']==1?"是":"否";
|
||||||
|
$lists[$key]['createtime'] = date('Y-m-d H:i:s',$value['createtime']);
|
||||||
|
$room = db::name('vs_room')->where('id',$value['room_id'])->find();
|
||||||
|
$lists[$key]['room_name'] = "";
|
||||||
|
if($room){
|
||||||
|
$lists[$key]['room_name'] = $room['room_number']."-".$room['room_name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//今日锁定礼物数量
|
||||||
|
$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])
|
||||||
|
->where($where)
|
||||||
|
->sum('a.num');
|
||||||
|
$return_data = [
|
||||||
|
'page' =>$page,
|
||||||
|
'page_limit' => $page_limit,
|
||||||
|
'count' => $count,
|
||||||
|
'lists' => $lists,
|
||||||
|
'locking_num' => $locking_num
|
||||||
|
];
|
||||||
|
return V(1,"成功", $return_data);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ class Decorate extends adminApi
|
|||||||
$type = input('type', '');
|
$type = input('type', '');
|
||||||
$where = ['delete_time'=>0];
|
$where = ['delete_time'=>0];
|
||||||
if($name){
|
if($name){
|
||||||
$where['name'] = ['like', '%'.$name.'%'];
|
$where['title'] = ['like', '%'.$name.'%'];
|
||||||
}
|
}
|
||||||
if($type){
|
if($type){
|
||||||
$where['type'] = $type;
|
$where['type'] = $type;
|
||||||
@@ -51,15 +51,18 @@ class Decorate extends adminApi
|
|||||||
$return_list[$k]['id'] = $v['did'];
|
$return_list[$k]['id'] = $v['did'];
|
||||||
$return_list[$k]['name'] = $v['title'];
|
$return_list[$k]['name'] = $v['title'];
|
||||||
$return_list[$k]['type'] = $v['type'];
|
$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]['base_image'] = $v['base_image'];
|
||||||
$return_list[$k]['file_type'] = $v['file_type'];
|
$return_list[$k]['file_type'] = $v['file_type'];
|
||||||
$return_list[$k]['file_type_str'] = $v['file_type'] ? "SVGA" : "MP4";
|
$return_list[$k]['file_type_str'] = $v['file_type']==1 ? "SVGA" : "MP4";
|
||||||
$return_list[$k]['play_image'] = $v['play_image'];
|
$return_list[$k]['play_image'] = $v['play_image'];
|
||||||
$return_list[$k]['show_status'] = $v['show_status'];
|
$return_list[$k]['show_status'] = $v['show_status'];
|
||||||
$return_list[$k]['is_buy'] = $v['is_buy'];
|
$return_list[$k]['is_buy'] = $v['is_buy'];
|
||||||
$return_list[$k]['createtime'] = date('Y-m-d H:i:s', $v['createtime']);
|
$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]['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 = [
|
$return_data = [
|
||||||
@@ -86,12 +89,19 @@ class Decorate extends adminApi
|
|||||||
$play_image = input('play_image', '');
|
$play_image = input('play_image', '');
|
||||||
//靓号
|
//靓号
|
||||||
$special_num = input('special_num', '');
|
$special_num = input('special_num', '');
|
||||||
|
$ext_value = input('ext_value', '');
|
||||||
|
$price = input('price', 0);
|
||||||
if($title==""){
|
if($title==""){
|
||||||
return V(0,"参数错");
|
return V(0,"参数错");
|
||||||
}
|
}
|
||||||
if($type==""){
|
if($type==""){
|
||||||
return V(0,"参数错");
|
return V(0,"参数错");
|
||||||
}
|
}
|
||||||
|
if(in_array($type, [6,7,8])){
|
||||||
|
if($special_num==""){
|
||||||
|
return V(0,"请填写靓号");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
@@ -104,7 +114,9 @@ class Decorate extends adminApi
|
|||||||
'special_num' => $special_num,
|
'special_num' => $special_num,
|
||||||
'createtime' => time(),
|
'createtime' => time(),
|
||||||
'updatetime' => time(),
|
'updatetime' => time(),
|
||||||
'admin_id' => $admin_id
|
'admin_id' => $admin_id,
|
||||||
|
'ext_value' => $ext_value,
|
||||||
|
'price' => $price,
|
||||||
];
|
];
|
||||||
$id = db::name($this->table)->insertGetId($data);
|
$id = db::name($this->table)->insertGetId($data);
|
||||||
if(!$id){
|
if(!$id){
|
||||||
@@ -143,6 +155,13 @@ class Decorate extends adminApi
|
|||||||
$file_type = input('file_type', 2);
|
$file_type = input('file_type', 2);
|
||||||
$play_image = input('play_image', '');
|
$play_image = input('play_image', '');
|
||||||
$special_num = input('special_num', '');
|
$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 = [];
|
$data = [];
|
||||||
if($title!=""){
|
if($title!=""){
|
||||||
$data['title'] = $title;
|
$data['title'] = $title;
|
||||||
@@ -168,6 +187,12 @@ class Decorate extends adminApi
|
|||||||
if($special_num!=""){
|
if($special_num!=""){
|
||||||
$data['special_num'] = $special_num;
|
$data['special_num'] = $special_num;
|
||||||
}
|
}
|
||||||
|
if($ext_value!=""){
|
||||||
|
$data['ext_value'] = $ext_value;
|
||||||
|
}
|
||||||
|
if($price!=""){
|
||||||
|
$data['price'] = $price;
|
||||||
|
}
|
||||||
$data['updatetime'] = time();
|
$data['updatetime'] = time();
|
||||||
$res = db::name($this->table)->where(['did'=>$did])->update($data);
|
$res = db::name($this->table)->where(['did'=>$did])->update($data);
|
||||||
if(!$res){
|
if(!$res){
|
||||||
@@ -256,12 +281,20 @@ class Decorate extends adminApi
|
|||||||
if($price==""){
|
if($price==""){
|
||||||
return V(0,"参数错");
|
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){
|
if($decorate_data){
|
||||||
return V(0,"该价格已存在");
|
return V(0,"该价格已存在");
|
||||||
}
|
}
|
||||||
//计算折扣取整
|
//计算折扣取整
|
||||||
$discount = round($price/$original_price, 2)*10;
|
if($price==0 || $original_price==0){
|
||||||
|
$discount = 0;
|
||||||
|
}else{
|
||||||
|
$discount = round($price/$original_price, 2)*10;
|
||||||
|
if($discount >= 10){
|
||||||
|
$discount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'did' => $did,
|
'did' => $did,
|
||||||
'day' => $day,
|
'day' => $day,
|
||||||
@@ -327,6 +360,7 @@ class Decorate extends adminApi
|
|||||||
$type = input('type', '');
|
$type = input('type', '');
|
||||||
$where = [];
|
$where = [];
|
||||||
if($user_id!=""){
|
if($user_id!=""){
|
||||||
|
$user_id = db::name('user')->where('user_code', $user_id)->value('id');
|
||||||
$where['user_id'] = $user_id;
|
$where['user_id'] = $user_id;
|
||||||
}
|
}
|
||||||
if($did!=""){
|
if($did!=""){
|
||||||
@@ -340,9 +374,10 @@ class Decorate extends adminApi
|
|||||||
$return_list = [];
|
$return_list = [];
|
||||||
foreach ($lists as $k=>$v){
|
foreach ($lists as $k=>$v){
|
||||||
$return_list[$k]['id'] = $v['udid'];
|
$return_list[$k]['id'] = $v['udid'];
|
||||||
$return_list[$k]['user_name'] = $v['user_id']."-".db::name('user')->where(['id'=>$v['user_id']])->value('nickname');
|
$user_data = db::name('user')->where(['id'=>$v['user_id']])->find();
|
||||||
$return_list[$k]['type'] = model('api/Decorate')->TypeArray[$v['type']];
|
$return_list[$k]['user_name'] = $user_data['user_code']."-".db::name('user')->where(['id'=>$v['user_id']])->value('nickname');
|
||||||
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'];
|
$return_list[$k]['name'] = $v['special_num'];
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
@@ -373,18 +408,21 @@ class Decorate extends adminApi
|
|||||||
public function give_decorate(){
|
public function give_decorate(){
|
||||||
$user_id = input('user_id', '');
|
$user_id = input('user_id', '');
|
||||||
$decorate_id = input('decorate_id', '');
|
$decorate_id = input('decorate_id', '');
|
||||||
$day = input('day', '');
|
$day = input('day', 0);
|
||||||
$user = db::name('user')->where(['id'=>$user_id])->find();
|
$user = db::name('user')->where(['user_code'=>$user_id])->find();
|
||||||
if(!$user){
|
if(!$user){
|
||||||
return V(0,"用户不存在");
|
return V(0,"用户不存在");
|
||||||
}
|
}
|
||||||
|
$user_id = $user['id'];
|
||||||
$decorate = db::name('vs_decorate')->where(['did'=>$decorate_id])->find();
|
$decorate = db::name('vs_decorate')->where(['did'=>$decorate_id])->find();
|
||||||
if(!$decorate){
|
if(!$decorate){
|
||||||
return V(0,"装扮不存在");
|
return V(0,"装扮不存在");
|
||||||
}
|
}
|
||||||
$decorate_price = db::name('vs_decorate_price')->where(['did'=>$decorate_id,'day'=>$day,'is_delete'=>1])->find();
|
if($decorate['type']!=12){
|
||||||
if(!$decorate_price){
|
$decorate_price = db::name('vs_decorate_price')->where(['did'=>$decorate_id,'day'=>$day,'is_delete'=>1])->find();
|
||||||
return V(0,"该装扮天数不存在");
|
if(!$decorate_price){
|
||||||
|
return V(0,"该装扮天数不存在");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$result = model('api/Decorate')->pay_decorate($user_id,$decorate_id,$day,2);
|
$result = model('api/Decorate')->pay_decorate($user_id,$decorate_id,$day,2);
|
||||||
if($result['code'] == 1){
|
if($result['code'] == 1){
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace app\adminapi\controller;
|
|||||||
|
|
||||||
use app\admin\model\AdminLog;
|
use app\admin\model\AdminLog;
|
||||||
use app\common\controller\adminApi;
|
use app\common\controller\adminApi;
|
||||||
|
use think\Cache;
|
||||||
use think\Config;
|
use think\Config;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Hook;
|
use think\Hook;
|
||||||
@@ -44,7 +45,12 @@ class Gift extends adminApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($type == 2){
|
if($type == 2){
|
||||||
$giftTypeData = db::name('vs_gift_label')->where('delete_time',0)->order("sort asc,id desc")->select();
|
$type_id = input('type_id', 0);
|
||||||
|
$where['delete_time'] = 0;
|
||||||
|
if(!empty($type_id)){
|
||||||
|
$where['tid'] = $type_id;
|
||||||
|
}
|
||||||
|
$giftTypeData = db::name('vs_gift_label')->where($where)->order("sort asc,id desc")->select();
|
||||||
foreach ($giftTypeData as $key => $value) {
|
foreach ($giftTypeData as $key => $value) {
|
||||||
$giftType[$key]['id'] = $value['id'];
|
$giftType[$key]['id'] = $value['id'];
|
||||||
$giftType[$key]['name'] = $value['name'];
|
$giftType[$key]['name'] = $value['name'];
|
||||||
@@ -94,6 +100,7 @@ class Gift extends adminApi
|
|||||||
$lists[$key]['is_can_buy'] = $value['is_can_buy'];
|
$lists[$key]['is_can_buy'] = $value['is_can_buy'];
|
||||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
$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]['updatetime'] = date('Y-m-d H:i:s', $value['updatetime']);
|
||||||
|
$lists[$key]['icon'] = $value['icon']??"";
|
||||||
}
|
}
|
||||||
$return_data = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
@@ -121,6 +128,7 @@ class Gift extends adminApi
|
|||||||
$is_can_buy = input('is_can_buy', 1);
|
$is_can_buy = input('is_can_buy', 1);
|
||||||
$is_show = input('is_show', 1);
|
$is_show = input('is_show', 1);
|
||||||
$sort = input('sort', 0);
|
$sort = input('sort', 0);
|
||||||
|
$icon = input('icon', '');
|
||||||
if($gift_name==""){
|
if($gift_name==""){
|
||||||
return V(0,"礼物名称不能为空");
|
return V(0,"礼物名称不能为空");
|
||||||
}
|
}
|
||||||
@@ -151,12 +159,19 @@ class Gift extends adminApi
|
|||||||
'is_show' => $is_show,
|
'is_show' => $is_show,
|
||||||
'sort' => $sort,
|
'sort' => $sort,
|
||||||
'createtime' => time(),
|
'createtime' => time(),
|
||||||
'updatetime' => time()
|
'updatetime' => time(),
|
||||||
|
'icon' => $icon,
|
||||||
];
|
];
|
||||||
$id = db::name($this->table)->insertGetId($data);
|
$id = db::name($this->table)->insertGetId($data);
|
||||||
if(!$id){
|
if(!$id){
|
||||||
return V(0,"添加失败");
|
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]);
|
return V(1,"成功",['id'=>$id]);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -191,6 +206,7 @@ class Gift extends adminApi
|
|||||||
$is_can_buy = input('is_can_buy', '');
|
$is_can_buy = input('is_can_buy', '');
|
||||||
$is_show = input('is_show', '');
|
$is_show = input('is_show', '');
|
||||||
$sort = input('sort', '');
|
$sort = input('sort', '');
|
||||||
|
$icon = input('icon', '');
|
||||||
if($gid == ''){
|
if($gid == ''){
|
||||||
return V(0,"ID不能为空");
|
return V(0,"ID不能为空");
|
||||||
}
|
}
|
||||||
@@ -240,10 +256,18 @@ class Gift extends adminApi
|
|||||||
if($is_show){
|
if($is_show){
|
||||||
$data['is_show'] = $is_show;
|
$data['is_show'] = $is_show;
|
||||||
}
|
}
|
||||||
|
if($icon){
|
||||||
|
$data['icon'] = $icon;
|
||||||
|
}
|
||||||
$result = db::name($this->table)->where(['gid'=>$gid])->update($data);
|
$result = db::name($this->table)->where(['gid'=>$gid])->update($data);
|
||||||
if(!$result){
|
if(!$result){
|
||||||
return V(0,"修改失败,礼物内容无更改");
|
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]);
|
return V(1,"成功", ['id'=>$gid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace app\adminapi\controller;
|
namespace app\adminapi\controller;
|
||||||
|
ini_set('memory_limit', '512M'); // 临时增加到512MB
|
||||||
use app\common\controller\adminApi;
|
use app\common\controller\adminApi;
|
||||||
|
use app\common\library\GiftTableManager;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
|
use think\Log;
|
||||||
|
|
||||||
class GiveGift extends adminApi
|
class GiveGift extends adminApi
|
||||||
{
|
{
|
||||||
@@ -27,80 +29,119 @@ class GiveGift extends adminApi
|
|||||||
$from_id = input('from_id', '');//礼物来源id
|
$from_id = input('from_id', '');//礼物来源id
|
||||||
$gift_id = input('gift_id', '');//礼物id
|
$gift_id = input('gift_id', '');//礼物id
|
||||||
$from = input('from', '');// 来源类型,1聊天送礼物 2房间语聊送礼 3直播送礼 4动态打赏 5系统任务 6-cp房间送礼
|
$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');
|
||||||
$where=[];
|
$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 != ''){
|
if($send_user != ''){
|
||||||
$user_id = db::name('user')->where('user_code', $send_user)->value('id');
|
$user_id = db::name('user')->where('user_code', $send_user)->value('id');
|
||||||
$where['user_id'] = $user_id;
|
$where['user_id'] = $user_id;
|
||||||
|
$gwhere['gg.user_id'] = $user_id;
|
||||||
}
|
}
|
||||||
if($gift_user != ''){
|
if($gift_user != ''){
|
||||||
$gift_user_id = db::name('user')->where('user_code', $gift_user)->value('id');
|
$gift_user_id = db::name('user')->where('user_code', $gift_user)->value('id');
|
||||||
$where['gift_user'] = $gift_user_id;
|
$where['gift_user'] = $gift_user_id;
|
||||||
|
$gwhere['gg.gift_user'] = $gift_user_id;
|
||||||
}
|
}
|
||||||
if($from_id != ''){
|
if($from_id != ''){
|
||||||
$room_id = db::name('vs_room')->where('room_number', $from_id)->value('id');
|
$room_id = db::name('vs_room')->where('room_number', $from_id)->value('id');
|
||||||
if($room_id){
|
if($room_id){
|
||||||
$where['from_id'] = $room_id;
|
$where['from_id'] = $room_id;
|
||||||
|
$gwhere['gg.from_id'] = $room_id;
|
||||||
}else{
|
}else{
|
||||||
$where['from_id'] = $from_id;
|
$where['from_id'] = $from_id;
|
||||||
|
$gwhere['gg.from_id'] = $from_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($gift_id != ''){
|
if($gift_id != ''){
|
||||||
$where['gift_id'] = $gift_id;
|
$where['gift_id'] = $gift_id;
|
||||||
|
$gwhere['gg.gift_id'] = $gift_id;
|
||||||
}
|
}
|
||||||
if($from != ''){
|
if($from != ''){
|
||||||
$where['from'] = $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.' 23:59:59')]];
|
if (!empty($start_time) && !empty($end_time)) {
|
||||||
} elseif(!empty($start_time)){
|
$where['createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||||
$where['createtime'] = ['>=', strtotime($start_time)];
|
$gwhere['gg.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||||
} elseif(!empty($end_time)){
|
} elseif (!empty($start_time)) {
|
||||||
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
|
$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;
|
$app_earning = 0;
|
||||||
//接收人收益
|
//接收人收益
|
||||||
$receive_earning = 0;
|
$receive_earning = 0;
|
||||||
//房主收益
|
//房主收益
|
||||||
$room_owner_earning = 0;
|
$room_owner_earning = 0;
|
||||||
|
|
||||||
// 获取所有送礼记录
|
// 获取所有送礼记录
|
||||||
$list = db::name('vs_give_gift')->where($where)->order('id', 'desc')->select();
|
$lists = $gift_list['lists'];
|
||||||
$gift_ids = array_column($list, 'id');
|
$count = $gift_list['count'];
|
||||||
if (!empty($gift_ids)) {
|
// $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)){
|
||||||
|
$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')
|
$earning_list = db::name('vs_give_gift_ratio_log')
|
||||||
->where('give_gift_id', 'in', $gift_ids)
|
->field('app_earning,gift_user_earning,room_owner_earning')
|
||||||
->order('id', 'desc')
|
->order('id', 'desc')
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
// 计算总收益
|
|
||||||
foreach ($earning_list as $earning) {
|
|
||||||
$app_earning += $earning['app_earning'];
|
|
||||||
$receive_earning += $earning['gift_user_earning'];
|
|
||||||
$room_owner_earning += $earning['room_owner_earning'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$count = count($list);
|
// 计算总收益
|
||||||
$lists = $this->array_pagination($list, $page, $page_limit);
|
foreach ($earning_list as $earning) {
|
||||||
|
$app_earning += $earning['app_earning'];
|
||||||
|
$receive_earning += $earning['gift_user_earning'];
|
||||||
|
$room_owner_earning += $earning['room_owner_earning'];
|
||||||
|
}
|
||||||
|
|
||||||
// 提取所有需要关联查询的ID
|
// 提取所有需要关联查询的ID
|
||||||
$user_ids = array_merge(
|
$user_ids = array_merge(
|
||||||
array_column($lists, 'user_id'),
|
array_column($lists, 'user_id'),
|
||||||
array_column($lists, 'gift_user')
|
array_column($lists, 'gift_user')
|
||||||
);
|
);
|
||||||
$room_ids = array_filter(array_merge(
|
// $room_ids = array_filter(array_merge(
|
||||||
array_column($lists, 'room_id'),
|
// array_column($lists, 'room_id'),
|
||||||
array_column($lists, 'from_id')
|
// array_column($lists, 'from_id')
|
||||||
));
|
// ));
|
||||||
|
$room_ids = array_column($lists, 'from_id');
|
||||||
$gift_ids_list = array_column($lists, 'gift_id');
|
$gift_ids_list = array_column($lists, 'gift_id');
|
||||||
|
|
||||||
// 批量获取用户信息
|
// 批量获取用户信息
|
||||||
@@ -132,7 +173,7 @@ class GiveGift extends adminApi
|
|||||||
if (!empty($gift_ids_list)) {
|
if (!empty($gift_ids_list)) {
|
||||||
$gift_list = db::name('vs_gift')
|
$gift_list = db::name('vs_gift')
|
||||||
->where('gid', 'in', array_unique($gift_ids_list))
|
->where('gid', 'in', array_unique($gift_ids_list))
|
||||||
->field('gid,gift_name,gift_price')
|
->field('gid,gift_name,gift_price,type,label')
|
||||||
->select();
|
->select();
|
||||||
foreach ($gift_list as $gift) {
|
foreach ($gift_list as $gift) {
|
||||||
$gifts[$gift['gid']] = $gift;
|
$gifts[$gift['gid']] = $gift;
|
||||||
@@ -165,8 +206,11 @@ class GiveGift extends adminApi
|
|||||||
// 礼物信息
|
// 礼物信息
|
||||||
$gift_info = isset($gifts[$value['gift_id']]) ? $gifts[$value['gift_id']] : null;
|
$gift_info = isset($gifts[$value['gift_id']]) ? $gifts[$value['gift_id']] : null;
|
||||||
$value['gift_name'] = $gift_info ? $gift_info['gift_name'].'-'.$value['gift_id'] : '';
|
$value['gift_name'] = $gift_info ? $gift_info['gift_name'].'-'.$value['gift_id'] : '';
|
||||||
$value['gift_price'] = $gift_info ? $gift_info['gift_price'] : 0;
|
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){
|
if($value['from'] == 1){
|
||||||
$value['room'] = '聊天送礼';
|
$value['room'] = '聊天送礼';
|
||||||
@@ -189,6 +233,8 @@ class GiveGift extends adminApi
|
|||||||
$value['gift_user_earning'] = $earning_info ? $earning_info['gift_user_earning'] : 0;
|
$value['gift_user_earning'] = $earning_info ? $earning_info['gift_user_earning'] : 0;
|
||||||
$value['room_owner_earning'] = $earning_info ? $earning_info['room_owner_earning'] : 0;
|
$value['room_owner_earning'] = $earning_info ? $earning_info['room_owner_earning'] : 0;
|
||||||
}
|
}
|
||||||
|
//比例
|
||||||
|
$config = get_system_config();
|
||||||
$return_data = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
@@ -199,7 +245,10 @@ class GiveGift extends adminApi
|
|||||||
'total_price' => $total_price,
|
'total_price' => $total_price,
|
||||||
'app_earning' => round($app_earning,2) ,
|
'app_earning' => round($app_earning,2) ,
|
||||||
'receive_earning' => round($receive_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);
|
return V(1,"成功", $return_data);
|
||||||
@@ -209,4 +258,5 @@ class GiveGift extends adminApi
|
|||||||
$start = ($page - 1) * $limit;
|
$start = ($page - 1) * $limit;
|
||||||
return array_slice($array, $start, $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')]];
|
// $where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime.' 23:59:59')]];
|
||||||
// }
|
// }
|
||||||
$count = db::name('vs_guild')->where($where)->count();
|
$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 = [];
|
$list = [];
|
||||||
foreach ($data as $k=>$v) {
|
foreach ($data as $k=>$v) {
|
||||||
$list[$k]['id'] = $v['id'];
|
$list[$k]['id'] = $v['id'];
|
||||||
@@ -82,14 +82,19 @@ class Guild extends adminApi
|
|||||||
}
|
}
|
||||||
$list[$k]['guild_logo'] = $v['cover'];
|
$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'] = $v['is_show'];
|
||||||
|
$list[$k]['is_show_str'] = $v['is_show'] == 1 ? '显示' : '隐藏';
|
||||||
$list[$k]['status'] = $v['status'];
|
$list[$k]['status'] = $v['status'];
|
||||||
$list[$k]['status_str'] = $v['status'] == 1 ? '正常' : '解散';
|
$list[$k]['status_str'] = $v['status'] == 1 ? '正常' : '解散';
|
||||||
$list[$k]['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
|
$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]['updatetime'] = date('Y-m-d H:i:s',$v['updatetime']);
|
||||||
$list[$k]['user_id'] = $user['user_code'];
|
$list[$k]['user_id'] = $user['user_code']??"";
|
||||||
$list[$k]['intro'] = $v['intro'];
|
$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 排序
|
// 数组按today_money 排序
|
||||||
usort($list, function($a, $b) {
|
usort($list, function($a, $b) {
|
||||||
@@ -102,7 +107,21 @@ class Guild extends adminApi
|
|||||||
$reslut['list'] = $list;
|
$reslut['list'] = $list;
|
||||||
return V(1,"成功", $reslut);
|
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
|
* @param guild_special_id 靓号 guild_special_id
|
||||||
@@ -154,6 +173,15 @@ class Guild extends adminApi
|
|||||||
return V(0, "靓号已使用");
|
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();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$data = [
|
$data = [
|
||||||
@@ -170,7 +198,13 @@ class Guild extends adminApi
|
|||||||
}
|
}
|
||||||
//会长是否有房间
|
//会长是否有房间
|
||||||
$rid = 0;
|
$rid = 0;
|
||||||
$room_info = db::name('vs_room')->where('user_id', $user_id)->find();
|
$where = [
|
||||||
|
'user_id' => $user_id,
|
||||||
|
'delete_time' => 0
|
||||||
|
];
|
||||||
|
$where['apply_status'] = 2;//1待审核 2审核通过 3审核失败
|
||||||
|
$where['type_id'] = ['<>',6];
|
||||||
|
$room_info = db::name('vs_room')->where($where)->find();
|
||||||
if($room_info){
|
if($room_info){
|
||||||
$rid = $room_info['id'];
|
$rid = $room_info['id'];
|
||||||
}
|
}
|
||||||
@@ -180,8 +214,18 @@ class Guild extends adminApi
|
|||||||
$insert_data['room_id'] = $rid;
|
$insert_data['room_id'] = $rid;
|
||||||
$insert_data['status'] = 1;
|
$insert_data['status'] = 1;
|
||||||
$insert_data['is_deacon'] = 1;
|
$insert_data['is_deacon'] = 1;
|
||||||
|
$insert_data['apply_time'] = time();
|
||||||
$insert_data['createtime'] = time();
|
$insert_data['createtime'] = time();
|
||||||
$insert_data['is_show_room'] = 1;
|
$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);
|
$re = db::name('vs_guild_user')->insert($insert_data);
|
||||||
if (!$re) {
|
if (!$re) {
|
||||||
db::rollback();
|
db::rollback();
|
||||||
@@ -193,6 +237,26 @@ class Guild extends adminApi
|
|||||||
return V(0, $reslut['msg']);
|
return V(0, $reslut['msg']);
|
||||||
}
|
}
|
||||||
model('api/Tencent')->send_group_system_notification('g'.$res, $request['guild_name'].'工会群聊创建成功');
|
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();
|
db::commit();
|
||||||
return V(1,"成功", []);
|
return V(1,"成功", []);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -218,7 +282,7 @@ class Guild extends adminApi
|
|||||||
return V(0, "该工会不存在");
|
return V(0, "该工会不存在");
|
||||||
}
|
}
|
||||||
if (!empty($request['guild_name'])) {
|
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']) {
|
if (!empty($guild_name) && $guild_name['id'] != $request['id']) {
|
||||||
return V(0, "该工会名称已存在");
|
return V(0, "该工会名称已存在");
|
||||||
}
|
}
|
||||||
@@ -242,10 +306,10 @@ class Guild extends adminApi
|
|||||||
if(isset($request['guild_name']) && $request['guild_name']){
|
if(isset($request['guild_name']) && $request['guild_name']){
|
||||||
$data['guild_name'] = $request['guild_name'];
|
$data['guild_name'] = $request['guild_name'];
|
||||||
}
|
}
|
||||||
if(isset($request['user_id']) && $request['user_id']){
|
// if(isset($request['user_id']) && $request['user_id']){
|
||||||
$userID = db::name('user')->where('user_code',$request['user_id'])->value('id');
|
// $userID = db::name('user')->where('user_code',$request['user_id'])->value('id');
|
||||||
$data['user_id'] = $userID;
|
// $data['user_id'] = $userID;
|
||||||
}
|
// }
|
||||||
if(isset($request['guild_logo']) && $request['guild_logo']){
|
if(isset($request['guild_logo']) && $request['guild_logo']){
|
||||||
$data['cover'] = $request['guild_logo'];
|
$data['cover'] = $request['guild_logo'];
|
||||||
}
|
}
|
||||||
@@ -253,14 +317,56 @@ class Guild extends adminApi
|
|||||||
$data['intro'] = $request['guild_desc'];
|
$data['intro'] = $request['guild_desc'];
|
||||||
}
|
}
|
||||||
$res = model('Guild')->edit(['id' => $request['id']], $data);
|
$res = model('Guild')->edit(['id' => $request['id']], $data);
|
||||||
if ($res) {
|
//新功能
|
||||||
db::commit();
|
//创建基础信息数据
|
||||||
return V(1, "修改成功");
|
$guild_data = db::name('vs_guild_data')->where('guild_id',$guild['id'])->find();
|
||||||
} else {
|
$user = db::name('user')->where('id',$guild['user_id'])->find();
|
||||||
|
if($request['guild_user_mobile'] != $user['mobile']){
|
||||||
db::rollback();
|
db::rollback();
|
||||||
return V(0, "修改失败");
|
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, "修改成功");
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
db::rollback();
|
db::rollback();
|
||||||
return V(0, $e->getMessage());
|
return V(0, $e->getMessage());
|
||||||
@@ -288,9 +394,9 @@ class Guild extends adminApi
|
|||||||
$res = model('Guild')->edit(['id'=>$id],['status'=>2,'delete_time'=>time()]);
|
$res = model('Guild')->edit(['id'=>$id],['status'=>2,'delete_time'=>time()]);
|
||||||
|
|
||||||
if($res){
|
if($res){
|
||||||
db('vs_guild_user')->where(['guild_id'=>$id,'quit_type'=>0])->update(['quit_type'=>3,'quit_time'=>time()]);
|
db('vs_guild_user')->where(['guild_id'=>$id,'quit_type'=>0])->update(['quit_type'=>3,'quit_time'=>time(),'delete_time'=>time()]);
|
||||||
//解散群
|
//解散群
|
||||||
model('Tencent')->delete_group('g'.$id);
|
model('api/Tencent')->delete_group('g'.$id);
|
||||||
return V(1,"解散成功");
|
return V(1,"解散成功");
|
||||||
}else{
|
}else{
|
||||||
return V(0,"解散失败");
|
return V(0,"解散失败");
|
||||||
@@ -336,9 +442,9 @@ class Guild extends adminApi
|
|||||||
$rum_lists[$k]['id']=$v['id'];
|
$rum_lists[$k]['id']=$v['id'];
|
||||||
$rum_lists[$k]['user_id']=$v['user_id'];
|
$rum_lists[$k]['user_id']=$v['user_id'];
|
||||||
$rum_lists[$k]['user_code']=model('api/Decorate')->user_decorate_detail($v['user_id'],6);
|
$rum_lists[$k]['user_code']=model('api/Decorate')->user_decorate_detail($v['user_id'],6);
|
||||||
$rum_lists[$k]['nickname']=$user_info['nickname'];
|
$rum_lists[$k]['nickname']=$user_info['nickname']?? '';
|
||||||
$rum_lists[$k]['charm_level']=$user_info['charm_level'];
|
$rum_lists[$k]['charm_level']=$user_info['charm_level']??0;
|
||||||
$rum_lists[$k]['wealth_level']=$user_info['wealth_level'];
|
$rum_lists[$k]['wealth_level']=$user_info['wealth_level']??0;
|
||||||
//用户流水
|
//用户流水
|
||||||
$consumption_sql = db::name('vs_user_money_log')
|
$consumption_sql = db::name('vs_user_money_log')
|
||||||
->whereIn('change_type',$coin_consumption_type_array)
|
->whereIn('change_type',$coin_consumption_type_array)
|
||||||
@@ -373,8 +479,8 @@ class Guild extends adminApi
|
|||||||
$page = input('page', 1);
|
$page = input('page', 1);
|
||||||
$page_limit = input('page_limit', 30);
|
$page_limit = input('page_limit', 30);
|
||||||
$guild_id = input('guild_id', 0);
|
$guild_id = input('guild_id', 0);
|
||||||
$search_stime = input('search_stime','');
|
$search_stime_str = input('search_stime','');
|
||||||
$search_etime = input('search_etime','');
|
$search_etime_str = input('search_etime','');
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
$where=['a.status'=>1];
|
$where=['a.status'=>1];
|
||||||
$where=['a.room_id'=>['>',0]];
|
$where=['a.room_id'=>['>',0]];
|
||||||
@@ -390,28 +496,87 @@ class Guild extends adminApi
|
|||||||
}
|
}
|
||||||
$count = db::name($this->table_guild_user)->alias('a')
|
$count = db::name($this->table_guild_user)->alias('a')
|
||||||
->join('vs_room b', 'a.room_id = b.id', 'left')
|
->join('vs_room b', 'a.room_id = b.id', 'left')
|
||||||
->where(['a.guild_id'=>$guild_id,'a.quit_type'=>['in',[0,3]]])->where($where)->count();
|
->where(['a.guild_id'=>$guild_id])->where($where)->count();
|
||||||
$list = db::name($this->table_guild_user)->alias('a')
|
$list = db::name($this->table_guild_user)->alias('a')
|
||||||
->join('vs_room b', 'a.room_id = b.id', 'left')
|
->join('vs_room b', 'a.room_id = b.id', 'left')
|
||||||
->where(['a.guild_id'=>$guild_id,'a.quit_type'=>['in',[0,3]]])->where($where)->page($page, $page_limit)->select();
|
->where(['a.guild_id'=>$guild_id])->where($where)
|
||||||
|
// ->page($page, $page_limit)
|
||||||
|
->select();
|
||||||
if(!$list){
|
if(!$list){
|
||||||
return V(0,"暂无数据");
|
return V(0,"暂无数据");
|
||||||
}
|
}
|
||||||
$rum_lists = [];
|
$rum_lists = [];
|
||||||
|
//总流水
|
||||||
|
$total_consumption = 0;
|
||||||
foreach ($list as $k=>$v){
|
foreach ($list as $k=>$v){
|
||||||
|
$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']);
|
||||||
|
}
|
||||||
|
}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();
|
$room_info = db::name('vs_room')->where(['id'=>$v['room_id']])->find();
|
||||||
$rum_lists[$k]['id']=$v['id'];
|
$rum_lists[$k]['id']=$v['id'];
|
||||||
$rum_lists[$k]['room_id']=$v['room_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_code']= model('api/Decorate')->user_decorate_detail($v['room_id'], 7);
|
||||||
$rum_lists[$k]['room_name']=$room_info['room_name']?? '';
|
$rum_lists[$k]['room_name']=$room_info['room_name']?? '';
|
||||||
$rum_lists[$k]['room_cover']=$room_info['room_cover']?? '';
|
$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]['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']);
|
$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 = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'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,
|
'count' => $count,
|
||||||
'lists' => $rum_lists
|
'lists' => $rum_lists
|
||||||
];
|
];
|
||||||
@@ -441,44 +606,44 @@ class Guild extends adminApi
|
|||||||
$guild_id = input('guild_id', '');
|
$guild_id = input('guild_id', '');
|
||||||
$merge_guild_id = input('merge_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)){
|
if(empty($guild)){
|
||||||
return V(0,"该工会不存在");
|
return V(0,"该工会不存在");
|
||||||
}
|
}
|
||||||
if($guild['status'] == 2){
|
if($guild['status'] == 2){
|
||||||
return V(0,"该工会已解散");
|
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();
|
db::startTrans();
|
||||||
try{
|
try{
|
||||||
$res = model('Guild')->edit(['id'=>$guild_id],['status'=>2,'delete_time'=>time()]);
|
$res = model('Guild')->edit(['id'=>$guild_id],['status'=>2,'delete_time'=>time()]);
|
||||||
//并入工会
|
$merge_guild_user = db('vs_guild_user')->where(['guild_id'=>$guild_id,'quit_type'=>0,'status'=>1])->select();
|
||||||
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();
|
|
||||||
foreach ($merge_guild_user as $key=>$value){
|
foreach ($merge_guild_user as $key=>$value){
|
||||||
$res = db('vs_guild_user')->insert([
|
$res = db('vs_guild_user')->insert([
|
||||||
'user_id'=>$value['user_id'],
|
'user_id'=>$value['user_id'],
|
||||||
'guild_id'=>$merge_guild_id,
|
'guild_id'=>$merge_guild_id,
|
||||||
'room_id'=>$value['room_id'],
|
'room_id'=>$value['room_id'],
|
||||||
'coin'=>$value['coin'],
|
|
||||||
'status'=>$value['status'],
|
'status'=>$value['status'],
|
||||||
'is_deacon'=>$value['is_deacon'],
|
|
||||||
'is_show_room'=>$value['is_show_room'],
|
'is_show_room'=>$value['is_show_room'],
|
||||||
'remarks'=>$value['remarks'],
|
'remarks'=>"公会合并:从".$guild['guild_name']."合入".$merge_guild['guild_name'],
|
||||||
'apply_time'=>$value['apply_time'],
|
'settlement_ratio' =>$value['settlement_ratio'],
|
||||||
|
'apply_time'=>time(),
|
||||||
'createtime'=>time(),
|
'createtime'=>time(),
|
||||||
]);
|
]);
|
||||||
if(!$res){
|
if(!$res){
|
||||||
db::rollback();
|
db::rollback();
|
||||||
return V(0,"失败");
|
return V(0,"失败");
|
||||||
}
|
}
|
||||||
|
//更新公会人数
|
||||||
|
db('vs_guild')->where('id', $merge_guild_id)->setInc('num');
|
||||||
//拉用户进入工会群聊
|
//拉用户进入工会群聊
|
||||||
$rid = 'g'.$merge_guild_id;
|
$rid = 'g'.$merge_guild_id;
|
||||||
$reslut = model('api/Tencent')->add_group_member($rid, $value['user_id']);
|
$reslut = model('api/Tencent')->add_group_member($rid, $value['user_id']);
|
||||||
@@ -489,7 +654,7 @@ class Guild extends adminApi
|
|||||||
return V(0,"失败");
|
return V(0,"失败");
|
||||||
}
|
}
|
||||||
//解散群
|
//解散群
|
||||||
model('Tencent')->delete_group('g'.$guild_id);
|
model('api/Tencent')->delete_group('g'.$guild_id);
|
||||||
db::commit();
|
db::commit();
|
||||||
return V(1,"成功");
|
return V(1,"成功");
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
@@ -617,12 +782,14 @@ class Guild extends adminApi
|
|||||||
$search_status_time = input('search_status_time', '');
|
$search_status_time = input('search_status_time', '');
|
||||||
$search_end_time = input('search_end_time', '');
|
$search_end_time = input('search_end_time', '');
|
||||||
$search_status = input('search_status', '');
|
$search_status = input('search_status', '');
|
||||||
$where = ['b.delete_time'=>0];
|
// $where = ['b.delete_time'=>0];
|
||||||
|
$where = [];
|
||||||
if($search_user_id){
|
if($search_user_id){
|
||||||
$where['b.user_id'] = $search_user_id;
|
$where['b.user_id'] = $search_user_id;
|
||||||
}
|
}
|
||||||
if($search_guild_id){
|
if($search_guild_id){
|
||||||
$where['a.guild_id'] = $search_guild_id;
|
//$where['a.guild_id'] = $search_guild_id;
|
||||||
|
$where['b.guild_special_id'] = $search_guild_id;
|
||||||
}
|
}
|
||||||
if($search_status_time){
|
if($search_status_time){
|
||||||
$where['a.start_time'] = ['>=', $search_status_time];
|
$where['a.start_time'] = ['>=', $search_status_time];
|
||||||
@@ -640,7 +807,7 @@ class Guild extends adminApi
|
|||||||
$lists_data = db::name($this->table_guild_subsidy)->alias('a')
|
$lists_data = db::name($this->table_guild_subsidy)->alias('a')
|
||||||
->join('vs_guild b','a.guild_id = b.id')
|
->join('vs_guild b','a.guild_id = b.id')
|
||||||
->where($where)
|
->where($where)
|
||||||
->order('a.id desc')
|
->order('a.total_transaction desc')
|
||||||
->field('a.*,b.guild_name,b.user_id,b.guild_special_id')
|
->field('a.*,b.guild_name,b.user_id,b.guild_special_id')
|
||||||
->page($page,$page_limit)
|
->page($page,$page_limit)
|
||||||
->select();
|
->select();
|
||||||
|
|||||||
@@ -54,6 +54,15 @@ class Index extends adminApi
|
|||||||
//总待付款笔数
|
//总待付款笔数
|
||||||
$return_data['all_wait_pay_num'] = db::name('vs_user_recharge')->where('pay_status',1)->count();
|
$return_data['all_wait_pay_num'] = db::name('vs_user_recharge')->where('pay_status',1)->count();
|
||||||
|
|
||||||
|
//周实时收入金额
|
||||||
|
$return_data['week_money'] = db::name('vs_user_recharge')->where('pay_status',2)->whereTime('pay_time', 'week')->sum('money');
|
||||||
|
//上周收入金额
|
||||||
|
$return_data['last_week_money'] = db::name('vs_user_recharge')->where('pay_status',2)->whereTime('pay_time', 'last week')->sum('money');
|
||||||
|
//月收入金额
|
||||||
|
$return_data['month_money'] = db::name('vs_user_recharge')->where('pay_status',2)->whereTime('pay_time', 'month')->sum('money');
|
||||||
|
//上月收入金额
|
||||||
|
$return_data['last_month_money'] = db::name('vs_user_recharge')->where('pay_status',2)->whereTime('pay_time', 'last month')->sum('money');
|
||||||
|
|
||||||
//待办事项
|
//待办事项
|
||||||
//房间审核数
|
//房间审核数
|
||||||
$return_data['room_audit_num'] = db::name('vs_room')->where('apply_status',1)->count();
|
$return_data['room_audit_num'] = db::name('vs_room')->where('apply_status',1)->count();
|
||||||
@@ -114,17 +123,27 @@ class Index extends adminApi
|
|||||||
$return_data['register_count'] = db::name('user')->where('status', 1)->where('is_robot', 0)->whereTime('createtime', 'today')->count();
|
$return_data['register_count'] = db::name('user')->where('status', 1)->where('is_robot', 0)->whereTime('createtime', 'today')->count();
|
||||||
//充值会员数
|
//充值会员数
|
||||||
$return_data['recharge_count'] = db::name('vs_user_recharge')->where('pay_status',2)->group('user_id')->count();
|
$return_data['recharge_count'] = db::name('vs_user_recharge')->where('pay_status',2)->group('user_id')->count();
|
||||||
//充值会员百分比
|
if(empty($return_data['member_count'])){
|
||||||
$return_data['recharge_count_percent'] = round(($return_data['recharge_count'] / $return_data['member_count']) * 100);
|
$return_data['recharge_count_percent'] = 0;
|
||||||
//未充值会员数
|
$return_data['no_recharge_count'] = 0;
|
||||||
$return_data['no_recharge_count'] = $return_data['member_count'] - $return_data['recharge_count'];
|
$return_data['no_recharge_count_percent'] = 0;
|
||||||
$return_data['no_recharge_count_percent'] = round(($return_data['no_recharge_count'] / $return_data['member_count']) * 100);
|
$return_data['no_recharge_count'] = 0;
|
||||||
//IOS用户数
|
$return_data['ios_count_percent'] = 0;
|
||||||
$return_data['ios_count'] = db::name('user')->where('status', 1)->where('is_robot', 0)->where('system', 'iOS')->count();
|
$return_data['android_count'] = 0;
|
||||||
$return_data['ios_count_percent'] = round(($return_data['ios_count'] / $return_data['member_count']) * 100);
|
$return_data['android_count_percent'] = 0;
|
||||||
//安卓用户数
|
}else{
|
||||||
$return_data['android_count'] = $return_data['member_count']-$return_data['ios_count'];
|
//充值会员百分比
|
||||||
$return_data['android_count_percent'] = round(($return_data['android_count'] / $return_data['member_count']) * 100);
|
$return_data['recharge_count_percent'] = round(($return_data['recharge_count'] / $return_data['member_count']) * 100);
|
||||||
|
//未充值会员数
|
||||||
|
$return_data['no_recharge_count'] = $return_data['member_count'] - $return_data['recharge_count'];
|
||||||
|
$return_data['no_recharge_count_percent'] = round(($return_data['no_recharge_count'] / $return_data['member_count']) * 100);
|
||||||
|
//IOS用户数
|
||||||
|
$return_data['ios_count'] = db::name('user')->where('status', 1)->where('is_robot', 0)->where('system', 'iOS')->count();
|
||||||
|
$return_data['ios_count_percent'] = round(($return_data['ios_count'] / $return_data['member_count']) * 100);
|
||||||
|
//安卓用户数
|
||||||
|
$return_data['android_count'] = $return_data['member_count']-$return_data['ios_count'];
|
||||||
|
$return_data['android_count_percent'] = round(($return_data['android_count'] / $return_data['member_count']) * 100);
|
||||||
|
}
|
||||||
|
|
||||||
//礼物打赏实时统计
|
//礼物打赏实时统计
|
||||||
//一个月内的礼物打赏
|
//一个月内的礼物打赏
|
||||||
|
|||||||
@@ -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();
|
$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){
|
}elseif($item['report_type'] ==3){
|
||||||
$from_info = db::name('user_zone')->where('id',$item['from_id'])->field('content as title ,id as code')->find();
|
$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['createtime'] = date('Y-m-d H:i:s', $item['createtime']);
|
||||||
$item['updatetime'] = date('Y-m-d H:i:s', $item['updatetime']);
|
$item['updatetime'] = date('Y-m-d H:i:s', $item['updatetime']);
|
||||||
@@ -253,7 +255,8 @@ class Inform extends adminApi
|
|||||||
$item['report_type_str'] = [
|
$item['report_type_str'] = [
|
||||||
1=>'用户',
|
1=>'用户',
|
||||||
2=>'房间',
|
2=>'房间',
|
||||||
3=>'动态'
|
3=>'动态',
|
||||||
|
4=>'公会'
|
||||||
][$item['report_type']];
|
][$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不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -93,18 +93,19 @@ class Level extends adminApi
|
|||||||
if(!$level_id){
|
if(!$level_id){
|
||||||
return V(0,"添加失败");
|
return V(0,"添加失败");
|
||||||
}
|
}
|
||||||
//等级特权
|
if(!empty($gift_id)){
|
||||||
$decorate = db::name("vs_decorate")->where(['did' => $gift_id, 'delete_time' => 0])->find();
|
//等级特权
|
||||||
if(empty($decorate)){
|
$decorate = db::name("vs_decorate")->where(['did' => $gift_id, 'delete_time' => 0])->find();
|
||||||
return V(0,"请选择等级特权");
|
if(empty($decorate)){
|
||||||
}
|
return V(0,"请选择等级特权");
|
||||||
if($gift_id){
|
}
|
||||||
db::name('vs_wealth_level_rights')->insert([
|
db::name('vs_wealth_level_rights')->insert([
|
||||||
'level_id' => $level_id,
|
'level_id' => $level_id,
|
||||||
'gift_id' => $gift_id,
|
'gift_id' => $gift_id,
|
||||||
'createtime' => time()
|
'createtime' => time()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return V(1,"成功", ['id'=>$level]);
|
return V(1,"成功", ['id'=>$level]);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -124,28 +125,28 @@ class Level extends adminApi
|
|||||||
if($id == ''){
|
if($id == ''){
|
||||||
return V(0,"参数错误");
|
return V(0,"参数错误");
|
||||||
}
|
}
|
||||||
if($level){
|
if($level!=''){
|
||||||
$level_data['level'] = $level;
|
$level_data['level'] = $level;
|
||||||
}
|
}
|
||||||
if($name){
|
if($name!=''){
|
||||||
$level_data['name'] = $name;
|
$level_data['name'] = $name;
|
||||||
}
|
}
|
||||||
if($image){
|
if($image!=''){
|
||||||
$level_data['image'] = $image;
|
$level_data['image'] = $image;
|
||||||
}
|
}
|
||||||
if($status){
|
if($status!=''){
|
||||||
$level_data['status'] = $status;
|
$level_data['status'] = $status;
|
||||||
}
|
}
|
||||||
if($change_value){
|
if($change_value!=''){
|
||||||
$level_data['change_value'] = $change_value;
|
$level_data['change_value'] = $change_value;
|
||||||
}
|
}
|
||||||
if($coins){
|
if($coins!=''){
|
||||||
$level_data['coins'] = $coins;
|
$level_data['coins'] = $coins;
|
||||||
}
|
}
|
||||||
if($bg_image){
|
if($bg_image!=''){
|
||||||
$level_data['bg_image'] = $bg_image;
|
$level_data['bg_image'] = $bg_image;
|
||||||
}
|
}
|
||||||
if($color){
|
if($color!=''){
|
||||||
$level_data['color'] = $color;
|
$level_data['color'] = $color;
|
||||||
}
|
}
|
||||||
$level_data['updatetime'] = time();
|
$level_data['updatetime'] = time();
|
||||||
@@ -163,6 +164,8 @@ class Level extends adminApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
db::name('vs_wealth_level_rights')->where(['level_id'=>$id])->delete();
|
||||||
}
|
}
|
||||||
$result = db::name($this->table_wealth_level)->where(['id'=>$id])->update($level_data);
|
$result = db::name($this->table_wealth_level)->where(['id'=>$id])->update($level_data);
|
||||||
if(!$result){
|
if(!$result){
|
||||||
|
|||||||
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\admin\model\AdminLog;
|
||||||
use app\common\controller\adminApi;
|
use app\common\controller\adminApi;
|
||||||
|
use app\common\library\GiftTableManager;
|
||||||
|
use think\Cache;
|
||||||
use think\Config;
|
use think\Config;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Hook;
|
use think\Hook;
|
||||||
@@ -71,14 +73,24 @@ class Room extends adminApi
|
|||||||
$label_icon = input('label_icon', '');
|
$label_icon = input('label_icon', '');
|
||||||
$label_icon_room = input('label_icon_room', '');
|
$label_icon_room = input('label_icon_room', '');
|
||||||
$status = input('status', 1);
|
$status = input('status', 1);
|
||||||
|
$default_index = input('default_index', 0);
|
||||||
|
$sort = input('sort', 99);
|
||||||
if($label_name == ''){
|
if($label_name == ''){
|
||||||
return V(0,"请输入房间标签名称");
|
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 = [
|
$data = [
|
||||||
'label_name' => $label_name,
|
'label_name' => $label_name,
|
||||||
'label_icon' => $label_icon,
|
'label_icon' => $label_icon,
|
||||||
'label_icon_room' => $label_icon_room,
|
'label_icon_room' => $label_icon_room,
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
|
'default_index' => $default_index,
|
||||||
|
'sort' => $sort,
|
||||||
'updatetime' => time(),
|
'updatetime' => time(),
|
||||||
'createtime' => time()
|
'createtime' => time()
|
||||||
];
|
];
|
||||||
@@ -144,6 +156,8 @@ class Room extends adminApi
|
|||||||
$label_icon = input('label_icon', '');
|
$label_icon = input('label_icon', '');
|
||||||
$label_icon_room = input('label_icon_room', '');
|
$label_icon_room = input('label_icon_room', '');
|
||||||
$status = input('status', 1);
|
$status = input('status', 1);
|
||||||
|
$default_index = input('default_index', 0);
|
||||||
|
$sort = input('sort', 99);
|
||||||
if($label_id == ''){
|
if($label_id == ''){
|
||||||
return V(0,"标签ID不能为空");
|
return V(0,"标签ID不能为空");
|
||||||
}
|
}
|
||||||
@@ -171,6 +185,18 @@ class Room extends adminApi
|
|||||||
if($status){
|
if($status){
|
||||||
$data['status'] = $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();
|
$data['updatetime'] = time();
|
||||||
$result = db::name($this->table_room_label)->where(['id'=>$label_id])->update($data);
|
$result = db::name($this->table_room_label)->where(['id'=>$label_id])->update($data);
|
||||||
if(!$result){
|
if(!$result){
|
||||||
@@ -186,7 +212,7 @@ class Room extends adminApi
|
|||||||
$page = input('page', 1);
|
$page = input('page', 1);
|
||||||
$page_limit = input('page_limit', 30);
|
$page_limit = input('page_limit', 30);
|
||||||
$search_name = input('search_name', '');
|
$search_name = input('search_name', '');
|
||||||
$where=[];
|
$where['deletetime'] = 0;
|
||||||
//标签名称
|
//标签名称
|
||||||
if($search_name!==''){
|
if($search_name!==''){
|
||||||
$where['label_name'] = ['like', '%'.$search_name.'%'];
|
$where['label_name'] = ['like', '%'.$search_name.'%'];
|
||||||
@@ -196,6 +222,14 @@ class Room extends adminApi
|
|||||||
foreach ($lists as $key => $value) {
|
foreach ($lists as $key => $value) {
|
||||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
$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 = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
@@ -237,7 +271,7 @@ class Room extends adminApi
|
|||||||
if(!$type_data){
|
if(!$type_data){
|
||||||
return V(0,"房间类型不存在");
|
return V(0,"房间类型不存在");
|
||||||
}
|
}
|
||||||
$result = db::name($this->table_room_type)->where(['id'=>$type_id])->delete();
|
$result = db::name($this->table_room_type)->where(['id'=>$type_id])->update(['deletetime'=>time()]);
|
||||||
if(!$result){
|
if(!$result){
|
||||||
return V(0,"删除失败");
|
return V(0,"删除失败");
|
||||||
}
|
}
|
||||||
@@ -386,6 +420,12 @@ class Room extends adminApi
|
|||||||
public function edit_relation(){
|
public function edit_relation(){
|
||||||
$relation_id = input('relation_id', '');
|
$relation_id = input('relation_id', '');
|
||||||
$name = input('name', '');
|
$name = input('name', '');
|
||||||
|
if($relation_id == 0){
|
||||||
|
if($name != '无'){
|
||||||
|
return V(0,'此关系不允许修改');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$type = input('type', '');
|
$type = input('type', '');
|
||||||
$is_open_movie = input('is_open_movie', 1);
|
$is_open_movie = input('is_open_movie', 1);
|
||||||
$icon = input('icon', '');
|
$icon = input('icon', '');
|
||||||
@@ -425,6 +465,12 @@ class Room extends adminApi
|
|||||||
$search_room_id = input('search_room_id', '');
|
$search_room_id = input('search_room_id', '');
|
||||||
$search_user_id = input('search_user_id', '');
|
$search_user_id = input('search_user_id', '');
|
||||||
$search_status = input('search_status', '');
|
$search_status = input('search_status', '');
|
||||||
|
$type_id = input('type_id', '');
|
||||||
|
$label_id = input('label_id', '');
|
||||||
|
$is_hot = input('is_hot', '');
|
||||||
|
$is_top = input('is_top', '');
|
||||||
|
$is_recommend = input('is_recommend', '');
|
||||||
|
|
||||||
$where=[];
|
$where=[];
|
||||||
//房间号
|
//房间号
|
||||||
if($search_room_id!==''){
|
if($search_room_id!==''){
|
||||||
@@ -437,9 +483,30 @@ class Room extends adminApi
|
|||||||
if($search_status!==''){
|
if($search_status!==''){
|
||||||
$where['room_status'] = $search_status;
|
$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;
|
||||||
|
}
|
||||||
|
if($is_hot!==''){
|
||||||
|
$where['is_hot'] = $is_hot;
|
||||||
|
}
|
||||||
|
if($is_top!==''){
|
||||||
|
$where['is_top'] = $is_top;
|
||||||
|
}
|
||||||
|
if($is_recommend!==''){
|
||||||
|
$where['is_recommend'] = $is_recommend;
|
||||||
|
}
|
||||||
//房间列表只展示 审核通过的房间
|
//房间列表只展示 审核通过的房间
|
||||||
$where['apply_status'] = 2;//1待审核 2审核通过 3审核失败
|
$where['apply_status'] = 2;//1待审核 2审核通过 3审核失败
|
||||||
$where['type_id'] = ['<>',6];
|
|
||||||
$count = db::name($this->table)->where($where)->count();
|
$count = db::name($this->table)->where($where)->count();
|
||||||
$room_lists = db::name($this->table)->where($where)->page($page, $page_limit)->select();
|
$room_lists = db::name($this->table)->where($where)->page($page, $page_limit)->select();
|
||||||
$lists = [];
|
$lists = [];
|
||||||
@@ -457,8 +524,14 @@ class Room extends adminApi
|
|||||||
$lists[$key]['user_name'] = model('User')->where(['id'=>$value['user_id']])->value('nickname');
|
$lists[$key]['user_name'] = model('User')->where(['id'=>$value['user_id']])->value('nickname');
|
||||||
$lists[$key]['room_name'] = $value['room_name'];
|
$lists[$key]['room_name'] = $value['room_name'];
|
||||||
$lists[$key]['room_cover'] = $value['room_cover'];
|
$lists[$key]['room_cover'] = $value['room_cover'];
|
||||||
$lists[$key]['room_type_str'] = db::name($this->table_room_type)->where(['id'=>$value['type_id']])->value('type_name');
|
if($value['type_id']==1 && $value['label_id']==2){
|
||||||
$lists[$key]['room_label_str'] = db::name($this->table_room_label)->where(['id'=>$value['label_id']])->value('label_name');
|
$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_recommend'] = $value['is_recommend'] != 1 ? '是' : '否';
|
||||||
$lists[$key]['is_top'] = $value['is_top'] != 1 ? '是' : '否';
|
$lists[$key]['is_top'] = $value['is_top'] != 1 ? '是' : '否';
|
||||||
$lists[$key]['is_hot'] = $value['is_hot'] != 1 ? '是' : '否';
|
$lists[$key]['is_hot'] = $value['is_hot'] != 1 ? '是' : '否';
|
||||||
@@ -468,6 +541,8 @@ class Room extends adminApi
|
|||||||
$lists[$key]['guild_name'] = !empty($guild) ? $guild['guild_name'] : "";
|
$lists[$key]['guild_name'] = !empty($guild) ? $guild['guild_name'] : "";
|
||||||
$lists[$key]['room_status_str'] = model('Room')->room_status[$value['room_status']];
|
$lists[$key]['room_status_str'] = model('Room')->room_status[$value['room_status']];
|
||||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||||
|
$lists[$key]['is_robot_num'] = $value['robot_num']==0 ? 1 : 2;
|
||||||
|
$lists[$key]['is_open_blind_box_turntable_str'] = $value['is_open_blind_box_turntable'] == 1 ? '是' : '否';
|
||||||
}
|
}
|
||||||
$return_data = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
@@ -516,6 +591,7 @@ class Room extends adminApi
|
|||||||
$room_data['room_type_str'] = db::name('vs_room_type')->where(['id'=>$room_data['type_id']])->value('type_name');
|
$room_data['room_type_str'] = db::name('vs_room_type')->where(['id'=>$room_data['type_id']])->value('type_name');
|
||||||
$room_data['liang'] = model('api/Decorate')->user_decorate_detail($room_data['id'],7);
|
$room_data['liang'] = model('api/Decorate')->user_decorate_detail($room_data['id'],7);
|
||||||
$room_data['owner'] = db::name('user')->where(['id'=>$room_data['user_id']])->value('nickname');
|
$room_data['owner'] = db::name('user')->where(['id'=>$room_data['user_id']])->value('nickname');
|
||||||
|
$room_data['is_robot_num'] = $room_data['robot_num']==0 ? 2 : 1;
|
||||||
$room_data['guild_name'] = '';
|
$room_data['guild_name'] = '';
|
||||||
$guild_id = db::name('vs_guild_user')->where('user_id',$room_data['user_id'])->value('guild_id');
|
$guild_id = db::name('vs_guild_user')->where('user_id',$room_data['user_id'])->value('guild_id');
|
||||||
if($guild_id){
|
if($guild_id){
|
||||||
@@ -586,6 +662,10 @@ class Room extends adminApi
|
|||||||
}
|
}
|
||||||
$room_data['growth_week_subsidy'] = round($weekSubsidy, 2);
|
$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);
|
return V(1,"成功", $room_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,71 +718,72 @@ class Room extends adminApi
|
|||||||
$page = input('page', 1);
|
$page = input('page', 1);
|
||||||
$page_limit = input('page_limit', 10);
|
$page_limit = input('page_limit', 10);
|
||||||
$type = input('type', 1);//1:全部流水 2:日流水 3:周流水 4:月流水
|
$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 == ''){
|
if($room_id == ''){
|
||||||
return V(0,"参数错误");
|
return V(0,"参数错误");
|
||||||
}
|
}
|
||||||
if($type == 1){
|
|
||||||
$begin_time = 1748676768;//2025-06-00 15:32:48
|
$params['from_id'] = $room_id;
|
||||||
$end_time = time();
|
$ext_params['start_time'] = strtotime($begin_time_table);
|
||||||
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
|
$ext_params['end_time'] = strtotime($end_time_table);
|
||||||
}elseif ($type == 2){
|
$params['page'] = $page;
|
||||||
//日流水
|
$params['limit'] = $page_limit;
|
||||||
$begin_time = strtotime(date('Y-m-d 00:00:00',time()));
|
$res = model('api/GiveGiftBases')->getGiftRecords($params,$ext_params);
|
||||||
$end_time = time();
|
$list = $res['data'];
|
||||||
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
|
$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 24:00:00',strtotime('-'.date('w').'days')));
|
|
||||||
$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){
|
if($list){
|
||||||
foreach ($list as &$v){
|
foreach ($list as &$v){
|
||||||
$v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
|
$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动态打赏
|
// 来源: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 = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'lists' => $list,
|
'lists' => $list,
|
||||||
'total' =>[
|
'total' =>[
|
||||||
'total_price' => db::name('vs_give_gift')->alias('a')
|
'total_price' => $all_total_price,
|
||||||
->join('user b', 'a.user_id = b.id', 'left')
|
'total_lucky_coin' => $total_lucky_coin,
|
||||||
->where('a.from',2)
|
|
||||||
->where('a.from_id',$room_id)
|
|
||||||
->where($where)->sum('total_price')
|
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
return V(1,"成功", $return_data);
|
return V(1,"成功", $return_data);
|
||||||
@@ -744,6 +825,26 @@ class Room extends adminApi
|
|||||||
];
|
];
|
||||||
return V(1,"成功", $return_data);
|
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()
|
public function edit_room()
|
||||||
@@ -818,11 +919,16 @@ class Room extends adminApi
|
|||||||
//在用户表里找 $robot_num 个机器人 进入到房间
|
//在用户表里找 $robot_num 个机器人 进入到房间
|
||||||
$user_list = db::name('user')->field('id')->where('is_robot',1)->limit($robot_num)->orderRaw('rand()')->select();
|
$user_list = db::name('user')->field('id')->where('is_robot',1)->limit($robot_num)->orderRaw('rand()')->select();
|
||||||
if($user_list){
|
if($user_list){
|
||||||
|
if(count($user_list) != $robot_num){
|
||||||
|
return V(0,"机器人数量不足");
|
||||||
|
}
|
||||||
foreach ($user_list as $v){
|
foreach ($user_list as $v){
|
||||||
model('api/Room')->join_room($v['id'],$room_id,$room_password);
|
model('api/Room')->join_room($v['id'],$room_id,$room_password);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
return V(0,"没有可用机器人");
|
||||||
}
|
}
|
||||||
}elseif ($is_robot_num == 2 && $robot_num == 0){
|
}elseif ($is_robot_num == 2 || $robot_num == 0){
|
||||||
$data['robot_num'] = 0;
|
$data['robot_num'] = 0;
|
||||||
//查询在房间中的机器人 并退出
|
//查询在房间中的机器人 并退出
|
||||||
$user_list = db::name('vs_room_visitor')->alias('a')->join('user b','a.user_id = b.id','left')
|
$user_list = db::name('vs_room_visitor')->alias('a')->join('user b','a.user_id = b.id','left')
|
||||||
@@ -836,9 +942,43 @@ class Room extends adminApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$is_open_blind_box_turntable = input('is_open_blind_box_turntable', '');//是否开启盲盒转盘:0 否 1是
|
||||||
|
if($is_open_blind_box_turntable !== ""){
|
||||||
|
$data['is_open_blind_box_turntable'] = $is_open_blind_box_turntable;
|
||||||
|
if($is_open_blind_box_turntable == 1){
|
||||||
|
$room_data = db::name('vs_room')->find($room_id);
|
||||||
|
if($room_data['is_open_blind_box_turntable'] == 0){
|
||||||
|
model('Room')->bindPan($room_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//排序
|
||||||
|
$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);
|
$res = db::name('vs_room')->where('id',$room_id)->update($data);
|
||||||
if($res){
|
if($res){
|
||||||
|
Cache::rm('room_info_'.$room_id);
|
||||||
return V(1,"成功");
|
return V(1,"成功");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -909,9 +1049,22 @@ class Room extends adminApi
|
|||||||
if($status){
|
if($status){
|
||||||
$data['status'] = $status;
|
$data['status'] = $status;
|
||||||
}
|
}
|
||||||
|
$bg_url = db::name('vs_room_background')->where('id',$id)->value('image_url');
|
||||||
|
|
||||||
$res = db::name('vs_room_background')->where('id',$id)->update($data);
|
$res = db::name('vs_room_background')->where('id',$id)->update($data);
|
||||||
if($res){
|
if($res){
|
||||||
|
if($bg_url != $image_url){
|
||||||
|
//查询使用默认背景的房间
|
||||||
|
$room_list = db::name('vs_room')->field('id,room_background')->where(['room_status' => ['<>',3]])->select();
|
||||||
|
if($room_list){
|
||||||
|
foreach ($room_list as $v){
|
||||||
|
//判断是否使用默认背景,room_background 字段值是否是以 get_system_config_value('web_site') 开头
|
||||||
|
if(strpos($v['room_background'],get_system_config_value('web_site')) !== FALSE){
|
||||||
|
db::name('vs_room')->where('id',$v['id'])->update(['room_background' => $image_url]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return V(1,"成功");
|
return V(1,"成功");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -962,6 +1115,10 @@ class Room extends adminApi
|
|||||||
$search_room_number = input('search_room_number', '');
|
$search_room_number = input('search_room_number', '');
|
||||||
$search_onwer_number = input('search_onwer_number', '');
|
$search_onwer_number = input('search_onwer_number', '');
|
||||||
$room_status = input('room_status', '');
|
$room_status = input('room_status', '');
|
||||||
|
//开始 时间
|
||||||
|
$start_time = input('start_time', '');
|
||||||
|
//结束 时间
|
||||||
|
$end_time = input('end_time', '');
|
||||||
|
|
||||||
if($search_room_number!==''){
|
if($search_room_number!==''){
|
||||||
$where['room_number'] = $search_room_number;
|
$where['room_number'] = $search_room_number;
|
||||||
@@ -972,12 +1129,36 @@ class Room extends adminApi
|
|||||||
if($room_status!==''){
|
if($room_status!==''){
|
||||||
$where['room_status'] = $room_status;
|
$where['room_status'] = $room_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查并转换时间格式为时间戳
|
||||||
|
if($start_time !== '' && $end_time !== ''){
|
||||||
|
// 同时有开始和结束时间
|
||||||
|
$startTime = strtotime($start_time);
|
||||||
|
$endTime = strtotime($end_time);
|
||||||
|
if($startTime !== false && $endTime !== false){
|
||||||
|
$where['createtime'] = ['between', [$startTime, $endTime]];
|
||||||
|
}
|
||||||
|
}elseif($start_time !== ''){
|
||||||
|
// 只有开始时间
|
||||||
|
$startTime = strtotime($start_time);
|
||||||
|
if($startTime !== false){
|
||||||
|
$where['createtime'] = ['>=', $startTime];
|
||||||
|
}
|
||||||
|
}elseif($end_time !== ''){
|
||||||
|
// 只有结束时间
|
||||||
|
$endTime = strtotime($end_time);
|
||||||
|
if($endTime !== false){
|
||||||
|
$where['createtime'] = ['<=', $endTime];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$where['type_id'] = 6;
|
$where['type_id'] = 6;
|
||||||
$count = db::name('vs_room')->where($where)->count();
|
$count = db::name('vs_room')->where($where)->count();
|
||||||
$lists = db::name('vs_room')->field('id,room_name,room_cover,room_number,user_id,room_status,createtime')
|
$lists = db::name('vs_room')->field('id,room_name,room_cover,room_number,user_id,room_status,createtime')
|
||||||
->where($where)
|
->where($where)
|
||||||
->order('id desc')
|
->order('id desc')
|
||||||
->page($page, $page_limit)->select();
|
->page($page, $page_limit)->select();
|
||||||
|
|
||||||
foreach ($lists as &$value) {
|
foreach ($lists as &$value) {
|
||||||
$guild = model('Guild')->getGuildByUserId($value['user_id']);
|
$guild = model('Guild')->getGuildByUserId($value['user_id']);
|
||||||
$value['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
$value['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||||
@@ -988,7 +1169,27 @@ class Room extends adminApi
|
|||||||
$value['room_code'] = model('api/Decorate')->user_decorate_detail($value['id'], 7);
|
$value['room_code'] = model('api/Decorate')->user_decorate_detail($value['id'], 7);
|
||||||
//房间状态1正常2封禁3关闭
|
//房间状态1正常2封禁3关闭
|
||||||
$value['room_status_str'] = $value['room_status'] ==1 ? "正常" : ($value['room_status'] ==2 ? "封禁" : "关闭");
|
$value['room_status_str'] = $value['room_status'] ==1 ? "正常" : ($value['room_status'] ==2 ? "封禁" : "关闭");
|
||||||
|
|
||||||
|
$cpRoom = db::name('vs_room_cp_movie')->where('room_id',$value['id'])->find();
|
||||||
|
if($cpRoom){
|
||||||
|
if($cpRoom['user_id'] == $value['user_id']){
|
||||||
|
$value['cp_nickname'] = db::name('user')->where('id', $cpRoom['user_id1'])->value('nickname');
|
||||||
|
$value['cp_user_id'] = db::name('user')->where('id', $cpRoom['user_id1'])->value('user_code');
|
||||||
|
}
|
||||||
|
if($cpRoom['user_id1'] == $value['user_id']){
|
||||||
|
$value['cp_nickname'] = db::name('user')->where('id', $cpRoom['user_id'])->value('nickname');
|
||||||
|
$value['cp_user_id'] = db::name('user')->where('id', $cpRoom['user_id'])->value('user_code');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 流水计算也应使用相同的时间范围
|
||||||
|
$liushuiWhere = ['from_id' => $value['id']];
|
||||||
|
if(isset($where['createtime'])){
|
||||||
|
$liushuiWhere['createtime'] = $where['createtime'];
|
||||||
|
}
|
||||||
|
$value['liushui'] = db::name('vs_give_gift')->where($liushuiWhere)->sum('total_price') * get_system_config_value('coin_charm_exp');
|
||||||
}
|
}
|
||||||
|
|
||||||
$return_data = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
@@ -998,6 +1199,7 @@ class Room extends adminApi
|
|||||||
return V(1,"成功", $return_data);
|
return V(1,"成功", $return_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Cp电影房封禁
|
//Cp电影房封禁
|
||||||
public function cp_movie_room_forbid()
|
public function cp_movie_room_forbid()
|
||||||
{
|
{
|
||||||
@@ -1211,7 +1413,7 @@ class Room extends adminApi
|
|||||||
if($apply_status!==''){
|
if($apply_status!==''){
|
||||||
$where['apply_status'] = $apply_status;
|
$where['apply_status'] = $apply_status;
|
||||||
}else{
|
}else{
|
||||||
$where['apply_status'] = ['<>',2];
|
$where['apply_status'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = db::name($this->table)->where($where)->count();
|
$count = db::name($this->table)->where($where)->count();
|
||||||
@@ -1221,7 +1423,8 @@ class Room extends adminApi
|
|||||||
|
|
||||||
foreach ($room_lists as &$value) {
|
foreach ($room_lists as &$value) {
|
||||||
$value['room_code'] = model('api/Decorate')->user_decorate_detail($value['id'], 7);
|
$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['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||||
$value['room_name'] = $value['room_name'].'-'.$value['room_number'];
|
$value['room_name'] = $value['room_name'].'-'.$value['room_number'];
|
||||||
}
|
}
|
||||||
@@ -1238,6 +1441,7 @@ class Room extends adminApi
|
|||||||
//房间审核
|
//房间审核
|
||||||
public function room_audit(){
|
public function room_audit(){
|
||||||
$id = input('id', '');
|
$id = input('id', '');
|
||||||
|
$remark = input('remark', '');
|
||||||
if($id == ''){
|
if($id == ''){
|
||||||
return V(0,"参数错误");
|
return V(0,"参数错误");
|
||||||
}
|
}
|
||||||
@@ -1245,10 +1449,42 @@ class Room extends adminApi
|
|||||||
if($apply_status == ''){
|
if($apply_status == ''){
|
||||||
return V(0,"参数错误");
|
return V(0,"参数错误");
|
||||||
}
|
}
|
||||||
$result = db::name('vs_room')->where(['id'=>$id])->update(['apply_status'=>$apply_status]);
|
$room_data = db::name('vs_room')->where(['id'=>$id])->find();
|
||||||
|
if(!$room_data){
|
||||||
|
return V(0,"参数错误");
|
||||||
|
}
|
||||||
|
$result = db::name('vs_room')->where(['id'=>$id])->update([
|
||||||
|
'apply_status'=>$apply_status,
|
||||||
|
'is_open_blind_box_turntable'=>1,
|
||||||
|
'updatetime'=>time(),
|
||||||
|
]);
|
||||||
if(!$result){
|
if(!$result){
|
||||||
return V(0,"修改失败");
|
return V(0,"修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//发系统信息
|
||||||
|
if($apply_status ==2){
|
||||||
|
$deal_content = '审核通过';
|
||||||
|
//首次建立房间【完成任务】
|
||||||
|
model('api/Tasks')->tasks_complete($room_data['user_id'],34);
|
||||||
|
}elseif($apply_status ==3){
|
||||||
|
$deal_content = '审核未通过';
|
||||||
|
}
|
||||||
|
if(!empty($remark)){
|
||||||
|
$deal_content .= ',原因:'.$remark;
|
||||||
|
}
|
||||||
|
db::name('system_message')->insert([
|
||||||
|
'title' => '房间审核结果',
|
||||||
|
'content' => '您创建的房间'.$room_data['room_name'].$deal_content,
|
||||||
|
'type' => 1,
|
||||||
|
'admin_id' => Session::get('admin_id'),
|
||||||
|
'receiving_id' => $room_data['user_id'],
|
||||||
|
'createtime' => time(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
//房间绑定盘
|
||||||
|
model('Room')->bindPan($id);
|
||||||
|
|
||||||
return V(1,"成功");
|
return V(1,"成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1404,10 +1640,10 @@ class Room extends adminApi
|
|||||||
$where['createtime'] = ['>=',strtotime($stime)];
|
$where['createtime'] = ['>=',strtotime($stime)];
|
||||||
}
|
}
|
||||||
if(!empty($etime)){
|
if(!empty($etime)){
|
||||||
$where['createtime'] = ['<=',strtotime($etime.' 23:59:59')];
|
$where['createtime'] = ['<=',strtotime($etime)];
|
||||||
}
|
}
|
||||||
if(!empty($stime) && !empty($etime)){
|
if(!empty($stime) && !empty($etime)){
|
||||||
$where['createtime'] = ['between',[strtotime($stime),strtotime($etime.' 23:59:59')]];
|
$where['createtime'] = ['between',[strtotime($stime),strtotime($etime)]];
|
||||||
}
|
}
|
||||||
$room_log_lists = db::name($this->table_room_log)->where($where)->order('id desc')->page($page, $page_limit)->select();
|
$room_log_lists = db::name($this->table_room_log)->where($where)->order('id desc')->page($page, $page_limit)->select();
|
||||||
$count = db::name($this->table_room_log)->where($where)->count();
|
$count = db::name($this->table_room_log)->where($where)->count();
|
||||||
@@ -1575,4 +1811,183 @@ class Room extends adminApi
|
|||||||
return V(1,"成功", $result);
|
return V(1,"成功", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 房间红包列表
|
||||||
|
public function room_redpacket_list(){
|
||||||
|
$page = input('page', 1);
|
||||||
|
$page_limit = input('page_limit', 30);
|
||||||
|
$room_id = input('room_id', '');
|
||||||
|
//红包状态
|
||||||
|
$status = input('status', '');
|
||||||
|
//发红包的时间
|
||||||
|
$stime = input('stime', '');
|
||||||
|
$etime = input('etime', '');
|
||||||
|
$where = [];
|
||||||
|
if($room_id){
|
||||||
|
$where['room_id'] = $room_id;
|
||||||
|
}
|
||||||
|
if($status){
|
||||||
|
$where['status'] = $status;
|
||||||
|
}
|
||||||
|
if($stime){
|
||||||
|
$where['createtime'] = ['>=',strtotime($stime)];
|
||||||
|
}
|
||||||
|
if($etime){
|
||||||
|
$where['createtime'] = ['<=',strtotime($etime)];
|
||||||
|
}
|
||||||
|
$count = db::name("redpacket")->where($where)->count();
|
||||||
|
$room_redpacket_lists = db::name("redpacket")->where($where)->page($page, $page_limit)->order('id desc')->select();
|
||||||
|
//循环数据 获取发红的昵称和头像 时间格式化 状态:0=未开始,1=进行中,2=已结束,3=已退回' 币种(coin_type):1=金币,2=钻石',红包类型(type):1=普通红包,2=口令红包'
|
||||||
|
//多选条件(逗号分隔存值)(conditions) 0=无,1=收藏,2=在麦上
|
||||||
|
if($room_redpacket_lists){
|
||||||
|
foreach ($room_redpacket_lists as $key => $value){
|
||||||
|
$room_redpacket_lists[$key]['nickname'] = db::name('user')->where(['id'=>$value['user_id']])->value('nickname');
|
||||||
|
$room_redpacket_lists[$key]['avatar'] = db::name('user')->where(['id'=>$value['user_id']])->value('avatar');
|
||||||
|
$room_redpacket_lists[$key]['user_code'] = db::name('user')->where(['id'=>$value['user_id']])->value('user_code');
|
||||||
|
$room_redpacket_lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||||
|
$room_redpacket_lists[$key]['status_text'] = $value['status'] == 0 ? '未开始' : ($value['status'] == 1 ? '进行中' : ($value['status'] == 2 ? '已结束' : '已退回'));
|
||||||
|
$room_redpacket_lists[$key]['coin_type_text'] = $value['coin_type'] == 1 ? '金币' : ($value['coin_type'] == 2 ? '钻石' : '未知');
|
||||||
|
$room_redpacket_lists[$key]['type_text'] = $value['type'] == 1 ? '普通红包' : ($value['type'] == 2 ? '口令红包' : '未知');
|
||||||
|
|
||||||
|
// 多选条件处理:0=无(不能和其他条件共存),1=收藏,2=在麦上
|
||||||
|
// 可以同时存在,也可以单独存在,同时存在时用逗号分隔
|
||||||
|
$conditions = explode(',',$value['conditions']);
|
||||||
|
// 过滤掉空值元素
|
||||||
|
$conditions = array_filter($conditions, function($item) {
|
||||||
|
return $item !== '' && $item !== null;
|
||||||
|
});
|
||||||
|
// 去除重复的条件
|
||||||
|
$conditions = array_unique($conditions);
|
||||||
|
// 重新索引数组,确保索引连续
|
||||||
|
$conditions = array_values($conditions);
|
||||||
|
|
||||||
|
// 特殊处理:如果包含条件0(无条件),则只保留这一项
|
||||||
|
if (in_array('0', $conditions)) {
|
||||||
|
$room_redpacket_lists[$key]['conditions'] = ['无条件'];
|
||||||
|
} else {
|
||||||
|
// 将数字条件转换为对应的中文描述
|
||||||
|
$conditions_text = array_map(function($item){
|
||||||
|
// 0=无条件,1=收藏,2=在麦上
|
||||||
|
switch($item) {
|
||||||
|
case '0':
|
||||||
|
return '无条件';
|
||||||
|
case '1':
|
||||||
|
return '收藏';
|
||||||
|
case '2':
|
||||||
|
return '在麦上';
|
||||||
|
default:
|
||||||
|
return '未知';
|
||||||
|
}
|
||||||
|
}, $conditions);
|
||||||
|
$room_redpacket_lists[$key]['conditions'] = $conditions_text;
|
||||||
|
}
|
||||||
|
//房间名称
|
||||||
|
$room_redpacket_lists[$key]['room_name'] = db::name('vs_room')->where(['id'=>$value['room_id']])->value('room_name');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$return_data = [
|
||||||
|
'page' =>$page,
|
||||||
|
'page_limit' => $page_limit,
|
||||||
|
'count' => $count,
|
||||||
|
'lists' => $room_redpacket_lists
|
||||||
|
];
|
||||||
|
return V(1,"成功", $return_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取房间红包详情
|
||||||
|
public function room_redpacket_detail(){
|
||||||
|
// 红包ID
|
||||||
|
$redpacket_id = input('redpacket_id', '');
|
||||||
|
if(empty($redpacket_id)){
|
||||||
|
return V(0, "红包ID不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取红包基本信息
|
||||||
|
$redpacket_info = db::name("redpacket")->where(['id'=>$redpacket_id])->find();
|
||||||
|
if(!$redpacket_info){
|
||||||
|
return V(0, "红包不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取发红包用户信息
|
||||||
|
$redpacket_info['nickname'] = db::name('user')->where(['id'=>$redpacket_info['user_id']])->value('nickname');
|
||||||
|
$redpacket_info['avatar'] = db::name('user')->where(['id'=>$redpacket_info['user_id']])->value('avatar');
|
||||||
|
$redpacket_info['user_code'] = db::name('user')->where(['id'=>$redpacket_info['user_id']])->value('user_code');
|
||||||
|
$redpacket_info['createtime_text'] = date('Y-m-d H:i:s', $redpacket_info['createtime']);
|
||||||
|
$redpacket_info['start_time_text'] = date('Y-m-d H:i:s', $redpacket_info['start_time']);
|
||||||
|
$redpacket_info['end_time_text'] = date('Y-m-d H:i:s', $redpacket_info['end_time']);
|
||||||
|
//房间名称
|
||||||
|
$redpacket_info['room_name'] = db::name('vs_room')->where(['id'=>$redpacket_info['room_id']])->value('room_name');
|
||||||
|
|
||||||
|
// 红包状态文字描述
|
||||||
|
$status_map = [
|
||||||
|
0 => '未开始',
|
||||||
|
1 => '进行中',
|
||||||
|
2 => '已结束',
|
||||||
|
3 => '已退回'
|
||||||
|
];
|
||||||
|
$redpacket_info['status_text'] = $status_map[$redpacket_info['status']] ?? '未知';
|
||||||
|
|
||||||
|
// 币种文字描述
|
||||||
|
$coin_type_map = [
|
||||||
|
1 => '金币',
|
||||||
|
2 => '钻石'
|
||||||
|
];
|
||||||
|
$redpacket_info['coin_type_text'] = $coin_type_map[$redpacket_info['coin_type']] ?? '未知';
|
||||||
|
|
||||||
|
// 红包类型文字描述
|
||||||
|
$type_map = [
|
||||||
|
1 => '普通红包',
|
||||||
|
2 => '口令红包'
|
||||||
|
];
|
||||||
|
$redpacket_info['type_text'] = $type_map[$redpacket_info['type']] ?? '未知';
|
||||||
|
|
||||||
|
// 领取条件处理
|
||||||
|
$conditions = explode(',',$redpacket_info['conditions']);
|
||||||
|
$conditions = array_filter($conditions, function($item) {
|
||||||
|
return $item !== '' && $item !== null;
|
||||||
|
});
|
||||||
|
$conditions = array_unique($conditions);
|
||||||
|
$conditions = array_values($conditions);
|
||||||
|
|
||||||
|
// 特殊处理:如果包含条件0(无条件),则只保留这一项
|
||||||
|
if (in_array('0', $conditions)) {
|
||||||
|
$redpacket_info['conditions_text'] = ['无条件'];
|
||||||
|
} else {
|
||||||
|
// 将数字条件转换为对应的中文描述
|
||||||
|
$conditions_text = array_map(function($item){
|
||||||
|
switch($item) {
|
||||||
|
case '0':
|
||||||
|
return '无条件';
|
||||||
|
case '1':
|
||||||
|
return '收藏';
|
||||||
|
case '2':
|
||||||
|
return '在麦上';
|
||||||
|
default:
|
||||||
|
return '未知';
|
||||||
|
}
|
||||||
|
}, $conditions);
|
||||||
|
$redpacket_info['conditions_text'] = $conditions_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 领取详情 redpacket_record 表里面的数据
|
||||||
|
// 外键redpacket_id redpacket表的ID,user_id 外键user表的ID amount 抢到的金额 createtime抢红包的时间
|
||||||
|
// 红包领取详情 谁在什么时候 抢红包 抢了多少钱
|
||||||
|
$redpacket_record_lists = db::name("redpacket_record")->where(['redpacket_id'=>$redpacket_id])->order('createtime asc')->select();
|
||||||
|
if($redpacket_record_lists){
|
||||||
|
foreach ($redpacket_record_lists as $key => $value){
|
||||||
|
$redpacket_record_lists[$key]['nickname'] = db::name('user')->where(['id'=>$value['user_id']])->value('nickname');
|
||||||
|
$redpacket_record_lists[$key]['avatar'] = db::name('user')->where(['id'=>$value['user_id']])->value('avatar');
|
||||||
|
$redpacket_record_lists[$key]['user_code'] = db::name('user')->where(['id'=>$value['user_id']])->value('user_code');
|
||||||
|
$redpacket_record_lists[$key]['createtime_text'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$return_data = [
|
||||||
|
'redpacket_info' => $redpacket_info,
|
||||||
|
'record_lists' => $redpacket_record_lists
|
||||||
|
];
|
||||||
|
|
||||||
|
return V(1, "成功", $return_data);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
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, '删除失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
371
application/adminapi/controller/RoomHourRanking.php
Normal file
371
application/adminapi/controller/RoomHourRanking.php
Normal file
@@ -0,0 +1,371 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\adminapi\controller;
|
||||||
|
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
|
class RoomHourRanking
|
||||||
|
{
|
||||||
|
public static function withdraw_status (){
|
||||||
|
return [
|
||||||
|
// [25 => '全时段'],
|
||||||
|
[0 => '00:00-01:00'],
|
||||||
|
[1 => '01:00-02:00'],
|
||||||
|
[2 => '02:00-03:00'],
|
||||||
|
[3 => '03:00-04:00'],
|
||||||
|
[4 => '04:00-05:00'],
|
||||||
|
[5 => '05:00-06:00'],
|
||||||
|
[6 => '06:00-07:00'],
|
||||||
|
[7 => '07:00-08:00'],
|
||||||
|
[8 => '08:00-09:00'],
|
||||||
|
[9 => '09:00-10:00'],
|
||||||
|
[10 => '10:00-11:00'],
|
||||||
|
[11 => '11:00-12:00'],
|
||||||
|
[12 => '12:00-13:00'],
|
||||||
|
[13 => '13:00-14:00'],
|
||||||
|
[14 => '14:00-15:00'],
|
||||||
|
[15 => '15:00-16:00'],
|
||||||
|
[16 => '16:00-17:00'],
|
||||||
|
[17 => '17:00-18:00'],
|
||||||
|
[18 => '18:00-19:00'],
|
||||||
|
[19 => '19:00-20:00'],
|
||||||
|
[20 => '20:00-21:00'],
|
||||||
|
[21 => '21:00-22:00'],
|
||||||
|
[22 => '22:00-23:00'],
|
||||||
|
[23 => '23:00-00:00'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//房间小时榜列表
|
||||||
|
public function room_hour_ranking()
|
||||||
|
{
|
||||||
|
$page = input('page', 1);
|
||||||
|
$page_limit = input('page_limit', 20);
|
||||||
|
$search_ranking = input('search_ranking', '');
|
||||||
|
$search_stime = input('search_stime', '');
|
||||||
|
$search_etime = input('search_etime', '');
|
||||||
|
$where = [];
|
||||||
|
if ($search_ranking) {
|
||||||
|
$where[] = ['room_name', 'like', '%' . $search_ranking . '%'];
|
||||||
|
}
|
||||||
|
if ($search_stime) {
|
||||||
|
$where[] = ['stime', '>=', $search_stime];
|
||||||
|
}
|
||||||
|
if ($search_etime) {
|
||||||
|
$where[] = ['etime', '<=', $search_etime];
|
||||||
|
}
|
||||||
|
$count = db::name('vs_hour_ranking')->where($where)->count();
|
||||||
|
$list = db::name('vs_hour_ranking')->where($where)->page($page, $page_limit)->order('id desc')->select();
|
||||||
|
if($list){
|
||||||
|
foreach ($list as &$v){
|
||||||
|
$v['room_name'] = db::name('vs_room')->where(['id'=>$v['room_id']])->value('room_name');
|
||||||
|
$v['user_id'] = db::name('vs_room')->where(['id'=>$v['room_id']])->value('user_id');
|
||||||
|
if($v['user_id']){
|
||||||
|
$v['nickname'] = db::name('user')->where(['id'=>$v['user_id']])->value('nickname');
|
||||||
|
}
|
||||||
|
$v['stime'] = date('Y-m-d H:i', $v['stime']);
|
||||||
|
$v['etime'] = date('Y-m-d H:i', $v['etime']);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$return_data = [
|
||||||
|
'page' =>$page,
|
||||||
|
'page_limit' => $page_limit,
|
||||||
|
'count' => $count,
|
||||||
|
'lists' => $list
|
||||||
|
];
|
||||||
|
return V(1,"成功", $return_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//房间小时榜配置
|
||||||
|
public function room_hour_ranking_config()
|
||||||
|
{
|
||||||
|
$list = db::name('vs_hour_ranking_config')->where('id', '1')->find();
|
||||||
|
if($list){
|
||||||
|
//open_time 字段转化为2025-09-30 07:00 的格式
|
||||||
|
$list['open_time'] = $list['open_time'] ? date('Y-m-d H:i', $list['open_time']) : 0;
|
||||||
|
}
|
||||||
|
return V(1,"成功", $list);
|
||||||
|
}
|
||||||
|
|
||||||
|
//房间小时榜配置修改
|
||||||
|
public function room_hour_ranking_config_edit()
|
||||||
|
{
|
||||||
|
$id = input('id');
|
||||||
|
$data['is_open_red_pack'] = 0;//暂时不开启
|
||||||
|
$data['is_public_server'] = input('is_public_server');
|
||||||
|
$data['broadcast_times'] = input('broadcast_times');
|
||||||
|
$data['is_open_xlh'] = input('is_open_xlh');
|
||||||
|
$data['min_price'] = input('min_price');
|
||||||
|
$open_time = input('open_time');
|
||||||
|
$data['open_time'] = $open_time ? strtotime($open_time) : 0;
|
||||||
|
$data['createtime'] = time();
|
||||||
|
$data['updatetime'] = time();
|
||||||
|
|
||||||
|
$timeSlots = json_decode(input('timeJson'), true);
|
||||||
|
|
||||||
|
$timePeriods = $this->withdraw_status();
|
||||||
|
|
||||||
|
// 构建正确的时间映射关系
|
||||||
|
$timeMap = [];
|
||||||
|
foreach($timePeriods as $period) {
|
||||||
|
foreach($period as $key => $value) {
|
||||||
|
$timeMap[$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//$timeMap 里面 键值互换
|
||||||
|
$timeMap = array_flip($timeMap);
|
||||||
|
//开启事务
|
||||||
|
db::startTrans();
|
||||||
|
if($timeSlots){
|
||||||
|
$insertData = [];
|
||||||
|
foreach ($timeSlots as $timeSlot) {
|
||||||
|
// $timeRange = ;
|
||||||
|
$timeRange = $timeMap[$timeSlot['time']] ?? '99';
|
||||||
|
|
||||||
|
foreach ($timeSlot['reward'] as $rewardItem) {
|
||||||
|
$hasReward = !empty($rewardItem['content']);
|
||||||
|
|
||||||
|
if ($hasReward) {
|
||||||
|
// 有奖励内容:为每个奖励内容创建一条记录
|
||||||
|
foreach ($rewardItem['content'] as $rewardContent) {
|
||||||
|
if($rewardContent['type'] == 0){
|
||||||
|
$coin = $rewardContent['value'];
|
||||||
|
$gift_id = 0;
|
||||||
|
$gift_name = '';
|
||||||
|
}else{
|
||||||
|
$coin = 0;
|
||||||
|
$gift_id = $rewardContent['value'];
|
||||||
|
$gift_name = $rewardContent['name'];
|
||||||
|
}
|
||||||
|
$insertData[] = [
|
||||||
|
'time_id' => $timeRange,
|
||||||
|
'ranking' => $rewardItem['index'],
|
||||||
|
// 'rank_name' => $rewardItem['name'],
|
||||||
|
'gift_type' => $rewardContent['type'],
|
||||||
|
'gift_id' => $gift_id,
|
||||||
|
'coin' => $coin,
|
||||||
|
'name' => $gift_name,
|
||||||
|
'createtime' => time()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 无奖励内容:插入一条空奖励记录
|
||||||
|
$insertData[] = [
|
||||||
|
'time_id' => $timeRange,
|
||||||
|
'ranking' => $rewardItem['index'],
|
||||||
|
// 'rank_name' => $rewardItem['name'],
|
||||||
|
'gift_type' => 0,
|
||||||
|
'gift_id' => 0,
|
||||||
|
'coin' => 0,
|
||||||
|
'name' => '',
|
||||||
|
'createtime' => time(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量插入
|
||||||
|
if (!empty($insertData)) {
|
||||||
|
$del = db::name('vs_hour_ranking_gift_config')->where('id','>',0)->delete();
|
||||||
|
$ins = db::name('vs_hour_ranking_gift_config')->insertAll($insertData);
|
||||||
|
}else{
|
||||||
|
$ins = false;
|
||||||
|
$del = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$del = true;
|
||||||
|
$ins = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// $res = db::name('vs_hour_ranking_config')->where('id', $id)->update($data);
|
||||||
|
$res = db::name('vs_hour_ranking_config')->where('id', $id)->update($data);
|
||||||
|
// if ($del && $ins && $res) {
|
||||||
|
if ($ins) {
|
||||||
|
db::commit();
|
||||||
|
return V(1, "成功");
|
||||||
|
} else {
|
||||||
|
db::rollback();
|
||||||
|
return V(0, "失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//时间段对应关系
|
||||||
|
public function time_period_correspondence()
|
||||||
|
{
|
||||||
|
$list = $this->withdraw_status();
|
||||||
|
$timePeriods = $this->withdraw_status();
|
||||||
|
$timeMap = [];
|
||||||
|
foreach($timePeriods as $period) {
|
||||||
|
foreach($period as $key => $value) {
|
||||||
|
$timeMap[$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return V(1,"成功", $timeMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//添加核心配置
|
||||||
|
public function add_core_config()
|
||||||
|
{
|
||||||
|
$data['is_public_server'] = input('is_public_server');
|
||||||
|
$data['createtime'] = time();
|
||||||
|
$data['updatetime'] = time();
|
||||||
|
|
||||||
|
|
||||||
|
$res = db::name('vs_hour_ranking_config')->insert($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//核心配置列表
|
||||||
|
public function core_config_list()
|
||||||
|
{
|
||||||
|
$timePeriods = $this->withdraw_status();
|
||||||
|
|
||||||
|
// 构建正确的时间映射关系
|
||||||
|
$timeMap = [];
|
||||||
|
foreach($timePeriods as $period) {
|
||||||
|
foreach($period as $key => $value) {
|
||||||
|
$timeMap[$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先按时间段和排名索引分组查询
|
||||||
|
$timeRanges = db::name('vs_hour_ranking_gift_config')->distinct(true)
|
||||||
|
->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' => []
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加奖励内容到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'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按index排序
|
||||||
|
ksort($rewardMap);
|
||||||
|
|
||||||
|
$result[] = [
|
||||||
|
'time' => $timeMap[$timeRange],
|
||||||
|
'reward' => array_values($rewardMap)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return V(1, "成功", $result);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function core_config_lists()
|
||||||
|
// {
|
||||||
|
// $list = db::name('vs_hour_ranking_gift_config')->select();
|
||||||
|
// $data = [];
|
||||||
|
//
|
||||||
|
// // 按 time_id 和 ranking 重组数据
|
||||||
|
// $reorganizedData = [];
|
||||||
|
// $timePeriods = $this->withdraw_status();
|
||||||
|
//
|
||||||
|
// // 构建正确的时间映射关系
|
||||||
|
// $timeMap = [];
|
||||||
|
// foreach($timePeriods as $period) {
|
||||||
|
// foreach($period as $key => $value) {
|
||||||
|
// $timeMap[$key] = $value;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// foreach ($list as $item) {
|
||||||
|
//// $timeId = $item['time_id'];
|
||||||
|
// $timeId = $timeMap[$item['time_id']] ?? '未知时间段';
|
||||||
|
// $ranking = $item['ranking'];
|
||||||
|
//
|
||||||
|
// $gift_name = '';
|
||||||
|
// if (!isset($reorganizedData[$timeId])) {
|
||||||
|
// $reorganizedData[$timeId] = [];
|
||||||
|
// }
|
||||||
|
// if (!isset($reorganizedData[$timeId][$ranking])) {
|
||||||
|
// $reorganizedData[$timeId][$ranking] = [];
|
||||||
|
// }
|
||||||
|
// if($item['gift_id']){
|
||||||
|
// if($item['gift_type'] == 2){
|
||||||
|
// $gift_name = db::name('vs_gift')->where(['gid'=>$item['gift_id']])->value('gift_name');
|
||||||
|
// }
|
||||||
|
// if($item['gift_type'] == 3 || $item['gift_type'] == 4){
|
||||||
|
// $gift_name = db::name('vs_decorate')->where(['did'=>$item['gift_id']])->value('title');
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }else{
|
||||||
|
// $gift_name = '';
|
||||||
|
// }
|
||||||
|
// $reorganizedData[$timeId][$ranking][] = [
|
||||||
|
// 'gift_type' => $item['gift_type'],
|
||||||
|
// 'gift_id' => $item['gift_id'],
|
||||||
|
// 'gift_name' => $gift_name,
|
||||||
|
// 'coin' => $item['coin']
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 输出重组后的数据
|
||||||
|
// print_r($reorganizedData);
|
||||||
|
// return V(1, "成功", $data);
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
namespace app\adminapi\controller;
|
||||||
|
|
||||||
use app\common\controller\adminApi;
|
use app\common\controller\adminApi;
|
||||||
|
use app\common\library\GiftTableManager;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
use Yzh\YunPay;
|
use Yzh\YunPay;
|
||||||
|
|
||||||
@@ -11,6 +12,7 @@ class Statistical extends adminApi
|
|||||||
//初始化
|
//初始化
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
{
|
{
|
||||||
|
set_time_limit(0);
|
||||||
parent::_initialize();
|
parent::_initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,10 +39,10 @@ class Statistical extends adminApi
|
|||||||
$where['createtime'] = ['>=', strtotime($begin_time)];
|
$where['createtime'] = ['>=', strtotime($begin_time)];
|
||||||
}
|
}
|
||||||
if($end_time !== ''){
|
if($end_time !== ''){
|
||||||
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
|
$where['createtime'] = ['<=', strtotime($end_time)];
|
||||||
}
|
}
|
||||||
if(!empty($begin_time) && !empty($end_time)){
|
if(!empty($begin_time) && !empty($end_time)){
|
||||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]];
|
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
|
||||||
}
|
}
|
||||||
|
|
||||||
$where['pay_status'] = 2;//1待支付,2已支付
|
$where['pay_status'] = 2;//1待支付,2已支付
|
||||||
@@ -85,6 +87,12 @@ class Statistical extends adminApi
|
|||||||
$search_uid = input('search_uid', '');
|
$search_uid = input('search_uid', '');
|
||||||
$begin_time = input('begin_time', '');
|
$begin_time = input('begin_time', '');
|
||||||
$end_time = input('end_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=[];
|
$where=[];
|
||||||
$group = 'user_id';
|
$group = 'user_id';
|
||||||
if($type == 2){
|
if($type == 2){
|
||||||
@@ -112,16 +120,25 @@ class Statistical extends adminApi
|
|||||||
$where['createtime'] = ['>=', strtotime($begin_time)];
|
$where['createtime'] = ['>=', strtotime($begin_time)];
|
||||||
}
|
}
|
||||||
if($end_time !== ''){
|
if($end_time !== ''){
|
||||||
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
|
$where['createtime'] = ['<=', strtotime($end_time)];
|
||||||
}
|
}
|
||||||
if(!empty($begin_time) && !empty($end_time)){
|
if(!empty($begin_time) && !empty($end_time)){
|
||||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]];
|
$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)
|
->where($where)
|
||||||
->group($group)
|
->group($group)
|
||||||
->count();
|
->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')
|
->field('id,createtime,user_id,gift_user,sum(total_price) as total_price,sum(number) as number')
|
||||||
->where($where)
|
->where($where)
|
||||||
->group($group)
|
->group($group)
|
||||||
@@ -177,21 +194,21 @@ class Statistical extends adminApi
|
|||||||
$where['createtime'] = ['>=', strtotime($begin_time)];
|
$where['createtime'] = ['>=', strtotime($begin_time)];
|
||||||
}
|
}
|
||||||
if($end_time !== ''){
|
if($end_time !== ''){
|
||||||
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
|
$where['createtime'] = ['<=', strtotime($end_time)];
|
||||||
}
|
}
|
||||||
if(!empty($begin_time) && !empty($end_time)){
|
if(!empty($begin_time) && !empty($end_time)){
|
||||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]];
|
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
|
||||||
}
|
}
|
||||||
// 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮
|
// 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮
|
||||||
// 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换
|
// 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换
|
||||||
// 15.首充 16.天降好礼充值 17.退出工会扣款 18.房主收益 19.主持人收益 20.抢头条 21.公会长收益
|
// 15.首充 16.天降好礼充值 17.退出工会扣款 18.房主收益 19.主持人收益 20.抢头条 21.公会长收益
|
||||||
$where['change_type'] = ['in', [4,7,10,17,20]];
|
$where['change_type'] = ['in', [4,7,10,17,20,24,25,32,42,50,56,59]];
|
||||||
$count = db::name('vs_user_money_log')
|
$count = db::name('user_coin_log')
|
||||||
->where($where)
|
->where($where)
|
||||||
->group('user_id')
|
->group('user_id')
|
||||||
->count();
|
->count();
|
||||||
$lists = db::name('vs_user_money_log')
|
$lists = db::name('user_coin_log')
|
||||||
->field('log_id,createtime,user_id,sum(change_value) as change_value')
|
->field('id,createtime,user_id,sum(coin) as change_value')
|
||||||
->where($where)
|
->where($where)
|
||||||
->group('user_id')
|
->group('user_id')
|
||||||
->order('change_value desc')
|
->order('change_value desc')
|
||||||
@@ -209,7 +226,7 @@ class Statistical extends adminApi
|
|||||||
'count' => $count,
|
'count' => $count,
|
||||||
'lists' => $lists,
|
'lists' => $lists,
|
||||||
'total' =>[
|
'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);
|
return V(1,"成功", $return_data);
|
||||||
@@ -239,18 +256,26 @@ class Statistical extends adminApi
|
|||||||
$where['createtime'] = ['>=', strtotime($begin_time)];
|
$where['createtime'] = ['>=', strtotime($begin_time)];
|
||||||
}
|
}
|
||||||
if($end_time !== ''){
|
if($end_time !== ''){
|
||||||
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
|
$where['createtime'] = ['<=', strtotime($end_time)];
|
||||||
}
|
}
|
||||||
if(!empty($begin_time) && !empty($end_time)){
|
if(!empty($begin_time) && !empty($end_time)){
|
||||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]];
|
$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;
|
$where['from'] = 2;
|
||||||
$count = db::name('vs_give_gift')
|
$count = db::name($table_name)
|
||||||
->where($where)
|
->where($where)
|
||||||
->group('from_id')
|
->group('from_id')
|
||||||
->count();
|
->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')
|
->field('id,createtime,user_id,gift_user,sum(total_price) as total_price,sum(number) as number,from_id')
|
||||||
->where($where)
|
->where($where)
|
||||||
->group('from_id')
|
->group('from_id')
|
||||||
@@ -259,21 +284,52 @@ class Statistical extends adminApi
|
|||||||
->select();
|
->select();
|
||||||
foreach ($lists as $key => $value) {
|
foreach ($lists as $key => $value) {
|
||||||
$room = db::name('vs_room')->where('id', $value['from_id'])->find();
|
$room = db::name('vs_room')->where('id', $value['from_id'])->find();
|
||||||
|
if($room){
|
||||||
|
$lists[$key]['room_name'] = $room['room_name'].'-'.$room['room_number'];
|
||||||
|
$lists[$key]['room_number'] = $room['room_number'];
|
||||||
|
}else{
|
||||||
|
$lists[$key]['room_name'] = "--";
|
||||||
|
$lists[$key]['room_number'] = "--";
|
||||||
|
}
|
||||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||||
$lists[$key]['room_name'] = $room['room_name'].'-'.$room['room_number'];
|
|
||||||
$lists[$key]['room_number'] = $room['room_number'];
|
|
||||||
$lists[$key]['room_cover'] = db::name('vs_room')->where('id', $value['from_id'])->value('room_cover');
|
$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');
|
$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');
|
$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 = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'lists' => $lists,
|
'lists' => $lists,
|
||||||
'total' =>[
|
'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);
|
return V(1,"成功", $return_data);
|
||||||
@@ -302,10 +358,10 @@ class Statistical extends adminApi
|
|||||||
$where['createtime'] = ['>=', strtotime($pay_stime)];
|
$where['createtime'] = ['>=', strtotime($pay_stime)];
|
||||||
}
|
}
|
||||||
if($pay_etime !== ''){
|
if($pay_etime !== ''){
|
||||||
$where['createtime'] = ['<=', strtotime($pay_etime.' 23:59:59')];
|
$where['createtime'] = ['<=', strtotime($pay_etime)];
|
||||||
}
|
}
|
||||||
if(!empty($pay_stime) && !empty($pay_etime)){
|
if(!empty($pay_stime) && !empty($pay_etime)){
|
||||||
$where['createtime'] = ['between',[strtotime($pay_stime),strtotime($pay_etime.' 23:59:59')]];
|
$where['createtime'] = ['between',[strtotime($pay_stime),strtotime($pay_etime)]];
|
||||||
}
|
}
|
||||||
if($pay_status !== ''){
|
if($pay_status !== ''){
|
||||||
$where['pay_status'] = $pay_status;
|
$where['pay_status'] = $pay_status;
|
||||||
@@ -325,7 +381,7 @@ class Statistical extends adminApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
$count = db::name('vs_user_recharge')->where($where)->count();
|
$count = db::name('vs_user_recharge')->where($where)->count();
|
||||||
$lists = db::name('vs_user_recharge')->where($where)->page($page, $page_limit)->select();
|
$lists = db::name('vs_user_recharge')->where($where)->order('rid desc')->page($page, $page_limit)->select();
|
||||||
foreach ($lists as $key => $value) {
|
foreach ($lists as $key => $value) {
|
||||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||||
$lists[$key]['user_name'] = db::name('user')->where('id', $value['user_id'])->value('nickname').'-'.
|
$lists[$key]['user_name'] = db::name('user')->where('id', $value['user_id'])->value('nickname').'-'.
|
||||||
@@ -346,19 +402,21 @@ class Statistical extends adminApi
|
|||||||
];
|
];
|
||||||
//总收入
|
//总收入
|
||||||
$wherew=[];
|
$wherew=[];
|
||||||
$return_data['total_money'] = db::name('vs_user_recharge')->sum('money');
|
unset($where['pay_status']);
|
||||||
|
unset($where['pay_type']);
|
||||||
|
$return_data['total_money'] = db::name('vs_user_recharge')->where($where)->sum('money');
|
||||||
//未支付
|
//未支付
|
||||||
$return_data['unpaid_money'] = db::name('vs_user_recharge')->where('pay_status',1)->sum('money');
|
$return_data['unpaid_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',1)->sum('money');
|
||||||
//已支付
|
//已支付
|
||||||
$return_data['paid_money'] = db::name('vs_user_recharge')->where('pay_status',2)->sum('money');
|
$return_data['paid_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->sum('money');
|
||||||
//微信支付
|
//微信支付
|
||||||
$wherew['pay_type'] = ['in', [1,4]];
|
$wherew['pay_type'] = ['in', [1,4]];
|
||||||
$return_data['wx_money'] = db::name('vs_user_recharge')->where('pay_status',2)->where($wherew)->sum('money');
|
$return_data['wx_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->where($wherew)->sum('money');
|
||||||
//支付宝支付
|
//支付宝支付
|
||||||
$wherez['pay_type'] = ['in', [2,3]];
|
$wherez['pay_type'] = ['in', [2,3]];
|
||||||
$return_data['ali_money'] = db::name('vs_user_recharge')->where('pay_status',2)->where($wherez)->sum('money');
|
$return_data['ali_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->where($wherez)->sum('money');
|
||||||
//金币数量
|
//金币数量
|
||||||
$return_data['gold_num'] = db::name('vs_user_recharge')->where('pay_status',2)->sum('coin');
|
$return_data['gold_num'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->sum('coin');
|
||||||
return V(1,"成功", $return_data);
|
return V(1,"成功", $return_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,15 +441,16 @@ class Statistical extends adminApi
|
|||||||
$where['a.createtime'] = ['>=', strtotime($start_time)];
|
$where['a.createtime'] = ['>=', strtotime($start_time)];
|
||||||
}
|
}
|
||||||
if($end_time !== ''){
|
if($end_time !== ''){
|
||||||
$where['a.createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
|
$where['a.createtime'] = ['<=', strtotime($end_time)];
|
||||||
}
|
}
|
||||||
if($start_time !== '' && $end_time !== ''){
|
if($start_time !== '' && $end_time !== ''){
|
||||||
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time.' 23:59:59')]];
|
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = db::name('user_exchange')->where($where)->alias('a')->join('user b', 'a.user_id = b.id')->count();
|
$count = db::name('user_exchange')->where($where)->alias('a')->join('user b', 'a.user_id = b.id')->count();
|
||||||
$lists = db::name('user_exchange')->where($where)->alias('a')->join('user b', 'a.user_id = b.id')
|
$lists = db::name('user_exchange')->where($where)->alias('a')->join('user b', 'a.user_id = b.id')
|
||||||
->field('a.*,b.nickname,b.user_code')
|
->field('a.*,b.nickname,b.user_code')
|
||||||
|
->order('a.id desc')
|
||||||
->page($page, $page_limit)->select();
|
->page($page, $page_limit)->select();
|
||||||
foreach ($lists as $key => $value) {
|
foreach ($lists as $key => $value) {
|
||||||
$lists[$key]['user_name'] = $value['nickname'].'-'.$value['user_code'];
|
$lists[$key]['user_name'] = $value['nickname'].'-'.$value['user_code'];
|
||||||
@@ -428,10 +487,10 @@ class Statistical extends adminApi
|
|||||||
$where['a.createtime'] = ['>=', strtotime($start_time)];
|
$where['a.createtime'] = ['>=', strtotime($start_time)];
|
||||||
}
|
}
|
||||||
if($end_time !== ''){
|
if($end_time !== ''){
|
||||||
$where['a.createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
|
$where['a.createtime'] = ['<=', strtotime($end_time)];
|
||||||
}
|
}
|
||||||
if($start_time !== '' && $end_time !== ''){
|
if($start_time !== '' && $end_time !== ''){
|
||||||
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time.' 23:59:59')]];
|
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||||
}
|
}
|
||||||
$count = db::name('vs_admin_recharge_log')
|
$count = db::name('vs_admin_recharge_log')
|
||||||
->alias('a')->join('user b', 'a.user_id = b.id')
|
->alias('a')->join('user b', 'a.user_id = b.id')
|
||||||
@@ -473,4 +532,304 @@ class Statistical extends adminApi
|
|||||||
];
|
];
|
||||||
return V(1,"成功", $return_data);
|
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\admin\model\AdminLog;
|
||||||
use app\common\controller\adminApi;
|
use app\common\controller\adminApi;
|
||||||
|
use think\Cache;
|
||||||
use think\Config;
|
use think\Config;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Hook;
|
use think\Hook;
|
||||||
@@ -33,6 +34,12 @@ class SysSet extends adminApi
|
|||||||
'8' => '房间配置',
|
'8' => '房间配置',
|
||||||
'9' => '弹窗内容设置',
|
'9' => '弹窗内容设置',
|
||||||
'10' => '邀请奖励',
|
'10' => '邀请奖励',
|
||||||
|
'11' => '二级密码',
|
||||||
|
];
|
||||||
|
public $noAdminConfigType = [
|
||||||
|
'1' => '基础设置',
|
||||||
|
'4' => '提现设置',
|
||||||
|
'8' => '房间配置',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
@@ -44,14 +51,18 @@ class SysSet extends adminApi
|
|||||||
* 类型列表
|
* 类型列表
|
||||||
*/
|
*/
|
||||||
public function type_list(){
|
public function type_list(){
|
||||||
$configType = $this->configType;
|
if($this->auth->isSuperAdmin()){
|
||||||
|
$configType = $this->configType;
|
||||||
|
}else{
|
||||||
|
$configType = $this->noAdminConfigType;
|
||||||
|
}
|
||||||
$list = [];
|
$list = [];
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach ($configType as $k=>$v){
|
foreach ($configType as $k=>$v){
|
||||||
$list[$i]['id'] = $k;
|
$list[$i]['id'] = $k;
|
||||||
$list[$i]['name'] = $v;
|
$list[$i]['name'] = $v;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
return V(1,"成功", $list);
|
return V(1,"成功", $list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,9 +96,25 @@ class SysSet extends adminApi
|
|||||||
$data = [
|
$data = [
|
||||||
'key_value'=>$v,
|
'key_value'=>$v,
|
||||||
];
|
];
|
||||||
|
if($k == 'is_maintenance' || $k == 'inside_uid'){
|
||||||
|
Cache::rm($k);
|
||||||
|
}
|
||||||
db::name($this->table)->where(['key_title'=>$k])->update($data);
|
db::name($this->table)->where(['key_title'=>$k])->update($data);
|
||||||
}
|
}
|
||||||
return V(1,"成功");
|
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]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||||
$lists[$key]['updatetime'] = date('Y-m-d H:i:s', $value['updatetime']);
|
$lists[$key]['updatetime'] = date('Y-m-d H:i:s', $value['updatetime']);
|
||||||
$lists[$key]['type_name'] = $value['type'] == 1 ? '系统消息' : '官方公告';
|
$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');
|
$lists[$key]['admin_name'] = db::name('admin')->where('id', $value['admin_id'])->value('nickname');
|
||||||
if($lists[$key]['room_id'] > 0){
|
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');
|
$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;
|
$data['title'] = $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = input('content', '');
|
$content = input('content', ''); //$_POST['content'] ?? '';
|
||||||
if($content){
|
if($content){
|
||||||
$data['content'] = $content;
|
$data['content'] = $content;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,7 @@ class Tasks extends adminApi
|
|||||||
{
|
{
|
||||||
protected $noNeedLogin = [];
|
protected $noNeedLogin = [];
|
||||||
protected $noNeedRight = [];
|
protected $noNeedRight = [];
|
||||||
protected $table = 'vs_daily_tasks';
|
protected $table = 'vs_tasks';
|
||||||
public $task_type = [
|
|
||||||
'1' => '每日任务',
|
|
||||||
'2' => '每日特殊任务',
|
|
||||||
'3' => '平台常规任务'
|
|
||||||
];
|
|
||||||
|
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
{
|
{
|
||||||
parent::_initialize();
|
parent::_initialize();
|
||||||
@@ -41,21 +35,20 @@ class Tasks extends adminApi
|
|||||||
if($seach_task_type != ''){
|
if($seach_task_type != ''){
|
||||||
$where['task_type'] = $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();
|
$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_daily_tasks')->where(['delete_time'=>0])->where($where)->count();
|
$count = db::name('vs_tasks')->where(['delete_time'=>0])->where($where)->count();
|
||||||
$list_data = [];
|
$list_data = [];
|
||||||
foreach ($list as $k=>$v){
|
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]['icon'] = $v['icon'];
|
||||||
$list_data[$k]['task_name'] = $v['task_name'];
|
$list_data[$k]['task_name'] = $v['task_name'];
|
||||||
$list_data[$k]['task_description'] = $v['task_description']??"";
|
$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]['target_quantity'] = $v['target_quantity'];
|
||||||
$list_data[$k]['task_type'] = $v['task_type'];
|
$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]['sort'] = $v['sort'];
|
||||||
$list_data[$k]['bag_id'] = $v['bag_id'];
|
$list_data[$k]['bag_id'] = $v['tasks_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_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'];
|
$list_data[$k]['is_active'] = $v['is_active'];
|
||||||
}
|
}
|
||||||
$return_data = [
|
$return_data = [
|
||||||
@@ -63,7 +56,7 @@ class Tasks extends adminApi
|
|||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'lists' => $list_data,
|
'lists' => $list_data,
|
||||||
'task_type' => $this->task_type,
|
'task_type' => model('api/Tasks')->task_type,
|
||||||
];
|
];
|
||||||
return V(1,"成功", $return_data);
|
return V(1,"成功", $return_data);
|
||||||
}
|
}
|
||||||
@@ -95,7 +88,7 @@ class Tasks extends adminApi
|
|||||||
$data['sort'] = $sort;
|
$data['sort'] = $sort;
|
||||||
}
|
}
|
||||||
if($bag_id != ''){
|
if($bag_id != ''){
|
||||||
$data['bag_id'] = $bag_id;
|
$data['tasks_bag_id'] = $bag_id;
|
||||||
}
|
}
|
||||||
if($is_active != ''){
|
if($is_active != ''){
|
||||||
$data['is_active'] = $is_active;
|
$data['is_active'] = $is_active;
|
||||||
@@ -103,13 +96,10 @@ class Tasks extends adminApi
|
|||||||
if($task_type != ''){
|
if($task_type != ''){
|
||||||
$data['task_type'] = $task_type;
|
$data['task_type'] = $task_type;
|
||||||
}
|
}
|
||||||
if($gold_reward != ''){
|
|
||||||
$data['gold_reward'] = $gold_reward;
|
|
||||||
}
|
|
||||||
if($target_quantity){
|
if($target_quantity){
|
||||||
$data['target_quantity'] = $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){
|
if($res){
|
||||||
return V(1,"修改成功");
|
return V(1,"修改成功");
|
||||||
}else{
|
}else{
|
||||||
@@ -123,7 +113,7 @@ class Tasks extends adminApi
|
|||||||
public function task_open(){
|
public function task_open(){
|
||||||
$task_id = input('task_id', '');
|
$task_id = input('task_id', '');
|
||||||
$is_active = input('is_active', '');
|
$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){
|
if($res){
|
||||||
return V(1,"开启成功");
|
return V(1,"开启成功");
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ class Theme extends adminApi
|
|||||||
}
|
}
|
||||||
$list = db::name($this->table)->where($where)->page($page, $page_limit)->select();
|
$list = db::name($this->table)->where($where)->page($page, $page_limit)->select();
|
||||||
$count = db::name($this->table)->where($where)->count();
|
$count = db::name($this->table)->where($where)->count();
|
||||||
|
foreach ($list as &$value) {
|
||||||
|
$value['begin_time'] = date('Y-m-d H:i:s',$value['begin_time']);
|
||||||
|
$value['end_time'] = date('Y-m-d H:i:s',$value['end_time']);
|
||||||
|
}
|
||||||
$return_data = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
@@ -62,6 +66,10 @@ class Theme extends adminApi
|
|||||||
$auxiliary_color = input('auxiliary_color', '');
|
$auxiliary_color = input('auxiliary_color', '');
|
||||||
$file_url = input('file_url', '');
|
$file_url = input('file_url', '');
|
||||||
$is_active = input('is_active', '');
|
$is_active = input('is_active', '');
|
||||||
|
$begin_time = input('begin_time', '');
|
||||||
|
$end_time = input('end_time', '');
|
||||||
|
$begin_time = !empty($begin_time) ? strtotime($begin_time) : 0;
|
||||||
|
$end_time = !empty($end_time) ? strtotime($end_time) : 0;
|
||||||
$data = [
|
$data = [
|
||||||
'theme_name' => $theme_name,
|
'theme_name' => $theme_name,
|
||||||
'theme_color' => $theme_color,
|
'theme_color' => $theme_color,
|
||||||
@@ -69,7 +77,9 @@ class Theme extends adminApi
|
|||||||
'file_url' => $file_url,
|
'file_url' => $file_url,
|
||||||
'is_active' => $is_active,
|
'is_active' => $is_active,
|
||||||
'admin_id' => $admin_id,
|
'admin_id' => $admin_id,
|
||||||
'createtime' => time()
|
'createtime' => time(),
|
||||||
|
'begin_time' => $begin_time,
|
||||||
|
'end_time' => $end_time,
|
||||||
];
|
];
|
||||||
$res = db::name($this->table)->insert($data);
|
$res = db::name($this->table)->insert($data);
|
||||||
if($res){
|
if($res){
|
||||||
@@ -87,6 +97,10 @@ class Theme extends adminApi
|
|||||||
$auxiliary_color = input('auxiliary_color', '');
|
$auxiliary_color = input('auxiliary_color', '');
|
||||||
$file_url = input('file_url', '');
|
$file_url = input('file_url', '');
|
||||||
$is_active = input('is_active', '');
|
$is_active = input('is_active', '');
|
||||||
|
$begin_time = input('begin_time', '');
|
||||||
|
$end_time = input('end_time', '');
|
||||||
|
$begin_time = !empty($begin_time) ? strtotime($begin_time) : 0;
|
||||||
|
$end_time = !empty($end_time) ? strtotime($end_time) : 0;
|
||||||
$id = input('id', '');
|
$id = input('id', '');
|
||||||
$data = [
|
$data = [
|
||||||
'theme_name' => $theme_name,
|
'theme_name' => $theme_name,
|
||||||
@@ -94,7 +108,9 @@ class Theme extends adminApi
|
|||||||
'auxiliary_color' => $auxiliary_color,
|
'auxiliary_color' => $auxiliary_color,
|
||||||
'file_url' => $file_url,
|
'file_url' => $file_url,
|
||||||
'is_active' => $is_active,
|
'is_active' => $is_active,
|
||||||
'updatetime' => time()
|
'updatetime' => time(),
|
||||||
|
'begin_time' => $begin_time,
|
||||||
|
'end_time' => $end_time,
|
||||||
];
|
];
|
||||||
$res = db::name($this->table)->where(['id'=>$id])->update($data);
|
$res = db::name($this->table)->where(['id'=>$id])->update($data);
|
||||||
if($res){
|
if($res){
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ class Underage extends adminApi
|
|||||||
*/
|
*/
|
||||||
public function content_List(){
|
public function content_List(){
|
||||||
$page = input('page', 1);
|
$page = input('page', 1);
|
||||||
$page_limit = input('pageSize', 30);
|
$page_limit = input('page_limit', 10);
|
||||||
$search_name = input('search_name', '');
|
$search_name = input('search_name', '');
|
||||||
$where = [];
|
$where = [];
|
||||||
if($search_name){
|
if($search_name){
|
||||||
@@ -167,6 +167,7 @@ class Underage extends adminApi
|
|||||||
}
|
}
|
||||||
$list = DB::name('vs_underage_mode_content')->where($where)->order('sort,id', 'asc')->page($page, $page_limit)->select();
|
$list = DB::name('vs_underage_mode_content')->where($where)->order('sort,id', 'asc')->page($page, $page_limit)->select();
|
||||||
$count = DB::name('vs_underage_mode_content')->where($where)->count();
|
$count = DB::name('vs_underage_mode_content')->where($where)->count();
|
||||||
|
$return_lists = [];
|
||||||
foreach ($list as $key => $value) {
|
foreach ($list as $key => $value) {
|
||||||
$return_lists[$key]['id'] = $value['id'];
|
$return_lists[$key]['id'] = $value['id'];
|
||||||
$return_lists[$key]['type_id'] = $value['type_id'];
|
$return_lists[$key]['type_id'] = $value['type_id'];
|
||||||
@@ -266,7 +267,7 @@ class Underage extends adminApi
|
|||||||
$type_id = input('type_id', '');
|
$type_id = input('type_id', '');
|
||||||
$title = input('title', '');
|
$title = input('title', '');
|
||||||
$introduced = input('introduced', '');
|
$introduced = input('introduced', '');
|
||||||
$content = input('content', '');
|
$content = $_POST['content']??"";
|
||||||
$url = input('url', '');
|
$url = input('url', '');
|
||||||
$img = input('img', '');
|
$img = input('img', '');
|
||||||
$from = input('from', 1);
|
$from = input('from', 1);
|
||||||
@@ -303,9 +304,6 @@ class Underage extends adminApi
|
|||||||
$data['content'] = $content;
|
$data['content'] = $content;
|
||||||
}
|
}
|
||||||
$result = db::name('vs_underage_mode_content')->where(['id'=>$id])->update($data);
|
$result = db::name('vs_underage_mode_content')->where(['id'=>$id])->update($data);
|
||||||
if(!$result){
|
|
||||||
return V(0,"修改失败");
|
|
||||||
}
|
|
||||||
return V(1,"成功", ['id'=>$id]);
|
return V(1,"成功", ['id'=>$id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ namespace app\adminapi\controller;
|
|||||||
|
|
||||||
use app\admin\model\AdminLog;
|
use app\admin\model\AdminLog;
|
||||||
use app\common\controller\Upload;
|
use app\common\controller\Upload;
|
||||||
|
use Overtrue\Pinyin\Pinyin;
|
||||||
use think\Request;
|
use think\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,14 +33,39 @@ class UploadFile extends Upload
|
|||||||
try {
|
try {
|
||||||
// 获取临时路径和原始文件名
|
// 获取临时路径和原始文件名
|
||||||
$filePath = $file->getRealPath();
|
$filePath = $file->getRealPath();
|
||||||
$objectName = $file->getInfo('name');
|
$originalName = $file->getInfo('name');
|
||||||
// 调用父类方法上传到 OSS
|
|
||||||
$result = $this->uploadFile($objectName, $filePath);
|
// 提取文件扩展名
|
||||||
if (!$result) {
|
$extension = pathinfo($originalName, PATHINFO_EXTENSION);
|
||||||
return V(0, '上传失败,请检查OSS配置或网络', null);
|
|
||||||
|
// 处理文件名(中文转拼音) 移除扩展名(如果有的话)
|
||||||
|
$fileName = pathinfo($originalName, PATHINFO_FILENAME);
|
||||||
|
if (preg_match('/[\x{4e00}-\x{9fa5}]+/u', $fileName)) {
|
||||||
|
$pinyin = new Pinyin();
|
||||||
|
$fileName = $pinyin->permalink($fileName, ''); // 转换为无分隔符的拼音
|
||||||
}
|
}
|
||||||
// 返回访问地址
|
|
||||||
$url = $this->config['oss_cdn_url'] . $objectName;
|
// 去除文件名中的空格
|
||||||
|
$fileName = str_replace(' ', '', $fileName);
|
||||||
|
|
||||||
|
// 添加唯一标识符(时间戳+随机数)
|
||||||
|
$uniqueId = time() . mt_rand(1000, 9999);
|
||||||
|
$objectName = $fileName . '_' . $uniqueId . '.' . $extension;
|
||||||
|
|
||||||
|
// 调用父类方法上传到 OSS
|
||||||
|
// $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, '上传失败,请检查COS配置或网络', null);
|
||||||
|
}
|
||||||
|
$url = $result;// 返回访问地址 具体访问地址根据你的实际配置来定这个需要修改 等域名通过备案后修改
|
||||||
return V(1, '上传成功', ['url' => $url]);
|
return V(1, '上传成功', ['url' => $url]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return V(0, '上传异常: ' . $e->getMessage(), null);
|
return V(0, '上传异常: ' . $e->getMessage(), null);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use think\Db;
|
|||||||
use think\Hook;
|
use think\Hook;
|
||||||
use think\Session;
|
use think\Session;
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
use app\common\library\Token as TokenLib;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 后台首页
|
* 后台首页
|
||||||
@@ -35,8 +36,10 @@ class User extends adminApi
|
|||||||
$page_limit = input('page_limit', 30);
|
$page_limit = input('page_limit', 30);
|
||||||
$search_str = input('search', '');
|
$search_str = input('search', '');
|
||||||
$search_user_code = input('search_user_code', '');
|
$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.is_robot'] =0;
|
||||||
$where['a.delete_time'] = 0;
|
// $where['a.delete_time'] = 0;
|
||||||
//如果是手机号查手机号
|
//如果是手机号查手机号
|
||||||
if($search_str !==''){
|
if($search_str !==''){
|
||||||
if(is_numeric($search_str)) {
|
if(is_numeric($search_str)) {
|
||||||
@@ -60,7 +63,7 @@ class User extends adminApi
|
|||||||
if($is_real == 1) {
|
if($is_real == 1) {
|
||||||
$where['b.is_real'] = 1;
|
$where['b.is_real'] = 1;
|
||||||
}else {
|
}else {
|
||||||
$where['b.is_real'] = ['<>',1];
|
$where['b.is_real'] = [['<>',1],['null', null],'or'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//高级搜索
|
//高级搜索
|
||||||
@@ -72,10 +75,12 @@ class User extends adminApi
|
|||||||
if($v=='coin1'){
|
if($v=='coin1'){
|
||||||
$where['c.coin'] = ['>=',$input_data];
|
$where['c.coin'] = ['>=',$input_data];
|
||||||
}elseif($v=='coin2'){
|
}elseif($v=='coin2'){
|
||||||
$where['c.coin'] = ['<=',$input_data];
|
if($input_data){
|
||||||
|
$where['c.coin'] = ['<=',$input_data];
|
||||||
|
}
|
||||||
}elseif($v=='createtime'){
|
}elseif($v=='createtime'){
|
||||||
$where['a.createtime'] = ['>=',strtotime($input_data.' 00:00:00')];
|
$where['a.createtime'] = ['>=',strtotime($input_data)];
|
||||||
$where['a.createtime'] = ['<=',strtotime($input_data.' 23:59:59')];
|
$where['a.createtime'] = ['<=',strtotime($input_data)];
|
||||||
}else{
|
}else{
|
||||||
$where['a.'.$v] = $input_data;
|
$where['a.'.$v] = $input_data;
|
||||||
}
|
}
|
||||||
@@ -91,26 +96,46 @@ class User extends adminApi
|
|||||||
a.login_device,
|
a.login_device,
|
||||||
a.loginip,
|
a.loginip,
|
||||||
c.coin,
|
c.coin,
|
||||||
c.earnings,
|
d.earnings,
|
||||||
b.is_real,
|
b.is_real,
|
||||||
a.init_code,
|
a.init_code,
|
||||||
a.status
|
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')
|
$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('(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)
|
->where($where)
|
||||||
->field($field)
|
->field($field)
|
||||||
->order('a.id desc');
|
->order($order);
|
||||||
$lists = $user_data->page($page, $page_limit)->select();
|
$lists = $user_data->page($page, $page_limit)->select();
|
||||||
$count = db::name('user')->alias('a')
|
$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('(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)
|
->where($where)
|
||||||
->field($field)
|
->field($field)
|
||||||
->order('a.id desc')->count();
|
->count();
|
||||||
foreach ($lists as $key => $value) {
|
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 ? '已实名' : '未实名';
|
$lists[$key]['is_real_str'] = $value['is_real'] == 1 ? '已实名' : '未实名';
|
||||||
//禁用状态
|
//禁用状态
|
||||||
//1:禁用账号 2:禁用设备号 3:禁用IP
|
//1:禁用账号 2:禁用设备号 3:禁用IP
|
||||||
@@ -146,9 +171,27 @@ class User extends adminApi
|
|||||||
$lists[$key]['special_num'] = "无";
|
$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 = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
|
'total_coin' => $total_coin,
|
||||||
|
'total_earnings' => $total_earnings,
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'lists' => $lists
|
'lists' => $lists
|
||||||
];
|
];
|
||||||
@@ -231,8 +274,12 @@ class User extends adminApi
|
|||||||
'type' => $type,
|
'type' => $type,
|
||||||
'type_text' => $type_text,
|
'type_text' => $type_text,
|
||||||
];
|
];
|
||||||
$res = Db::name('block')->where($map)->delete();
|
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);
|
return V(1,"成功", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +381,7 @@ class User extends adminApi
|
|||||||
$user_data['user_info']['wealth_level_icon'] = $user['wealth_level_icon'];
|
$user_data['user_info']['wealth_level_icon'] = $user['wealth_level_icon'];
|
||||||
$user_data['user_info']['user_code'] = $user['user_code'];
|
$user_data['user_info']['user_code'] = $user['user_code'];
|
||||||
$user_data['user_info']['mobile'] = $user['mobile'];
|
$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']['birthday'] = $user['birthday'];
|
||||||
$user_data['user_info']['system'] = $user['system'];
|
$user_data['user_info']['system'] = $user['system'];
|
||||||
$user_data['user_info']['age'] = $user['age'];
|
$user_data['user_info']['age'] = $user['age'];
|
||||||
@@ -346,7 +393,16 @@ class User extends adminApi
|
|||||||
$user_data['user_info']['red_status_str'] = $user['red_status']==1 ? '开启' : '禁止';
|
$user_data['user_info']['red_status_str'] = $user['red_status']==1 ? '开启' : '禁止';
|
||||||
//标签
|
//标签
|
||||||
$user_data['user_info']['tag'] = $user['tag_list'];
|
$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']['user_recharge_all_money'] = $user['user_recharge_all_money'];
|
||||||
$user_data['follow_num']['coin'] = $user['coin'];
|
$user_data['follow_num']['coin'] = $user['coin'];
|
||||||
@@ -422,7 +478,15 @@ class User extends adminApi
|
|||||||
$reslut = DB::name('user')->where('id', $user_id)->update($up_user);
|
$reslut = DB::name('user')->where('id', $user_id)->update($up_user);
|
||||||
}
|
}
|
||||||
if($up_user_data){
|
if($up_user_data){
|
||||||
$res = DB::name('user_auth')->where('mobile', $user['mobile'])->update($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,'操作成功');
|
return V(1,'操作成功');
|
||||||
}
|
}
|
||||||
@@ -435,7 +499,15 @@ class User extends adminApi
|
|||||||
$page = input('page',1);
|
$page = input('page',1);
|
||||||
$page_limit = input('page_limit',10);
|
$page_limit = input('page_limit',10);
|
||||||
$type = input('type','');
|
$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 = [];
|
$list = [];
|
||||||
foreach($return['list'] as $k=>$v){
|
foreach($return['list'] as $k=>$v){
|
||||||
$list[$k] = [
|
$list[$k] = [
|
||||||
@@ -455,6 +527,14 @@ class User extends adminApi
|
|||||||
return V(1,"操作成功", $return_data);
|
return V(1,"操作成功", $return_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 获取用户资金类型
|
||||||
|
*/
|
||||||
|
public function get_money_type(){
|
||||||
|
$reslut = model('UserWallet')->getChangeTypeLableList();
|
||||||
|
return V(1,"操作成功", $reslut);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 相册列表
|
* 相册列表
|
||||||
*/
|
*/
|
||||||
@@ -515,7 +595,7 @@ class User extends adminApi
|
|||||||
a.user_code,
|
a.user_code,
|
||||||
a.login_device,
|
a.login_device,
|
||||||
c.coin,
|
c.coin,
|
||||||
c.earnings,
|
d.earnings,
|
||||||
b.is_real,
|
b.is_real,
|
||||||
a.init_code,
|
a.init_code,
|
||||||
a.status,
|
a.status,
|
||||||
@@ -523,12 +603,14 @@ class User extends adminApi
|
|||||||
';
|
';
|
||||||
$count = db::name('user')->alias('a')
|
$count = db::name('user')->alias('a')
|
||||||
->join('fa_user_auth b', 'a.mobile = b.mobile','LEFT')
|
->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)
|
->where($where)
|
||||||
->count();
|
->count();
|
||||||
$user_data = db::name('user')->alias('a')
|
$user_data = db::name('user')->alias('a')
|
||||||
->join('fa_user_auth b', 'a.mobile = b.mobile','LEFT')
|
->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)
|
->where($where)
|
||||||
->field($field)
|
->field($field)
|
||||||
->order('a.id desc');
|
->order('a.id desc');
|
||||||
@@ -599,32 +681,68 @@ class User extends adminApi
|
|||||||
$page_limit = input('page_limit',10);
|
$page_limit = input('page_limit',10);
|
||||||
$where['a.is_tester'] = 1;
|
$where['a.is_tester'] = 1;
|
||||||
if($user_id){
|
if($user_id){
|
||||||
$where['a.user_id'] = $user_id;
|
$where['b.user_code'] = $user_id;
|
||||||
}
|
}
|
||||||
if($gid){
|
if($gid){
|
||||||
$where['a.gid'] = $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')
|
$list = db::name('vs_user_gift_pack')
|
||||||
->alias('a')
|
->alias('a')
|
||||||
->join('user b', 'a.user_id = b.id')
|
->join('user b', 'a.user_id = b.id')
|
||||||
->join('vs_gift c', 'a.gid = c.gid')
|
->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) {
|
foreach ($list as $key => &$value) {
|
||||||
$value['createtime'] = date('Y-m-d H:i:s',$value['createtime']);
|
$value['createtime'] = date('Y-m-d H:i:s',$value['updatetime']);
|
||||||
$value['user_id_nickname'] = $value['user_code'].'——'.$value['nickname'];
|
$value['nickname'] = $value['nickname'].'-'.$value['user_code'];
|
||||||
$value['gift_id_name'] = $value['gid'].'——'.$value['gift_name'];
|
$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_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')
|
||||||
$gift_total = db::name('vs_user_gift_pack')->alias('a')->join('user b', 'a.user_id = b.id')
|
->alias('a')
|
||||||
|
->join('user b', 'a.user_id = b.id')
|
||||||
->join('vs_gift c', 'a.gid = c.gid')
|
->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 = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
|
'gift_kinds' => $gift_kinds,
|
||||||
'gift_count' => $gift_count,
|
'gift_count' => $gift_count,
|
||||||
'gift_total' => $gift_total,
|
'gift_total' => $gift_total,
|
||||||
'lists' => $list
|
'lists' => $list
|
||||||
@@ -735,7 +853,163 @@ class User extends adminApi
|
|||||||
* 用户列表
|
* 用户列表
|
||||||
*/
|
*/
|
||||||
public function get_user_list(){
|
public function get_user_list(){
|
||||||
$user = db::name('user')->field('id,nickname,avatar')->where(['status'=>1,'is_robot'=>0,'delete_time'=>0])->select();
|
$user_code = input('user_code', 0);
|
||||||
|
$where = [];
|
||||||
|
if($user_code){
|
||||||
|
$where['user_code'] = $user_code;
|
||||||
|
}
|
||||||
|
$user = db::name('user')->field('id,nickname,avatar')->where($where)->where(['status'=>1,'is_robot'=>0,'delete_time'=>0])->select();
|
||||||
return V(1,"操作成功", $user);
|
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(){
|
public function del_zone(){
|
||||||
$id = input('id', 0);
|
$id = input('id', 0);
|
||||||
$res = db::name('user_zone')->where(['id'=>$id])->update(['is_delete'=> 2,'delete_time'=> time()]);
|
$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 ? '删除成功' : '删除失败');
|
return V($res ? 1 : 0, $res ? '删除成功' : '删除失败');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,8 +178,46 @@ class UserZone extends adminApi
|
|||||||
public function del_comment(){
|
public function del_comment(){
|
||||||
$id = input('id', 0);
|
$id = input('id', 0);
|
||||||
$res = db::name('user_zone_comment')->where(['id'=>$id])->update(['is_delete'=> 2,'updatetime'=> time()]);
|
$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 ? '删除成功' : '删除失败');
|
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(){
|
public function zone_top_or_show(){
|
||||||
$id = input('id', 0);
|
$id = input('id', 0);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class Version extends adminApi
|
|||||||
$version = input('version', '');
|
$version = input('version', '');
|
||||||
$type = input('type', '');
|
$type = input('type', '');
|
||||||
$downloadurl = input('downloadurl', '');
|
$downloadurl = input('downloadurl', '');
|
||||||
$content = input('content', '');
|
$content = $_POST['content'] ?? '';
|
||||||
$enforce = input('enforce', '');
|
$enforce = input('enforce', '');
|
||||||
$version_code = input('version_code', '');
|
$version_code = input('version_code', '');
|
||||||
$status = input('status', 1);
|
$status = input('status', 1);
|
||||||
@@ -98,27 +98,34 @@ class Version extends adminApi
|
|||||||
* 修改
|
* 修改
|
||||||
*/
|
*/
|
||||||
public function version_edit(){
|
public function version_edit(){
|
||||||
$version = input('version', '');
|
$version = input('version', '');//新版本好
|
||||||
$type = input('type', '');
|
$type = input('type', '');//1-安卓 2-IOS
|
||||||
$downloadurl = input('downloadurl', '');
|
$downloadurl = input('downloadurl', '');//下载地址
|
||||||
$content = input('content', '');
|
$content = $_POST['content'] ?? '';//更新内容
|
||||||
$enforce = input('enforce', '');
|
$enforce = input('enforce', '');//强制更新 1-是 0-否
|
||||||
$version_code = input('version_code', '');
|
$version_code = input('version_code', '');//版本号(目前安卓使用,用来判定是否升级)
|
||||||
$status = input('status', 1);
|
$status = input('status', 1);//0-待发布,1-已发布,2-禁用
|
||||||
|
|
||||||
$id = input('id', '');
|
$id = input('id', '');
|
||||||
$versions = db::name($this->table)->where(['newversion'=>$version,'id'=>['neq',$id]])->find();
|
$now_version = db::name($this->table)->where(['id'=>$id])->find();
|
||||||
if($versions){
|
if(!$now_version){
|
||||||
|
return V(0,"数据不存在");
|
||||||
|
}
|
||||||
|
$res = version_compare($now_version['newversion'], $version);
|
||||||
|
if($res == 0){
|
||||||
return V(0,"版本号已存在");
|
return V(0,"版本号已存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'newversion' => $version,
|
'newversion' => $version,
|
||||||
|
'oldversion' => $now_version['newversion'],
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'downloadurl' => $downloadurl,
|
'downloadurl' => $downloadurl,
|
||||||
'content' => $content,
|
'content' => $content,
|
||||||
'enforce' => $enforce,
|
'enforce' => $enforce,
|
||||||
'code' => $version_code,
|
'code' => $version_code,
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
'createtime' => time()
|
'updatetime' => time()
|
||||||
];
|
];
|
||||||
$res = db::name($this->table)->where(['id'=>$id])->update($data);
|
$res = db::name($this->table)->where(['id'=>$id])->update($data);
|
||||||
if($res){
|
if($res){
|
||||||
|
|||||||
@@ -60,10 +60,10 @@ class Withdrawal extends adminApi
|
|||||||
$where['a.createtime'] = ['>=', strtotime($search_stime)];
|
$where['a.createtime'] = ['>=', strtotime($search_stime)];
|
||||||
}
|
}
|
||||||
if($search_etime !== ''){
|
if($search_etime !== ''){
|
||||||
$where['a.createtime'] = ['<=', strtotime($search_etime.' 23:59:59')];
|
$where['a.createtime'] = ['<=', strtotime($search_etime)];
|
||||||
}
|
}
|
||||||
if(!empty($search_stime) && !empty($search_etime)){
|
if(!empty($search_stime) && !empty($search_etime)){
|
||||||
$where['a.createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime.' 23:59:59')]];
|
$where['a.createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
|
||||||
}
|
}
|
||||||
$count = db::name('vs_user_withdrawal')->alias('a')
|
$count = db::name('vs_user_withdrawal')->alias('a')
|
||||||
->join('user b', 'a.user_id = b.id', 'left')
|
->join('user b', 'a.user_id = b.id', 'left')
|
||||||
@@ -75,6 +75,7 @@ class Withdrawal extends adminApi
|
|||||||
->field('a.*,b.nickname,b.user_code')
|
->field('a.*,b.nickname,b.user_code')
|
||||||
->order('a.createtime desc')
|
->order('a.createtime desc')
|
||||||
->where($where)
|
->where($where)
|
||||||
|
->page($page, $page_limit)
|
||||||
->select();
|
->select();
|
||||||
$data_lists = [];
|
$data_lists = [];
|
||||||
foreach ($lists as $key => $value) {
|
foreach ($lists as $key => $value) {
|
||||||
@@ -103,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');
|
$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');
|
$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;
|
$total_money = $complete_money+$server_money;
|
||||||
|
|
||||||
@@ -255,19 +268,23 @@ class Withdrawal extends adminApi
|
|||||||
//查询该用户云账户提现金额
|
//查询该用户云账户提现金额
|
||||||
$had_money = db::name('vs_user_withdrawal')->where(['user_id'=>$withdraw_info['user_id'],'deal_type'=>2,'status'=>6])->where('pay_time','month')->sum('general_money');
|
$had_money = db::name('vs_user_withdrawal')->where(['user_id'=>$withdraw_info['user_id'],'deal_type'=>2,'status'=>6])->where('pay_time','month')->sum('general_money');
|
||||||
$max_month_money = 98000;
|
$max_month_money = 98000;
|
||||||
if(($had_money+$withdraw_info['general_money']) >= 98000){
|
if(($had_money+$withdraw_info['general_money']) >= $max_month_money){
|
||||||
return ['code' => 0, 'msg' => '单人单月云账户提现金额最大为98000元!', 'data' => null];
|
return ['code' => 0, 'msg' => '单人单月云账户提现金额最大为98000元!', 'data' => null];
|
||||||
}
|
}
|
||||||
//查询该用户信息
|
//查询该用户信息
|
||||||
$user_info = model('api/user')->get_user_info($withdraw_info['user_id']);
|
$user_info = model('api/user')->get_user_info($withdraw_info['user_id'], ['user','user_auth']);
|
||||||
if(empty($user_info)){
|
if(empty($user_info)){
|
||||||
return ['code' => 0, 'msg' => '用户信息错误!', 'data' => null];
|
return ['code' => 0, 'msg' => '用户信息错误!', 'data' => null];
|
||||||
}
|
}
|
||||||
|
|
||||||
$real_name = $user_info['real_name'];
|
$real_name = $user_info['real_name'];
|
||||||
$id_card = $user_info['card_id'];
|
$id_card = $user_info['card_id'];
|
||||||
$order_id = $withdraw_info['order_sn'];
|
$order_id = $withdraw_info['order_sn'];
|
||||||
$order_amount = $withdraw_info['general_money'];
|
$order_amount = $withdraw_info['general_money'];
|
||||||
$phone = $user_info['mobile'];
|
$phone = $user_info['mobile'];
|
||||||
|
if(empty($phone)) {
|
||||||
|
return ['code' => 0, 'msg' => '请先绑定手机号', 'data' => null];
|
||||||
|
}
|
||||||
if (empty($real_name) || empty($id_card)) {
|
if (empty($real_name) || empty($id_card)) {
|
||||||
return ['code' => 0, 'msg' => '请先实名认证', 'data' => null];
|
return ['code' => 0, 'msg' => '请先实名认证', 'data' => null];
|
||||||
}
|
}
|
||||||
@@ -281,7 +298,11 @@ class Withdrawal extends adminApi
|
|||||||
}
|
}
|
||||||
$card_no = $user_info['alipay_account'];
|
$card_no = $user_info['alipay_account'];
|
||||||
$yun_pay = new YunPay($order_id, $real_name, $id_card, $card_no, $order_amount,$phone);
|
$yun_pay = new YunPay($order_id, $real_name, $id_card, $card_no, $order_amount,$phone);
|
||||||
$result = $yun_pay->alipay();
|
$user_data = [
|
||||||
|
'nickname' => $user_info['nickname'],
|
||||||
|
'user_id' => $withdraw_info['user_id'],
|
||||||
|
];
|
||||||
|
$result = $yun_pay->alipay($user_data);
|
||||||
} elseif ($withdraw_info['type'] == 3) {
|
} elseif ($withdraw_info['type'] == 3) {
|
||||||
if(empty($user_info['bank_card_number'])){
|
if(empty($user_info['bank_card_number'])){
|
||||||
return ['code' => 0, 'msg' => '请先绑定银行卡号', 'data' => null];
|
return ['code' => 0, 'msg' => '请先绑定银行卡号', 'data' => null];
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace app\adminapi\model;
|
namespace app\adminapi\model;
|
||||||
|
|
||||||
|
use app\common\library\GiftTableManager;
|
||||||
|
use think\Log;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
use think\Session;
|
use think\Session;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
@@ -19,14 +21,19 @@ class Gift extends Model
|
|||||||
public $giftType = [
|
public $giftType = [
|
||||||
1 => '普通礼物',
|
1 => '普通礼物',
|
||||||
2 => '盲盒礼物',
|
2 => '盲盒礼物',
|
||||||
3 => '礼包礼物'
|
3 => '礼包礼物',
|
||||||
|
6 => '酒吧房礼物'
|
||||||
];
|
];
|
||||||
//送礼流水来源:1聊天送礼物 2房间语聊送礼 3直播送礼 4动态打赏
|
//送礼流水来源:1聊天送礼物 2房间语聊送礼 3直播送礼 4动态打赏
|
||||||
public $GiveGiftFromStr = [
|
public $GiveGiftFromStr = [
|
||||||
1 => '聊天送礼',
|
1 => '聊天送礼',
|
||||||
2 => '房间语聊送礼',
|
2 => '房间语聊送礼',
|
||||||
3 => '直播送礼',
|
3 => '直播送礼',
|
||||||
4 => '动态打赏'
|
4 => '动态打赏',
|
||||||
|
5 => '房心愿礼物',
|
||||||
|
6 => '酒吧房自定义礼物',
|
||||||
|
7 => '酒吧房普通礼物',
|
||||||
|
8 => '酒吧房小黑屋礼物'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function getList($where = [], $page = 1, $limit = 10)
|
public function getList($where = [], $page = 1, $limit = 10)
|
||||||
@@ -73,4 +80,104 @@ class Gift extends Model
|
|||||||
}
|
}
|
||||||
return $res;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class Guild extends Model
|
|||||||
->alias('g')
|
->alias('g')
|
||||||
->join('vs_guild gg','g.guild_id = gg.id')
|
->join('vs_guild gg','g.guild_id = gg.id')
|
||||||
->field('gg.*')
|
->field('gg.*')
|
||||||
->where(['g.user_id' => $user_id])
|
->where(['g.user_id' => $user_id,'g.status' => 1,'g.delete_time' => 0])
|
||||||
->find();
|
->find();
|
||||||
return $guild;
|
return $guild;
|
||||||
}
|
}
|
||||||
@@ -94,32 +94,106 @@ 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=""){
|
public function getTodayMoney($guild_id,$stoday="",$etoday=""){
|
||||||
$where = [];
|
$where = [];
|
||||||
|
$where['guild_id'] = $guild_id;
|
||||||
if(empty($stoday) && empty($etoday)){
|
if(empty($stoday) && empty($etoday)){
|
||||||
$stoday = strtotime(date('Y-m-d 00:00:00'));
|
$where['day'] = date('Y-m-d');
|
||||||
$etoday = strtotime(date('Y-m-d 23:59:59'));
|
|
||||||
$where['createtime'] = ['between', [$stoday, $etoday]];
|
|
||||||
}else{
|
}else{
|
||||||
if(!empty($stoday)){
|
if(!empty($stoday)){
|
||||||
$where['createtime'] = ['>=', strtotime($stoday."00:00:00")];
|
$where['createtime'] = ['>=',strtotime($stoday)];
|
||||||
}
|
}
|
||||||
if(!empty($etoday)){
|
if(!empty($etime)){
|
||||||
$where['createtime'] = ['<=', strtotime($etoday." 23:59:59")];
|
$where['createtime'] = ['<',strtotime($etoday)];
|
||||||
}
|
}
|
||||||
if(!empty($stoday) && !empty($etoday)){
|
if(!empty($stime) && !empty($etime)){
|
||||||
$where['createtime'] = ['between', [strtotime($stoday." 00:00:00"), strtotime($etoday." 23:59:59")]];
|
$where['createtime'] = [['>=',strtotime($stoday)],['<',strtotime($etoday)]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$guild_flow = db::name('vs_guild_flow')
|
||||||
//获取所有工会房间ID
|
|
||||||
$room_ids = db::name('vs_guild_user')->where('guild_id', $guild_id)->field('room_id')->select();
|
|
||||||
$room_ids = array_column($room_ids, 'room_id');
|
|
||||||
$transaction = db::name('vs_give_gift')
|
|
||||||
->whereIn('from_id',$room_ids)
|
|
||||||
->where(['from'=>['in',[2,3,6]]])
|
|
||||||
->where($where)
|
->where($where)
|
||||||
->sum('total_price');
|
->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)->where(['apply_time'=>['>',0],'status'=>1])->field('room_id,apply_time,createtime,quit_time')->select();
|
||||||
|
$transaction = 0;
|
||||||
|
foreach ($guild_user_data as $k => $v) {
|
||||||
|
$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['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_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;
|
return $transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,22 +72,42 @@ class Room extends Model
|
|||||||
*/
|
*/
|
||||||
public function getRoomFlow($room_id,$stime='',$etime=''){
|
public function getRoomFlow($room_id,$stime='',$etime=''){
|
||||||
$give_where = [];
|
$give_where = [];
|
||||||
$give_where['from_id'] = $room_id;
|
$give_where['room_id'] = $room_id;
|
||||||
$give_where['from'] = ["in",[2,3,6]];
|
// $give_where['from'] = ["in",[2,3,6]];
|
||||||
|
// $give_where['from'] = 2;
|
||||||
if(!empty($stime)){
|
if(!empty($stime)){
|
||||||
$give_where['createtime'] = ['>=',strtotime($stime.' 00:00:00')];
|
$give_where['createtime'] = ['>=',strtotime($stime)];
|
||||||
}
|
}
|
||||||
if(!empty($etime)){
|
if(!empty($etime)){
|
||||||
$give_where['createtime'] = ['<=',strtotime($etime.' 23:59:59')];
|
$give_where['createtime'] = ['<',strtotime($etime)];
|
||||||
}
|
}
|
||||||
if(!empty($stime) && !empty($etime)){
|
if(!empty($stime) && !empty($etime)){
|
||||||
$give_where['createtime'] = ['between',[strtotime($stime.' 00:00:00'),strtotime($etime.' 23:59:59')]];
|
// $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)
|
$total_price = db::name('vs_guild_flow')->where($give_where)
|
||||||
->sum('total_price');
|
->sum('flow_price');
|
||||||
return $total_price;
|
return $total_price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 房间绑定盘
|
||||||
|
*/
|
||||||
|
public function bindPan($room_id){
|
||||||
|
db::name('vs_room_pan')->where(['room_id'=>$room_id])->delete();
|
||||||
|
$gift_bag = db::name('vs_gift_bag_detail')->where(['gift_bag_id'=>['in',[10,11,12,13]]])->select();
|
||||||
|
foreach ($gift_bag as $k=>$v){
|
||||||
|
$data = [
|
||||||
|
'room_id'=>$room_id,
|
||||||
|
'gift_bag_id'=>$v['gift_bag_id'],
|
||||||
|
'gift_bag_detail_id'=>$v['id'],
|
||||||
|
'remaining_number'=>$v['quantity'],
|
||||||
|
'createtime'=>time()
|
||||||
|
];
|
||||||
|
db::name('vs_room_pan')->insert($data);
|
||||||
|
}
|
||||||
|
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class Activities extends BaseCom
|
|||||||
$data['name'] = $activities_title??"";
|
$data['name'] = $activities_title??"";
|
||||||
$data['gift_bag'] = [];
|
$data['gift_bag'] = [];
|
||||||
foreach ($gift_bag as $k=>$v){
|
foreach ($gift_bag as $k=>$v){
|
||||||
|
$data['gift_bag'][$k]['gift_bag_id'] = $v['id']??0;
|
||||||
$data['gift_bag'][$k]['name'] = $v['title']??"";
|
$data['gift_bag'][$k]['name'] = $v['title']??"";
|
||||||
$ext = json_decode($v['ext'],true);
|
$ext = json_decode($v['ext'],true);
|
||||||
$data['gift_bag'][$k]['title1'] = $ext['title1']??"";
|
$data['gift_bag'][$k]['title1'] = $ext['title1']??"";
|
||||||
@@ -49,17 +50,19 @@ class Activities extends BaseCom
|
|||||||
$list[$kk]['base_image'] = localpath_to_netpath("static/image/icon/gold.png");
|
$list[$kk]['base_image'] = localpath_to_netpath("static/image/icon/gold.png");
|
||||||
}elseif ($vv['type'] == 2) {
|
}elseif ($vv['type'] == 2) {
|
||||||
$gift = DB::name('vs_gift')->where(['gid'=>$vv['foreign_id']])->find();
|
$gift = DB::name('vs_gift')->where(['gid'=>$vv['foreign_id']])->find();
|
||||||
$list[$kk]['gift_name'] = $gift['gift_name'];
|
if($gift){
|
||||||
$list[$kk]['num'] = $vv['quantity'];
|
$list[$kk]['gift_name'] = $gift['gift_name'];
|
||||||
$list[$kk]['gift_price'] = $gift['gift_price'];
|
$list[$kk]['num'] = $vv['quantity']." 个";
|
||||||
$list[$kk]['type'] =2;
|
$list[$kk]['gift_price'] = $gift['gift_price'];
|
||||||
$list[$kk]['base_image'] = $gift['base_image'];
|
$list[$kk]['type'] =2;
|
||||||
|
$list[$kk]['base_image'] = $gift['base_image'];
|
||||||
|
}
|
||||||
} elseif ($vv['type'] == 3) {
|
} elseif ($vv['type'] == 3) {
|
||||||
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$vv['foreign_id']])->find();
|
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$vv['foreign_id']])->find();
|
||||||
if($decorate_price){
|
if($decorate_price){
|
||||||
$gift = DB::name('vs_decorate')->where(['did'=>$decorate_price['did']])->find();
|
$gift = DB::name('vs_decorate')->where(['did'=>$decorate_price['did']])->find();
|
||||||
$list[$kk]['gift_name'] = $gift['title']??""; //装扮名称
|
$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]['gift_price'] = $decorate_price['price']??0; //价格
|
||||||
$list[$kk]['type'] =3;
|
$list[$kk]['type'] =3;
|
||||||
$list[$kk]['base_image'] = $gift['base_image'] ?? "";
|
$list[$kk]['base_image'] = $gift['base_image'] ?? "";
|
||||||
@@ -85,8 +88,8 @@ class Activities extends BaseCom
|
|||||||
$uid = input('uid',$this->uid);
|
$uid = input('uid',$this->uid);
|
||||||
$permission_status = 1;
|
$permission_status = 1;
|
||||||
//查询是否首充
|
//查询是否首充
|
||||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->count();
|
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->where(['createtime'=>['>=',"1760666400"]])->count();
|
||||||
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->find();
|
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->where(['createtime'=>['>=',"1760666400"]])->find();
|
||||||
$system = request()->header('system');
|
$system = request()->header('system');
|
||||||
$app_version = request()->header('App-Version');
|
$app_version = request()->header('App-Version');
|
||||||
if(!$app_version){
|
if(!$app_version){
|
||||||
@@ -95,7 +98,7 @@ class Activities extends BaseCom
|
|||||||
$api_version = 0;
|
$api_version = 0;
|
||||||
if ($system == 'iOS') {
|
if ($system == 'iOS') {
|
||||||
$api_versions = db::name('version')->where(['type' => 2, 'status' => 1])->order('id', 'desc')->find();
|
$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) {
|
if ($result < 0) {
|
||||||
$api_version = 1;
|
$api_version = 1;
|
||||||
}
|
}
|
||||||
@@ -127,46 +130,51 @@ class Activities extends BaseCom
|
|||||||
//礼包
|
//礼包
|
||||||
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->find();
|
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->find();
|
||||||
$data = [];
|
$data = [];
|
||||||
|
$data['gift_bag_id'] = $gift_bag['id']??0;
|
||||||
$data['name'] = $activities['title']??"";
|
$data['name'] = $activities['title']??"";
|
||||||
$data['bag_name'] = $gift_bag['title']??"";
|
$data['bag_name'] = $gift_bag['title']??"";
|
||||||
$data['effective_time'] = $activities['effective_time']??"";
|
$data['effective_time'] = $activities['effective_time']??"";
|
||||||
//规则
|
//规则
|
||||||
$data['rule'] = get_system_config_value('web_site')."/api/Page/page_show?id=13";
|
$data['rule'] = get_system_config_value('web_site')."/api/Page/page_show?id=13";
|
||||||
$ext = json_decode($gift_bag['ext'],true);
|
$ext = json_decode($gift_bag['ext'],true);
|
||||||
$data['money'] = $ext['money'];
|
$data['money'] = $gift_bag['money'];
|
||||||
$data['counter']['counter'] = $ext['counter'];
|
$data['counter'] = $ext['counter'];
|
||||||
$data['counter']['money'] = $ext['money_str'];
|
$data['money_str'] = $ext['money_str'];
|
||||||
$data['counter']['diamond'] = $ext['diamond'];
|
$data['diamond'] = $ext['diamond'];
|
||||||
|
$data['effective_time'] = $ext['activity_end_time']??"";
|
||||||
|
if(strtotime($ext['activity_end_time']) < time()){
|
||||||
|
return V(0,'活动已结束!',null);
|
||||||
|
}
|
||||||
$detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag['id']])->select();
|
$detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag['id']])->select();
|
||||||
$data['gift_list'] = [];
|
$data['gift_list'] = [];
|
||||||
foreach ($detail as $k=>$v){
|
foreach ($detail as $k=>$v){
|
||||||
if($v['type'] == 1){
|
if($v['type'] == 1){
|
||||||
$list[$k]['name'] = "金币";
|
$list[$k]['gift_name'] = "金币";
|
||||||
$list[$k]['num'] = $v['gold'];
|
$list[$k]['num'] = $v['gold'];
|
||||||
$list[$k]['gold'] = $v['gold'];
|
$list[$k]['gift_price'] = $v['gold'];
|
||||||
$list[$k]['type'] = 1;
|
$list[$k]['type'] = 1;
|
||||||
$list[$k]['icon'] = localpath_to_netpath("static/image/icon/gold.png");
|
$list[$k]['base_image'] = localpath_to_netpath("static/image/icon/gold.png");
|
||||||
}elseif($v['type'] == 2) {
|
}elseif($v['type'] == 2) {
|
||||||
$gift = DB::name('vs_gift')->where(['gid'=>$v['foreign_id']])->find();
|
$gift = DB::name('vs_gift')->where(['gid'=>$v['foreign_id']])->find();
|
||||||
$list[$k]['name'] = $gift['gift_name'];
|
$list[$k]['gift_name'] = $gift['gift_name'];
|
||||||
$list[$k]['num'] = $v['quantity'];
|
$list[$k]['num'] = $v['quantity']." 个";
|
||||||
$list[$k]['gold'] = $gift['gift_price'];
|
$list[$k]['gift_price'] = $gift['gift_price'];
|
||||||
$list[$k]['type'] =2;
|
$list[$k]['type'] =2;
|
||||||
$list[$k]['icon'] = $gift['play_image'];
|
$list[$k]['base_image'] = $gift['base_image'];
|
||||||
} elseif($v['type'] == 3) {
|
} elseif($v['type'] == 3) {
|
||||||
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
|
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
|
||||||
$gift = DB::name('vs_decorate')->where(['did'=>$decorate_price['did']])->find();
|
$gift = DB::name('vs_decorate')->where(['did'=>$decorate_price['did']])->find();
|
||||||
$list[$k]['name'] = $gift['title']; //装扮名称
|
$list[$k]['gift_name'] = $gift['title']; //装扮名称
|
||||||
$list[$k]['num'] = $decorate_price['day']; //天数
|
$list[$k]['num'] = $decorate_price['day']." 天"??0; //天数
|
||||||
$list[$k]['gold'] = $decorate_price['price']; //价格
|
$list[$k]['gift_price'] = $decorate_price['price']; //价格
|
||||||
$list[$k]['type'] =3;
|
$list[$k]['type'] =3;
|
||||||
$list[$k]['icon'] = $gift['base_image'];
|
$list[$k]['base_image'] = $gift['base_image'];
|
||||||
}elseif($v['type'] == 4) {
|
}elseif($v['type'] == 4) {
|
||||||
$list[$k]['name'] = "钻石";
|
$list[$k]['gift_name'] = "钻石";
|
||||||
$list[$k]['num'] = $v['quantity'];
|
$list[$k]['num'] = $v['quantity'];
|
||||||
$list[$k]['gold'] = $v['gold'];
|
$list[$k]['gift_price'] = $v['gold'];
|
||||||
$list[$k]['type'] = 4;
|
$list[$k]['type'] = 4;
|
||||||
$list[$k]['icon'] = localpath_to_netpath("static/image/icon/gold.png");
|
$list[$k]['base_image'] = localpath_to_netpath("static/image/icon/gold.png");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$data['gift_list'] = $list;
|
$data['gift_list'] = $list;
|
||||||
@@ -177,20 +185,183 @@ class Activities extends BaseCom
|
|||||||
{
|
{
|
||||||
$activities_id = 3;//天降好礼
|
$activities_id = 3;//天降好礼
|
||||||
$uid = input('uid',$this->uid);
|
$uid = input('uid',$this->uid);
|
||||||
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->find();
|
//礼包
|
||||||
if($permission){
|
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>3,'status'=>1])->find();
|
||||||
return V(1,'操作成功', ['permission'=>0]);
|
$permission = 0;
|
||||||
}else{
|
if($gift_bag){
|
||||||
return V(1,'操作成功', ['permission'=>1]);
|
$ext = json_decode($gift_bag['ext'],true);
|
||||||
|
if($ext['activity_end_time'] <= time()){
|
||||||
|
$permission = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return V(1,'操作成功', ['permission'=>$permission]);
|
||||||
}
|
}
|
||||||
//天降好礼发放
|
//天降好礼发放
|
||||||
public function drop_gift_send()
|
public function drop_gift_send()
|
||||||
{
|
{
|
||||||
$uid = input('uid',$this->uid);
|
$uid = input('uid',$this->uid);
|
||||||
$reslut = model('Activities')->drop_gift_send($uid);
|
$reslut = model('Activities')->drop_gift_send($uid,16);
|
||||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//新人好礼
|
||||||
|
public function new_charge_gift()
|
||||||
|
{
|
||||||
|
//活动信息
|
||||||
|
$activities_id = 7;
|
||||||
|
$activities_title = DB::name('vs_activities')->where(['id'=>$activities_id,'status'=>1,'delete_time'=>0])->value('title');
|
||||||
|
//礼包
|
||||||
|
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->select();
|
||||||
|
$data = [];
|
||||||
|
$data['name'] = $activities_title??"";
|
||||||
|
$data['gift_bag'] = [];
|
||||||
|
//一键领取
|
||||||
|
$bag_receive_all = DB::name('vs_gift_bag_receive_log')->where(['gift_bag_id'=>17,'user_id'=>$this->uid])->find();
|
||||||
|
foreach ($gift_bag as $k=>$v){
|
||||||
|
$data['gift_bag'][$k]['gift_bag_id'] = $v['id']??0;
|
||||||
|
$data['gift_bag'][$k]['name'] = $v['title']??"";
|
||||||
|
$ext = json_decode($v['ext'],true);
|
||||||
|
$data['gift_bag'][$k]['title1'] = $ext['title1']??"";
|
||||||
|
$data['gift_bag'][$k]['title2'] = $ext['title2']??"";
|
||||||
|
$data['gift_bag'][$k]['money'] = $ext['money'];
|
||||||
|
$data['gift_bag'][$k]['gift_list'] = [];
|
||||||
|
$detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$v['id']])->select();
|
||||||
|
$list = [];
|
||||||
|
foreach ($detail as $kk=>$vv){
|
||||||
|
if($vv['type'] == 1){
|
||||||
|
$list[$kk]['gift_name'] = "金币";
|
||||||
|
$list[$kk]['num'] = $vv['quantity'];
|
||||||
|
$list[$kk]['gift_price'] = $vv['gold'];
|
||||||
|
$list[$kk]['type'] = 1;
|
||||||
|
$list[$kk]['base_image'] = localpath_to_netpath("static/image/icon/gold.png");
|
||||||
|
}elseif ($vv['type'] == 2) {
|
||||||
|
$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]['gift_price'] = $gift['gift_price'];
|
||||||
|
$list[$kk]['type'] =2;
|
||||||
|
$list[$kk]['base_image'] = $gift['base_image'];
|
||||||
|
}
|
||||||
|
} elseif ($vv['type'] == 3) {
|
||||||
|
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$vv['foreign_id']])->find();
|
||||||
|
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]['gift_price'] = $decorate_price['price']??0; //价格
|
||||||
|
$list[$kk]['type'] =3;
|
||||||
|
$list[$kk]['base_image'] = $gift['base_image'] ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}elseif ($vv['type'] == 4) {
|
||||||
|
$list[$kk]['gift_name'] = "钻石";
|
||||||
|
$list[$kk]['num'] = $vv['quantity'];
|
||||||
|
$list[$kk]['gift_price'] = $vv['gold'];
|
||||||
|
$list[$kk]['type'] = 4;
|
||||||
|
$list[$kk]['base_image'] = localpath_to_netpath("static/image/icon/diamond.png");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data['gift_bag'][$k]['gift_list'] = array_values($list);
|
||||||
|
if($bag_receive_all){
|
||||||
|
$data['gift_bag'][$k]['status'] = 0;
|
||||||
|
}else{
|
||||||
|
if($v['id']!=17){
|
||||||
|
$bag_receive_log = DB::name('vs_gift_bag_receive_log')->where(['gift_bag_id'=>$v['id'],'user_id'=>$this->uid])->find();
|
||||||
|
if($bag_receive_log){
|
||||||
|
$data['gift_bag'][$k]['status'] = 0;
|
||||||
|
} else {
|
||||||
|
$data['gift_bag'][$k]['status'] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return V(1,'操作成功', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//新人好礼发放
|
||||||
|
public function new_charge_gift_receive()
|
||||||
|
{
|
||||||
|
$uid = input('uid',$this->uid);
|
||||||
|
$money = input('money',0);
|
||||||
|
$reslut = model('Activities')->new_charge_gift_send($uid,$money);
|
||||||
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 活动权限
|
||||||
|
*/
|
||||||
|
public function activities_permission(){
|
||||||
|
$system = request()->header('system');
|
||||||
|
$app_version = request()->header('App-Version');
|
||||||
|
if(!$app_version){
|
||||||
|
$app_version = input('App-Version');
|
||||||
|
}
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//首充
|
||||||
|
$activities_id = 1;
|
||||||
|
$uid = input('uid',$this->uid);
|
||||||
|
$first_charge_permission = 1;
|
||||||
|
//查询是否首充
|
||||||
|
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->where(['createtime'=>['>=',"1760666400"]])->count();
|
||||||
|
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->where(['createtime'=>['>=',"1760666400"]])->find();
|
||||||
|
if($is_first_charge > 0){
|
||||||
|
$first_charge_permission = 0;
|
||||||
|
}
|
||||||
|
if($permission){
|
||||||
|
$first_charge_permission = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//天降好礼
|
||||||
|
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>3,'status'=>1])->find();
|
||||||
|
$day_drop_permission = 0;
|
||||||
|
if($gift_bag){
|
||||||
|
$ext = json_decode($gift_bag['ext'],true);
|
||||||
|
if(strtotime($ext['activity_end_time']) >= time()){
|
||||||
|
$day_drop_permission = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//新人充值好礼
|
||||||
|
$activities = DB::name('vs_activities')->where(['id'=>7,'status'=>1,'delete_time'=>0])->find();
|
||||||
|
if($activities){
|
||||||
|
$effective_time = $activities['effective_time'];
|
||||||
|
}else{
|
||||||
|
$effective_time = 0;
|
||||||
|
}
|
||||||
|
$bag_data = DB::name('vs_gift_bag')->where(['activities_id'=>7,'status'=>1,'delete_time'=>0])->select();
|
||||||
|
$bag_receive_log = DB::name('vs_gift_bag_receive_log')->where(['gift_bag_id'=>['in',array_column($bag_data,'id')],'user_id'=>$uid])->select();
|
||||||
|
$new_permission = 0;
|
||||||
|
$user_info = DB::name('user')->where(['id'=>$uid])->find();
|
||||||
|
if($user_info['createtime']<"1760666400"){
|
||||||
|
$user_info['createtime'] = 1760666400;
|
||||||
|
}
|
||||||
|
if($user_info['createtime'] + $effective_time >= time()){
|
||||||
|
$new_permission = 1;
|
||||||
|
}
|
||||||
|
$gift_bag_log_ids = array_column($bag_receive_log,'gift_bag_id');
|
||||||
|
if(in_array(17,$gift_bag_log_ids)){
|
||||||
|
$new_permission = 0;
|
||||||
|
}else{
|
||||||
|
$gift_bag_log_ids = array_intersect([14,15,16],$gift_bag_log_ids);
|
||||||
|
if(count($gift_bag_log_ids) == 3){
|
||||||
|
$new_permission = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return V(1,'操作成功',[
|
||||||
|
'first_charge_permission'=>$first_charge_permission,
|
||||||
|
'day_drop_permission'=>$day_drop_permission,
|
||||||
|
'n_people_permission'=>$new_permission
|
||||||
|
],$api_version);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,4 +48,16 @@ class Banner extends controller
|
|||||||
$reslut = model('Banner')->banner_list($show_type);
|
$reslut = model('Banner')->banner_list($show_type);
|
||||||
return V(1,'操作成功', $reslut);
|
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']);
|
||||||
|
}
|
||||||
|
}
|
||||||
150
application/api/controller/BlindBoxTurntable.php
Normal file
150
application/api/controller/BlindBoxTurntable.php
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use app\common\controller\BaseCom;
|
||||||
|
use think\Controller;
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 盲盒转盘
|
||||||
|
* 2025-08-16
|
||||||
|
*/
|
||||||
|
|
||||||
|
class BlindBoxTurntable extends BaseCom
|
||||||
|
{
|
||||||
|
protected function initialize()
|
||||||
|
{
|
||||||
|
//允许跨域
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 获取活动奖池礼物列表
|
||||||
|
*/
|
||||||
|
public function get_gift_list(){
|
||||||
|
$gift_bag_id = input('gift_bag_id',0);
|
||||||
|
$room_id = input('room_id',0);
|
||||||
|
$reslut = model('BlindBoxTurntableGift')->get_gift_list($gift_bag_id,$room_id);
|
||||||
|
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 抽奖
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function draw_gift(){
|
||||||
|
$gift_bag_id = input('gift_bag_id',0);
|
||||||
|
$user_id = $this->uid;
|
||||||
|
$room_id = input('room_id',0);
|
||||||
|
$gift_user_ids = input('gift_user_ids',0);
|
||||||
|
$num = input('num',1);
|
||||||
|
$heart_id = input('heart_id',0);
|
||||||
|
$auction_id = input('auction_id',0);
|
||||||
|
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']);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 礼物发放
|
||||||
|
*/
|
||||||
|
public function gift_send(){
|
||||||
|
// $key_name = "api:blind_box_turntable:gift_send:" . $this->uid;
|
||||||
|
// redis_lock_exit($key_name);
|
||||||
|
$send_id = input('send_id',0);
|
||||||
|
$reslut = model('BlindBoxTurntableGift')->gift_send($send_id);
|
||||||
|
// redis_unlock($key_name);
|
||||||
|
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 获取我的抽奖记录
|
||||||
|
*/
|
||||||
|
public function get_my_record(){
|
||||||
|
$user_id = $this->uid;
|
||||||
|
$gift_bag_id = input('gift_bag_id',0);
|
||||||
|
$page = input('page',1);
|
||||||
|
$page_size = input('page_size',12);
|
||||||
|
$reslut = model('BlindBoxTurntableGift')->get_user_record($gift_bag_id,$user_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']);
|
||||||
|
// }
|
||||||
|
/*
|
||||||
|
* 巡乐会
|
||||||
|
*/
|
||||||
|
public function xlh(){
|
||||||
|
$room_id = input('room_id',0);
|
||||||
|
$reslut = model('BlindBoxTurntableGift')->xlh_gift_list($room_id);
|
||||||
|
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 巡乐会抽奖
|
||||||
|
*/
|
||||||
|
public function xlh_draw_gift(){
|
||||||
|
$user_id = $this->uid;
|
||||||
|
$room_id = input('room_id',0);
|
||||||
|
$num = input('num',1);
|
||||||
|
$reslut = model('BlindBoxTurntableGiftDrawWorldNew')->xlh_draw_gift($user_id,$num,$room_id);
|
||||||
|
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 获取我的巡乐会记录
|
||||||
|
*/
|
||||||
|
public function get_xlh_my_record(){
|
||||||
|
$page = input('page',1);
|
||||||
|
$page_size = input('page_size',12);
|
||||||
|
$user_id = $this->uid;
|
||||||
|
$room_id = input('room_id',0);
|
||||||
|
$reslut = model('BlindBoxTurntableGift')->xlh_get_user_record($user_id,$room_id,$page,$page_size);
|
||||||
|
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 获取全服巡乐会记录(榜单)
|
||||||
|
*/
|
||||||
|
public function get_xlh_all_record(){
|
||||||
|
$page = input('page',1);
|
||||||
|
$page_size = input('page_size',12);
|
||||||
|
$room_id = input('room_id',0);
|
||||||
|
$reslut = model('BlindBoxTurntableGift')->xlh_ranking($room_id,$page,$page_size);
|
||||||
|
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 巡乐会榜单 (以期数显示)
|
||||||
|
*/
|
||||||
|
public function get_xlh_ranking(){
|
||||||
|
$page = input('page',1);
|
||||||
|
$page_size = input('page_size',12);
|
||||||
|
$room_id = input('room_id',0);
|
||||||
|
$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']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,10 +6,12 @@ use think\Controller;
|
|||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Log;
|
use think\Log;
|
||||||
|
|
||||||
class Ceshi extends Controller
|
class Ceshi extends Controllers
|
||||||
{
|
{
|
||||||
//测试 发送各种消息
|
//设置白名单ip访问本类接口
|
||||||
|
protected $allowIp = [
|
||||||
|
'113.201.181.82'
|
||||||
|
];
|
||||||
|
|
||||||
//发送群组系统消息
|
//发送群组系统消息
|
||||||
public function send_group_system_notification()
|
public function send_group_system_notification()
|
||||||
@@ -145,631 +147,6 @@ class Ceshi extends Controller
|
|||||||
return V(1, '成功', $reslut);
|
return V(1, '成功', $reslut);
|
||||||
}
|
}
|
||||||
|
|
||||||
//清空数据 禁用 慎用 !!!!!!
|
|
||||||
//清空数据 禁用 慎用 !!!!!!
|
|
||||||
//清空数据 禁用 慎用 !!!!!!
|
|
||||||
public function clear_data()
|
|
||||||
{
|
|
||||||
$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, '财富等级日志删除失败!');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//数据提交
|
|
||||||
db::commit();
|
|
||||||
return V(1, '成功'.$i.'条数据!', $res);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//测试富文本消息
|
//测试富文本消息
|
||||||
public function test_rich_text(){
|
public function test_rich_text(){
|
||||||
@@ -791,6 +168,27 @@ class Ceshi extends Controller
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//测试异步信息
|
||||||
|
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,23 +5,109 @@ namespace app\api\controller;
|
|||||||
class Cron
|
class Cron
|
||||||
{
|
{
|
||||||
//每秒执行
|
//每秒执行
|
||||||
|
/*
|
||||||
|
*拍卖房结束提醒
|
||||||
|
* Pk房连线中倒计时结束操作PK结束
|
||||||
|
* Pk房PK进行中倒计时结束操作PK结束
|
||||||
|
* Pk房PK结束惩罚倒计时结束断开操作
|
||||||
|
* 房间红包清退
|
||||||
|
* pk发起10秒后无应答拒绝
|
||||||
|
* 提现云账号订单状态查询
|
||||||
|
* 签约房时间结束处理
|
||||||
|
* 签约到期处理
|
||||||
|
*/
|
||||||
public function PerformPerSecond()
|
public function PerformPerSecond()
|
||||||
{
|
{
|
||||||
$cron = new \app\cron\controller\PerformPerSecond();
|
$cron = new \app\cron\controller\PerformPerSecond();
|
||||||
$cron->index();
|
$cron->index();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//每周执行
|
//每周执行
|
||||||
|
/*工会补贴生成开始
|
||||||
|
*房间补贴生成开始
|
||||||
|
*/
|
||||||
public function PerformPerWeek()
|
public function PerformPerWeek()
|
||||||
{
|
{
|
||||||
$cron = new \app\cron\controller\Subsidy();
|
$cron = new \app\cron\controller\Subsidy();
|
||||||
$cron->index();
|
$cron->index();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//经业务调整 暂时不要了
|
||||||
//每10秒执行
|
//每10秒执行
|
||||||
public function TenSeconds()
|
public function TenSeconds()
|
||||||
{
|
{
|
||||||
$cron = new \app\cron\controller\TenSeconds();
|
$cron = new \app\cron\controller\TenSeconds();
|
||||||
$cron->index();
|
$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 = [];
|
$data = [];
|
||||||
$reslut = model('Decorate')->get_decorate_detail($did);
|
$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_id'] = $this->uid;
|
||||||
$data['user_info']['user_coin'] = intval($user_coin);
|
$data['user_info']['user_coin'] = intval($user_coin);
|
||||||
$data['decorate'] = $reslut['data'];
|
$data['decorate'] = $reslut['data'];
|
||||||
@@ -55,12 +55,13 @@ class Decorate extends BaseCom
|
|||||||
$did = input('did', 0);
|
$did = input('did', 0);
|
||||||
$day = input('day', 1);
|
$day = input('day', 1);
|
||||||
$user_id = input('user_id', 0);
|
$user_id = input('user_id', 0);
|
||||||
|
$num = input('num', 1);
|
||||||
$keyname = "api:Decorate:pay_decorate:uid:".$uid;
|
$keyname = "api:Decorate:pay_decorate:uid:".$uid;
|
||||||
redis_lock_exit($keyname);
|
redis_lock_exit($keyname);
|
||||||
if($user_id){//购买装扮 赠送好友
|
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{
|
}else{
|
||||||
$reslut = model('Decorate')->pay_decorate($uid, $did, $day,1);
|
$reslut = model('Decorate')->pay_decorate($uid, $did, $day,1,0,'', $num);
|
||||||
}
|
}
|
||||||
redis_unlock($keyname);
|
redis_unlock($keyname);
|
||||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
65
application/api/controller/Friend.php
Normal file
65
application/api/controller/Friend.php
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use app\common\controller\BaseCom;
|
||||||
|
|
||||||
|
class Friend extends BaseCom
|
||||||
|
{
|
||||||
|
//交友开始
|
||||||
|
public function start_friend(){
|
||||||
|
$key_name = "api:friend:start_friend:" . $this->uid;
|
||||||
|
redis_lock_exits($key_name);
|
||||||
|
$room_id = input('room_id', '');
|
||||||
|
$reslut = model('Friend')->start_friend($this->uid,$room_id);
|
||||||
|
redis_unlocks($key_name);
|
||||||
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//交友延时
|
||||||
|
public function delay(){
|
||||||
|
$friend_id = input('friend_id', '');
|
||||||
|
$room_id = input('room_id', '');
|
||||||
|
$delay_times = input('delay_times', '');//分钟
|
||||||
|
|
||||||
|
$reslut = model('Friend')->delay($this->uid,$room_id,$friend_id,$delay_times);
|
||||||
|
|
||||||
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//交友结束
|
||||||
|
public function end_friend(){
|
||||||
|
|
||||||
|
$friend_id = input('friend_id', '');
|
||||||
|
$room_id = input('room_id', '');
|
||||||
|
|
||||||
|
$result = model('Friend')->end_friend($this->uid,$room_id,$friend_id);
|
||||||
|
|
||||||
|
return V($result['code'], $result['msg'], $result['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//卡关系 创建关系
|
||||||
|
public function create_relation()
|
||||||
|
{
|
||||||
|
$key_name = "api:friend:create_relation:" . $this->uid;
|
||||||
|
redis_lock_exits($key_name);
|
||||||
|
$room_id = input('room_id', '');
|
||||||
|
$friend_id = input('friend_id', '');
|
||||||
|
$user1_id = input('user1_id', '');
|
||||||
|
$user2_id = input('user2_id', '');
|
||||||
|
$relation_id = input('relation_id', '');
|
||||||
|
$result = model('Friend')->createRelation($this->uid,$room_id,$friend_id,$user1_id,$user2_id,$relation_id);
|
||||||
|
redis_unlocks($key_name);
|
||||||
|
return V($result['code'], $result['msg'], $result['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//退出私密小屋
|
||||||
|
public function out_room()
|
||||||
|
{
|
||||||
|
$room_id = input('room_id', '');
|
||||||
|
|
||||||
|
$result = model('Friend')->outRoom($this->uid,$room_id);
|
||||||
|
|
||||||
|
return V($result['code'], $result['msg'], $result['data']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,7 +25,9 @@ class Gift extends BaseCom
|
|||||||
public function get_gift_list()
|
public function get_gift_list()
|
||||||
{
|
{
|
||||||
$label = input('label',0);
|
$label = input('label',0);
|
||||||
$reslut = model('Gift')->get_gift_list($label);
|
$room_id = input('room_id',0);
|
||||||
|
$user_id = $this->uid ?? 0;
|
||||||
|
$reslut = model('Gift')->get_gift_list($label,$room_id,$user_id);
|
||||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,6 @@ class Guild extends BaseCom
|
|||||||
public function guild_list()
|
public function guild_list()
|
||||||
{
|
{
|
||||||
$page = input('page',1);
|
$page = input('page',1);
|
||||||
$page = $page > 0 ? $page : 1;
|
|
||||||
$limit = input('limit',10);
|
$limit = input('limit',10);
|
||||||
$search = input('search_id','');
|
$search = input('search_id','');
|
||||||
$reslut = model('Guild')->get_guild_list($page,$limit,$search,$this->uid);
|
$reslut = model('Guild')->get_guild_list($page,$limit,$search,$this->uid);
|
||||||
@@ -42,7 +41,7 @@ class Guild extends BaseCom
|
|||||||
$guild_id = input('guild_id', 0);
|
$guild_id = input('guild_id', 0);
|
||||||
$key_name = "api:guild:join_guild:".$uid;
|
$key_name = "api:guild:join_guild:".$uid;
|
||||||
redis_lock_exit($key_name);
|
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);
|
redis_unlock($key_name);
|
||||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -64,7 +63,7 @@ class Guild extends BaseCom
|
|||||||
$type = input('type', 1);
|
$type = input('type', 1);
|
||||||
$key_name = "api:guild:operate_guild:".$uid;
|
$key_name = "api:guild:operate_guild:".$uid;
|
||||||
redis_lock_exit($key_name);
|
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);
|
redis_unlock($key_name);
|
||||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -175,9 +174,14 @@ class Guild extends BaseCom
|
|||||||
$uid = $this->uid;
|
$uid = $this->uid;
|
||||||
$reslut = model('Guild')->user_is_join($uid);
|
$reslut = model('Guild')->user_is_join($uid);
|
||||||
if($reslut==0){
|
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]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -188,7 +192,8 @@ class Guild extends BaseCom
|
|||||||
$guild_id = input('guild_id', 0);
|
$guild_id = input('guild_id', 0);
|
||||||
$page = input('page', 1);
|
$page = input('page', 1);
|
||||||
$page_limit = input('page_limit', 20);
|
$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']);
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -197,7 +202,7 @@ class Guild extends BaseCom
|
|||||||
*/
|
*/
|
||||||
public function get_guild_info(){
|
public function get_guild_info(){
|
||||||
$uid = $this->uid;
|
$uid = $this->uid;
|
||||||
$guild_id = input('guild_id', 0);
|
$guild_id = input('guild_id', '');
|
||||||
$reslut = model('Guild')->guild_info($guild_id,$uid);
|
$reslut = model('Guild')->guild_info($guild_id,$uid);
|
||||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -206,7 +211,7 @@ class Guild extends BaseCom
|
|||||||
*/
|
*/
|
||||||
public function set_guild_info(){
|
public function set_guild_info(){
|
||||||
$uid = $this->uid;
|
$uid = $this->uid;
|
||||||
$guild_id = input('guild_id', 0);
|
$guild_id = input('guild_id', '');
|
||||||
//群聊名称
|
//群聊名称
|
||||||
$name = input('name', '');
|
$name = input('name', '');
|
||||||
//群聊公告
|
//群聊公告
|
||||||
@@ -217,5 +222,30 @@ class Guild extends BaseCom
|
|||||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
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,9 +18,9 @@ class Index extends BaseCom
|
|||||||
public function room_list()
|
public function room_list()
|
||||||
{
|
{
|
||||||
$is_top = input('is_top', 0); //1非置顶2置顶
|
$is_top = input('is_top', 0); //1非置顶2置顶
|
||||||
$label_id = input('label_id', 0);
|
$label_id = input('label_id');
|
||||||
$page = input('page', 1);
|
$page = input('page', 1);
|
||||||
$page_limit = input('page_limit', 15);
|
$page_limit = input('page_limit', 20);
|
||||||
|
|
||||||
$reslut = model('Room')->room_list($label_id,$is_top, $page, $page_limit);
|
$reslut = model('Room')->room_list($label_id,$is_top, $page, $page_limit);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data'], $reslut['api_version']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data'], $reslut['api_version']);
|
||||||
@@ -29,9 +29,47 @@ class Index extends BaseCom
|
|||||||
//房间类型列表
|
//房间类型列表
|
||||||
public function room_type_list()
|
public function room_type_list()
|
||||||
{
|
{
|
||||||
$list = db::name('vs_room_type')->where('status', 1)->field('id,type_name as label_name')->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);
|
return V(1, '获取成功', $list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class Invited extends BaseCom
|
|||||||
}
|
}
|
||||||
$reslut['init_code'] = $init_code ? $init_code:'';
|
$reslut['init_code'] = $init_code ? $init_code:'';
|
||||||
$invited_draw = get_system_config_value('invited_draw');
|
$invited_draw = get_system_config_value('invited_draw');
|
||||||
|
$reslut['invited_draw'] = $invited_draw;
|
||||||
//说明
|
//说明
|
||||||
$reslut['explain'] = '绑定成功后,您每次充值金额的'.$invited_draw.'%'.'将以钻石形式赠送给邀请人,满足提现金额邀请人可以直接提现';
|
$reslut['explain'] = '绑定成功后,您每次充值金额的'.$invited_draw.'%'.'将以钻石形式赠送给邀请人,满足提现金额邀请人可以直接提现';
|
||||||
return V(1,'操作成功',$reslut);
|
return V(1,'操作成功',$reslut);
|
||||||
|
|||||||
@@ -36,4 +36,27 @@ class Level extends BaseCom
|
|||||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
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 app\api\controller\Sms;
|
||||||
use http\Client;
|
use http\Client;
|
||||||
use think\Controller;
|
use think\Controller;
|
||||||
|
use think\Db;
|
||||||
use think\Loader;
|
use think\Loader;
|
||||||
use Firebase\JWT\JWT;
|
use Firebase\JWT\JWT;
|
||||||
use think\Log;
|
use think\Log;
|
||||||
@@ -32,11 +33,11 @@ class Login extends Controller
|
|||||||
{
|
{
|
||||||
$user_name = input('user_login', '');
|
$user_name = input('user_login', '');
|
||||||
$password = input('password', '');
|
$password = input('password', '');
|
||||||
$system = input('system','');
|
$system = input('system');
|
||||||
if(empty($system)){
|
if(empty($system)){
|
||||||
$system = request()->header('system');
|
$system = request()->header('system');
|
||||||
}
|
}
|
||||||
$login_device = input('deviceId','');
|
$login_device = input('deviceId');
|
||||||
if(empty($login_device)){
|
if(empty($login_device)){
|
||||||
$login_device = request()->header('deviceId');
|
$login_device = request()->header('deviceId');
|
||||||
}
|
}
|
||||||
@@ -55,24 +56,31 @@ class Login extends Controller
|
|||||||
*/
|
*/
|
||||||
public function phone_code(){
|
public function phone_code(){
|
||||||
|
|
||||||
$system = input('system','');
|
$system = input('system');
|
||||||
if(empty($system)){
|
if(empty($system)){
|
||||||
$system = request()->header('system');
|
$system = request()->header('system');
|
||||||
}
|
}
|
||||||
$login_device = input('deviceId','');
|
$login_device = input('deviceId');
|
||||||
if(empty($login_device)){
|
if(empty($login_device)){
|
||||||
$login_device = request()->header('deviceId');
|
$login_device = request()->header('deviceId');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_name = input('user_login');
|
$user_name = input('user_login');
|
||||||
$sms_code = input('sms_code', ''); //短信验证码
|
|
||||||
// $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);
|
|
||||||
if ($ret['code'] == 0) {
|
|
||||||
return V($ret['code'], $ret['msg'], null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$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);
|
$reslut = model('Login')->phone_verification_code_log($user_name, $system,$login_device);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -87,11 +95,11 @@ class Login extends Controller
|
|||||||
public function one_click_login()
|
public function one_click_login()
|
||||||
{
|
{
|
||||||
$loginToken = input('login_token', '');
|
$loginToken = input('login_token', '');
|
||||||
$system = input('system','');
|
$system = input('system');
|
||||||
if(empty($system)){
|
if(empty($system)){
|
||||||
$system = request()->header('system');
|
$system = request()->header('system');
|
||||||
}
|
}
|
||||||
$login_device = input('deviceId','');
|
$login_device = input('deviceId');
|
||||||
if(empty($login_device)){
|
if(empty($login_device)){
|
||||||
$login_device = request()->header('deviceId');
|
$login_device = request()->header('deviceId');
|
||||||
}
|
}
|
||||||
@@ -106,6 +114,21 @@ class Login extends Controller
|
|||||||
if (!$mobile) {
|
if (!$mobile) {
|
||||||
return V(0, '登录失败, 请更换登录方式!' );
|
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)){
|
if(ctype_digit($mobile)){
|
||||||
$reslut = model('Login')->phone_verification_code_log($mobile,$system,$login_device);
|
$reslut = model('Login')->phone_verification_code_log($mobile,$system,$login_device);
|
||||||
@@ -119,8 +142,8 @@ class Login extends Controller
|
|||||||
public function multi_account_login()
|
public function multi_account_login()
|
||||||
{
|
{
|
||||||
$user_name = input('user_login');
|
$user_name = input('user_login');
|
||||||
$system = input('system','');
|
$system = input('system');
|
||||||
$login_device = input('deviceId','');
|
$login_device = input('deviceId');
|
||||||
if(empty($login_device)){
|
if(empty($login_device)){
|
||||||
$login_device = request()->header('deviceId');
|
$login_device = request()->header('deviceId');
|
||||||
}
|
}
|
||||||
@@ -138,11 +161,11 @@ class Login extends Controller
|
|||||||
public function wechatLogin()
|
public function wechatLogin()
|
||||||
{
|
{
|
||||||
$code = input('code');
|
$code = input('code');
|
||||||
$system = input('system','');
|
$system = input('system');
|
||||||
if(empty($system)){
|
if(empty($system)){
|
||||||
$system = request()->header('system');
|
$system = request()->header('system');
|
||||||
}
|
}
|
||||||
$login_device = input('deviceId','');
|
$login_device = input('deviceId');
|
||||||
if(empty($login_device)){
|
if(empty($login_device)){
|
||||||
$login_device = request()->header('deviceId');
|
$login_device = request()->header('deviceId');
|
||||||
}
|
}
|
||||||
@@ -238,11 +261,11 @@ class Login extends Controller
|
|||||||
public function aliLogin()
|
public function aliLogin()
|
||||||
{
|
{
|
||||||
$authCode = input('auth_code');
|
$authCode = input('auth_code');
|
||||||
$system = input('system','');
|
$system = input('system');
|
||||||
if(empty($system)){
|
if(empty($system)){
|
||||||
$system = request()->header('system');
|
$system = request()->header('system');
|
||||||
}
|
}
|
||||||
$login_device = input('deviceId','');
|
$login_device = input('deviceId');
|
||||||
if(empty($login_device)){
|
if(empty($login_device)){
|
||||||
$login_device = request()->header('deviceId');
|
$login_device = request()->header('deviceId');
|
||||||
}
|
}
|
||||||
@@ -290,11 +313,11 @@ class Login extends Controller
|
|||||||
*/
|
*/
|
||||||
public function iosLogin()
|
public function iosLogin()
|
||||||
{
|
{
|
||||||
$system = input('system','');
|
$system = input('system');
|
||||||
if(empty($system)){
|
if(empty($system)){
|
||||||
$system = request()->header('system');
|
$system = request()->header('system');
|
||||||
}
|
}
|
||||||
$login_device = input('deviceId','');
|
$login_device = input('deviceId');
|
||||||
if(empty($login_device)){
|
if(empty($login_device)){
|
||||||
$login_device = request()->header('deviceId');
|
$login_device = request()->header('deviceId');
|
||||||
}
|
}
|
||||||
@@ -357,8 +380,32 @@ class Login extends Controller
|
|||||||
//注销
|
//注销
|
||||||
public function cancel()
|
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');
|
$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']);
|
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', '');
|
$id = input('id', '');
|
||||||
$reslut = model('Page')->get_page($id);
|
$reslut = model('Page')->get_page($id);
|
||||||
$html = $reslut['content'] ? $reslut['content'] : '';
|
if($reslut){
|
||||||
|
$html = $reslut['content'] ??'';
|
||||||
|
}else{
|
||||||
|
$html = '';
|
||||||
|
}
|
||||||
|
|
||||||
//解析html
|
//解析html
|
||||||
$html = htmlspecialchars_decode($html);
|
$html = htmlspecialchars_decode($html);
|
||||||
return $html;
|
return $html;
|
||||||
|
|||||||
@@ -22,31 +22,58 @@ class Payment extends Controller
|
|||||||
* APP支付
|
* APP支付
|
||||||
*/
|
*/
|
||||||
public function app_pay() {
|
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);
|
$user_id = input('user_id', 0);
|
||||||
$money = input('money', 0);
|
$money = input('money', 0);
|
||||||
$coin = input('coin', 0);
|
$coin = input('coin', 0);
|
||||||
if(!$coin){
|
$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 && $nobility_id == 0){
|
||||||
$coin = $money * get_system_config_value('rmb_coin_ratio');
|
$coin = $money * get_system_config_value('rmb_coin_ratio');
|
||||||
}
|
}
|
||||||
if (!$user_id) {
|
if (!$user_id) {
|
||||||
return V(0, '请选择充值用户', null);
|
return V(0, '请选择充值用户', null);
|
||||||
}
|
}
|
||||||
|
//获取用户的手机号
|
||||||
|
$user_phone = db::name('user')->where(["id" => $user_id])->value('mobile');
|
||||||
|
if(!$user_phone){
|
||||||
|
return V(0, '请先绑定手机号!', null);
|
||||||
|
}
|
||||||
|
//获取用户的实名信息
|
||||||
|
$real_name = db::name('user_auth')->where(["mobile" => $user_phone,'is_real' => 1])->find();
|
||||||
|
if(!$real_name){
|
||||||
|
return V(0, '请先实名认证', null);
|
||||||
|
}
|
||||||
|
//获取用户的年龄
|
||||||
|
if(!getAgeId($real_name['card_id'])){
|
||||||
|
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);
|
return V(0, '请选择正确的充值金额', null);
|
||||||
}
|
}
|
||||||
$user_code = db::name('user')->where(["id" => $user_id])->value('user_code');
|
$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();
|
$order_number = $this->createOrderSn();
|
||||||
$data['order_sn'] = $order_number;
|
$data['order_sn'] = $order_number;
|
||||||
$data['money'] = $money;
|
$data['money'] = $money;
|
||||||
$data['coin'] = $coin;
|
|
||||||
$data['user_id'] = $user_id;
|
$data['user_id'] = $user_id;
|
||||||
$data['pay_type'] = $type;
|
$data['pay_type'] = $type;
|
||||||
|
$data['coin'] = $coin;
|
||||||
$data['createtime'] = time();
|
$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);
|
$re = db::name('vs_user_recharge')->insert($data);
|
||||||
if (!$re) {
|
if (!$re) {
|
||||||
@@ -57,7 +84,7 @@ class Payment extends Controller
|
|||||||
//引用支付宝sdk
|
//引用支付宝sdk
|
||||||
Loader::import('AliPayV2.AliPay', EXTEND_PATH, '.php');
|
Loader::import('AliPayV2.AliPay', EXTEND_PATH, '.php');
|
||||||
$ali = new \AliPay();
|
$ali = new \AliPay();
|
||||||
$result['ali'] = $ali->aliAppPays($order_number, $money, $title);
|
$result['ali'] = $ali->aliAppPays($order_number, $money, $title, $user_id);
|
||||||
}elseif($type == 1){
|
}elseif($type == 1){
|
||||||
//引用微信sdk
|
//引用微信sdk
|
||||||
Loader::import('WxPay.WxPay', EXTEND_PATH, '.php');
|
Loader::import('WxPay.WxPay', EXTEND_PATH, '.php');
|
||||||
@@ -68,6 +95,13 @@ class Payment extends Controller
|
|||||||
Loader::import('TongLian.TongLian', EXTEND_PATH, '.php');
|
Loader::import('TongLian.TongLian', EXTEND_PATH, '.php');
|
||||||
$tonglian = new \TongLian();
|
$tonglian = new \TongLian();
|
||||||
$result['tl'] = $tonglian->TongLianPay($data, $type);
|
$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);
|
return V(1, 'app支付', $result);
|
||||||
@@ -91,6 +125,7 @@ class Payment extends Controller
|
|||||||
$where['order_sn']=$out_trade_no;
|
$where['order_sn']=$out_trade_no;
|
||||||
$where['order_type']=1;
|
$where['order_type']=1;
|
||||||
$where['pay_type']=2;
|
$where['pay_type']=2;
|
||||||
|
$where['pay_status']=1;
|
||||||
|
|
||||||
$data=[
|
$data=[
|
||||||
'trade_no'=>$trade_no
|
'trade_no'=>$trade_no
|
||||||
@@ -135,6 +170,7 @@ class Payment extends Controller
|
|||||||
$where['order_sn']=$out_trade_no;
|
$where['order_sn']=$out_trade_no;
|
||||||
$where['order_type']=1;//1 充值
|
$where['order_type']=1;//1 充值
|
||||||
$where['pay_type']=1;//1微信2支付宝 3通联支付宝 4通联微信
|
$where['pay_type']=1;//1微信2支付宝 3通联支付宝 4通联微信
|
||||||
|
$where['pay_status']=1;
|
||||||
|
|
||||||
$data=[
|
$data=[
|
||||||
'trade_no'=>$transaction_id
|
'trade_no'=>$transaction_id
|
||||||
@@ -190,6 +226,7 @@ class Payment extends Controller
|
|||||||
$where['order_sn']=$out_trade_no;
|
$where['order_sn']=$out_trade_no;
|
||||||
$where['order_type']=1;//1 充值
|
$where['order_type']=1;//1 充值
|
||||||
$where['pay_type']=$pay_type;//1微信2支付宝 3通联支付宝 4通联微信
|
$where['pay_type']=$pay_type;//1微信2支付宝 3通联支付宝 4通联微信
|
||||||
|
$where['pay_status']=1;
|
||||||
|
|
||||||
$data=[
|
$data=[
|
||||||
'trade_no'=>$trade_no
|
'trade_no'=>$trade_no
|
||||||
@@ -211,21 +248,26 @@ class Payment extends Controller
|
|||||||
* 云账户回调(提现)
|
* 云账户回调(提现)
|
||||||
*/
|
*/
|
||||||
public function yun_callback(){
|
public function yun_callback(){
|
||||||
$data = input("data", "");
|
// $data = input("data", "");
|
||||||
$mess = input("mess", "");
|
// $mess = input("mess", "");
|
||||||
$timestamp = input("timestamp", "");
|
// $timestamp = input("timestamp", "");
|
||||||
$sign = input("sign", "");
|
// $sign = input("sign", "");
|
||||||
Log::record("云账户回调信息".json_encode($_POST),"info");
|
$data = $_POST['data']??"";
|
||||||
|
$mess = $_POST['mess']??"";
|
||||||
|
$timestamp = $_POST['timestamp']?? "";
|
||||||
|
$sign = $_POST['sign']??"";
|
||||||
|
|
||||||
|
write_log_redis("yunzhanghu_huidiao_原始数据",$_POST);
|
||||||
$yun_pay = new YunPay();
|
$yun_pay = new YunPay();
|
||||||
$result = $yun_pay->yun_callback($data,$mess,$timestamp,$sign);
|
$result = $yun_pay->yun_callback($data,$mess,$timestamp,$sign);
|
||||||
if($result['code']==1){
|
if($result['code']==1){
|
||||||
$data = $result['data']['data'];
|
$data = $result['data'];
|
||||||
if($data){
|
if($data){
|
||||||
$status = $data['status'];
|
|
||||||
if(!isset($data['status'])){
|
if(!isset($data['status'])){
|
||||||
echo 'fail';
|
echo 'fail';
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
$status = $data['status'];
|
||||||
switch ($status){
|
switch ($status){
|
||||||
case "1":
|
case "1":
|
||||||
// 支付成功(对于支付宝和微信支付是最终状态,对于银行卡大部分情况是终态,小概率会出现"退汇现象",状态由"成功"变为"退汇")
|
// 支付成功(对于支付宝和微信支付是最终状态,对于银行卡大部分情况是终态,小概率会出现"退汇现象",状态由"成功"变为"退汇")
|
||||||
@@ -300,4 +342,92 @@ class Payment extends Controller
|
|||||||
echo "fail";
|
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']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//公会榜
|
//公会榜【废弃】
|
||||||
public function guild_ranking()
|
public function guild_ranking()
|
||||||
{
|
{
|
||||||
$reslut = $this->model->guild_ranking();
|
$reslut = $this->model->guild_ranking();
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//真爱榜
|
//真爱榜【心动榜】
|
||||||
public function love_ranking()
|
public function love_ranking()
|
||||||
{
|
{
|
||||||
$reslut = $this->model->love_ranking();
|
$reslut = $this->model->love_rankings();
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
127
application/api/controller/Redpacket.php
Normal file
127
application/api/controller/Redpacket.php
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use app\common\controller\BaseCom;
|
||||||
|
use app\common\service\RedpacketService;
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 红包接口
|
||||||
|
*/
|
||||||
|
class Redpacket extends BaseCom
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发红包
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
|
||||||
|
$data['user_id'] = $this->uid;
|
||||||
|
|
||||||
|
$service = new RedpacketService();
|
||||||
|
$reslut = $service->create($data);
|
||||||
|
|
||||||
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抢红包
|
||||||
|
*/
|
||||||
|
public function grab()
|
||||||
|
{
|
||||||
|
$redpacketId = input('redpacket_id', 0);
|
||||||
|
|
||||||
|
if (empty($redpacketId)) {
|
||||||
|
return V(0, '红包ID不能为空');
|
||||||
|
}
|
||||||
|
|
||||||
|
$service = new RedpacketService();
|
||||||
|
// 在抢红包前确保状态正确
|
||||||
|
$service->checkAndUpdateRedpacketStatus($redpacketId);
|
||||||
|
$reslut = $service->grabWithResult($redpacketId, $this->uid);
|
||||||
|
|
||||||
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取抢红包结果
|
||||||
|
*/
|
||||||
|
public function grabResult()
|
||||||
|
{
|
||||||
|
$redpacketId = $this->request->get('redpacket_id');
|
||||||
|
|
||||||
|
if (empty($redpacketId)) {
|
||||||
|
return V(0, '红包ID不能为空');
|
||||||
|
}
|
||||||
|
|
||||||
|
$service = new RedpacketService();
|
||||||
|
$result = $service->getGrabResult($redpacketId, $this->uid);
|
||||||
|
|
||||||
|
if (!$result) {
|
||||||
|
return V(0, '红包不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
return V(1, '获取成功', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 红包详情
|
||||||
|
*/
|
||||||
|
public function detail()
|
||||||
|
{
|
||||||
|
$redpacketId = input('redpacket_id', 0);
|
||||||
|
|
||||||
|
if (empty($redpacketId)) {
|
||||||
|
return V(0, '红包ID不能为空');
|
||||||
|
}
|
||||||
|
|
||||||
|
$service = new RedpacketService();
|
||||||
|
// 在获取详情前确保状态正确
|
||||||
|
$service->checkAndUpdateRedpacketStatus($redpacketId);
|
||||||
|
$detail = $service->getDetail($redpacketId, $this->uid);
|
||||||
|
|
||||||
|
if (!$detail) {
|
||||||
|
return V(0, '红包不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
return V(1, '获取成功', $detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取倒计时选项
|
||||||
|
*/
|
||||||
|
public function countdownOptions()
|
||||||
|
{
|
||||||
|
$options = \app\common\model\Redpacket::$countdownOptions;
|
||||||
|
$this->success('获取成功', $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取房间内红包列表
|
||||||
|
public function roomRedPackets()
|
||||||
|
{
|
||||||
|
$roomId = $this->request->get('room_id');
|
||||||
|
$result = Db::name('redpacket')->where(['room_id' => $roomId, 'status' => ['<=',1]])->select();
|
||||||
|
if($result){
|
||||||
|
foreach ($result as &$item) {
|
||||||
|
$item['redpacket_id'] = $item['id'];
|
||||||
|
$item['redpacket_time'] = get_system_config_value('red_packet_time');//展示时间
|
||||||
|
$item['nickname'] = Db::name('user')->where('id', $item['user_id'])->value('nickname');
|
||||||
|
$item['avatar'] = Db::name('user')->where('id', $item['user_id'])->value('avatar');
|
||||||
|
$is_qiang = Db::name('redpacket_record')->where(['redpacket_id' => $item['id'], 'user_id' => $this->uid])->find();
|
||||||
|
$item['is_qiang'] = $is_qiang ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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(){
|
public function report(){
|
||||||
// $user_id = input('user_id', '');//举报者
|
// $user_id = input('user_id', '');//举报者
|
||||||
$type_id = input('type_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', '');//举报内容
|
$content = input('content', '');//举报内容
|
||||||
$image = input('image', '');//举报图片,多个用英文逗号隔开
|
$image = input('image', '');//举报图片,多个用英文逗号隔开
|
||||||
$from_id = input('from_id', '');//举报来源id
|
$from_id = input('from_id', '');//举报来源id
|
||||||
if($type_id == '' || $report_type == '' || $from_id == ''){
|
if($type_id == '' || $report_type == '' || $from_id == ''){
|
||||||
return V(0,"参数错误",null);
|
return V(0,"参数错误",null);
|
||||||
}
|
}
|
||||||
|
if($content == '' && $image == ''){
|
||||||
|
return V(0,"请填写举报内容或上传证据图片",null);
|
||||||
|
}
|
||||||
$data = [
|
$data = [
|
||||||
'user_id' => $this->uid,
|
'user_id' => $this->uid,
|
||||||
'type_id' => $type_id,
|
'type_id' => $type_id,
|
||||||
@@ -42,5 +44,20 @@ class Report extends BaseCom
|
|||||||
$res = db::name('vs_user_inform')->insert($data);
|
$res = db::name('vs_user_inform')->insert($data);
|
||||||
return V($res ? 1 : 0, $res ? "成功" : "失败", null);
|
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
|
class Room extends BaseCom
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
//创建房间
|
//创建房间
|
||||||
public function create_room()
|
public function create_room()
|
||||||
{
|
{
|
||||||
$room_name = input('room_name', '');
|
$room_name = input('room_name', '');
|
||||||
$room_cover = input('room_cover', '');
|
$room_cover = input('room_cover', '');
|
||||||
$room_intro = input('room_intro', '');
|
$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;
|
$key_name = "api:room:user_create_room:" . $this->uid;
|
||||||
redis_lock_exits($key_name);
|
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);
|
redis_unlock($key_name);
|
||||||
|
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
@@ -35,15 +45,6 @@ class Room extends BaseCom
|
|||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
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()
|
public function room_random_name()
|
||||||
@@ -55,7 +56,7 @@ class Room extends BaseCom
|
|||||||
public function user_room_history_list()
|
public function user_room_history_list()
|
||||||
{
|
{
|
||||||
$page = input('page', 1);
|
$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);
|
$reslut = model('UserData')->user_room_history_list($this->uid, $page, $page_limit);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -112,10 +113,23 @@ class Room extends BaseCom
|
|||||||
$end_time = input('end_time', '');
|
$end_time = input('end_time', '');
|
||||||
$page = input('page', 1);
|
$page = input('page', 1);
|
||||||
$page_limit = input('page_limit', 15);
|
$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']);
|
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);
|
$room_id = input('room_id', 0);
|
||||||
$password = input('password', '');
|
$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);
|
$reslut = model('Room')->join_room($this->uid, $room_id, $password);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -131,6 +168,9 @@ class Room extends BaseCom
|
|||||||
public function quit_room()
|
public function quit_room()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
|
if(!$room_id){
|
||||||
|
return V(0, '房间不存在');
|
||||||
|
}
|
||||||
$user_id = input('user_id', 0);
|
$user_id = input('user_id', 0);
|
||||||
$reslut = model('Room')->quit_room($this->uid, $room_id,$user_id);
|
$reslut = model('Room')->quit_room($this->uid, $room_id,$user_id);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
@@ -146,17 +186,38 @@ class Room extends BaseCom
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//直播间送礼
|
//直播间送礼【1.6废弃】
|
||||||
|
//
|
||||||
public function room_give_gift()
|
public function room_give_gift()
|
||||||
{
|
{
|
||||||
|
$key_name = "api:room:gift:" . $this->uid;
|
||||||
|
redis_lock_exit($key_name);
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
$gift_id = input('gift_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,逗号隔开的字符串
|
$to_uid = input('to_uid', 0);//收礼人ID,逗号隔开的字符串
|
||||||
$type = input('type', 1);//1金币购买 2送背包礼物
|
$type = input('type', 1);//1金币购买 2送背包礼物
|
||||||
$pit_number = input('pit_number', 0);
|
$pit_number = input('pit_number', 0);
|
||||||
|
$heart_id = input('heart_id', 0);
|
||||||
|
|
||||||
$reslut = model('Room')->room_gift($this->uid, $to_uid, $gift_id, $gift_num, $type, $room_id, $pit_number);
|
$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']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//房间送礼 背包一键全清
|
||||||
|
public function room_gift_all_clear()
|
||||||
|
{
|
||||||
|
$room_id = input('room_id', 0);
|
||||||
|
$to_uid = input('to_uid', 0);//收礼人ID
|
||||||
|
$heart_id = input('heart_id', 0);//交友
|
||||||
|
$auction_id = input('auction_id');//竞拍
|
||||||
|
$reslut = model('Room')->room_gift_all_clear($this->uid, $room_id, $to_uid,$heart_id,$auction_id);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,8 +237,11 @@ class Room extends BaseCom
|
|||||||
public function room_online_list()
|
public function room_online_list()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
|
if(!$room_id){
|
||||||
|
return V(0, '房间不存在');
|
||||||
|
}
|
||||||
$page = input('page', 1);
|
$page = input('page', 1);
|
||||||
$limit = input('limit', 50);
|
$limit = input('limit', 15);
|
||||||
$reslut = model('Room')->room_online_list($room_id, $page, $limit);
|
$reslut = model('Room')->room_online_list($room_id, $page, $limit);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -186,6 +250,9 @@ class Room extends BaseCom
|
|||||||
public function room_user_home()
|
public function room_user_home()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
|
if(!$room_id){
|
||||||
|
return V(0, '房间不存在');
|
||||||
|
}
|
||||||
$user_id = input('user_id', 0);
|
$user_id = input('user_id', 0);
|
||||||
$reslut = model('Room')->room_user_home($this->uid,$room_id, $user_id);
|
$reslut = model('Room')->room_user_home($this->uid,$room_id, $user_id);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
@@ -260,7 +327,7 @@ class Room extends BaseCom
|
|||||||
public function change_room_type()
|
public function change_room_type()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
$type = input('type', 1);//1-点唱,2-拍卖,3-男神,4-女神
|
$type = input('type', 1);//1-交友,2-拍卖,7-互娱,8-交友(不要了),9-点唱,10-签约,11-酒吧房
|
||||||
$reslut = model('Room')->change_room_type($this->uid, $room_id, $type);
|
$reslut = model('Room')->change_room_type($this->uid, $room_id, $type);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -286,6 +353,9 @@ class Room extends BaseCom
|
|||||||
public function room_info()
|
public function room_info()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
|
if(!$room_id){
|
||||||
|
return V(0, '房间不存在');
|
||||||
|
}
|
||||||
$reslut = model('Room')->room_info($this->uid, $room_id);
|
$reslut = model('Room')->room_info($this->uid, $room_id);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -300,16 +370,6 @@ class Room extends BaseCom
|
|||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
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()
|
public function set_lock_pit()
|
||||||
{
|
{
|
||||||
@@ -395,4 +455,36 @@ class Room extends BaseCom
|
|||||||
$reslut = model('Room')->room_online_number($room_id);
|
$reslut = model('Room')->room_online_number($room_id);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//房间用户当前魅力值列表
|
||||||
|
public function room_user_charm_list()
|
||||||
|
{
|
||||||
|
$room_id = input('room_id', 0);
|
||||||
|
$user_id = input('user_id', '');
|
||||||
|
$reslut = model('Room')->room_user_charm_list($room_id, $user_id);
|
||||||
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//用户重连
|
||||||
|
//用户在房间内切后台保留机制
|
||||||
|
|
||||||
|
//给用户发送房间内消息
|
||||||
|
public function send_room_message()
|
||||||
|
{
|
||||||
|
$user_id = input('user_id', '');
|
||||||
|
$room_id = input('room_id', 0);
|
||||||
|
$reslut = model('Room')->send_room_message($this->uid, $user_id,$room_id);
|
||||||
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//师徒任务跳转房间
|
||||||
|
public function task_jump_room()
|
||||||
|
{
|
||||||
|
$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;
|
namespace app\api\controller;
|
||||||
|
|
||||||
use app\common\controller\BaseCom;
|
use app\common\controller\BaseCom;
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
class RoomAuction extends BaseCom
|
class RoomAuction extends BaseCom
|
||||||
{
|
{
|
||||||
@@ -18,6 +19,10 @@ class RoomAuction extends BaseCom
|
|||||||
public function room_auction_time()
|
public function room_auction_time()
|
||||||
{
|
{
|
||||||
$gift_id = input('gift_id');
|
$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);
|
$reslut = model('RoomAuction')->room_auction_time($gift_id);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -29,6 +34,15 @@ class RoomAuction extends BaseCom
|
|||||||
$room_id = input('room_id');
|
$room_id = input('room_id');
|
||||||
$user_id = input('user_id');
|
$user_id = input('user_id');
|
||||||
$gift_id = input('gift_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','');
|
$relation_id = input('relation_id','');
|
||||||
$auction_type = input('auction_type',1);//1真爱拍 2 亲密拍
|
$auction_type = input('auction_type',1);//1真爱拍 2 亲密拍
|
||||||
$time_day = input('time_day', 0);//小时
|
$time_day = input('time_day', 0);//小时
|
||||||
@@ -54,8 +68,12 @@ class RoomAuction extends BaseCom
|
|||||||
$gift_id = input('gift_id');
|
$gift_id = input('gift_id');
|
||||||
$num = input('num');
|
$num = input('num');
|
||||||
$type = input('type',1);//1金币购买 2送背包礼物
|
$type = input('type',1);//1金币购买 2送背包礼物
|
||||||
|
$gift_bag_id = input('gift_bag_id',0);
|
||||||
$reslut = model('RoomAuction')->room_auction_join($auction_id,$user_id,$gift_id,$num,$type);
|
$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']);
|
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']);
|
||||||
|
}
|
||||||
|
}
|
||||||
34
application/api/controller/RoomHourRanking.php
Normal file
34
application/api/controller/RoomHourRanking.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use app\common\controller\BaseCom;
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
|
class RoomHourRanking extends BaseCom
|
||||||
|
{
|
||||||
|
//房间小时榜是否开启
|
||||||
|
public function room_hour_ranking_is_open()
|
||||||
|
{
|
||||||
|
$open_time = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('open_time');
|
||||||
|
return V(1, '获取成功', ['open_time' => $open_time]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//房间小时榜玩法
|
||||||
|
public function room_hour_ranking_play()
|
||||||
|
{
|
||||||
|
$introd = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('introd');
|
||||||
|
return V(1, '获取成功', ['introd' => $introd]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//房间小时榜
|
||||||
|
public function room_hour_ranking()
|
||||||
|
{
|
||||||
|
$page = input('page', 1);
|
||||||
|
$page_limit = input('page_limit', 20);
|
||||||
|
|
||||||
|
$reslut = model('RoomHourRanking')->room_hour_ranking($page, $page_limit);
|
||||||
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,39 +7,46 @@ use think\Db;
|
|||||||
|
|
||||||
class RoomPit extends BaseCom
|
class RoomPit extends BaseCom
|
||||||
{
|
{
|
||||||
|
|
||||||
//申请上麦
|
//申请上麦
|
||||||
public function apply_pit()
|
public function apply_pit()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
$pit_number = input('pit_number', 0);
|
|
||||||
if($room_id == 0){
|
if($room_id == 0){
|
||||||
return V(0, '房间ID不能为空', null);
|
return V(0, '房间ID不能为空', null);
|
||||||
}
|
}
|
||||||
$res = model('Room')->get_room_label($room_id);
|
$pit_number = input('pit_number', 0);
|
||||||
if($res['code'] != 1){
|
|
||||||
return V(0, '房间不存在', null);
|
|
||||||
}
|
|
||||||
//查询房间主持麦有人吗
|
|
||||||
$room_host_info = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => 9])->value('user_id');
|
|
||||||
//房主,管理,主持不受此限制
|
|
||||||
$room_owner = db::name('vs_room')->where(['id' => $room_id, 'user_id' => $this->uid])->find();
|
|
||||||
//管理
|
|
||||||
$room_manager = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $this->uid,'type' => 2,'delete_time' => null])->find();
|
|
||||||
//主持
|
|
||||||
$room_host = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $this->uid,'type' => 1,'delete_time' => null])->find();
|
|
||||||
if($room_host_info == 0 && !$room_owner && !$room_manager && !$room_host){
|
|
||||||
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 == 2){
|
$key_name = "api:room:apply_pit:" . $this->uid;
|
||||||
$reslut = model('RoomPit')->apply_pit($this->uid, $room_id,$pit_number);
|
redis_lock_exits($key_name);
|
||||||
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4)){
|
|
||||||
$reslut = model('RoomSong')->apply_kpit($this->uid, $room_id,$pit_number);
|
$room_type = model('Room')->get_room_type($room_id);
|
||||||
}else{
|
if($room_type == 0){
|
||||||
return V(0, '房间不存在', null);
|
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',
|
//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);
|
model('Room')->room_operation_record($this->uid,$room_id,7,0,$pit_number);
|
||||||
|
|
||||||
@@ -50,6 +57,9 @@ class RoomPit extends BaseCom
|
|||||||
public function apply_pit_list()
|
public function apply_pit_list()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$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);
|
$reslut = model('RoomPit')->apply_pit_list($this->uid, $room_id);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -58,7 +68,13 @@ class RoomPit extends BaseCom
|
|||||||
public function help_apply_pit()
|
public function help_apply_pit()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
|
if($room_id == 0){
|
||||||
|
return V(0, '房间ID不能为空', null);
|
||||||
|
}
|
||||||
$user_id = input('user_id', 0);
|
$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);
|
$reslut = model('RoomPit')->help_apply_pit($this->uid, $room_id, $user_id);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -67,7 +83,13 @@ class RoomPit extends BaseCom
|
|||||||
public function agree_pit()
|
public function agree_pit()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
|
if($room_id == 0){
|
||||||
|
return V(0, '房间ID不能为空', null);
|
||||||
|
}
|
||||||
$user_id = input('user_id', 0);//逗号分割
|
$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);
|
$reslut = model('RoomPit')->agree_pit($this->uid, $room_id, $user_id);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -76,6 +98,9 @@ class RoomPit extends BaseCom
|
|||||||
public function refuse_pit()
|
public function refuse_pit()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
|
if($room_id == 0){
|
||||||
|
return V(0, '房间ID不能为空', null);
|
||||||
|
}
|
||||||
$user_id = input('user_id', 0);//逗号分割
|
$user_id = input('user_id', 0);//逗号分割
|
||||||
$reslut = model('RoomPit')->clear_apply_pit_list($this->uid, $room_id, $user_id);
|
$reslut = model('RoomPit')->clear_apply_pit_list($this->uid, $room_id, $user_id);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
@@ -85,6 +110,9 @@ class RoomPit extends BaseCom
|
|||||||
public function clear_apply_pit_list()
|
public function clear_apply_pit_list()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$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);
|
$reslut = model('RoomPit')->clear_apply_pit_list($this->uid, $room_id);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -93,8 +121,18 @@ class RoomPit extends BaseCom
|
|||||||
public function set_room_pit_apply_help_gift()
|
public function set_room_pit_apply_help_gift()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
|
if($room_id == 0){
|
||||||
|
return V(0, '房间ID不能为空', null);
|
||||||
|
}
|
||||||
$gift_id = input('gift_id', 0);
|
$gift_id = input('gift_id', 0);
|
||||||
|
if($gift_id == 0){
|
||||||
|
return V(0, '请选择礼物', null);
|
||||||
|
}
|
||||||
$gift_price = input('gift_price', 0);
|
$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);
|
$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']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
@@ -103,20 +141,27 @@ class RoomPit extends BaseCom
|
|||||||
public function down_pit()
|
public function down_pit()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
$pit_number = input('pit_number', 0);
|
|
||||||
if($room_id == 0){
|
if($room_id == 0){
|
||||||
return V(0, '房间ID不能为空', null);
|
return V(0, '房间ID不能为空', null);
|
||||||
}
|
}
|
||||||
$res = model('Room')->get_room_label($room_id);
|
$pit_number = input('pit_number', 0);
|
||||||
if($res['code'] != 1){
|
|
||||||
|
$room_type = model('Room')->get_room_type($room_id);
|
||||||
|
if($room_type == 0){
|
||||||
return V(0, '房间不存在', null);
|
return V(0, '房间不存在', null);
|
||||||
}
|
}
|
||||||
$room_label = $res['data']['label_id'];
|
|
||||||
$room_type = $res['data']['type_id'];
|
if($room_type == 10){
|
||||||
if(($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4)) || $room_type == 2){
|
$upit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $this->uid])->value('pit_number');
|
||||||
$reslut = model('RoomPit')->DownPit($this->uid, $room_id,$pit_number);
|
if($upit == 2){
|
||||||
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4)){
|
return V(0, '师父麦,不能操作', null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($room_type == 2){
|
||||||
$reslut = model('RoomSong')->down_kpit($this->uid, $room_id);
|
$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']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
@@ -128,7 +173,10 @@ class RoomPit extends BaseCom
|
|||||||
$key_name = "api:room:change_room_up_pit_type:" . $this->uid;
|
$key_name = "api:room:change_room_up_pit_type:" . $this->uid;
|
||||||
redis_lock_exit($key_name);
|
redis_lock_exit($key_name);
|
||||||
$room_id = input('room_id', 0);
|
$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);
|
$reslut = model('RoomPit')->change_room_up_pit_type($this->uid, $room_id);
|
||||||
redis_unlock($key_name);
|
redis_unlock($key_name);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
@@ -138,10 +186,28 @@ class RoomPit extends BaseCom
|
|||||||
public function host_user_pit()
|
public function host_user_pit()
|
||||||
{
|
{
|
||||||
$room_id = input('room_id', 0);
|
$room_id = input('room_id', 0);
|
||||||
|
if($room_id == 0){
|
||||||
|
return V(0, '房间ID不能为空', null);
|
||||||
|
}
|
||||||
$pit_number = input('pit_number', 0);
|
$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-踢下去
|
$type = input('type', 0);//1-抱麦 2-踢下去
|
||||||
$reslut = model('RoomPit')->host_user_pit($this->uid, $room_id,$pit_number,$user_id,$type);
|
$reslut = model('RoomPit')->host_user_pit($this->uid, $room_id,$pit_number,$user_id,$type);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
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(){
|
public function agree_song(){
|
||||||
|
return V(0, '暂不支持此类型的操作');
|
||||||
$room_id = input('room_id');
|
$room_id = input('room_id');
|
||||||
$type = input('type',1);//1同意 2拒绝
|
$type = input('type',1);//1同意 2拒绝
|
||||||
$res = model('RoomSong')->agree_song($this->uid,$room_id,$type);
|
$res = model('RoomSong')->agree_song($this->uid,$room_id,$type);
|
||||||
@@ -48,12 +49,29 @@ class RoomSong extends BaseCom
|
|||||||
return V($res['code'], $res['msg'], $res['data']);
|
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置顶
|
//上移歌 $type 1上移 2置顶
|
||||||
public function up_song(){
|
public function up_song(){
|
||||||
$room_song_id = input('did');
|
$room_song_id = input('did');
|
||||||
$type = input('type');//1上移,2置顶
|
$type = input('type');//1上移,2置顶
|
||||||
$res = model('RoomSong')->up_song($room_song_id,$type);
|
$res = model('RoomSong')->up_song($this->uid,$room_song_id,$type);
|
||||||
return V($res['code'], $res['msg'], $res['data']);
|
return V($res['code'], $res['msg'], $res['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +81,8 @@ class RoomSong extends BaseCom
|
|||||||
redis_lock_exit($key_name);
|
redis_lock_exit($key_name);
|
||||||
$room_id = input('room_id');
|
$room_id = input('room_id');
|
||||||
$now_room_song_id = input('now_did');
|
$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);
|
redis_unlock($key_name);
|
||||||
return V($res['code'], $res['msg'], $res['data']);
|
return V($res['code'], $res['msg'], $res['data']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,12 +35,16 @@ class Search extends BaseCom
|
|||||||
if(is_numeric($search)){
|
if(is_numeric($search)){
|
||||||
$where = [
|
$where = [
|
||||||
'room_number' => $search,
|
'room_number' => $search,
|
||||||
'apply_status' => 2
|
'apply_status' => 2,
|
||||||
|
'type_id' => ['<>',6],
|
||||||
|
'room_status' => 1
|
||||||
];
|
];
|
||||||
}else{
|
}else{
|
||||||
$where = [
|
$where = [
|
||||||
'room_name' => ['like', '%'.$search . '%'],
|
'room_name' => ['like', '%'.$search . '%'],
|
||||||
'apply_status' => 2
|
'apply_status' => 2,
|
||||||
|
'type_id' => ['<>',6],
|
||||||
|
'room_status' => 1
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +88,7 @@ class Search extends BaseCom
|
|||||||
$lists[$k]['picture'] = $v['room_cover'];
|
$lists[$k]['picture'] = $v['room_cover'];
|
||||||
$lists[$k]['code'] = $v['room_number'];
|
$lists[$k]['code'] = $v['room_number'];
|
||||||
$lists[$k]['label_icon'] = db::name('vs_room_label')->where('id', $v['label_id'])->value('label_icon');
|
$lists[$k]['label_icon'] = db::name('vs_room_label')->where('id', $v['label_id'])->value('label_icon');
|
||||||
$lists[$k]['hot_value'] = $v['hot_value'];
|
$lists[$k]['hot_value'] = $v['today_hot_value'];
|
||||||
}elseif($type == 3){
|
}elseif($type == 3){
|
||||||
$lists[$k]['id'] = $v['id'];
|
$lists[$k]['id'] = $v['id'];
|
||||||
$lists[$k]['name'] = $v['guild_name'];
|
$lists[$k]['name'] = $v['guild_name'];
|
||||||
@@ -96,4 +100,59 @@ class Search extends BaseCom
|
|||||||
|
|
||||||
return V(1, '获取成功', $lists);
|
return V(1, '获取成功', $lists);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//搜索
|
||||||
|
public function search_list()
|
||||||
|
{
|
||||||
|
$search = input('search', '');
|
||||||
|
|
||||||
|
if(is_numeric($search)){
|
||||||
|
$where = [
|
||||||
|
'user_code' => $search,
|
||||||
|
'status' => 1
|
||||||
|
];
|
||||||
|
$where1 = [
|
||||||
|
'room_number' => $search,
|
||||||
|
'apply_status' => 2,
|
||||||
|
'type_id' => ['<>',6],
|
||||||
|
'room_status' => 1
|
||||||
|
];
|
||||||
|
}else{
|
||||||
|
$where = [
|
||||||
|
'nickname' => ['like', '%'.$search . '%'],
|
||||||
|
'status' => 1
|
||||||
|
];
|
||||||
|
$where1 = [
|
||||||
|
'room_name' => ['like', '%'.$search . '%'],
|
||||||
|
'apply_status' => 2,
|
||||||
|
'type_id' => ['<>',6],
|
||||||
|
'room_status' => 1
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$users = db::name('user')->field('id as user_id,nickname,avatar,user_code,sex')->where($where)->select();
|
||||||
|
|
||||||
|
if(isset($users)){
|
||||||
|
foreach ($users as &$v){
|
||||||
|
$v['room_id'] = 0;
|
||||||
|
//是否在房间
|
||||||
|
$is_room = db::name('vs_room_visitor')->where(['user_id' => $v['user_id'], 'is_delete' => 1])->order('id desc')->value('room_id');
|
||||||
|
if ($is_room) {
|
||||||
|
$v['room_id'] = $is_room;
|
||||||
|
}
|
||||||
|
$v['icon'][0] = model('UserData')->user_wealth_icon($v['user_id']);//财富图标
|
||||||
|
$v['icon'][1] = model('UserData')->user_charm_icon($v['user_id']);//魅力图标
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$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($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'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return V(1, '获取成功', ['users' => $users, 'rooms' => $rooms]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
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)) {
|
if (!checkMobile($mobile)) {
|
||||||
return V(0, '手机号不正确');
|
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();
|
$last = db::name('sms')->where(['mobile' => $mobile, 'event' => $event])->order('id', 'DESC')->find();
|
||||||
if ($last && time() - $last['createtime'] < 60) {
|
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) {
|
if ($ipSendTotal >= 7) {
|
||||||
return V(0, '发送频繁');
|
return V(0, '发送频繁!!');
|
||||||
}
|
}
|
||||||
//发送短信
|
//发送短信
|
||||||
$ret = $this->send_smsbao_msg($mobile, $event);
|
$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']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
17
application/api/controller/Tencent.php
Normal file
17
application/api/controller/Tencent.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use think\Controller;
|
||||||
|
|
||||||
|
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);
|
||||||
|
return json($reslut);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,12 +15,82 @@ class Theme extends controller
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* 启动页列表
|
* 启动页列表
|
||||||
* @return array
|
* app背景图片 app_bg
|
||||||
*
|
* 首页选中 home_sel
|
||||||
|
* 首页正常 home_nor
|
||||||
|
* 广场选中 find_sel
|
||||||
|
* 广场正常 find_nor
|
||||||
|
* 消息选中 msg_sel
|
||||||
|
* 消息正常 msg_nor
|
||||||
|
* 我的选中 mine_sel
|
||||||
|
* 我的正常 mine_nor
|
||||||
|
* 主题色 theme_color
|
||||||
|
* 按钮文字颜色 btn_text_color
|
||||||
*/
|
*/
|
||||||
public function get_theme_data()
|
public function get_theme_data()
|
||||||
{
|
{
|
||||||
$reslut = DB::name('vs_theme')->where('is_active',1)->where('delete_time',0)->find();
|
// $reslut = DB::name('vs_theme')->field('theme_color,file_url,auxiliary_color')
|
||||||
return V(1,'操作成功', $reslut);
|
// ->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';
|
||||||
|
// }
|
||||||
|
|
||||||
|
//版本号
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 节日主题
|
||||||
|
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 app\common\library\Sms;
|
||||||
use fast\Random;
|
use fast\Random;
|
||||||
use think\Config;
|
use think\Config;
|
||||||
|
use think\Db;
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -222,7 +223,18 @@ class User extends BaseCom
|
|||||||
public function get_user_info()
|
public function get_user_info()
|
||||||
{
|
{
|
||||||
$reslut = model('user')->get_me($this->uid);
|
$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);
|
||||||
}
|
}
|
||||||
|
|
||||||
//关注(回关)
|
//关注(回关)
|
||||||
@@ -234,6 +246,15 @@ class User extends BaseCom
|
|||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//关注房间(红包专用)
|
||||||
|
public function follow_room()
|
||||||
|
{
|
||||||
|
$room_id = input('room_id', 0);
|
||||||
|
$type = input('type', 1);//1-收藏,0-取消收藏
|
||||||
|
$reslut = model('user')->follow_room($this->uid, $room_id,$type);
|
||||||
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
//用户关系卡(亲密拍)、关系位(真爱拍)
|
//用户关系卡(亲密拍)、关系位(真爱拍)
|
||||||
public function user_cp_list()
|
public function user_cp_list()
|
||||||
{
|
{
|
||||||
@@ -264,4 +285,24 @@ class User extends BaseCom
|
|||||||
$reslut = model('UserWallet')->give_coin($this->uid, $give_uid, $coin);
|
$reslut = model('UserWallet')->give_coin($this->uid, $give_uid, $coin);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
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;
|
$key_name = "api:user:follow_user:" . $this->uid;
|
||||||
redis_lock_exit($key_name);
|
redis_lock_exit($key_name);
|
||||||
$nick_name = input('nickname');
|
$nick_name = input('nickname');
|
||||||
$birthday = input('birthday');
|
$birthday = input('birthday', '1990-01-01');
|
||||||
$sex = input('sex', 0);
|
$sex = input('sex', 0);
|
||||||
$head_pic = input('avatar', '');
|
$head_pic = input('avatar', '');
|
||||||
$reg_code = input('init_code', '');
|
$reg_code = input('init_code', '');
|
||||||
@@ -47,7 +47,7 @@ class UserData extends BaseCom
|
|||||||
$key_name = "api:user:follow_user:" . $this->uid;
|
$key_name = "api:user:follow_user:" . $this->uid;
|
||||||
redis_lock_exit($key_name);
|
redis_lock_exit($key_name);
|
||||||
$nick_name = input('nick_name');
|
$nick_name = input('nick_name');
|
||||||
$birthday = input('birthday');
|
$birthday = input('birthday', '1990-01-01');
|
||||||
$sex = input('sex', 1);
|
$sex = input('sex', 1);
|
||||||
$head_pic = input('head_pic', '');
|
$head_pic = input('head_pic', '');
|
||||||
$images = input('images', '');//背景图(以json字符串的形式可以多图)
|
$images = input('images', '');//背景图(以json字符串的形式可以多图)
|
||||||
@@ -80,19 +80,28 @@ class UserData extends BaseCom
|
|||||||
{
|
{
|
||||||
$key_name = "api:user:bind_mobile:" . $this->uid;
|
$key_name = "api:user:bind_mobile:" . $this->uid;
|
||||||
redis_lock_exit($key_name);
|
redis_lock_exit($key_name);
|
||||||
|
|
||||||
$mobile = input('new_mobile');
|
$mobile = input('new_mobile');
|
||||||
$sms_code = input('sms_code', '');
|
$sms_code = input('sms_code', '');
|
||||||
|
|
||||||
//default-默认登录,1-更换手机号,2绑定手机号,3-忘记密码,4-设置密码,5-账号注销,6-提现
|
//default-默认登录,1-更换手机号,2绑定手机号,3-忘记密码,4-设置密码,5-账号注销,6-提现
|
||||||
$reslut = model('sms')->verification_code(2,$mobile, $sms_code);
|
$reslut = model('sms')->verification_code(2,$mobile, $sms_code);
|
||||||
if ($reslut['code'] == 0) {
|
if ($reslut['code'] == 0) {
|
||||||
redis_unlock($key_name);
|
redis_unlock($key_name);
|
||||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
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);
|
$reslut = model('UserData')->modify_mobile($mobile,$this->uid);
|
||||||
redis_unlock($key_name);
|
redis_unlock($key_name);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更换手机号
|
||||||
|
//default-默认登录,1-更换手机号,2绑定手机号,3-忘记密码,4-设置密码,5-账号注销,6-提现
|
||||||
//更换手机号
|
//更换手机号
|
||||||
public function modify_mobile()
|
public function modify_mobile()
|
||||||
{
|
{
|
||||||
@@ -102,10 +111,13 @@ class UserData extends BaseCom
|
|||||||
$new_mobile = input('new_mobile');
|
$new_mobile = input('new_mobile');
|
||||||
$sms_code = input('sms_code', '');
|
$sms_code = input('sms_code', '');
|
||||||
$user_mobile = db::name('user')->where('id',$this->uid)->value('mobile');
|
$user_mobile = db::name('user')->where('id',$this->uid)->value('mobile');
|
||||||
if ($user_mobile != $mobile){
|
if($user_mobile){
|
||||||
redis_unlock($key_name);
|
if ($user_mobile != $mobile){
|
||||||
return V(0, "旧手机号错误", null);
|
redis_unlock($key_name);
|
||||||
|
// return V(0, "旧手机号错误", null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($new_mobile == $user_mobile){
|
if ($new_mobile == $user_mobile){
|
||||||
redis_unlock($key_name);
|
redis_unlock($key_name);
|
||||||
return V(0, "新手机号不能与旧手机号一致", null);
|
return V(0, "新手机号不能与旧手机号一致", null);
|
||||||
@@ -121,6 +133,59 @@ class UserData extends BaseCom
|
|||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
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()
|
public function real_name()
|
||||||
{
|
{
|
||||||
@@ -128,13 +193,14 @@ class UserData extends BaseCom
|
|||||||
redis_lock_exit($key_name);
|
redis_lock_exit($key_name);
|
||||||
$real_name = input('real_name');
|
$real_name = input('real_name');
|
||||||
$card_number = input('card_number');
|
$card_number = input('card_number');
|
||||||
|
//去掉前后空格
|
||||||
|
$card_number = trim($card_number);
|
||||||
$reslut = model('UserData')->real_name($this->uid,$real_name, $card_number);
|
$reslut = model('UserData')->real_name($this->uid,$real_name, $card_number);
|
||||||
redis_unlock($key_name);
|
redis_unlock($key_name);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//实名认证结果获取
|
//实名认证成功后通知后端
|
||||||
public function real_name_result()
|
public function real_name_result()
|
||||||
{
|
{
|
||||||
$orderNo = input('orderNo', '');
|
$orderNo = input('orderNo', '');
|
||||||
@@ -149,4 +215,13 @@ class UserData extends BaseCom
|
|||||||
$reslut = model('UserData')->real_name_info($this->uid);
|
$reslut = model('UserData')->real_name_info($this->uid);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
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']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,13 +24,21 @@ class UserGiftPack extends BaseCom
|
|||||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取背包礼物列表总值
|
||||||
|
public function get_gift_pack_list_count()
|
||||||
|
{
|
||||||
|
$user_id = $this->uid;
|
||||||
|
$reslut = model('UserGiftPack')->get_gift_pack_list_count($user_id);
|
||||||
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||||
|
}
|
||||||
|
|
||||||
//背包收入
|
//背包收入
|
||||||
public function get_gift_pack_income()
|
public function get_gift_pack_income()
|
||||||
{
|
{
|
||||||
$user_id = $this->uid;
|
$user_id = $this->uid;
|
||||||
$page = input('page',1);
|
$page = input('page',1);
|
||||||
$page_limit = input('page_limit',10);
|
$page_limit = input('page_limit',10);
|
||||||
$reslut = model('UserGiftPack')->income_user_gift_pack($user_id,$page=1,$page_limit=10);
|
$reslut = model('UserGiftPack')->income_user_gift_pack($user_id,$page,$page_limit);
|
||||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +48,7 @@ class UserGiftPack extends BaseCom
|
|||||||
$user_id = $this->uid;
|
$user_id = $this->uid;
|
||||||
$page = input('page',1);
|
$page = input('page',1);
|
||||||
$page_limit = input('page_limit',10);
|
$page_limit = input('page_limit',10);
|
||||||
$reslut = model('UserGiftPack')->get_gift_pack_outcome($user_id,$page=1,$page_limit=10);
|
$reslut = model('UserGiftPack')->get_gift_pack_outcome($user_id,$page,$page_limit);
|
||||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,51 +14,35 @@ class UserWallet extends BaseCom
|
|||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
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()
|
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);
|
$page_limit = input('page_limit', 30);
|
||||||
$in_out_type = input('in_out_type', 1);//1收入2支出
|
$in_out_type = input('in_out_type', 1);//1收入2支出
|
||||||
$gift_type = input('gift_type', 1);//1金币,2收益(钻石)
|
$gift_type = input('gift_type', 1);//1金币,2收益(钻石)
|
||||||
//开始时间
|
$start_time = input('start_time', '');//开始时间
|
||||||
$start_time = input('start_time', '');
|
$end_time = input('end_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']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//收益(钻石)兑换金币
|
//收益(钻石)兑换金币
|
||||||
public function exchange_coin()
|
public function exchange_coin()
|
||||||
{
|
{
|
||||||
|
$key_name = 'exchange_coin_' . $this->uid;
|
||||||
|
redis_lock_exits($key_name, 10, 10);
|
||||||
$earnings_num = input('earnings_num', 0);
|
$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);
|
$reslut = model('UserWallet')->exchange_coin($this->uid,$earnings_num);
|
||||||
|
redis_unlocks($key_name);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,9 +61,52 @@ class UserWallet extends BaseCom
|
|||||||
foreach ($reslut as $k=>$v){
|
foreach ($reslut as $k=>$v){
|
||||||
$reslut_data[$k]['money'] = $v['money'];
|
$reslut_data[$k]['money'] = $v['money'];
|
||||||
$reslut_data[$k]['coins'] = $v['coins'];
|
$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);
|
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;
|
$api_version = 0;
|
||||||
if ($system == 'iOS') {
|
if ($system == 'iOS') {
|
||||||
$api_versions = db::name('version')->where(['type' => 2, 'status' => 1])->order('id', 'desc')->find();
|
$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) {
|
if ($result < 0) {
|
||||||
$api_version = 1;
|
$api_version = 1;
|
||||||
}
|
}
|
||||||
@@ -185,6 +185,10 @@ class UserZone extends BaseCom
|
|||||||
$gift_id = input('gift_id', 0);
|
$gift_id = input('gift_id', 0);
|
||||||
$num = input('num', 1);
|
$num = input('num', 1);
|
||||||
$is_pack = input('is_pack', 1);//2背包 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);
|
$reslut = model('GiveGift')->reward_zone($this->uid, $zid, $gift_id, $num, $is_pack);
|
||||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||||
}
|
}
|
||||||
|
|||||||
117
application/api/controller/Xintiao.php
Normal file
117
application/api/controller/Xintiao.php
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use think\Controller;
|
||||||
|
use think\Db;
|
||||||
|
use think\Log;
|
||||||
|
|
||||||
|
use app\common\controller\BaseCom;
|
||||||
|
|
||||||
|
class Xintiao extends BaseCom
|
||||||
|
{
|
||||||
|
|
||||||
|
//房间内保持心跳
|
||||||
|
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_room_heartbeat')->where(['user_id' => $user_id, 'room_id' => $room_id])->find();
|
||||||
|
if($is_xintiao){
|
||||||
|
db::name('vs_room_heartbeat')->where('id' , $is_xintiao['id'])->update(['updatetime' => time()]);
|
||||||
|
}else{
|
||||||
|
db::name('vs_room_heartbeat')->insert([
|
||||||
|
'user_id' => $user_id,
|
||||||
|
'room_id' => $room_id,
|
||||||
|
'createtime' => time(),
|
||||||
|
'updatetime' => time()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
//任务: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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
411
application/api/controller/Xxiaoshi.php
Normal file
411
application/api/controller/Xxiaoshi.php
Normal file
@@ -0,0 +1,411 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use think\Controller;
|
||||||
|
use think\Db;
|
||||||
|
use think\Log;
|
||||||
|
|
||||||
|
use app\common\controller\Push;
|
||||||
|
|
||||||
|
class Xxiaoshi extends Controllers
|
||||||
|
{
|
||||||
|
|
||||||
|
public function test()
|
||||||
|
{
|
||||||
|
$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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//测试数据
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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]
|
||||||
|
// ];
|
||||||
|
|
||||||
|
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(); // 转为普通数组方便处理
|
||||||
|
|
||||||
|
if($rechargeData){
|
||||||
|
foreach ($rechargeData as $recharge){
|
||||||
|
$dtae[] = [
|
||||||
|
'p_user' => $userId,
|
||||||
|
'user_id' => $recharge['user_id'],
|
||||||
|
'createtime' => $recharge['updatetime'],
|
||||||
|
'money' => $recharge['money'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "=========";
|
||||||
|
echo "\n";
|
||||||
|
// var_dump($invite);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -108,7 +108,7 @@ return [
|
|||||||
'该装扮天数不存在' => '该装扮天数不存在',
|
'该装扮天数不存在' => '该装扮天数不存在',
|
||||||
'该个人靓号已被购买' => '该个人靓号已被购买',
|
'该个人靓号已被购买' => '该个人靓号已被购买',
|
||||||
'该房间靓号已被购买' => '该房间靓号已被购买',
|
'该房间靓号已被购买' => '该房间靓号已被购买',
|
||||||
'该工会靓号已被购买' => '该工会靓号已被购买',
|
'该公会靓号已被购买' => '该公会靓号已被购买',
|
||||||
'用户信息错误' => '用户信息错误',
|
'用户信息错误' => '用户信息错误',
|
||||||
'非法资金类型' => '非法资金类型',
|
'非法资金类型' => '非法资金类型',
|
||||||
'当前用户金币已达上限' => '当前用户金币已达上限',
|
'当前用户金币已达上限' => '当前用户金币已达上限',
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ class Activities extends Model
|
|||||||
public static function first_charge_gift_send($user_id,$money=0)
|
public static function first_charge_gift_send($user_id,$money=0)
|
||||||
{
|
{
|
||||||
//礼包
|
//礼包
|
||||||
$gift_bag_id = DB::name('vs_gift_bag')->where(['activities_id'=>1,'status'=>1,'money'=>$money])->value('id');
|
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>1,'status'=>1,'delete_time'=>0,'money'=>['<=',$money]])->order('money desc')->find();
|
||||||
|
$gift_bag_id = $gift_bag['id'] ?? 0;
|
||||||
if (!$gift_bag_id) {
|
if (!$gift_bag_id) {
|
||||||
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
|
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
|
||||||
}
|
}
|
||||||
@@ -36,21 +37,29 @@ class Activities extends Model
|
|||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
foreach ($gift_bag_detail as $k=>$v){
|
foreach ($gift_bag_detail as $k=>$v){
|
||||||
|
$gift_id =0;
|
||||||
|
$gift_price = 0;
|
||||||
|
$gift_num = $v['quantity'];
|
||||||
switch ($v['type']) {
|
switch ($v['type']) {
|
||||||
case 1: //金币 方法1:直接添加到用户钱包
|
case 1: //金币 方法1:直接添加到用户钱包
|
||||||
|
$gift_price = $v['quantity'];
|
||||||
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::FIRST_CHARGE,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::FIRST_CHARGE));
|
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::FIRST_CHARGE,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::FIRST_CHARGE));
|
||||||
break;
|
break;
|
||||||
case 2: //礼物 方法2:添加到用户礼物背包
|
case 2: //礼物 方法2:添加到用户礼物背包
|
||||||
|
$gift_id = $v['foreign_id'];
|
||||||
$res = model('UserGiftPack')->change_user_gift_pack($user_id,$v['foreign_id'],$v['quantity'],model('UserGiftPack')::FIRST_CHARGE,"首充好礼获得礼物");
|
$res = model('UserGiftPack')->change_user_gift_pack($user_id,$v['foreign_id'],$v['quantity'],model('UserGiftPack')::FIRST_CHARGE,"首充好礼获得礼物");
|
||||||
break;
|
break;
|
||||||
case 3: //坐骑 方法3:添加到用户装扮
|
case 3: //坐骑 方法3:添加到用户装扮
|
||||||
|
$gift_id = $v['foreign_id'];
|
||||||
$decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
|
$decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
|
||||||
if(empty($decorate_price_info)){
|
if(empty($decorate_price_info)){
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
$gift_price = $decorate_price_info['price'];
|
||||||
$res = model('Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],5);
|
$res = model('Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],5);
|
||||||
break;
|
break;
|
||||||
case 4: //道具 方法5:钻石
|
case 4: //道具 方法5:钻石
|
||||||
|
$gift_price = $v['quantity'];
|
||||||
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPEARNINGS, model('common/UserWallet')::FIRST_CHARGE,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::FIRST_CHARGE));
|
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPEARNINGS, model('common/UserWallet')::FIRST_CHARGE,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::FIRST_CHARGE));
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -59,15 +68,19 @@ class Activities extends Model
|
|||||||
Db::rollback();
|
Db::rollback();
|
||||||
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
|
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
|
||||||
}
|
}
|
||||||
|
// 记录日志
|
||||||
|
//添加礼盒记录
|
||||||
|
$reslut = Db::name('vs_gift_bag_receive_log')->insert([
|
||||||
|
'user_id' => $user_id,
|
||||||
|
'gift_bag_id' => $gift_bag_id,
|
||||||
|
'gift_id'=> $gift_id,
|
||||||
|
'gift_price' => $gift_price,
|
||||||
|
'num' => $gift_num,
|
||||||
|
'bag_price' => $money,
|
||||||
|
'createtime' => time(),
|
||||||
|
'updatetime' => time()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
// 记录日志
|
|
||||||
//添加礼盒记录
|
|
||||||
$reslut = Db::name('vs_gift_bag_receive_log')->insert([
|
|
||||||
'user_id' => $user_id,
|
|
||||||
'gift_bag_id' => $gift_bag_id,
|
|
||||||
'createtime' => time(),
|
|
||||||
'updatetime' => time()
|
|
||||||
]);
|
|
||||||
// 添加活动记录
|
// 添加活动记录
|
||||||
$reslut = Db::name('vs_activities_receive')->insert([
|
$reslut = Db::name('vs_activities_receive')->insert([
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
@@ -86,14 +99,19 @@ class Activities extends Model
|
|||||||
/*
|
/*
|
||||||
* 天降好礼发放
|
* 天降好礼发放
|
||||||
*/
|
*/
|
||||||
public static function drop_gift_send($user_id)
|
public static function drop_gift_send($user_id,$money=0)
|
||||||
{
|
{
|
||||||
$activities_id = 3;
|
$activities_id = 3;
|
||||||
//礼包
|
//礼包
|
||||||
$gift_bag_id = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->value('id');
|
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->find();
|
||||||
|
$gift_bag_id = $gift_bag['id'] ?? 0;
|
||||||
|
|
||||||
if (!$gift_bag_id) {
|
if (!$gift_bag_id) {
|
||||||
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
|
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
|
||||||
}
|
}
|
||||||
|
if($money != $gift_bag['money']){
|
||||||
|
return ['code' => 0, 'msg' => '充值金额未命中天降好礼礼包','data' => null];
|
||||||
|
}
|
||||||
$gift_bag_detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag_id])->select();
|
$gift_bag_detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag_id])->select();
|
||||||
if (!$gift_bag_detail) {
|
if (!$gift_bag_detail) {
|
||||||
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
|
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
|
||||||
@@ -111,7 +129,7 @@ class Activities extends Model
|
|||||||
case 3: //坐骑 方法3:添加到用户装扮
|
case 3: //坐骑 方法3:添加到用户装扮
|
||||||
$decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
|
$decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
|
||||||
if(empty($decorate_price_info)){
|
if(empty($decorate_price_info)){
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
$res = model('Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],6);
|
$res = model('Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],6);
|
||||||
break;
|
break;
|
||||||
@@ -124,15 +142,20 @@ class Activities extends Model
|
|||||||
Db::rollback();
|
Db::rollback();
|
||||||
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
|
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
|
||||||
}
|
}
|
||||||
|
// 记录日志
|
||||||
|
//添加礼盒记录
|
||||||
|
$reslut = Db::name('vs_gift_bag_receive_log')->insert([
|
||||||
|
'user_id' => $user_id,
|
||||||
|
'gift_bag_id' => $gift_bag_id,
|
||||||
|
'parent_id' => $v['id'],
|
||||||
|
'gift_id'=> $v['foreign_id'],
|
||||||
|
'num' => $v['quantity'],
|
||||||
|
'bag_price' => $gift_bag['money'],
|
||||||
|
'gift_price' => $v['gold'],
|
||||||
|
'createtime' => time(),
|
||||||
|
'updatetime' => time()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
// 记录日志
|
|
||||||
//添加礼盒记录
|
|
||||||
$reslut = Db::name('vs_gift_bag_receive_log')->insert([
|
|
||||||
'user_id' => $user_id,
|
|
||||||
'gift_bag_id' => $gift_bag_id,
|
|
||||||
'createtime' => time(),
|
|
||||||
'updatetime' => time()
|
|
||||||
]);
|
|
||||||
// 添加活动记录
|
// 添加活动记录
|
||||||
$reslut = Db::name('vs_activities_receive')->insert([
|
$reslut = Db::name('vs_activities_receive')->insert([
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
@@ -148,4 +171,110 @@ class Activities extends Model
|
|||||||
return ['code' => 0, 'msg' => "请重试", 'data' => null];
|
return ['code' => 0, 'msg' => "请重试", 'data' => null];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 新人好礼发放
|
||||||
|
*/
|
||||||
|
public static function new_charge_gift_send($user_id,$money=0)
|
||||||
|
{
|
||||||
|
//礼包
|
||||||
|
$activities_id = 7;
|
||||||
|
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1,'delete_time'=>0,'money'=>$money])->order('money desc')->find();
|
||||||
|
$gift_bag_id = $gift_bag['id'] ?? 0;
|
||||||
|
if (!$gift_bag_id) {
|
||||||
|
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
|
||||||
|
}
|
||||||
|
$gift_bag_detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag_id])->select();
|
||||||
|
if (!$gift_bag_detail) {
|
||||||
|
return ['code' => 0, 'msg' => '礼包未配置','data' => null];
|
||||||
|
}
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
foreach ($gift_bag_detail as $k=>$v){
|
||||||
|
$gift_id =0;
|
||||||
|
$gift_price = 0;
|
||||||
|
$gift_num = $v['quantity'];
|
||||||
|
switch ($v['type']) {
|
||||||
|
case 1: //金币 方法1:直接添加到用户钱包
|
||||||
|
$gift_price = $v['quantity'];
|
||||||
|
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::NEW_USER_CHARGE_GIFT,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::NEW_USER_CHARGE_GIFT));
|
||||||
|
break;
|
||||||
|
case 2: //礼物 方法2:添加到用户礼物背包
|
||||||
|
$gift_id = $v['foreign_id'];
|
||||||
|
$res = model('UserGiftPack')->change_user_gift_pack($user_id,$v['foreign_id'],$v['quantity'],model('UserGiftPack')::NEW_CHARGE_GIFT,"新人好礼获得礼物");
|
||||||
|
break;
|
||||||
|
case 3: //坐骑 方法3:添加到用户装扮
|
||||||
|
$gift_id = $v['foreign_id'];
|
||||||
|
$decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
|
||||||
|
if(empty($decorate_price_info)){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$gift_price = $decorate_price_info['price'];
|
||||||
|
$res = model('Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],8);
|
||||||
|
break;
|
||||||
|
case 4: //道具 方法5:钻石
|
||||||
|
$gift_price = $v['quantity'];
|
||||||
|
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPEARNINGS, model('common/UserWallet')::NEW_USER_CHARGE_GIFT,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::NEW_USER_CHARGE_GIFT));
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ($res['code'] != 1) {
|
||||||
|
Db::rollback();
|
||||||
|
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
|
||||||
|
}
|
||||||
|
// 记录日志
|
||||||
|
//添加礼盒记录
|
||||||
|
$reslut = Db::name('vs_gift_bag_receive_log')->insert([
|
||||||
|
'user_id' => $user_id,
|
||||||
|
'gift_bag_id' => $gift_bag_id,
|
||||||
|
'parent_id' => $v['id'],
|
||||||
|
'gift_id'=> $v['foreign_id'],
|
||||||
|
'num' => $v['quantity'],
|
||||||
|
'bag_price' => $gift_bag['money'],
|
||||||
|
'gift_price' => $v['gold'],
|
||||||
|
'createtime' => time(),
|
||||||
|
'updatetime' => time()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
// 添加活动记录
|
||||||
|
$reslut = Db::name('vs_activities_receive')->insert([
|
||||||
|
'user_id' => $user_id,
|
||||||
|
'activities_id' => 7,
|
||||||
|
'createtime' => time(),
|
||||||
|
'updatetime' => time()
|
||||||
|
]);
|
||||||
|
Db::commit();
|
||||||
|
return ['code' => 1, 'msg' => '操作成功','data' => null];
|
||||||
|
}catch (\Exception $e) {
|
||||||
|
// 回滚事务
|
||||||
|
Db::rollback();
|
||||||
|
return ['code' => 0, 'msg' => "请重试", 'data' => null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取礼包总价值
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,13 @@ class Banner extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'fa_vs_banner';
|
protected $table = 'fa_vs_banner';
|
||||||
public $ShowType = [
|
public $ShowType = [
|
||||||
// 1 => '引导页',
|
1 => '引导页',
|
||||||
// 2 => '启动页',
|
2 => '启动页',
|
||||||
3 => '首页轮播图',
|
3 => '首页轮播图',
|
||||||
4 => '工会',
|
4 => '房间首页轮播图',
|
||||||
5 => '帮助反馈'
|
5 => '工会列表页广告位',
|
||||||
|
6 => '我的主页广告位',
|
||||||
|
7 => '道具商城广告位'
|
||||||
];
|
];
|
||||||
//1纯展示 2文章 3房间 4个人主页 5外站'
|
//1纯展示 2文章 3房间 4个人主页 5外站'
|
||||||
public $Type = [
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
492
application/api/model/BlindBoxTurntableGift.php
Normal file
492
application/api/model/BlindBoxTurntableGift.php
Normal file
@@ -0,0 +1,492 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\model;
|
||||||
|
use app\common\controller\Push;
|
||||||
|
use think\Cache;
|
||||||
|
use think\Model;
|
||||||
|
use think\Db;
|
||||||
|
use think\Session;
|
||||||
|
/*
|
||||||
|
* 盲盒转盘
|
||||||
|
* 2025-08-16
|
||||||
|
*/
|
||||||
|
class BlindBoxTurntableGift extends Model
|
||||||
|
{
|
||||||
|
// 开启自动写入时间戳字段
|
||||||
|
protected $autoWriteTimestamp = true;
|
||||||
|
// 定义时间戳字段名
|
||||||
|
protected $createTime = 'createtime';
|
||||||
|
protected $updateTime = 'updatetime';
|
||||||
|
protected $table = 'fa_vs_gift';
|
||||||
|
|
||||||
|
//获取奖池礼物列表
|
||||||
|
public function get_gift_list($gift_bag_id,$room_id)
|
||||||
|
{
|
||||||
|
$box = db::name('vs_gift_bag')->where('id',$gift_bag_id)->find();
|
||||||
|
$gifts = db::name('vs_gift_bag_detail')->where('gift_bag_id',$gift_bag_id)->order("id desc")->select();
|
||||||
|
$gift_list = [];
|
||||||
|
foreach ($gifts as $key => $value) {
|
||||||
|
$gift_data = db::name('vs_gift')->where('gid',$value['foreign_id'])->where('delete_time',0)->find();
|
||||||
|
if($gift_data){
|
||||||
|
$gift_list[$key]['number'] = $key;
|
||||||
|
$gift_list[$key]['gift_id'] = $gift_data['gid'];
|
||||||
|
$gift_list[$key]['gift_name'] = $gift_data['gift_name'];
|
||||||
|
$gift_list[$key]['base_image'] = $gift_data['base_image'];
|
||||||
|
$gift_list[$key]['play_image'] = $gift_data['play_image'];
|
||||||
|
$gift_list[$key]['gift_price'] = $gift_data['gift_price'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ext = json_decode($box['ext'],true);
|
||||||
|
$box_gift = Db::name('vs_gift')->where('gid',$ext['gift_id'])->find();
|
||||||
|
|
||||||
|
//巡乐会
|
||||||
|
$is_xlh = 0;
|
||||||
|
$xlh_box = db::name('vs_gift_bag')->where('id',13)->find();
|
||||||
|
$xlh_ext = json_decode($xlh_box['ext'],true);
|
||||||
|
$xlh = [];
|
||||||
|
if($xlh_ext['inlet_bag_id'] == $box['id']){
|
||||||
|
$is_xlh = 1;
|
||||||
|
$xlh['waiting_start_num'] = $xlh_ext['open_condition']['waiting_start_num'];//等待开奖次数
|
||||||
|
$xlh['start_num'] = $xlh_ext['open_condition']['start_num'];//开始开奖次数
|
||||||
|
//当前抽奖次数
|
||||||
|
$xlh['current_num'] = Cache::get("xlh_periods_num") ?? 0;
|
||||||
|
//状态
|
||||||
|
if($xlh['current_num'] >= $xlh_ext['open_condition']['start_num']){
|
||||||
|
$xlh['status'] = 1;//状态 1:巡乐会开始 2:即将开始开始 0:等待开始
|
||||||
|
} elseif($xlh['current_num'] >= $xlh_ext['open_condition']['waiting_start_num'] && $xlh['current_num'] < $xlh_ext['open_condition']['start_num']){
|
||||||
|
$xlh['status'] = 2;//状态 1:巡乐会开始 2:即将开始开始 0:等待开始
|
||||||
|
}else{
|
||||||
|
$xlh['status'] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result_data = [
|
||||||
|
'title' => $box['name'],
|
||||||
|
'rule_url' => get_system_config_value('web_site')."/api/Page/get_gift_box_rule?box_id=".$box["id"],
|
||||||
|
'box_price' => $box_gift['gift_price'],
|
||||||
|
'is_xlh' => $is_xlh,
|
||||||
|
'xlh_data' => $xlh,
|
||||||
|
'gift_list' => $gift_list,
|
||||||
|
];
|
||||||
|
return ['code' => 1, 'msg' => '获取成功', 'data' => $result_data];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 礼物特效播放
|
||||||
|
*/
|
||||||
|
public function gift_send($send_id){
|
||||||
|
try{
|
||||||
|
$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::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'];
|
||||||
|
$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();
|
||||||
|
$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[] = [
|
||||||
|
'text' => $text_message,
|
||||||
|
'gift_picture' => $draw_gift['base_image'],
|
||||||
|
'room_id' => $room_id,
|
||||||
|
'fromUserName' => $FromUserInfo['nickname'],
|
||||||
|
'toUserName' => $ToUserInfo['nickname'],
|
||||||
|
'giftName' => $draw_gift['gift_name'],
|
||||||
|
'roomId' => $room_id,
|
||||||
|
'number' => $value['count'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$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']
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$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,
|
||||||
|
'ToUserInfo' => $userInfo,
|
||||||
|
'GiftInfos' => array_values($gifts),
|
||||||
|
'text' => $userTextMessage
|
||||||
|
];
|
||||||
|
|
||||||
|
// 聊天室推送系统消息给每个用户
|
||||||
|
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_room')->where('id', $room_id)->value('hot_value');
|
||||||
|
$text1 = [
|
||||||
|
'room_id' => $room_id,
|
||||||
|
'hot_value' => $hot_value,
|
||||||
|
'text' => '房间心动值变化'
|
||||||
|
];
|
||||||
|
//聊天室推送系统消息
|
||||||
|
model('Chat')->sendMsg(1028,$room_id,$text1);
|
||||||
|
}else{
|
||||||
|
if(!empty($text_list_new)){
|
||||||
|
//推送礼物横幅
|
||||||
|
$push = new Push($blind_box_turntable['user_id'], $room_id);
|
||||||
|
$push->giftBanner($text_list_new);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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' => "网络请求错误,请重试!".$e->getMessage(), 'data' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 获取用户抽奖记录
|
||||||
|
*/
|
||||||
|
public function get_user_record($gift_bag_id,$user_id=0,$page=1,$page_size=12){
|
||||||
|
$where = [];
|
||||||
|
$where['b.gift_bag_id'] = $gift_bag_id;
|
||||||
|
if($user_id > 0){
|
||||||
|
$where['b.user_id'] = $user_id;
|
||||||
|
}
|
||||||
|
$list = db('vs_blind_box_turntable_results_log')
|
||||||
|
->alias('a')
|
||||||
|
->join('vs_blind_box_turntable_log b','b.id = a.tid','left')
|
||||||
|
->join('user c','a.gift_user_id = c.id','left')
|
||||||
|
->join('vs_gift d','d.gid = a.gift_id','left')
|
||||||
|
->field('a.gift_id,a.count,a.gift_user_id,a.createtime,c.nickname,d.gift_name as gift_name,d.base_image')
|
||||||
|
->where($where)
|
||||||
|
->order('a.createtime desc')
|
||||||
|
->page($page,$page_size)
|
||||||
|
->select();
|
||||||
|
foreach ($list as &$v){
|
||||||
|
$v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||||
|
}
|
||||||
|
return ['code' => 1, 'msg' => '成功', 'data' => $list];
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 获取全服抽奖记录
|
||||||
|
*/
|
||||||
|
public function get_all_record($gift_bag_id,$page=1,$page_size=12){
|
||||||
|
$where = [];
|
||||||
|
$where['b.gift_bag_id'] = $gift_bag_id;
|
||||||
|
$where['d.gift_bag_id'] = $gift_bag_id;
|
||||||
|
$where['d.is_world_show'] = 1;
|
||||||
|
$list = db('vs_blind_box_turntable_results_log')
|
||||||
|
->alias('a')
|
||||||
|
->join('vs_blind_box_turntable_log b','b.id = a.tid','left')
|
||||||
|
->join('user c','b.user_id = c.id','left')
|
||||||
|
->join('vs_gift_bag_detail d','d.foreign_id = a.gift_id','left')
|
||||||
|
->join('vs_gift e','e.gid = a.gift_id','left')
|
||||||
|
->field('a.gift_id,a.count,b.user_id,a.createtime,c.nickname,d.name as gift_name,e.base_image')
|
||||||
|
->where($where)
|
||||||
|
->order('a.createtime desc')
|
||||||
|
->page($page,$page_size)
|
||||||
|
->select();
|
||||||
|
foreach ($list as &$v){
|
||||||
|
$v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||||
|
}
|
||||||
|
return ['code' => 1, 'msg' => '成功', 'data' => $list];
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 巡乐会
|
||||||
|
*/
|
||||||
|
public function xlh_gift_list($room_id){
|
||||||
|
$gift_bag_id = 13;
|
||||||
|
$xlh_box = db::name('vs_gift_bag')->where('id',$gift_bag_id)->find();
|
||||||
|
$xlh_ext = json_decode($xlh_box['ext'],true);
|
||||||
|
$gifts = db::name('vs_gift_bag_detail')->where('gift_bag_id',$gift_bag_id)->order("id desc")->select();
|
||||||
|
$gift_list = [];
|
||||||
|
foreach ($gifts as $key => $value) {
|
||||||
|
$gift_data = db::name('vs_gift')->where('gid',$value['foreign_id'])->where('delete_time',0)->find();
|
||||||
|
if($gift_data){
|
||||||
|
$gift_list[$key]['number'] = $key;
|
||||||
|
$gift_list[$key]['gift_id'] = $gift_data['gid'];
|
||||||
|
$gift_list[$key]['gift_name'] = $gift_data['gift_name'];
|
||||||
|
$gift_list[$key]['base_image'] = $gift_data['base_image'];
|
||||||
|
$gift_list[$key]['play_image'] = $gift_data['play_image'];
|
||||||
|
$gift_list[$key]['gift_price'] = $gift_data['gift_price'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//房主信息
|
||||||
|
// $room_user = db::name('user')->where('id',$room_data['user_id'])->find();
|
||||||
|
//房主礼物
|
||||||
|
$room_user_gift = db::name('vs_gift')->where('gid',$xlh_ext['locking_condition']['give_homeowner_gift_id'])->find();
|
||||||
|
//巡乐会主礼物
|
||||||
|
$xlh_main_gift = db::name('vs_gift')->where('gid',$xlh_ext['locking_condition']['locking_gift_id'])->find();
|
||||||
|
//中奖用户
|
||||||
|
$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)){
|
||||||
|
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']){
|
||||||
|
$xlh_user = db::name('user')->where('id',$pan_xlh['user_id'])->find();
|
||||||
|
$xlh_user_data = [
|
||||||
|
'user_id' => $xlh_user['id'],
|
||||||
|
'nickname' => $xlh_user['nickname'],
|
||||||
|
'avatar' => $xlh_user['avatar'],
|
||||||
|
];
|
||||||
|
if($pan_xlh['room_id']){
|
||||||
|
$room_data = db::name('vs_room')->field('xlh_periods,xlh_periods_num,user_id')-> where('id',$pan_xlh['room_id'])->find();
|
||||||
|
$room_user = db::name('user')->where('id',$room_data['user_id'])->find();
|
||||||
|
$room_user_data = [
|
||||||
|
'user_id' => $room_user['id'],
|
||||||
|
'nickname' => $room_user['nickname'],
|
||||||
|
'avatar' => $room_user['avatar'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//$gift_list 按gift_price 升序排序
|
||||||
|
usort($gift_list, function($a, $b) {
|
||||||
|
return $a['gift_price'] - $b['gift_price'];
|
||||||
|
});
|
||||||
|
|
||||||
|
$result_data = [
|
||||||
|
'title' => $xlh_box['name'],
|
||||||
|
'rule_url' => get_system_config_value('web_site')."/api/Page/get_gift_box_rule?box_id=".$xlh_box["id"],
|
||||||
|
'box_price' => $xlh_ext['xlh_box_price'],
|
||||||
|
'xlh_end_time' =>$pan_xlh['end_time']??0,
|
||||||
|
'give_homeowner_gift' => [
|
||||||
|
'gift_id' => $room_user_gift['gid'],
|
||||||
|
'gift_name' => $room_user_gift['gift_name'],
|
||||||
|
'gift_price' => $room_user_gift['gift_price'],
|
||||||
|
'base_image' => $room_user_gift['base_image'],
|
||||||
|
],
|
||||||
|
'homeowner_user' => $room_user_data,
|
||||||
|
'locking_gift' => [
|
||||||
|
'gift_id' => $xlh_main_gift['gid'],
|
||||||
|
'gift_name' => $xlh_main_gift['gift_name'],
|
||||||
|
'gift_price' => $xlh_main_gift['gift_price'],
|
||||||
|
'base_image' => $xlh_main_gift['base_image'],
|
||||||
|
'gift_num' => $pan_xlh['num']??0
|
||||||
|
],
|
||||||
|
'xlh_user' => $xlh_user_data,
|
||||||
|
'gift_list' => $gift_list,
|
||||||
|
];
|
||||||
|
return ['code' => 1, 'msg' => '获取成功', 'data' => $result_data];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 巡乐会抽奖记录
|
||||||
|
*/
|
||||||
|
public function xlh_get_user_record($user_id,$room_id,$page=1,$page_size=12){
|
||||||
|
$where = [];
|
||||||
|
$where['a.gift_bag_id'] = 13;
|
||||||
|
$where['a.user_id'] = $user_id;
|
||||||
|
$list = db('vs_gift_bag_receive_pan_log')
|
||||||
|
->alias('a')
|
||||||
|
->join('vs_room_pan_xlh b','b.id = a.parent_id','left')
|
||||||
|
->join('vs_gift c','c.gid = a.gift_id','left')
|
||||||
|
->field('a.gift_id,a.num as count,a.createtime,c.gift_name as gift_name,c.base_image')
|
||||||
|
->where($where)
|
||||||
|
->order('a.createtime desc')
|
||||||
|
->page($page,$page_size)
|
||||||
|
->select();
|
||||||
|
foreach ($list as &$v){
|
||||||
|
$v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||||
|
}
|
||||||
|
return ['code' => 1, 'msg' => '成功', 'data' => $list];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 巡乐会榜单
|
||||||
|
*/
|
||||||
|
public function xlh_ranking($room_id,$page=1,$page_size=12){
|
||||||
|
$where = [];
|
||||||
|
$where['a.gift_bag_id'] = 13;
|
||||||
|
$where['e.is_world_show'] = 1;
|
||||||
|
$list = db('vs_gift_bag_receive_pan_log')
|
||||||
|
->alias('a')
|
||||||
|
->join('vs_room_pan_xlh b','b.id = a.parent_id','left')
|
||||||
|
->join('vs_gift c','c.gid = a.gift_id','left')
|
||||||
|
->join('fa_user d','d.id = a.user_id','left')
|
||||||
|
->join('vs_gift_bag_detail e','e.foreign_id = a.gift_id','left')
|
||||||
|
->field('a.gift_id,a.num as count,a.createtime,c.gift_name,c.base_image,d.nickname')
|
||||||
|
->where($where)
|
||||||
|
->order('a.createtime desc')
|
||||||
|
->page($page,$page_size)
|
||||||
|
->select();
|
||||||
|
foreach ($list as &$v){
|
||||||
|
$v['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||||
|
}
|
||||||
|
return ['code' => 1, 'msg' => '成功', 'data' => $list];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 获取用户当前房间的巡乐会信息
|
||||||
|
*/
|
||||||
|
public function get_user_xlh_info($room_id){
|
||||||
|
$gift_bag_id = 13;
|
||||||
|
$xlh_box = db::name('vs_gift_bag')->where('id',$gift_bag_id)->find();
|
||||||
|
$xlh_ext = json_decode($xlh_box['ext'],true);
|
||||||
|
$xlh_data = db('vs_room_pan_xlh')->where(["send_time"=>0,"end_time"=>[">",time()]])->field('id,room_id,periods,end_time')->order('periods desc')->find();
|
||||||
|
//寻乐会状态
|
||||||
|
$xlh_status = 0;
|
||||||
|
// 状态
|
||||||
|
$xlh_periods_num = Cache::get("xlh_periods_num") ?? 0;
|
||||||
|
if($xlh_periods_num >= $xlh_ext['open_condition']['start_num']){
|
||||||
|
$xlh_status = 1;//状态 1:巡乐会开始 2:即将开始 0:等待开始
|
||||||
|
} elseif($xlh_periods_num >= $xlh_ext['open_condition']['waiting_start_num'] && $xlh_periods_num < $xlh_ext['open_condition']['start_num']){
|
||||||
|
$xlh_status = 2;//状态 1:巡乐会开始 2:即将开始开始 0:等待开始
|
||||||
|
}else{
|
||||||
|
$xlh_status = 0;//未开始
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'activities_name' => $xlh_box['name'],
|
||||||
|
'icon' => null,
|
||||||
|
'xlh_status'=>$xlh_status,
|
||||||
|
'end_time'=>$xlh_data['end_time'] ?? 0,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 巡乐会榜单
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function xlh_ranking_list($room_id,$page=1,$page_size=12){
|
||||||
|
$gift_bag_id = 13;
|
||||||
|
$xlh_box = db::name('vs_gift_bag')->where('id',$gift_bag_id)->find();
|
||||||
|
$xlh_ext = json_decode($xlh_box['ext'],true);
|
||||||
|
$pan_xlh = db::name('vs_room_pan_xlh')
|
||||||
|
->order('id desc')
|
||||||
|
->page($page,$page_size)
|
||||||
|
->select();
|
||||||
|
$list = [];
|
||||||
|
foreach ($pan_xlh as $key=>$value){
|
||||||
|
$list[$key]['periods'] = "第".$value['periods']."期";
|
||||||
|
if(!empty($value['user_id'])){
|
||||||
|
$list[$key]['nickname'] = db::name('user')->where(['id'=>$value['user_id']])->value('nickname');
|
||||||
|
}else{
|
||||||
|
$list[$key]['nickname'] = "无";
|
||||||
|
}
|
||||||
|
if(!empty($value['gift_id'])){
|
||||||
|
$gift_data = db::name('vs_gift')->field('gift_name,base_image')->where(['gid'=>$value['gift_id']])->find();
|
||||||
|
$list[$key]['gift_name'] = 'x '.$value['num'].' '.$gift_data['gift_name'];
|
||||||
|
$list[$key]['base_image'] = $gift_data['base_image']??"";
|
||||||
|
}else{
|
||||||
|
$gift_data = db::name('vs_gift')->field('gift_name,base_image')->where(['gid'=>$xlh_ext['locking_condition']['locking_gift_id']])->find();
|
||||||
|
$list[$key]['gift_name'] = 'x 0 '.$gift_data['gift_name'];
|
||||||
|
$list[$key]['base_image'] = $gift_data['base_image']??"";
|
||||||
|
}
|
||||||
|
$list[$key]['createtime'] = $value['send_time'] ? date('Y-m-d H:i:s',$value['send_time']) : '' ;
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'code' => 1,
|
||||||
|
'msg' => '成功',
|
||||||
|
'data' => $list
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
//盲盒转盘开启状态
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
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
@@ -89,6 +89,78 @@ class Chat extends Model
|
|||||||
// RoomAuctionPK = 1037,
|
// RoomAuctionPK = 1037,
|
||||||
//送盲盒礼物推送文字消息
|
//送盲盒礼物推送文字消息
|
||||||
// RoomGiftBlindBox = 1038,
|
// RoomGiftBlindBox = 1038,
|
||||||
|
//换麦
|
||||||
|
// RoomChangePit = 1039,
|
||||||
|
|
||||||
|
//交友房间内发送消息
|
||||||
|
//交友房游戏阶段
|
||||||
|
// FriendRoomGameStart = 1049,
|
||||||
|
//交友房延时
|
||||||
|
// FriendRoomDelay = 1050,
|
||||||
|
//交友结束推送是否创建小房间
|
||||||
|
// FriendRoomEnd = 1051,
|
||||||
|
//交友房 私密小屋送礼增加结束时间
|
||||||
|
// FriendRoomGiftBlindBox = 1052,
|
||||||
|
//交友 房间换麦位
|
||||||
|
// FriendRoomChangePit = 1053,
|
||||||
|
//交友 心动值变化
|
||||||
|
// FriendRoomChangeCharm = 1054,
|
||||||
|
//交友 退出小房间
|
||||||
|
// FriendRoomQuit = 1055,
|
||||||
|
|
||||||
|
//盲盒转盘相关推送
|
||||||
|
//巡乐会进度推送
|
||||||
|
// BlindBoxTurnTableProgress = 1056,
|
||||||
|
//巡乐会抽奖结果推送
|
||||||
|
// BlindBoxTurnTableResult = 1057,
|
||||||
|
|
||||||
|
//直播群成员在离线状态变更
|
||||||
|
// RoomMemberOffline = 1058,
|
||||||
|
|
||||||
|
//清空个人魅力
|
||||||
|
// ClearUserCharm = 1059,
|
||||||
|
//发红包
|
||||||
|
// RedPacket = 1060,
|
||||||
|
//红包领完推送
|
||||||
|
// 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,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +170,7 @@ class Chat extends Model
|
|||||||
'Text' => $content
|
'Text' => $content
|
||||||
];
|
];
|
||||||
|
|
||||||
$data = model('Tencent')->send_group_system_notification('room'.$roomId,json_encode($text));
|
$data = model('api/Tencent')->send_group_system_notification('room'.$roomId,json_encode($text));
|
||||||
|
|
||||||
if($data['code'] == 0){
|
if($data['code'] == 0){
|
||||||
Log::record("腾讯发送群消息:".$data['msg'].$type,"info");
|
Log::record("腾讯发送群消息:".$data['msg'].$type,"info");
|
||||||
|
|||||||
@@ -85,8 +85,9 @@ class DailyTasks extends Model
|
|||||||
$reslut['tasks']['daily_tasks'] = [];//每日任务1
|
$reslut['tasks']['daily_tasks'] = [];//每日任务1
|
||||||
$reslut['tasks']['daily_tasks_special'] = [];//每日特殊任务2
|
$reslut['tasks']['daily_tasks_special'] = [];//每日特殊任务2
|
||||||
$reslut['tasks']['usual_tasks'] = [];//平台常规任务3
|
$reslut['tasks']['usual_tasks'] = [];//平台常规任务3
|
||||||
|
$reslut['tasks']['teacher_tasks'] = [];//师徒任务4
|
||||||
$data = db::name('vs_daily_tasks')
|
$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('delete_time',0)
|
||||||
->where('is_active',1)
|
->where('is_active',1)
|
||||||
->order('sort asc')->select();
|
->order('sort asc')->select();
|
||||||
@@ -99,10 +100,26 @@ class DailyTasks extends Model
|
|||||||
->where('task_id',$v['task_id'])
|
->where('task_id',$v['task_id'])
|
||||||
->whereTime('createtime', 'today')
|
->whereTime('createtime', 'today')
|
||||||
->find();
|
->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{
|
}else{
|
||||||
$user_daily_tasks = Db::name('vs_user_daily_tasks')->where('user_id',$user_id)->where('task_id',$v['task_id'])->find();
|
$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;
|
$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 = "";
|
$quantity_str = "";
|
||||||
if($v['target_quantity']!=1){
|
if($v['target_quantity']!=1){
|
||||||
$quantity_str= "({$progress}/{$v['target_quantity']})";
|
$quantity_str= "({$progress}/{$v['target_quantity']})";
|
||||||
@@ -129,19 +146,28 @@ class DailyTasks extends Model
|
|||||||
$v['task_type_str'] = "去签到";
|
$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['from_id'] = 0;
|
||||||
$v['is_time'] = 0;
|
$v['is_time'] = 0;
|
||||||
if(in_array($v['task_id'],[8,9])){
|
if(in_array($v['task_id'],[8,9])){
|
||||||
$v['processing_type'] = 2;
|
$v['processing_type'] = 2;
|
||||||
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
|
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
|
||||||
//跳转的房间路径
|
//跳转的房间路径
|
||||||
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6]])->orderRaw('rand()')->value('id');
|
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6],'apply_status'=>2])->orderRaw('rand()')->value('id');
|
||||||
$v['target_quantity'] = $v['target_quantity'] * 60;
|
$v['target_quantity'] = $v['target_quantity'] * 60;
|
||||||
$v['is_time'] = 1;
|
$v['is_time'] = 1;
|
||||||
}elseif(in_array($v['task_id'],[10])){
|
}elseif(in_array($v['task_id'],[10])){
|
||||||
$v['processing_type'] = 7;
|
$v['processing_type'] = 7;
|
||||||
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
|
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
|
||||||
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6]])->orderRaw('rand()')->value('id');
|
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6],'apply_status'=>2])->orderRaw('rand()')->value('id');
|
||||||
} else{
|
} else{
|
||||||
$v['processing_type'] = 9;
|
$v['processing_type'] = 9;
|
||||||
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
|
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
|
||||||
@@ -152,15 +178,18 @@ class DailyTasks extends Model
|
|||||||
$reslut['tasks']['daily_tasks'][] = $v;
|
$reslut['tasks']['daily_tasks'][] = $v;
|
||||||
}elseif ($v['task_type']==2) {
|
}elseif ($v['task_type']==2) {
|
||||||
$reslut['tasks']['daily_tasks_special'][] = $v;
|
$reslut['tasks']['daily_tasks_special'][] = $v;
|
||||||
}else{
|
}elseif ($v['task_type']==3) {
|
||||||
$reslut['tasks']['usual_tasks'][] = $v;
|
$reslut['tasks']['usual_tasks'][] = $v;
|
||||||
|
}elseif ($v['task_type']==4) {
|
||||||
|
$reslut['tasks']['teacher_tasks'][] = $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $reslut];
|
return ['code' => 1, 'msg' => '获取成功', 'data' => $reslut];
|
||||||
}
|
}
|
||||||
//完成每日任务
|
//完成每日任务
|
||||||
public function tasks_complete($user_id,$task_id){
|
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();
|
$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)){
|
if(empty($task_info)){
|
||||||
@@ -220,41 +249,83 @@ class DailyTasks extends Model
|
|||||||
|
|
||||||
//领取每日任务金币奖励
|
//领取每日任务金币奖励
|
||||||
public function daily_tasks_receive($user_id,$task_id){
|
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();
|
$task_info = Db::name('vs_daily_tasks')->where('task_id',$task_id)->find();
|
||||||
if (!$task_info) {
|
if (!$task_info) {
|
||||||
return ['code' => 0, 'msg' => '任务不存在','data' => null];
|
return ['code' => 0, 'msg' => '任务不存在','data' => null];
|
||||||
}
|
}
|
||||||
if($task_info['task_type']==3){
|
if($task_id!=17){
|
||||||
$user_daily_tasks = Db::name('vs_user_daily_tasks')->where('user_id',$user_id)->where('task_id',$task_id)->find();
|
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];
|
||||||
|
}
|
||||||
|
if ($user_daily_tasks['is_completed'] == 0) {
|
||||||
|
return ['code' => 0, 'msg' => '请完成该任务','data' => null];
|
||||||
|
}
|
||||||
|
if ($user_daily_tasks['is_claimed'] == 1) {
|
||||||
|
return ['code' => 0, 'msg' => '您已领取该奖励','data' => null];
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
$user_daily_tasks = Db::name('vs_user_daily_tasks')->where('user_id',$user_id)->where('task_id',$task_id)->whereTime('createtime', 'today')->find();
|
//师徒任务
|
||||||
}
|
//师傅签约返还
|
||||||
|
$user_sign_task = Db::name('vs_user_sign_task')->where(['user_id'=>$user_id,'day'=>date('Y-m-d')])->find();
|
||||||
if (!$user_daily_tasks) {
|
if (!$user_sign_task) {
|
||||||
return ['code' => 0, 'msg' => '请完成该任务','data' => null];
|
return ['code' => 0, 'msg' => '任务不存在或已结束','data' => null];
|
||||||
}
|
}
|
||||||
if ($user_daily_tasks['is_completed'] == 0) {
|
if($user_sign_task['status']==1){
|
||||||
return ['code' => 0, 'msg' => '请完成该任务','data' => null];
|
return ['code' => 0, 'msg' => '您已领取该奖励','data' => null];
|
||||||
}
|
}
|
||||||
if ($user_daily_tasks['is_claimed'] == 1) {
|
|
||||||
return ['code' => 0, 'msg' => '您已领取该奖励','data' => null];
|
|
||||||
}
|
}
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$reslut = Db::name('vs_user_daily_tasks')->where('id',$user_daily_tasks['id'])->update([
|
if($task_id==17){
|
||||||
'is_claimed' => 1,
|
//师徒任务
|
||||||
'updatetime' => time(),
|
$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_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) {
|
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(),
|
||||||
|
]);
|
||||||
|
if ($reslut) {
|
||||||
|
//操作用户金币
|
||||||
|
$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' => $res['msg'], 'data' => null];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
return ['code' => 0, 'msg' => $reslut['msg'], 'data' => null];
|
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Db::rollback();
|
|
||||||
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
|
|
||||||
}
|
}
|
||||||
// 提交事务
|
// 提交事务
|
||||||
Db::commit();
|
Db::commit();
|
||||||
@@ -342,10 +413,10 @@ class DailyTasks extends Model
|
|||||||
public function gift_bag_receive_list($user_id){
|
public function gift_bag_receive_list($user_id){
|
||||||
//查询每日任务礼盒记录
|
//查询每日任务礼盒记录
|
||||||
$gift_bag_receive_list = Db::name('vs_gift_bag_receive_log')
|
$gift_bag_receive_list = Db::name('vs_gift_bag_receive_log')
|
||||||
->field('bag.name as gift_bag_name,de.name as gift_name,re.createtime as createtime,de.quantity,de.type,de.foreign_id,de.days,de.gold')
|
->field('bag.name as gift_bag_name,re.createtime as createtime,de.name as gift_name,de.quantity,de.type,de.foreign_id,de.days,de.gold')
|
||||||
->alias('re')
|
->alias('re')
|
||||||
->join('vs_gift_bag bag', 'bag.id = re.gift_bag_id', 'LEFT')
|
->join('vs_gift_bag bag', 'bag.id = re.gift_bag_id', 'LEFT')
|
||||||
->join('vs_gift_bag_detail de', 'de.gift_bag_id = re.gift_bag_id','LEFT')
|
->join('vs_gift_bag_detail de', 'de.id = re.parent_id', 'LEFT')
|
||||||
->where(['re.user_id'=>$user_id,'bag.activities_id'=>2,'bag.status'=>1])
|
->where(['re.user_id'=>$user_id,'bag.activities_id'=>2,'bag.status'=>1])
|
||||||
->order('re.createtime desc')
|
->order('re.createtime desc')
|
||||||
->select();
|
->select();
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace app\api\model;
|
namespace app\api\model;
|
||||||
|
|
||||||
|
use think\Cache;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Session;
|
use think\Session;
|
||||||
@@ -15,9 +17,9 @@ class Decorate extends Model
|
|||||||
// 定义时间戳字段名
|
// 定义时间戳字段名
|
||||||
protected $createTime = 'createtime';
|
protected $createTime = 'createtime';
|
||||||
protected $updateTime = 'updatetime';
|
protected $updateTime = 'updatetime';
|
||||||
// 定义字段类型 1头像框 2坐骑 3麦圈 6个人靓号 7房间靓号 8工会靓号
|
// 定义字段类型 1头像框 2坐骑 3麦圈 6个人靓号 7房间靓号 8公会靓号
|
||||||
public $TypeArray = [1=>'头像框',2=>'坐骑',3=>'麦圈',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=>'财富等级特权赠送'];
|
protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送',8=>'新人充值好礼',9=>'爵位购买赠送',10=>'任务奖励',11=>"每日签到"];
|
||||||
public function __construct($data = [])
|
public function __construct($data = [])
|
||||||
{
|
{
|
||||||
parent::__construct($data);
|
parent::__construct($data);
|
||||||
@@ -27,6 +29,7 @@ class Decorate extends Model
|
|||||||
//获取装扮类型
|
//获取装扮类型
|
||||||
public function get_type_list($have_hot = 0)
|
public function get_type_list($have_hot = 0)
|
||||||
{
|
{
|
||||||
|
$no_show_ids = [7,8,3,10,11];
|
||||||
$label = $this->TypeArray;
|
$label = $this->TypeArray;
|
||||||
if ($have_hot) {
|
if ($have_hot) {
|
||||||
$label = [100 => '热门'] + array_filter($this->TypeArray, fn($key) => $key != 100, ARRAY_FILTER_USE_KEY);
|
$label = [100 => '热门'] + array_filter($this->TypeArray, fn($key) => $key != 100, ARRAY_FILTER_USE_KEY);
|
||||||
@@ -34,6 +37,9 @@ class Decorate extends Model
|
|||||||
$data = [];
|
$data = [];
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($label as $k => $v) {
|
foreach ($label as $k => $v) {
|
||||||
|
if (in_array($k, $no_show_ids)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$data[$i]['id'] = $k;
|
$data[$i]['id'] = $k;
|
||||||
$data[$i]['name'] = $v;
|
$data[$i]['name'] = $v;
|
||||||
++$i;
|
++$i;
|
||||||
@@ -71,11 +77,33 @@ class Decorate extends Model
|
|||||||
'a.type' => $type,
|
'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) {
|
foreach ($list as $k => &$v) {
|
||||||
$v['base_image'] = localpath_to_netpath($v['base_image']);
|
$v['base_image'] = localpath_to_netpath($v['base_image']);
|
||||||
$v['play_image'] = localpath_to_netpath($v['play_image']);
|
$v['play_image'] = localpath_to_netpath($v['play_image']);
|
||||||
$v['price'] = (int)$v['price'];
|
$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];
|
return ['code' => 1, 'msg' => '获取成功', 'data' => $list];
|
||||||
}
|
}
|
||||||
@@ -86,19 +114,26 @@ class Decorate extends Model
|
|||||||
if (!$decorate) {
|
if (!$decorate) {
|
||||||
return ['code' => 0, 'msg' => '参数错误'];
|
return ['code' => 0, 'msg' => '参数错误'];
|
||||||
}
|
}
|
||||||
$decorate_price = DB::name('vs_decorate_price')->where(['did' => $did, 'is_delete' => 1])->order('day asc')->select();
|
if($decorate['type'] == 12){
|
||||||
if (!$decorate_price) {
|
$result['title'] = $decorate['title'];
|
||||||
return ['code' => 0, 'msg' => '参数错误'];
|
$result['price'] = (int)$decorate['price'];
|
||||||
}
|
$result['base_image'] = localpath_to_netpath($decorate['base_image']);
|
||||||
$result['title'] = $decorate['title'];
|
}else{
|
||||||
foreach ($decorate_price as $k => $v) {
|
$decorate_price = DB::name('vs_decorate_price')->where(['did' => $did, 'is_delete' => 1])->order('day asc')->select();
|
||||||
$result['price_list'][$k]['price'] = (int)$v['price'];
|
if (!$decorate_price) {
|
||||||
$result['price_list'][$k]['discount'] = $v['discount'];
|
return ['code' => 0, 'msg' => '参数错误'];
|
||||||
$result['price_list'][$k]['day'] = $v['day'];
|
}
|
||||||
//月
|
$result['title'] = $decorate['title'];
|
||||||
$result['price_list'][$k]['month'] = $v['day']/30;
|
foreach ($decorate_price as $k => $v) {
|
||||||
//有效期至
|
$result['price_list'][$k]['price'] = (int)$v['price'];
|
||||||
$result['price_list'][$k]['end_time'] = date('Y-m-d',strtotime("+".$v['day']." day"));
|
$result['price_list'][$k]['original_price'] = $v['original_price'];
|
||||||
|
$result['price_list'][$k]['discount'] = $v['discount'];
|
||||||
|
$result['price_list'][$k]['day'] = $v['day'];
|
||||||
|
//月
|
||||||
|
$result['price_list'][$k]['month'] = $v['day']/30;
|
||||||
|
//有效期至
|
||||||
|
$result['price_list'][$k]['end_time'] = date('Y-m-d',strtotime("+".$v['day']." day"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $result];
|
return ['code' => 1, 'msg' => '获取成功', 'data' => $result];
|
||||||
}
|
}
|
||||||
@@ -113,7 +148,12 @@ class Decorate extends Model
|
|||||||
* @param $log_remark 日志备注
|
* @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)){
|
if(empty($log_remark)){
|
||||||
$log_remark = $this->FromType[$from_type];
|
$log_remark = $this->FromType[$from_type];
|
||||||
}
|
}
|
||||||
@@ -125,32 +165,38 @@ class Decorate extends Model
|
|||||||
$map = [];
|
$map = [];
|
||||||
$map = [
|
$map = [
|
||||||
'did' => $did,
|
'did' => $did,
|
||||||
'is_buy' => 1,
|
|
||||||
'delete_time' => 0,
|
'delete_time' => 0,
|
||||||
];
|
];
|
||||||
$decorate_info = DB::name($this->table)->where($map)->find();
|
$decorate_info = DB::name($this->table)->where($map)->find();
|
||||||
if(!$decorate_info){
|
if(!$decorate_info){
|
||||||
return ['code' => 0, 'msg' => '该装扮不存在'.$did, 'data' => null];
|
return ['code' => 0, 'msg' => '该装扮不存在'.$did, 'data' => null];
|
||||||
}
|
}
|
||||||
//该天数是否存在
|
if($decorate_info['type'] != 12){
|
||||||
$map = [];
|
//该天数是否存在
|
||||||
$map = [
|
$map = [];
|
||||||
'did' => $did,
|
$map = [
|
||||||
'day' => $day,
|
'did' => $did,
|
||||||
'is_delete' => 1,
|
'day' => $day,
|
||||||
];
|
'is_delete' => 1,
|
||||||
$decorate_price_info = db::name('vs_decorate_price')->where($map)->find();
|
];
|
||||||
if(!$decorate_price_info){
|
$decorate_price_info = db::name('vs_decorate_price')->where($map)->find();
|
||||||
return ['code' => 0, 'msg' => '该装扮天数不存在', 'data' => null];
|
if(!$decorate_price_info){
|
||||||
}
|
return ['code' => 0, 'msg' => '该装扮天数不存在', 'data' => null];
|
||||||
if($decorate_info['type'] == 6 && $decorate_info['is_user_buy'] == 1){
|
}
|
||||||
return ['code' => 0, 'msg' => '该个人靓号已被购买', 'data' => null];
|
if($decorate_info['type'] == 6 && $decorate_info['is_user_buy'] == 1){
|
||||||
}
|
return ['code' => 0, 'msg' => '该个人靓号已被购买', 'data' => null];
|
||||||
if($decorate_info['type'] == 7 && $decorate_info['is_user_buy'] == 1){
|
}
|
||||||
return ['code' => 0, 'msg' => '该房间靓号已被购买', 'data' => null];
|
if($decorate_info['type'] == 7 && $decorate_info['is_user_buy'] == 1){
|
||||||
}
|
return ['code' => 0, 'msg' => '该房间靓号已被购买', 'data' => null];
|
||||||
if($decorate_info['type'] == 8 && $decorate_info['is_user_buy'] == 1){
|
}
|
||||||
return ['code' => 0, 'msg' => '该工会靓号已被购买', 'data' => null];
|
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();
|
$start_time = $now_time = time();
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
@@ -194,24 +240,37 @@ class Decorate extends Model
|
|||||||
if($decorate_price_info['day'] == 0){//如果礼物购买配置的天数为0,则永久有效
|
if($decorate_price_info['day'] == 0){//如果礼物购买配置的天数为0,则永久有效
|
||||||
$data['is_using'] = 1;
|
$data['is_using'] = 1;
|
||||||
$data['end_time'] = 0;
|
$data['end_time'] = 0;
|
||||||
|
$data['is_perpetual'] = 1;
|
||||||
}else{
|
}else{
|
||||||
$change_time = $day * 24 * 3600;
|
$change_time = $day * 24 * 3600;
|
||||||
$data['is_using'] = 2;
|
$data['is_using'] = 2;
|
||||||
$data['end_time'] = $now_time + $change_time;
|
$data['end_time'] = $now_time + $change_time;
|
||||||
}
|
}
|
||||||
$data['createtime'] = $now_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);
|
$result = db::name('vs_user_decorate')->insert($data);
|
||||||
}else{
|
}else{
|
||||||
if($decorate_price_info['day'] > 0){//是不是永久礼物
|
if($decorate_info['type'] == 12){
|
||||||
if($decorate_price_info['price']<=0 && $user_decorate_data['end_time'] > $now_time + $change_time){
|
$result = db::name('vs_user_decorate')->where('udid', $user_decorate_data['udid'])->update([
|
||||||
return ['code' => 0, 'msg' => '您已购买过此装扮,请勿重复购买', 'data' => null];
|
'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'] = time();
|
||||||
|
}
|
||||||
|
$change_time = $day * 24 * 3600;
|
||||||
|
$update['is_using'] = 2;
|
||||||
|
$update['end_time'] = $user_decorate_data['end_time'] + $change_time;
|
||||||
|
$result = db::name('vs_user_decorate')->where('udid', $user_decorate_data['udid'])->update($update);
|
||||||
|
$start_time = $update['end_time'];
|
||||||
}
|
}
|
||||||
$change_time = $day * 24 * 3600;
|
|
||||||
$update['is_using'] = 2;
|
|
||||||
$update['end_time'] = $user_decorate_data['end_time'] + $change_time;
|
|
||||||
$result = db::name('vs_user_decorate')->where('udid', $user_decorate_data['udid'])->update($update);
|
|
||||||
$start_time = $update['end_time'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!$result){
|
if(!$result){
|
||||||
@@ -250,30 +309,39 @@ class Decorate extends Model
|
|||||||
}catch (\Exception $e) {
|
}catch (\Exception $e) {
|
||||||
// 回滚事务
|
// 回滚事务
|
||||||
Db::rollback();
|
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){
|
public function user_decorate($uid, $type,$page=1, $limit=10){
|
||||||
|
if($type == 12){
|
||||||
$reslut = db::name('vs_user_decorate')
|
$reslut = db::name('vs_user_decorate')
|
||||||
->alias('ud')->join('vs_decorate d', 'ud.did = d.did')
|
->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')
|
->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.user_id', $uid)
|
||||||
->where('ud.type', $type)
|
->where('ud.type', $type)
|
||||||
->where(['ud.end_time'=>[">=",time()]])
|
->where(['ud.num'=>[">",0]])
|
||||||
->page($page, $limit)
|
->page($page, $limit)
|
||||||
->select();
|
->select();
|
||||||
foreach($reslut as $k => &$v){
|
}else{
|
||||||
$remaining_day = ceil(($v['end_time'] - time())/86400);
|
$reslut = db::name('vs_user_decorate')
|
||||||
if($remaining_day <= 0){
|
->alias('ud')->join('vs_decorate d', 'ud.did = d.did')
|
||||||
$remaining_day = 0;
|
->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')
|
||||||
|
->where('ud.user_id', $uid)
|
||||||
|
->where('ud.type', $type)
|
||||||
|
->where(['ud.end_time'=>[">=",time()]])
|
||||||
|
->page($page, $limit)
|
||||||
|
->select();
|
||||||
|
foreach($reslut as $k => &$v){
|
||||||
|
$remaining_day = ceil(($v['end_time'] - time())/86400);
|
||||||
|
if($remaining_day <= 0){
|
||||||
|
$remaining_day = 0;
|
||||||
|
}
|
||||||
|
//剩余天数 取整
|
||||||
|
$v['remaining_day'] = $v['is_perpetual']==1 ? '永久' :$remaining_day;
|
||||||
|
$v['end_time'] = date('Y-m-d H:i:s', $v['end_time']);
|
||||||
}
|
}
|
||||||
//剩余天数 取整
|
|
||||||
$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];
|
return ['code' => 1, 'msg' => "获取成功", 'data' => $reslut];
|
||||||
}
|
}
|
||||||
@@ -290,10 +358,15 @@ class Decorate extends Model
|
|||||||
if (empty($info)) {
|
if (empty($info)) {
|
||||||
return ['code' => 0, 'msg' => '装扮不存在', 'data' => null];
|
return ['code' => 0, 'msg' => '装扮不存在', 'data' => null];
|
||||||
}
|
}
|
||||||
if ($info['end_time'] < time()) {
|
if($info['type'] == 12){
|
||||||
return ['code' => 0, 'msg' => '装扮已过期', 'data' => null];
|
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();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
//清理该类型装扮使用状态
|
//清理该类型装扮使用状态
|
||||||
@@ -318,6 +391,9 @@ class Decorate extends Model
|
|||||||
$data = [];
|
$data = [];
|
||||||
$data['is_using'] = 1;
|
$data['is_using'] = 1;
|
||||||
$data['updatetime'] = time();
|
$data['updatetime'] = time();
|
||||||
|
if($info['type'] == 12){
|
||||||
|
$data['num'] = $info['num'] - 1;
|
||||||
|
}
|
||||||
$reslut = Db::name('vs_user_decorate')->where($map)->update($data);
|
$reslut = Db::name('vs_user_decorate')->where($map)->update($data);
|
||||||
if (!$reslut) {
|
if (!$reslut) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
@@ -325,20 +401,51 @@ class Decorate extends Model
|
|||||||
}
|
}
|
||||||
// 提交事务
|
// 提交事务
|
||||||
Db::commit();
|
Db::commit();
|
||||||
//推送信息去所在房间
|
if($info['type'] == 12){
|
||||||
//查询当前所在房间
|
//使用降身卡,降低用户身价
|
||||||
$room_id = db::name('vs_room_visitor')->where(['user_id' => $uid])->order('id' , 'desc')->value('room_id');
|
$reduce_ratio = db::name('vs_decorate')->where(['did' => $info['did']])->value('ext_value') ?? 0;
|
||||||
if($room_id){
|
$market_value = db::name('user')->where(['id' => $uid])->value('market_value');
|
||||||
//当前用户信息
|
if($reduce_ratio){
|
||||||
//推送信息
|
$reduce_market_value = $market_value * ($reduce_ratio / 100);
|
||||||
$text['jia_jia'] = model('Decorate')->user_decorate_detail($uid,2);
|
}else{
|
||||||
$text['FromUserInfo'] = db::name('user')->where('id',$uid)->field('id as user_id,nickname,avatar,sex')->find();
|
$reduce_market_value = 0;
|
||||||
$text['FromUserInfo']['dress'] = model('Decorate')->user_decorate_detail($uid,1);
|
}
|
||||||
$text['FromUserInfo']['mic_dress'] = model('Decorate')->user_decorate_detail($uid,4);
|
if($reduce_market_value > 0){
|
||||||
$text['FromUserInfo']['chat_dress'] = model('Decorate')->user_decorate_detail($uid,5);
|
$up_market_value = $market_value - $reduce_market_value;
|
||||||
$text['text'] = '用户 ' . $text['FromUserInfo']['nickname'] .' 修改了信息';
|
if($up_market_value < 1){
|
||||||
model('Chat')->sendMsg(1035,$room_id,$text,$uid);
|
$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');
|
||||||
|
if($room_id){
|
||||||
|
//当前用户信息
|
||||||
|
//推送信息
|
||||||
|
$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_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];
|
return ['code' => 1, 'msg' => "设置成功", 'data' => null];
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 回滚事务
|
// 回滚事务
|
||||||
@@ -361,60 +468,81 @@ class Decorate extends Model
|
|||||||
if (!$reslut) {
|
if (!$reslut) {
|
||||||
return ['code' => 0, 'msg' => "取消装扮失败", 'data' => null];
|
return ['code' => 0, 'msg' => "取消装扮失败", 'data' => null];
|
||||||
}
|
}
|
||||||
|
//更新装备缓存
|
||||||
|
$cache_key = 'user_base_info_'.$uid;
|
||||||
|
Cache::rm($cache_key);
|
||||||
return ['code' => 1, 'msg' => "取消成功", 'data' => null];
|
return ['code' => 1, 'msg' => "取消成功", 'data' => null];
|
||||||
}
|
}
|
||||||
|
|
||||||
//用户装扮详情
|
//用户装扮详情
|
||||||
/*
|
/*
|
||||||
* @param $id 对象id
|
* @param $id 对象id
|
||||||
* @param $type 装扮类型 1头像框 2坐骑 3麦圈 6个人靓号 7房间靓号 8工会靓号
|
* @param $type 装扮类型 1头像框 2坐骑 3麦圈 6个人靓号 7房间靓号 8公会靓号
|
||||||
*/
|
*/
|
||||||
public function user_decorate_detail($id, $type){
|
public function user_decorate_detail($id, $type){
|
||||||
//根据$type 组装查询条件
|
//根据$type 组装查询条件
|
||||||
$reslut = "";
|
$reslut = "";
|
||||||
|
$map = [
|
||||||
|
'type' => $type,
|
||||||
|
'is_using' => 1
|
||||||
|
];
|
||||||
if($type == 7){//7房间靓号 8工会靓号
|
if($type == 7){//7房间靓号 8工会靓号
|
||||||
$room = db::name('vs_room')->where('id', $id)->field('user_id,room_number')->find();
|
$room = db::name('vs_room')->where('id', $id)->field('user_id,room_number')->find();
|
||||||
if(empty($room)){
|
if(empty($room)){
|
||||||
return $reslut;
|
return $reslut;
|
||||||
}
|
}
|
||||||
$map = [
|
$map['user_id'] = $room['user_id'];
|
||||||
'user_id' => $room['user_id']??0,
|
$user_decorate = db::name('vs_user_decorate')->where($map)->order('createtime', 'desc')->find();
|
||||||
'type' => $type,
|
if(empty($user_decorate)){
|
||||||
'is_using' => 1
|
return $room['room_number'];
|
||||||
];
|
}
|
||||||
$reslut = db::name('vs_user_decorate')->where($map)->where('end_time',['>=',time()],'or')->value('special_num') ?? $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){
|
}elseif($type == 8){
|
||||||
$guild = db::name('vs_guild')->where('id', $id)->field('user_id,guild_special_id')->find();
|
$guild = db::name('vs_guild')->where('id', $id)->field('user_id,guild_special_id')->find();
|
||||||
$map = [
|
if(empty($guild)){
|
||||||
'user_id' => $guild['user_id']??0,
|
return $reslut;
|
||||||
'type' => $type,
|
}
|
||||||
'is_using' => 1
|
$map['user_id'] = $guild['user_id'];
|
||||||
];
|
$user_decorate = db::name('vs_user_decorate')->where($map)->order('createtime', 'desc')->find();
|
||||||
$reslut = db::name('vs_user_decorate')->where($map)->where('end_time',['>=',time()],'or')->value('special_num') ?? $guild['guild_special_id'];
|
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){
|
}elseif($type == 6){
|
||||||
$map = [
|
|
||||||
'user_id' => $id??0,
|
|
||||||
'type' => $type,
|
|
||||||
'is_using' => 1
|
|
||||||
];
|
|
||||||
$user_code = db::name('user')->where('id', $id)->value('user_code');
|
$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{
|
}else{
|
||||||
$map = [
|
$map['user_id'] = $id;
|
||||||
'user_id' => $id??0,
|
$user_decorate = db::name('vs_user_decorate')->where($map)->order('createtime', 'desc')->find();
|
||||||
'type' => $type,
|
if(empty($user_decorate)){
|
||||||
'is_using' => 1
|
return $reslut;
|
||||||
];
|
}
|
||||||
$did = db::name('vs_user_decorate')->where($map)->where('end_time',['>=',time()],'or')->value('did');
|
if($user_decorate['is_perpetual']==2 && $user_decorate['end_time'] < time()){
|
||||||
if(empty($did)){
|
return $reslut;
|
||||||
$reslut = '';//返回数据
|
}
|
||||||
|
if(in_array($type, [9,12])){
|
||||||
|
$reslut = db::name('vs_decorate')->where('did', $user_decorate['did'])->value('base_image');
|
||||||
}else{
|
}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;
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
830
application/api/model/Friend.php
Normal file
830
application/api/model/Friend.php
Normal file
@@ -0,0 +1,830 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\model;
|
||||||
|
|
||||||
|
use think\Db;
|
||||||
|
use think\Log;
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
|
class Friend extends Model
|
||||||
|
{
|
||||||
|
public function start_friend($user_id, $room_id){
|
||||||
|
// 判断用户是否在主持麦
|
||||||
|
$host = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => 9,'user_id' => $user_id])->find();
|
||||||
|
if(!$host){
|
||||||
|
return ['code' => 0, 'msg' => '没有权限操作', 'data' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
$room_info = db::name('vs_room')->field('id,step,room_status')->where(['id' => $room_id,'room_status' =>1])->find();
|
||||||
|
if (!$room_info) {
|
||||||
|
return ['code' => 0, 'msg' => '房间不存在!', 'data' => null];
|
||||||
|
}
|
||||||
|
if($room_info['step'] == 2 || $room_info['step'] == 3){
|
||||||
|
return ['code' => 0, 'msg' => '交友正在进行中!', 'data' => null];
|
||||||
|
}
|
||||||
|
//在麦位上的用户
|
||||||
|
$pit_user = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => ['<',7],'user_id' => ['<>',0]])->count();
|
||||||
|
|
||||||
|
if($pit_user >= 2) {
|
||||||
|
$data['room_id'] = $room_id;
|
||||||
|
$data['end_time'] = time() + get_system_config_value('friend_time') * 60;
|
||||||
|
$data['create_time'] = time();
|
||||||
|
$data['status'] = 1;
|
||||||
|
|
||||||
|
$id = db::name('vs_user_friending')->insertGetId($data);
|
||||||
|
|
||||||
|
if (!$id) {
|
||||||
|
return ['code' => 0, 'msg' => '操作失败!', 'data' => null];
|
||||||
|
}
|
||||||
|
//修改房间状态
|
||||||
|
db::name('vs_room')->where(['id' => $room_id])->update(['step' => 2]);
|
||||||
|
//清除房间用户的魅力
|
||||||
|
model('Room')->clear_user_charm($user_id, $room_id);
|
||||||
|
|
||||||
|
//推送给前端消息
|
||||||
|
$text['text'] = '交友开始';
|
||||||
|
$text['step'] = 2;
|
||||||
|
$text['friend_id'] = $id;
|
||||||
|
$text['end_time'] = $data['end_time'];
|
||||||
|
model('api/Chat')->sendMsg(1049,$room_id,$text);
|
||||||
|
return ['code' => 1, 'msg' => '操作成功!', 'data' => ['friend_id' => $id]];
|
||||||
|
}else{
|
||||||
|
return ['code' => 0, 'msg' => '交友麦位至少两位用户才能开始', 'data' => null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//延时
|
||||||
|
public function delay($user_id,$room_id,$id,$delay_times){
|
||||||
|
// 判断用户是否在主持麦
|
||||||
|
$host = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => 9,'user_id' => $user_id])->find();
|
||||||
|
if(!$host){
|
||||||
|
return ['code' => 0, 'msg' => '没有权限操作', 'data' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$id || !$room_id) {
|
||||||
|
return ['code' => 0, 'msg' => '参数有误!', 'data' => null];
|
||||||
|
}
|
||||||
|
if($delay_times <= 0){
|
||||||
|
$delay_times = get_system_config_value('friend_delay_times');
|
||||||
|
}
|
||||||
|
//修改结束 时间
|
||||||
|
$res = db::name('vs_user_friending')->where('id', $id)->update([
|
||||||
|
'end_time' => Db::raw('end_time + ' . ($delay_times * 60))
|
||||||
|
]);
|
||||||
|
if(!$res){
|
||||||
|
return ['code' => 0, 'msg' => '操作失败!', 'data' => null];
|
||||||
|
}
|
||||||
|
//推送延时
|
||||||
|
$text['text'] = '延时';
|
||||||
|
$text['friend_id'] = $id;
|
||||||
|
$text['end_time'] = db::name('vs_user_friending')->where('id', $id)->value('end_time');
|
||||||
|
model('api/Chat')->sendMsg(1050,$room_id,$text);
|
||||||
|
return ['code' => 1, 'msg' => '操作成功!', 'data' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
//交友结束(结束牵手良缘)
|
||||||
|
public function end_friend($user_id,$room_id,$id,$is_system = 0){
|
||||||
|
if (!$id || !$room_id) {
|
||||||
|
return ['code' => 0, 'msg' => '参数有误!', 'data' => null];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($is_system == 0){
|
||||||
|
// 判断用户是否在主持麦
|
||||||
|
$host = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => 9,'user_id' => $user_id])->find();
|
||||||
|
if(!$host){
|
||||||
|
return ['code' => 0, 'msg' => '没有权限操作', 'data' => null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取心动值最高的
|
||||||
|
$originalPairs = db::name('vs_user_friending_heart')
|
||||||
|
->where(['room_id'=>$room_id,'friend_id'=>$id ,'status' =>1])
|
||||||
|
->order('heart_value DESC')->find();
|
||||||
|
$friend_heart_value = get_system_config_value('friend_heart_value');
|
||||||
|
if($originalPairs && $originalPairs['heart_value'] >= $friend_heart_value){
|
||||||
|
$step = 3;//结束进入牵手良缘卡关系
|
||||||
|
//心动值达到伐值 返回用户信息与关系列表
|
||||||
|
$return['user1_id'] =$originalPairs['user1_id'];
|
||||||
|
$return['user1_avatar'] = db::name('user')->where(['id'=>$originalPairs['user1_id']])->value('avatar');
|
||||||
|
$return['user1_nickname'] = db::name('user')->where(['id'=>$originalPairs['user1_id']])->value('nickname');
|
||||||
|
$return['user2_id'] =$originalPairs['user2_id'];
|
||||||
|
$return['user2_avatar'] = db::name('user')->where(['id'=>$originalPairs['user2_id']])->value('avatar');
|
||||||
|
$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');
|
||||||
|
$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;//结束下一轮
|
||||||
|
// 修改当前交友阶段 分开写 放到前面是为了下麦
|
||||||
|
db::name('vs_room')->where(['id' => $room_id])->update(['step' => 1]);
|
||||||
|
//所有人下麦
|
||||||
|
$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('api/RoomPit')->DownPit($pit['user_id'], $room_id,$pit['pit_number']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$return = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//结束交友游戏
|
||||||
|
if($step == 1){
|
||||||
|
db::name('vs_user_friending')->where(['id' => $id])->update(['status' => 2,'update_time' => time()]);
|
||||||
|
}
|
||||||
|
//推送给前端消息
|
||||||
|
$text['text'] = $step == 1 ? '交友结束' : '牵手良缘';
|
||||||
|
$text['step'] = $step;//1 等待邂逅 2 心动连线 3 牵手良缘
|
||||||
|
$text['friend_user'] = $return;
|
||||||
|
$text['friend_id'] = $id;
|
||||||
|
model('api/Chat')->sendMsg(1049,$room_id,$text);
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
|
//心动值超过配置值 创建关系
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
|
$user1 = min($user1_id, $user2_id);
|
||||||
|
$user2 = max($user1_id, $user2_id);
|
||||||
|
$friending_heart = db::name('vs_user_friending_heart')
|
||||||
|
->where(['room_id'=>$room_id,'friend_id'=>$friend_id ,'user1_id' =>$user1,'user2_id' => $user2])->order('id desc')->find();
|
||||||
|
|
||||||
|
$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){
|
||||||
|
//创建小房间
|
||||||
|
$room_ids = model('api/Room')->user_create_room($user1,'的电影房',get_system_config_value('web_site').'/data/avatar/head_pic.png','交友房产生的一次性房间',7);
|
||||||
|
if($room_ids['code'] != 1){
|
||||||
|
$msg = 'cp电影房创建失败';
|
||||||
|
}else{
|
||||||
|
//记录小房间
|
||||||
|
$datda = [
|
||||||
|
'room_id' => $room_ids['data'],
|
||||||
|
'relation_id' => $friending_config_id,
|
||||||
|
'user_id' => $user1,
|
||||||
|
'user_id1' => $user2,
|
||||||
|
'time_day' => time() + get_system_config_value('friend_room_timea') * 60,
|
||||||
|
'createtime' => time(),
|
||||||
|
'status' => 1,
|
||||||
|
'type' => 1
|
||||||
|
];
|
||||||
|
db::name('vs_room_cp_movie')->insert($datda);
|
||||||
|
|
||||||
|
if($room_ids['data']){
|
||||||
|
$text['text'] = '交友结束并创建房间';
|
||||||
|
$text['room_id'] = $room_ids['data'];//前端用来让用户跳转的房间id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$text['text'] = '交友结束未创建房间';
|
||||||
|
}
|
||||||
|
|
||||||
|
$text['relation_name'] = $relation;
|
||||||
|
$text['user1_id'] = $user1;
|
||||||
|
$text['user2_id'] = $user2;
|
||||||
|
$text['user1_avatar'] = db::name('user')->where(['id'=>$user1])->value('avatar');
|
||||||
|
$text['user1_nickname'] = db::name('user')->where(['id'=>$user1])->value('nickname');
|
||||||
|
$text['user2_avatar'] = db::name('user')->where(['id'=>$user2])->value('avatar');
|
||||||
|
$text['user2_nickname'] = db::name('user')->where(['id'=>$user2])->value('nickname');
|
||||||
|
model('api/Chat')->sendMsg(1051,$room_id,$text);
|
||||||
|
|
||||||
|
$shijian = floor($friending_heart['heart_value']/get_system_config_value('friend_heart_value')) * get_system_config_value('friend_heart_times');
|
||||||
|
$friendendtime = time() + $shijian * 3600;
|
||||||
|
|
||||||
|
//更新关系结束时间
|
||||||
|
db::name('vs_user_friending_heart')->where(['id'=>$friending_heart['id']])->update(['contact_end_time' => $friendendtime]);
|
||||||
|
|
||||||
|
//关系增加时间
|
||||||
|
$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' => 0, 'msg' => '创建关系失败!', 'data' => null];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//退出私密房间
|
||||||
|
public function outRoom($type,$room_id){
|
||||||
|
//推送给前端消息
|
||||||
|
$text['text'] = '退出私密小屋';
|
||||||
|
model('api/Chat')->sendMsg(1055,$room_id,$text);
|
||||||
|
|
||||||
|
|
||||||
|
//注销房间
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//房间内送礼
|
||||||
|
/*
|
||||||
|
* @param $uid 用户id
|
||||||
|
* @param $to_uid 接收用户id组
|
||||||
|
* @param $gift_id 礼物id
|
||||||
|
* @param $gift_num 礼物数量
|
||||||
|
* @param $from_type 来源 1聊天送礼物 2房间语聊送礼 3直播送礼 4动态打赏 5系统任务 6-cp房间送礼
|
||||||
|
* @param $type 1金币购买 2送背包礼物
|
||||||
|
* @param $room_id 房间id
|
||||||
|
* @param $pit_number 坑位
|
||||||
|
*/
|
||||||
|
public function room_give_gift($uid, $to_uid,$room_id,$res,$heart_id = 0)
|
||||||
|
{
|
||||||
|
//送礼成功后续操作
|
||||||
|
$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;
|
||||||
|
$user_idd = $to_uid;
|
||||||
|
|
||||||
|
if($heart_id){//有这个值就是助力 不参加抢麦操作
|
||||||
|
db::name('vs_user_friending_heart')->where(['id' => $heart_id])->setInc('heart_value', $sumPrice);
|
||||||
|
// $this->pullHeartChange($room_id,$friend['id']);//聊天室心动值变化通知 注释掉是因为下面那个函数会处理
|
||||||
|
//生成新排名 判断抱上麦 还是换麦
|
||||||
|
$this->pullUserPit($room_id,$friend['id']);
|
||||||
|
}else{
|
||||||
|
//判断送礼人或收礼人里面有主持和嘉宾
|
||||||
|
$host = $this->is_host($uid,$to_uid,$room_id);
|
||||||
|
$user_idd = explode(",", $user_idd); // 将字符串转换为数组
|
||||||
|
//判断是否是主持
|
||||||
|
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']); // 从数组中移除
|
||||||
|
if($user_idd){
|
||||||
|
//插入/更新心动表
|
||||||
|
$this->addUserHeart($uid,$user_idd,$friend['id'],$sumPrice,$room_id,$res['data']['gift_user_data']);
|
||||||
|
//送礼产生心动值并计算 判断拉取用户上麦还是换麦
|
||||||
|
//生成新排名 判断抱上麦 还是换麦
|
||||||
|
$this->pullUserPit($room_id,$friend['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//插入/更新心动表
|
||||||
|
$this->addUserHeart($uid,$user_idd,$friend['id'],$sumPrice,$room_id,$res['data']['gift_user_data']);
|
||||||
|
//送礼产生心动值并计算 判断拉取用户上麦还是换麦
|
||||||
|
//生成新排名 判断抱上麦 还是换麦
|
||||||
|
$this->pullUserPit($room_id,$friend['id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ['code' => 1, 'msg' => '送礼成功', 'data' => $res['data']];
|
||||||
|
}
|
||||||
|
|
||||||
|
//是否主持
|
||||||
|
public function is_host($uid,$to_uid,$room_id){
|
||||||
|
//获取当前主持人和嘉宾
|
||||||
|
$host[] = db::name('vs_room_pit')->where(['room_id' => $room_id,'pit_number' => 9])->value('user_id');
|
||||||
|
$host[] = db::name('vs_room_pit')->where(['room_id' => $room_id,'pit_number' => 10])->value('user_id');
|
||||||
|
|
||||||
|
$is_preside_user = [];
|
||||||
|
$is_preside = 0;
|
||||||
|
$user_ids = explode(",", $to_uid);
|
||||||
|
foreach ($user_ids as $value) {
|
||||||
|
//判断收礼人是否是主持
|
||||||
|
if (in_array($value, $host)) {
|
||||||
|
$is_preside = 1;//是主持
|
||||||
|
$is_preside_user[] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//送礼人是主持或嘉宾
|
||||||
|
if (in_array($uid, $host)) {
|
||||||
|
$is_preside = 1;//是嘉宾
|
||||||
|
$is_preside_user[] = $uid;
|
||||||
|
}
|
||||||
|
return ['is_preside' =>$is_preside,'is_preside_user' => $is_preside_user];
|
||||||
|
}
|
||||||
|
|
||||||
|
function pullHeartChange($room_id,$friend_id){
|
||||||
|
//聊天室心动值变化通知
|
||||||
|
$newRanking = $this->getRanking($room_id,$friend_id);
|
||||||
|
//心动值和心动表id
|
||||||
|
if(!isset($newRanking[0]['heart_value']) || $newRanking[0]['heart_value'] <= 0){
|
||||||
|
$heart1 = -1;
|
||||||
|
$heartId1 = -1;
|
||||||
|
}else{
|
||||||
|
$heart1 = $newRanking[0]['heart_value'];
|
||||||
|
$heartId1 = $newRanking[0]['id'];
|
||||||
|
}
|
||||||
|
if(!isset($newRanking[1]['heart_value']) || $newRanking[1]['heart_value'] <= 0){
|
||||||
|
$heart2 = -1;
|
||||||
|
$heartId2 = -1;
|
||||||
|
}else{
|
||||||
|
$heart2 = $newRanking[1]['heart_value'];
|
||||||
|
$heartId2 = $newRanking[1]['id'];
|
||||||
|
}
|
||||||
|
if(!isset($newRanking[2]['heart_value']) || $newRanking[2]['heart_value'] <= 0){
|
||||||
|
$heart3 = -1;
|
||||||
|
$heartId3 = -1;
|
||||||
|
}else{
|
||||||
|
$heart3 = $newRanking[2]['heart_value'];
|
||||||
|
$heartId3 = $newRanking[2]['id'];
|
||||||
|
}
|
||||||
|
$heart[0] = [
|
||||||
|
"heartNum" => $heart1,
|
||||||
|
"heartId" => $heartId1,
|
||||||
|
];
|
||||||
|
$heart[1] = [
|
||||||
|
"heartNum" => $heart2,
|
||||||
|
"heartId" => $heartId2,
|
||||||
|
];
|
||||||
|
$heart[2] = [
|
||||||
|
"heartNum" => $heart3,
|
||||||
|
"heartId" => $heartId3,
|
||||||
|
];
|
||||||
|
|
||||||
|
// $push = new Push(0, $this->room_id); //实例化推送类
|
||||||
|
// $push->heartChatRoom($heart);
|
||||||
|
//推送给前端消息
|
||||||
|
$text['text'] = '心动值变化通知';
|
||||||
|
$text['list'] = $heart;
|
||||||
|
model('api/Chat')->sendMsg(1054,$room_id,$text);
|
||||||
|
return $heart;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取心跳值排行
|
||||||
|
public function getRanking($room_id,$friend_id) {
|
||||||
|
// 获取有心动值的用户对且不重复
|
||||||
|
$originalPairs = db::name('vs_user_friending_heart')
|
||||||
|
->where(['room_id'=>$room_id,'friend_id'=>$friend_id])
|
||||||
|
->order('heart_value DESC')->select();
|
||||||
|
// 初始化排名数组和已使用用户数组
|
||||||
|
$ranking = [];
|
||||||
|
$usedUsers = [];
|
||||||
|
// 优先选择高价值且无重复用户的对
|
||||||
|
$heart_ids = [];
|
||||||
|
foreach ($originalPairs as &$rel) {
|
||||||
|
// 检查当前用户对是否包含已使用的用户ID
|
||||||
|
if (!in_array($rel['user1_id'], $usedUsers) &&
|
||||||
|
!in_array($rel['user2_id'], $usedUsers)) {
|
||||||
|
// 将符合条件的用户对添加到排名列表中
|
||||||
|
$ranking[] = [
|
||||||
|
'heart_value' => $rel['heart_value'],
|
||||||
|
'id' => $rel['id'],
|
||||||
|
'user1_id' => $rel['user1_id'],
|
||||||
|
'user2_id' => $rel['user2_id'],
|
||||||
|
];
|
||||||
|
// 更新已使用用户列表
|
||||||
|
$usedUsers = array_merge($usedUsers, [$rel['user1_id'], $rel['user2_id']]);
|
||||||
|
$heart_ids[] = $rel['id'];
|
||||||
|
// 如果排名列表达到3对用户,则停止循环
|
||||||
|
if (count($ranking) >= 3) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ranking1 = [];
|
||||||
|
$ranking2 = [];
|
||||||
|
if(count($ranking)<3){
|
||||||
|
$make_up_num = 3 - count($ranking);
|
||||||
|
$ranking_make_up = db::name('vs_user_friending_heart')
|
||||||
|
->where(['room_id'=>$room_id,'friend_id'=>$friend_id ,'id'=> ['notin',$heart_ids]])
|
||||||
|
->limit($make_up_num)
|
||||||
|
->order('heart_value DESC')->select();
|
||||||
|
foreach ($ranking_make_up as $rel1) {
|
||||||
|
// 如果两个用户都已使用,跳过这条记录
|
||||||
|
if(in_array($rel1['user1_id'], $usedUsers) && in_array($rel1['user2_id'], $usedUsers)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果只有user1已使用,将user2加入排名
|
||||||
|
if(in_array($rel1['user1_id'], $usedUsers)){
|
||||||
|
$ranking1[] = [
|
||||||
|
'heart_value' => 0,
|
||||||
|
'id' => $rel1['id'],
|
||||||
|
'user1_id' => -1,
|
||||||
|
'user2_id' => $rel1['user2_id'],
|
||||||
|
];
|
||||||
|
$usedUsers[] = $rel1['user2_id'];
|
||||||
|
$heart_ids[] = $rel1['id'];
|
||||||
|
}
|
||||||
|
// 如果只有user2已使用,将user1加入排名
|
||||||
|
elseif(in_array($rel1['user2_id'], $usedUsers)){
|
||||||
|
$ranking1[] = [
|
||||||
|
'heart_value' => 0,
|
||||||
|
'id' => $rel1['id'],
|
||||||
|
'user1_id' => $rel1['user1_id'],
|
||||||
|
'user2_id' => -1,
|
||||||
|
];
|
||||||
|
$usedUsers[] = $rel1['user1_id'];
|
||||||
|
$heart_ids[] = $rel1['id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 返回最终的排名列表
|
||||||
|
$ranking_rut = array_merge($ranking, $ranking1);
|
||||||
|
$nnum = count($ranking)*2 + count($ranking1);
|
||||||
|
if($nnum<6){
|
||||||
|
$make_up_num = 6 - $nnum;
|
||||||
|
$ranking_make_up = db::name('vs_user_friending_heart')
|
||||||
|
->where(array('room_id'=>$room_id,'friend_id'=>$friend_id ,'id'=>array('notin',$heart_ids)))
|
||||||
|
->limit($make_up_num)
|
||||||
|
->order('heart_value DESC')->select();
|
||||||
|
if($ranking_make_up){
|
||||||
|
foreach ($ranking_make_up as $rel1) {
|
||||||
|
if(in_array($rel1['user1_id'], $usedUsers) && in_array($rel1['user2_id'], $usedUsers)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(in_array($rel1['user1_id'], $usedUsers)){
|
||||||
|
$ranking2[] = [
|
||||||
|
'heart_value' => 0,
|
||||||
|
'id' => $rel1['id'],
|
||||||
|
'user1_id' => -1,
|
||||||
|
'user2_id' => $rel1['user2_id'],
|
||||||
|
];
|
||||||
|
$usedUsers[] = $rel1['user2_id'];
|
||||||
|
}
|
||||||
|
if(in_array($rel1['user2_id'], $usedUsers)){
|
||||||
|
$ranking2[] = [
|
||||||
|
'heart_value' => 0,
|
||||||
|
'id' => $rel1['id'],
|
||||||
|
'user1_id' => $rel1['user1_id'],
|
||||||
|
'user2_id' => -1,
|
||||||
|
];
|
||||||
|
$usedUsers[] = $rel1['user1_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return array_merge($ranking_rut, $ranking2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//抱上麦 还是换麦
|
||||||
|
public function pullUserPit($room_id,$friend_id){
|
||||||
|
$friendPlayPit = $this->friendPlayPit($room_id,$friend_id); // 获取实际应该对应的麦位
|
||||||
|
$this->changePitToPosPair($room_id,$friendPlayPit);//换麦,上下麦
|
||||||
|
$this->pullHeartChange($room_id,$friend_id);//聊天室心动值变化通知
|
||||||
|
}
|
||||||
|
|
||||||
|
//交友处理麦位排名
|
||||||
|
public function friendPlayPit($room_id,$friend_id){
|
||||||
|
//查询当前交友心动值表
|
||||||
|
$heart_data = $this->getRanking($room_id,$friend_id);
|
||||||
|
//数组根据里面的heart_value 由大到小进行排序
|
||||||
|
usort($heart_data, function($a, $b) {
|
||||||
|
return $b['heart_value'] - $a['heart_value'];
|
||||||
|
});
|
||||||
|
$pit = [];
|
||||||
|
$pit_number_array = [2=>5,1=>6,3=>4,5=>2,6=>1,4=>3]; //麦位对应关系
|
||||||
|
$pit_number_array_reverse = [0=>2,1=>1,2=>3,3=>4,4=>5,5=>6];
|
||||||
|
if($heart_data){
|
||||||
|
//排麦位
|
||||||
|
$pit_unique = [];
|
||||||
|
$key = 0;
|
||||||
|
foreach($heart_data as $value) {
|
||||||
|
if(count($pit) >= 6){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理两个用户都存在的情况
|
||||||
|
if($value['user1_id'] != -1 && $value['user2_id'] != -1){
|
||||||
|
if(!in_array($value['user1_id'],$pit_unique)){
|
||||||
|
// 检查目标麦位是否已被占用
|
||||||
|
if(!isset($pit[$pit_number_array_reverse[$key]])) {
|
||||||
|
$pit[$pit_number_array_reverse[$key]] = $value['user1_id'];
|
||||||
|
$pit[$pit_number_array[$pit_number_array_reverse[$key]]] = $value['user2_id'];
|
||||||
|
$pit_unique = array_merge($pit_unique, [$value['user1_id'], $value['user2_id']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 处理只有user2存在的情况
|
||||||
|
elseif($value['user1_id'] == -1 && !in_array($value['user2_id'],$pit_unique)){
|
||||||
|
// 检查该键是否已被使用
|
||||||
|
if(!isset($pit[$pit_number_array_reverse[$key]])) {
|
||||||
|
$pit[$pit_number_array_reverse[$key]] = $value['user2_id'];
|
||||||
|
$pit_unique[] = $value['user2_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 处理只有user1存在的情况
|
||||||
|
elseif($value['user2_id'] == -1 && !in_array($value['user1_id'],$pit_unique)){
|
||||||
|
// 检查该键是否已被使用
|
||||||
|
if(!isset($pit[$pit_number_array_reverse[$key]])) {
|
||||||
|
$pit[$pit_number_array_reverse[$key]] = $value['user1_id'];
|
||||||
|
$pit_unique[] = $value['user1_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$key++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $pit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//换麦
|
||||||
|
public function changePitToPosPairs($room_id,$friendPlayPit){
|
||||||
|
$now_pit_u = array_flip($friendPlayPit);
|
||||||
|
//按照键值排序数组
|
||||||
|
ksort($now_pit_u);
|
||||||
|
//查询现在麦位上有用户的数据 并且重组结果,键为麦位,值为用户,值必须存在,没值则不展示
|
||||||
|
$pit_user = db::name('vs_room_pit')->where(['room_id' => $room_id,'pit_number'=>['<',7],'user_id' => ['>', 0]])
|
||||||
|
->order('pit_number ASC')
|
||||||
|
->column('pit_number,user_id');
|
||||||
|
//比较两个数组,无论是键的差异还是值的差异,都输出字符串”有差异“否则输出”没有差异“
|
||||||
|
$result = array_diff_assoc($pit_user, $now_pit_u);
|
||||||
|
$result2 = array_diff_assoc($now_pit_u, $pit_user);
|
||||||
|
if(!empty($result) || !empty($result2)){
|
||||||
|
// var_dump('有差异');
|
||||||
|
//获取实际麦位上的用
|
||||||
|
$newPitUser = array_keys($friendPlayPit);
|
||||||
|
//获取当前麦位上的用户
|
||||||
|
$oldPitUser = db::name('vs_room_pit')->where(['room_id' => $room_id,'pit_number'=>['<',7]])->column('user_id');
|
||||||
|
//获取交集
|
||||||
|
$intersection = array_intersect($newPitUser,$oldPitUser);
|
||||||
|
//取差集
|
||||||
|
$diff = array_diff($newPitUser,$oldPitUser);
|
||||||
|
$changeData = [];
|
||||||
|
if($diff){
|
||||||
|
//推下麦
|
||||||
|
foreach($diff as $key => $value){
|
||||||
|
if(in_array($value,$oldPitUser)){
|
||||||
|
//查询当前空麦位
|
||||||
|
$pit_null = model('api/RoomPit')->getRoomNullPitWithout($room_id, [7,8,9,10]);
|
||||||
|
if($pit_null){
|
||||||
|
// $this->room_pit_model->getOnPit($this->room_id, $value, $pit_null);
|
||||||
|
model('api/RoomPit')->OnPit($value, $room_id, $pit_null);
|
||||||
|
// db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_null])->update(['user_id' => $value]);
|
||||||
|
}else{
|
||||||
|
//下麦
|
||||||
|
$UserRoomPit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $value])->value('pit_number');
|
||||||
|
model('api/RoomPit')->DownPit($value, $room_id, $UserRoomPit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(in_array($value,$newPitUser)){
|
||||||
|
//推上麦
|
||||||
|
//获取目标麦位是否有人
|
||||||
|
$getRoomPitUser= db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $friendPlayPit[$value]])->value('user_id');
|
||||||
|
if($getRoomPitUser){
|
||||||
|
//查询当前空麦位
|
||||||
|
$getRoomNullPitss = model('api/RoomPit')->getRoomNullPitWithout($room_id, [7,8,9,10,$friendPlayPit[$value]]);
|
||||||
|
if($getRoomNullPitss){
|
||||||
|
// $this->room_pit_model->getOnPit($this->room_id, $getRoomPitUser, $getRoomNullPitss);
|
||||||
|
db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $getRoomNullPitss])->update(['user_id' => $getRoomPitUser]);
|
||||||
|
}else{
|
||||||
|
model('api/RoomPit')->DownPit($getRoomPitUser, $room_id, $friendPlayPit[$value]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
model('api/RoomPit')->OnPit($value, $room_id, $friendPlayPit[$value]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($intersection){//交换麦位
|
||||||
|
//查询麦上的用户
|
||||||
|
$newPitUserStr = implode(',',$newPitUser);
|
||||||
|
$getRoomPit = db::name('vs_room_pit')->where("room_id=".$room_id." AND user_id in (".$newPitUserStr.")")->column('pit_number');
|
||||||
|
db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => ['in', $getRoomPit]])->update(['user_id' => 0]);
|
||||||
|
$changePitUser = [];
|
||||||
|
foreach ($friendPlayPit as $key => $value){
|
||||||
|
if(empty($value)){
|
||||||
|
$value = model('api/RoomPit')->getRoomNullPitWithout($room_id, [7,8,9,10]);
|
||||||
|
}
|
||||||
|
//获取目标麦位是否有人
|
||||||
|
$isPitHaveUser= db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $value])->value('user_id');
|
||||||
|
if($isPitHaveUser && !in_array($isPitHaveUser,$newPitUser)){
|
||||||
|
$changePitUser[$key]['user_id'] = $isPitHaveUser;
|
||||||
|
$changePitUser[$key]['pit_number'] = $value;
|
||||||
|
}
|
||||||
|
db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $value])->update(['user_id' => $key]);
|
||||||
|
}
|
||||||
|
//处理原麦位上的用户
|
||||||
|
foreach ($changePitUser as $key_change => $value_change){
|
||||||
|
//判断是否在左边 1,,2,,3 麦位上
|
||||||
|
if(in_array($value_change['pit_number'],[1,2,3])){
|
||||||
|
$null_pit = model('api/RoomPit')->getRoomNullPitWithout($room_id, [4,5,6,7,8,9,10]);
|
||||||
|
if(empty($null_pit)){
|
||||||
|
$null_pit = model('api/RoomPit')->getRoomNullPitWithout($room_id, [7,8,9,10]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$null_pit = model('api/RoomPit')->getRoomNullPitWithout($room_id, [1,2,3,7,8,9,10]);
|
||||||
|
if(empty($null_pit)){
|
||||||
|
$null_pit = model('api/RoomPit')->getRoomNullPitWithout($room_id, [7,8,9,10]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $null_pit])->update(['user_id' => $value_change['user_id']]);
|
||||||
|
}
|
||||||
|
// $getRoomNullPit = $this->room_pit_model->where(['room_id'=>$room_id,'pit_number'=>['notin',[7,9]]])->select();
|
||||||
|
$getRoomNullPit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => ['<',7]])->select();
|
||||||
|
$data_users = [];
|
||||||
|
foreach($getRoomNullPit as $key_data => $value_data){
|
||||||
|
$data_users[$key_data]['user_id'] = $value_data['user_id'];
|
||||||
|
$data_users[$key_data]['nickname'] = db::name('user')->where('id',$value_data['user_id'])->value('nickname');
|
||||||
|
$data_users[$key_data]['avatar'] = db::name('user')->where('id',$value_data['user_id'])->value('avatar');
|
||||||
|
$data_users[$key_data]['sex'] = db::name('user')->where('id',$value_data['user_id'])->value('sex');
|
||||||
|
//获取用户在此房间今天的魅力值
|
||||||
|
$charm =[];
|
||||||
|
if($value_data['user_id']){
|
||||||
|
$charm = db::name('vs_room_user_charm')->where(['user_id' => $value_data['user_id'],'room_id' => $room_id])->value('charm');
|
||||||
|
}
|
||||||
|
$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'] = '房间换麦位';
|
||||||
|
$text['list'] = $data_users;
|
||||||
|
model('api/Chat')->sendMsg(1053,$room_id,$text);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//换麦
|
||||||
|
public function changePitToPosPair($room_id,$friendPlayPit){
|
||||||
|
$new_pit_u = $friendPlayPit;
|
||||||
|
//按照键值排序数组
|
||||||
|
ksort($new_pit_u);
|
||||||
|
//查询原有麦位上有用户的数据 并且重组结果,键为麦位,值为用户,值必须存在,没值则不展示
|
||||||
|
$pit_users = db::name('vs_room_pit')->where(['room_id' => $room_id,'pit_number'=>['<',7],'user_id' => ['>', 0]])
|
||||||
|
->order('pit_number ASC')
|
||||||
|
->field('pit_number,user_id')->select();
|
||||||
|
$pit_user = [];
|
||||||
|
foreach ($pit_users as $value_pit_user){
|
||||||
|
$pit_user[$value_pit_user['pit_number']] = $value_pit_user['user_id'];
|
||||||
|
}
|
||||||
|
//比较两个数组,无论是键的差异还是值的差异,都输出字符串”有差异“否则输出”没有差异“
|
||||||
|
$result = array_diff_assoc($pit_user, $new_pit_u);//第一个数组中存在但其他数组中不存在的键/值对
|
||||||
|
$result2 = array_diff_assoc($new_pit_u, $pit_user);
|
||||||
|
if(!empty($result) || !empty($result2)){//换麦
|
||||||
|
db::name('vs_room_pit')->where(['room_id' => $room_id,'pit_number' => ['<',7]])->update(['user_id' => 0]);
|
||||||
|
//新麦位上的用户
|
||||||
|
foreach ($new_pit_u as $key_result2 => $value_result2){
|
||||||
|
db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $key_result2])->update(['user_id' => $value_result2]);
|
||||||
|
}
|
||||||
|
if($result){//原有麦位上的用户,且不在新麦位上的用户
|
||||||
|
foreach ($result as $key_result => $value_result){
|
||||||
|
$pit_null = model('api/RoomPit')->getRoomNullPitWithout($room_id, [7,8,9,10]);
|
||||||
|
$onPitUser = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $value_result])->find();
|
||||||
|
if($pit_null && !$onPitUser){
|
||||||
|
db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_null])->update(['user_id' => $value_result]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//获取此阶段的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){
|
||||||
|
$data_users[$key_data]['user_id'] = $value_data['user_id'];
|
||||||
|
$data_users[$key_data]['nickname'] = db::name('user')->where('id',$value_data['user_id'])->value('nickname');
|
||||||
|
$data_users[$key_data]['avatar'] = db::name('user')->where('id',$value_data['user_id'])->value('avatar');
|
||||||
|
$data_users[$key_data]['sex'] = db::name('user')->where('id',$value_data['user_id'])->value('sex');
|
||||||
|
//获取用户在此房间今天的魅力值
|
||||||
|
$charm =[];
|
||||||
|
if($value_data['user_id']){
|
||||||
|
$charm = db::name('vs_room_user_charm')->where(['user_id' => $value_data['user_id'],'room_id' => $room_id])->value('charm');
|
||||||
|
}
|
||||||
|
$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'] = '房间换麦位';
|
||||||
|
$text['list'] = $data_users;
|
||||||
|
model('api/Chat')->sendMsg(1053,$room_id,$text);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//交友厅游戏开始后送礼后一系列操作
|
||||||
|
//插入/更新心动表
|
||||||
|
public function addUserHeart($uid,$user_id,$friend_id,$value,$room_id,$user_data){
|
||||||
|
//给多个用户送礼
|
||||||
|
//数组重组 下标从0开始
|
||||||
|
$user_ids = array_values($user_id);
|
||||||
|
// $heart_value = $value;//心动值
|
||||||
|
$heart_value = 0;
|
||||||
|
$heart_exp = get_system_config_value('coin_charm_exp');//金币与魅力值转换比
|
||||||
|
for ($i = 0; $i < count($user_ids); $i++) {
|
||||||
|
foreach ($user_data as $cv){
|
||||||
|
if($user_ids[$i] == $cv['user_id']){
|
||||||
|
$heart_value = $cv['gift_price'] * $heart_exp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 处理用户ID顺序
|
||||||
|
$user1 = min($uid, $user_ids[$i]);
|
||||||
|
$user2 = max($uid, $user_ids[$i]);
|
||||||
|
// 更新心动关系表
|
||||||
|
$relation = db::name('vs_user_friending_heart')->where([
|
||||||
|
'user1_id' => $user1,
|
||||||
|
'user2_id' => $user2,
|
||||||
|
'friend_id' => $friend_id
|
||||||
|
])->find();
|
||||||
|
|
||||||
|
if ($relation) {
|
||||||
|
db::name('vs_user_friending_heart')->where([
|
||||||
|
'room_id' => $room_id,
|
||||||
|
'user1_id' => $user1,
|
||||||
|
'user2_id' => $user2,
|
||||||
|
'friend_id' => $friend_id
|
||||||
|
])->setInc('heart_value', $heart_value);
|
||||||
|
} else {
|
||||||
|
$relation['id'] = db::name('vs_user_friending_heart')->insert([
|
||||||
|
'room_id' => $room_id,
|
||||||
|
'user1_id' => $user1,
|
||||||
|
'user2_id' => $user2,
|
||||||
|
'friend_id' => $friend_id,
|
||||||
|
'heart_value' => $heart_value
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//修改用户心动连线状态
|
||||||
|
// $relation = db::name('vs_user_friending_heart')->where("(user1_id=".$uid." OR user2_id=".$uid.") AND friend_id=$friend_id AND room_id=$room_id AND status!=3")->order('heart_value desc')->find();
|
||||||
|
// if($relation){
|
||||||
|
// db::name('vs_user_friending_heart')->where("(user1_id=".$uid." OR user2_id=".$uid.") AND friend_id=$friend_id AND room_id=$room_id AND status!=3")->update(['status'=>2]);
|
||||||
|
// db::name('vs_user_friending_heart')->where(['id'=>$relation['id']])->update(['status'=>1]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace app\api\model;
|
namespace app\api\model;
|
||||||
|
use think\Cache;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Session;
|
use think\Session;
|
||||||
@@ -19,7 +20,8 @@ class Gift extends Model
|
|||||||
//获取礼物类型
|
//获取礼物类型
|
||||||
public function get_gift_label()
|
public function get_gift_label()
|
||||||
{
|
{
|
||||||
$giftTypeData = db::name('vs_gift_label')->where('delete_time',0)->order("sort asc,id desc")->select();
|
$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) {
|
foreach ($giftTypeData as $key => $value) {
|
||||||
$giftType[$key]['id'] = $value['id'];
|
$giftType[$key]['id'] = $value['id'];
|
||||||
$giftType[$key]['name'] = $value['name'];
|
$giftType[$key]['name'] = $value['name'];
|
||||||
@@ -27,42 +29,118 @@ class Gift extends Model
|
|||||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $giftType];
|
return ['code' => 1, 'msg' => '获取成功', 'data' => $giftType];
|
||||||
}
|
}
|
||||||
|
|
||||||
//拉去礼物列表
|
//拉取礼物列表
|
||||||
public function get_gift_list($label=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;
|
$map['delete_time'] = 0;
|
||||||
$where['is_show'] = 1;
|
$where['is_show'] = 1;
|
||||||
if ($label && $label !=99) {
|
if ($label && $label != 99) {
|
||||||
$map['label'] = $label;
|
$map['label'] = $label;
|
||||||
}
|
}
|
||||||
if ($label == 99) {
|
if ($label == 99) {
|
||||||
$gift_price = get_system_config_value('room_love_auction_cion');
|
$gift_price = get_system_config_value('room_love_auction_cion');
|
||||||
$where['gift_price'] = ['>',$gift_price];
|
$where['gift_price'] = ['>',$gift_price];
|
||||||
|
$where['label'] = ['<>',2];
|
||||||
}
|
}
|
||||||
$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){
|
if($label==2){
|
||||||
|
$list_data = [];
|
||||||
foreach ($list as &$v) {
|
foreach ($list as &$v) {
|
||||||
//获取盲盒列表
|
//获取盲盒列表
|
||||||
$box_list = Db::name('vs_gift_bag')->where(['status'=>1])->where('activities_id',4)->select();
|
$box_list = Db::name('vs_gift_bag')->where(['status'=>1])->where(['activities_id'=>["in",[4,5]]])->select();
|
||||||
foreach ($box_list as $key =>$box) {
|
foreach ($box_list as $key =>$box) {
|
||||||
$ext = json_decode($box['ext'],true);
|
$ext = json_decode($box['ext'],true);
|
||||||
if ($ext['gift_id'] == $v['gift_id']) {
|
if ($ext['gift_id'] == $v['gift_id']) {
|
||||||
$v['gift_bag_name'] = $box['name'];
|
$v['gift_bag_name'] = $box['name'];
|
||||||
$v['rule'] = $ext['description'];
|
$v['rule'] = $ext['description'];
|
||||||
$v['rule_url'] = get_system_config_value('web_site')."/api/Page/get_gift_box_rule?box_id=".$box["id"];
|
$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;
|
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){
|
||||||
|
$list_data[] = $gift;
|
||||||
|
}else{
|
||||||
|
if(isset($gift['activities_id']) && $gift['activities_id'] == 4){
|
||||||
|
$list_data[] = $gift;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 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];
|
return ['code' => 1, 'msg' => '获取成功', 'data' => $list];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* 盲盒规则链接
|
|
||||||
*/
|
|
||||||
public function get_gift_box_rule($box_id){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user