FloatTipsTest.php 670 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Bear
  5. * Date: 2020/3/4
  6. * Time: 上午11:51
  7. */
  8. use app\common\library\Redis;
  9. use app\main\constants\CacheConstants;
  10. use app\main\service\FloatTipsService;
  11. class FloatTipsTest extends TestInit
  12. {
  13. public function testInit()
  14. {
  15. $match = [
  16. ['weight'=>2, 'id'=>1],
  17. ['weight'=>2, 'id'=>2],
  18. ];
  19. usort($match, function ($v1, $v2) {
  20. if ($v2['weight'] > $v1['weight']) {
  21. return true;
  22. }
  23. if ($v2['id'] > $v1['id']) {
  24. return true;
  25. }
  26. return false;
  27. });
  28. var_dump($match);
  29. }
  30. }