PxApplyService.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace bizHd\px\services;
  3. use bizHd\base\services\BaseService;
  4. use bizHd\px\classes\PxApplyClass;
  5. use common\components\dict;
  6. use common\components\util;
  7. use Yii;
  8. class PxApplyService extends BaseService
  9. {
  10. public static $baseFile = '\bizHd\px\classes\PxApplyClass';
  11. //新增报名成功 ssh 2021.3.17
  12. public static function addBmPx($data)
  13. {
  14. $order = PxApplyClass::addApply($data, true);
  15. $payWay = dict::getDict('payWay', 'unknown');
  16. PxApplyClass::complete($order, $payWay);
  17. return $order;
  18. }
  19. //培训报名 ssh 20210523
  20. public static function thirdPay($payWay, $orderSn, $totalFee, $attach)
  21. {
  22. $order = PxApplyClass::getByCondition(['orderSn' => $orderSn], true);
  23. if (empty($order)) {
  24. $msg = "没有找到报名订单 orderSn:{$orderSn}";
  25. Yii::info($msg);
  26. util::fail($msg);
  27. }
  28. if ($order->actPrice != $totalFee) {
  29. $msg = "报名订单金额与回调通知金额不一致 orderSn:{$orderSn} {$order->actPrice} {$totalFee}";
  30. Yii::info($msg);
  31. util::fail($msg);
  32. }
  33. //临时解决微信一秒内通知二次问题
  34. $id = $order->id;
  35. $order = PxApplyClass::getLockById($id);
  36. PxApplyClass::complete($order, $payWay);
  37. }
  38. }