TestController.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. '030e02ba8fe602f3c6222b1f360aa88f', // 华为
  43. '4570ecb8970811d07629742c1612f3cd', // OPPO
  44. 'acec28309378a16c4ed10bbea6d40635', // 小米
  45. 'ee1763340e6e8778b9d6af259e65511f', // 荣耀 -- ee1763340e6e8778b9d6af259e65511f
  46. 'b768e3af3991d00f27d3ee728401b769', // Apple XS - 我的(线下)
  47. 'c9f4ccdf5b75da87abe1e9bcef6ef33f', // Apple XS Max - 测试机
  48. ];
  49. $title = '新订单';
  50. $content = '您有新的订单,请查看 order_id: ' . random_int(100000, 999999);
  51. $payload = [
  52. "page" => "pagesClient/member/detail",
  53. "params" => ["id" => 682]
  54. ];
  55. $rs = $push->pushByCloud($cids, $title, $content, $payload);
  56. Yii::info(json_encode($rs));
  57. // clientId 后接状态:successed_online / successed_offline
  58. echo json_encode($rs);
  59. }
  60. }