Manage.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. namespace Course\Lib;
  3. use Dever;
  4. class Manage
  5. {
  6. public function search_cate_course_api()
  7. {
  8. $level_num = Dever::input('level_num');
  9. $level_id = Dever::input('level_id');
  10. $auth = Dever::tops();
  11. $where = array();
  12. if ($level_num == 1) {
  13. $default = array
  14. (
  15. 'value' => -1,
  16. 'name' => '选择分类',
  17. );
  18. if ($auth) {
  19. $where['ids'] = $auth;
  20. }
  21. $data = Dever::db('course/cate')->getIds($where);
  22. } elseif ($level_num == 2 && $level_id > 0) {
  23. $default = array
  24. (
  25. 'value' => -1,
  26. 'name' => '选择课程',
  27. );
  28. if ($level_id > 0) {
  29. $where['cate_id'] = $level_id;
  30. } elseif ($auth) {
  31. $where['cate_id'] = $auth;
  32. }
  33. $data = Dever::db('course/info')->getIds($where);
  34. } else {
  35. return array();
  36. }
  37. array_unshift($data, $default);
  38. $result['level_total'] = 2;
  39. $result['list'] = $data;
  40. return $result;
  41. }
  42. public function showOrderUser($id)
  43. {
  44. $info = Dever::db('course/order')->one($id);
  45. $table = array();
  46. $user = Dever::db('passport/user')->one($info['uid']);
  47. $table['用户名'] = $user['username'] . '('.$info['uid'].')';
  48. $table['手机号'] = $user['mobile'];
  49. $table['课程'] = $info['name'];
  50. $table['购买数量'] = $info['buy_num'];
  51. $table['支付金额'] = $info['cash'];
  52. if ($info['teacher_id']) {
  53. $user = Dever::db('teacher/info')->one($info['teacher_id']);
  54. $table['讲师'] = $user['name'];
  55. }
  56. if ($info['seller_id']) {
  57. $user = Dever::db('seller/info')->one($info['seller_id']);
  58. $table['销售人'] = $user['name'];
  59. }
  60. return Dever::table($table);
  61. }
  62. public function showOrderStatus($id)
  63. {
  64. $info = Dever::db('course/order')->one($id);
  65. if ($info) {
  66. if ($info['status'] == 1) {
  67. return '待支付';
  68. } elseif ($info['status'] == 2) {
  69. return '已支付';
  70. } elseif ($info['status'] == 3) {
  71. return '支付失败';
  72. } elseif ($info['status'] == 10) {
  73. $table['状态'] = '已退款';
  74. $manage = Dever::db('manage/admin')->one($info['tk_admin']);
  75. $table['备注'] = $info['tk_desc'];
  76. $table['截图'] = '<a><img src="'.$info['tk_pic'].'" style="width:150px" /></a>';
  77. //$table['退款时间'] = date('Y-m-d H:i:s', $info['tk_time']);
  78. $table['操作人'] = $manage['username'];
  79. return Dever::table($table);
  80. }
  81. }
  82. }
  83. }