business.php 562 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * 通用业务
  4. * shish 2019.8.20
  5. */
  6. namespace common\components;
  7. use Yii;
  8. class business
  9. {
  10. //支付方式对应资金要保存的字段 shish 2019.8.20
  11. public static function savePayWayAmount($object, $amount, $payWay)
  12. {
  13. switch ($payWay) {
  14. case 0:
  15. $object->weixin += $amount;
  16. break;
  17. case 1:
  18. $object->alipay += $amount;
  19. break;
  20. case 2:
  21. $object->balancePay += $amount;
  22. break;
  23. case 3:
  24. $object->cash += $amount;
  25. break;
  26. default:
  27. util::fail('付款方式不存在');
  28. }
  29. return $object;
  30. }
  31. }