LjhApplyClass.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace bizHd\ljh\classes;
  3. use bizHd\base\classes\BaseClass;
  4. use common\components\util;
  5. use Yii;
  6. class LjhApplyClass extends BaseClass
  7. {
  8. public static $baseFile = '\bizHd\ljh\models\LjhApply';
  9. public static function addBase($data, $bool)
  10. {
  11. return self::add($data, $bool);
  12. }
  13. public static function addApply($data)
  14. {
  15. $respond = self::addBase($data, true);
  16. return $respond;
  17. }
  18. //微信第三方支付
  19. public static function thirdPay($payWay, $orderSn, $totalFee, $attach, $transactionId)
  20. {
  21. $info = self::getByCondition(['orderSn' => $orderSn], true);
  22. if (empty($info)) {
  23. $msg = "没有找到订单 orderSn:{$orderSn}";
  24. Yii::info($msg);
  25. util::fail($msg);
  26. }
  27. if ($info->actPrice != $totalFee) {
  28. $msg = "订单金额与回调通知金额不一致 orderSn:{$orderSn} {$info->actPrice} {$totalFee}";
  29. Yii::info($msg);
  30. util::fail($msg);
  31. }
  32. $id = $info->id;
  33. $info = self::getLockById($id);
  34. $info->thirdNo = $transactionId;
  35. $info->status = 2;
  36. $info->payWay = $payWay;
  37. $info->payTime = date("Y-m-d H:i:s");
  38. $info->save();
  39. }
  40. }