Manage.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace Pay\Lib;
  3. use Dever;
  4. class Manage
  5. {
  6. public function showOrderStatus($id)
  7. {
  8. $info = Dever::db('pay/order')->one($id);
  9. if ($info) {
  10. if ($info['status'] == 1) {
  11. #return '*已支付';
  12. return '待支付';
  13. } elseif ($info['status'] == 2) {
  14. return '已支付';
  15. } elseif ($info['status'] == 3) {
  16. return '支付失败';
  17. } elseif ($info['status'] == 5) {
  18. $table['状态'] = '已退款';
  19. $manage = Dever::db('manage/admin')->one($info['tk_admin']);
  20. $table['备注'] = $info['tk_desc'];
  21. $table['截图'] = '<a><img src="'.$info['tk_pic'].'" style="width:150px" /></a>';
  22. //$table['退款时间'] = date('Y-m-d H:i:s', $info['tk_time']);
  23. $table['操作人'] = $manage['username'];
  24. return Dever::table($table);
  25. }
  26. }
  27. }
  28. # 更新渠道的同时,更新passport下的项目
  29. public function updateChannel($id, $name, $param)
  30. {
  31. if (!Dever::project('passport')) {
  32. return;
  33. }
  34. $data['name'] = Dever::param('name', $param);
  35. # 获取小程序信息,同步过去
  36. $where['channel_id'] = $id;
  37. $where['system_source'] = 5;
  38. $account = Dever::db('pay/account')->one($where);
  39. if ($account) {
  40. $data['appid'] = $account['appid'];
  41. $data['secret'] = $account['appsecret'];
  42. }
  43. # 与passport下的id 对应
  44. $info = Dever::db('passport/system')->one($id);
  45. if (!$info) {
  46. Dever::db('passport/system')->insert($data);
  47. } else {
  48. $data['where_id'] = $info['id'];
  49. $data['state'] = Dever::param('state', $param);
  50. if (!$data['name']) {
  51. unset($data['name']);
  52. };
  53. Dever::db('passport/system')->update($data);
  54. }
  55. return $info;
  56. }
  57. }