Index.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?php
  2. namespace app\index\controller;
  3. use think\Controller;
  4. use think\Db;
  5. class Index extends Controller
  6. {
  7. public function index(){
  8. }
  9. //试课 支付成功页
  10. public function paysuccess(){
  11. $out_trade_no = input('out_trade_no','');
  12. $lang = input('lang','en');
  13. $info = Db::name('trylesson_order')->alias('order')
  14. ->field('order.order_no,order.order_amount,order.order_status,
  15. user.firstname,user.lastname,user.mobile,user.email,
  16. trylesson.name,trylesson.name_en
  17. ')
  18. ->join('user','order.user_id = user.id','LEFT')
  19. ->join('trylesson','order.trylesson_id = trylesson.id','LEFT')
  20. ->where('order.order_no',$out_trade_no)->find();
  21. $info['paystatus'] = $info['order_status'] == 10 ? __('Pay Success') : __('Pay Failed');
  22. $info['nowtime'] = date('n月d,Y H:i');
  23. if($lang == 'en'){
  24. $info['name'] = $info['name_en'];
  25. $info['nowtime'] = date('M d,Y H:i');
  26. }
  27. $this->assign('info',$info);
  28. $showtitle = [
  29. 'Order_No' => __('Order No'),
  30. 'User_Name' => __('User Name'),
  31. 'Mobile' => __('Mobile'),
  32. 'Status' => __('Status'),
  33. 'Pay_Amount'=> __('Pay Amount'),
  34. 'Info' => __('Info'),
  35. 'Pay_Time' => __('Pay Time'),
  36. 'bookingnow' => __('Book Session'),
  37. ];
  38. $this->assign('showtitle',$showtitle);
  39. return $this->fetch();
  40. }
  41. //售课 支付成功页
  42. public function lesson_paysuccess(){
  43. $out_trade_no = input('out_trade_no','');
  44. $lang = input('lang','en');
  45. $info = Db::name('lesson_order')->alias('order')
  46. ->field('order.order_no,order.order_amount,order.order_status,
  47. user.firstname,user.lastname,user.mobile,user.email,
  48. lesson.name,lesson.name_en
  49. ')
  50. ->join('user','order.user_id = user.id','LEFT')
  51. ->join('lesson','order.lesson_id = lesson.id','LEFT')
  52. ->where('order.order_no',$out_trade_no)->find();
  53. $info['paystatus'] = $info['order_status'] == 10 ? __('Pay Success') : __('Pay Failed');
  54. $info['nowtime'] = date('n月d,Y H:i');
  55. if($lang == 'en'){
  56. $info['name'] = $info['name_en'];
  57. $info['nowtime'] = date('M d,Y H:i');
  58. }
  59. $this->assign('info',$info);
  60. $showtitle = [
  61. 'Order_No' => __('Order No'),
  62. 'User_Name' => __('User Name'),
  63. 'Mobile' => __('Mobile'),
  64. 'Status' => __('Status'),
  65. 'Pay_Amount'=> __('Pay Amount'),
  66. 'Info' => __('Info'),
  67. 'Pay_Time' => __('Pay Time'),
  68. 'bookingnow' => __('Booking Now'),
  69. 'ok' => __('OK'),
  70. ];
  71. $this->assign('showtitle',$showtitle);
  72. return $this->fetch();
  73. }
  74. //套餐 支付成功页
  75. public function package_paysuccess(){
  76. $out_trade_no = input('out_trade_no','');
  77. $lang = input('lang','en');
  78. $info = Db::name('package_order')->alias('order')
  79. ->field('order.order_no,order.price as order_amount,order.order_status,
  80. user.firstname,user.lastname,user.mobile,user.email,
  81. lesson_package.name,lesson_package.name_en
  82. ')
  83. ->join('user','order.user_id = user.id','LEFT')
  84. ->join('lesson_package','order.package_id = lesson_package.id','LEFT')
  85. ->where('order.order_no',$out_trade_no)->find();
  86. $info['paystatus'] = $info['order_status'] == 1 ? __('Pay Success') : __('Pay Failed');
  87. $info['nowtime'] = date('n月d,Y H:i');
  88. if($lang == 'en'){
  89. $info['name'] = $info['name_en'];
  90. $info['nowtime'] = date('M d,Y H:i');
  91. }
  92. $this->assign('info',$info);
  93. $showtitle = [
  94. 'Order_No' => __('Order No'),
  95. 'User_Name' => __('User Name'),
  96. 'Mobile' => __('Mobile'),
  97. 'Status' => __('Status'),
  98. 'Pay_Amount'=> __('Pay Amount'),
  99. 'Info' => __('Info'),
  100. 'Pay_Time' => __('Pay Time'),
  101. 'bookingnow' => __('Booking Now'),
  102. 'ok' => __('OK'),
  103. ];
  104. $this->assign('showtitle',$showtitle);
  105. return $this->fetch();
  106. }
  107. //基础文章网页
  108. public function basedata(){
  109. $key = input('key','','trim');
  110. if(!$key){
  111. exit;
  112. }
  113. $lang = input('lang','zh-cn','strtolower');
  114. $content = Db::name('basedata')->where('key',$key)->find();
  115. if($lang == 'en'){
  116. $content['content'] = $content['content_en'];
  117. }
  118. $this->assign('content',$content['content']);
  119. return $this->fetch();
  120. }
  121. /**
  122. * app下载页
  123. * 判断是安卓还是ios
  124. * 用不到了,现在使用 index/appdown/index
  125. */
  126. public function appdownload() {
  127. if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
  128. header("Location: ".config('site.ios_downurl'));
  129. }else if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android')){
  130. $this->view->assign('downurl', config("site.android_apkUrl"));
  131. return $this->view->fetch();
  132. }else{
  133. $this->view->assign('downurl', config("site.android_apkUrl"));
  134. return $this->view->fetch();
  135. }
  136. }
  137. }