12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- namespace crmeb\repositories;
- use app\models\store\StoreOrder;
- use app\models\trade\CashTradeOrderPayment;
- use app\models\user\UserRecharge;
- /**
- * Class PaymentRepositories
- * @package crmeb\repositories
- */
- class PaymentRepositories
- {
- /**
- * 公众号下单成功之后
- * @param $order
- * @param $prepay_id
- */
- public static function wechatPaymentPrepare($order, $prepay_id)
- {
- }
- /**
- * 小程序下单成功之后
- * @param $order
- * @param $prepay_id
- */
- public static function wechatPaymentPrepareProgram($order, $prepay_id)
- {
- }
- /**
- * 使用余额支付订单时
- * @param $userInfo
- * @param $orderInfo
- */
- public static function yuePayProduct($userInfo, $orderInfo)
- {
- }
- /**
- * 订单支付成功之后
- * @param string|null $order_id 订单id
- * @return bool
- */
- public static function wechatProduct(string $order_id = null)
- {
- try {
- if (StoreOrder::be(['order_id' => $order_id, 'paid' => 1])) return true;
- return StoreOrder::paySuccess($order_id);
- } catch (\Exception $e) {
- return false;
- }
- }
- /**
- * 充值成功后
- * @param string|null $order_id 订单id
- * @return bool
- */
- public static function wechatUserRecharge(string $order_id = null)
- {
- try {
- if (UserRecharge::be(['order_id' => $order_id, 'paid' => 1])) return true;
- return UserRecharge::rechargeSuccess($order_id);
- } catch (\Exception $e) {
- return false;
- }
- }
- /**
- * 订单支付成功之后
- * @param string|null $order_id 订单id
- * @return bool
- */
- public static function wechatTrade(string $order_id = null)
- {
- try {
- if (CashTradeOrderPayment::be(['order_id' => $order_id, 'paid' => 1])) return true;
- return CashTradeOrderPayment::paySuccess($order_id);
- } catch (\Exception $e) {
- return false;
- }
- }
- }
|