TestController.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace hd\controllers;
  3. use bizHd\order\classes\OrderClass;
  4. use common\components\util;
  5. use Yii;
  6. class TestController extends BaseController
  7. {
  8. public function actionTestPayAfter()
  9. {
  10. // $get = Yii::$app->request->get();
  11. // $id = $get['order_id'];
  12. // $order = OrderClass::getById($id, true);
  13. // if (empty($order)) {
  14. // util::fail('没有找到订单');
  15. // }
  16. // if ($order->mainId != $this->mainId) {
  17. // util::fail('不是你的订单');
  18. // }
  19. //
  20. // $payWay = 1; // balancePay
  21. // $connection = Yii::$app->db;
  22. // $transaction = $connection->beginTransaction();
  23. // try {
  24. // $actPrice = $order->actPrice;
  25. // $order->debtPrice = $actPrice;
  26. // $order->remainDebtPrice = $actPrice;
  27. // $order->debt = 1;
  28. // $order->save();
  29. // OrderClass::payAfter($order, $payWay);
  30. // $transaction->commit();
  31. // util::complete('付款成功');
  32. // } catch (\Exception $exception) {
  33. // $transaction->rollBack();
  34. // Yii::info("付款失败原因:" . $exception->getMessage());
  35. // util::fail('操作失败');
  36. // }
  37. }
  38. public function actionPush()
  39. {
  40. $push = new \common\components\push('hd', \common\components\push::MSG_TYPE_ORDER);
  41. $cids = [
  42. '', // OPPO
  43. '', // 小米 - 线上
  44. '', //
  45. '', // 华为
  46. '', // VIVO
  47. '', // VIVO 线上
  48. '', // 荣耀
  49. '', // Apple XS - 我的(线下)
  50. '', // Apple XS Max - 测试机(线上)
  51. ];
  52. $title = '新订单';
  53. $content = '您有新的订单,请查看 order_id: ' . random_int(100000, 999999);
  54. $payload = [
  55. "page" => "pagesClient/member/detail",
  56. "params" => ["id" => 682]
  57. ];
  58. $rs = $push->pushByCloud($cids, $title, $content, $payload);
  59. Yii::info(json_encode($rs));
  60. // clientId 后接状态:successed_online / successed_offline
  61. echo json_encode($rs);
  62. }
  63. }