Manage.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. namespace Card\Lib;
  3. use Dever;
  4. class Manage
  5. {
  6. /**
  7. * 显示用户信息
  8. *
  9. * @return mixed
  10. */
  11. public function showUserInfo($id)
  12. {
  13. $info = Dever::db('card/code')->find($id);
  14. $table = array();
  15. if ($info && $info['status'] > 1 && $info['uid'] && $info['uid'] > 0) {
  16. $user = Dever::load('passport/user-one', $info['uid']);
  17. if ($user) {
  18. $table['购买人'] = $user['username'] . '('.$user['mobile'].')';
  19. $table['下单时间'] = date('Y-m-d H:i:s', $info['cdate']);
  20. $table['支付时间'] = date('Y-m-d H:i:s', $info['bdate']);
  21. }
  22. if (isset($info['dh_uid']) && $info['dh_uid'] && $info['dh_uid'] > 0) {
  23. $user = Dever::load('passport/user-one', $info['dh_uid']);
  24. if ($user) {
  25. $table['兑换人'] = $user['username'] . '('.$user['mobile'].')';
  26. $table['兑换时间'] = date('Y-m-d H:i:s', $info['ddate']);
  27. }
  28. }
  29. if ($table) {
  30. return Dever::table($table);
  31. }
  32. }
  33. return '暂无';
  34. }
  35. /**
  36. * 更新信息
  37. *
  38. * @return mixed
  39. */
  40. public function orderPs($id, $name, $data)
  41. {
  42. $order_id = Dever::param('order_id', $data);
  43. if ($order_id) {
  44. $update['where_id'] = $order_id;
  45. $update['set_status'] = 3;
  46. Dever::db('card/order')->update($update);
  47. }
  48. }
  49. /**
  50. * 更新信息
  51. *
  52. * @return mixed
  53. */
  54. public function orderSh($id, $name, $data)
  55. {
  56. $order_id = Dever::param('order_id', $data);
  57. if ($order_id) {
  58. $update['where_id'] = $order_id;
  59. $update['set_status'] = 4;
  60. Dever::db('card/order')->update($update);
  61. }
  62. }
  63. # 收货
  64. public function send_api()
  65. {
  66. return Dever::load('card/lib/buy')->send();
  67. }
  68. /**
  69. * 作废
  70. *
  71. * @return mixed
  72. */
  73. public function drop_api($id)
  74. {
  75. $update['where_id'] = $id;
  76. $update['type'] = 4;
  77. Dever::db('card/code')->update($update);
  78. return 'ok';
  79. }
  80. public function recovery_api($id)
  81. {
  82. $update['where_id'] = $id;
  83. $update['type'] = 1;
  84. Dever::db('card/code')->update($update);
  85. return 'ok';
  86. }
  87. }