WxappPrepayId.php 994 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\api\model;
  10. use app\common\model\WxappPrepayId as WxappPrepayIdModel;
  11. use app\common\enum\OrderType as OrderTypeEnum;
  12. /**
  13. * 小程序prepay_id模型
  14. * Class WxappPrepayId
  15. * @package app\api\model
  16. */
  17. class WxappPrepayId extends WxappPrepayIdModel
  18. {
  19. /**
  20. * 新增记录
  21. * @param $prepayId
  22. * @param $orderId
  23. * @param $userId
  24. * @param int $orderType
  25. * @return false|int
  26. */
  27. public function add($prepayId, $orderId, $userId, $orderType = OrderTypeEnum::MASTER)
  28. {
  29. return $this->save([
  30. 'prepay_id' => $prepayId,
  31. 'order_id' => $orderId,
  32. 'order_type' => $orderType,
  33. 'user_id' => $userId,
  34. 'can_use_times' => 0,
  35. 'used_times' => 0,
  36. 'expiry_time' => time() + (7 * 86400),
  37. 'wxapp_id' => self::$wxapp_id,
  38. ]);
  39. }
  40. }