You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
234 lines
6.6 KiB
234 lines
6.6 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | 天诚科技 [ 刘海东 17600099397赋能开发者,助力企业发展 ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2016~2020 https://www.tczxkj.com All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed 该系统并不是自由软件,未经许可不能去掉相关版权
|
|
// +----------------------------------------------------------------------
|
|
// | Author:甘肃天诚志信电子商务有限公司 刘海东 联系电话维系17600099397
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace behavior\wechat;
|
|
|
|
use app\wap\model\store\StoreOrder as StoreOrderRoutineModel;
|
|
use app\wap\model\store\StoreOrder as StoreOrderWapModel;
|
|
use app\wap\model\user\UserRecharge;
|
|
use service\HookService;
|
|
use service\WechatService;
|
|
use app\wap\model\activity\EventSignUp;
|
|
use app\wap\model\topic\TestPaperOrder;
|
|
use app\wap\model\material\DataDownloadOrder;
|
|
|
|
class PaymentBehavior
|
|
{
|
|
|
|
/**
|
|
* 下单成功之后
|
|
* @param $order
|
|
* @param $prepay_id
|
|
*/
|
|
public static function wechatPaymentPrepare($order, $prepay_id)
|
|
{
|
|
|
|
}
|
|
|
|
/**
|
|
* 支付成功后
|
|
* @param $notify
|
|
* @return bool|mixed
|
|
*/
|
|
public static function wechatPaySuccess($notify)
|
|
{
|
|
if (isset($notify->attach) && $notify->attach) {
|
|
return HookService::listen('wechat_pay_success_' . strtolower($notify->attach), $notify->out_trade_no, $notify, true, self::class);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* 抖音支付成功后
|
|
* @param $notify
|
|
* @return bool|mixed
|
|
*/
|
|
public static function douyinPaySuccess($notify)
|
|
{
|
|
if (isset($notify['cp_extra']) && $notify['cp_extra']) {
|
|
return HookService::listen('wechat_pay_success_' . strtolower($notify['cp_extra']), $notify['cp_orderno'], $notify, true, self::class);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* 快熟支付成功后
|
|
* @param $notify
|
|
* @return bool|mixed
|
|
*/
|
|
public static function kuaishouPaySuccess($notify)
|
|
{
|
|
if (isset($notify['attach']) && $notify['attach']) {
|
|
return HookService::listen('wechat_pay_success_' . strtolower($notify['attach']), $notify['out_order_no'], $notify, true, self::class);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* 商品订单支付成功后 微信公众号
|
|
* @param $orderId
|
|
* @param $notify
|
|
* @return bool
|
|
*/
|
|
public static function wechatPaySuccessGoods($orderId, $notify)
|
|
{
|
|
try {
|
|
if (StoreOrderWapModel::be(['order_id' => $orderId, 'paid' => 1, 'type' => 2])) return true;
|
|
return StoreOrderWapModel::payGoodsSuccess($orderId);
|
|
} catch (\Exception $e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 专题订单支付成功后 微信公众号 支付宝
|
|
* @param $orderId
|
|
* @param $notify
|
|
* @return bool
|
|
*/
|
|
public static function wechatPaySuccessSpecial($orderId, $notify)
|
|
{
|
|
try {
|
|
if (StoreOrderWapModel::be(['order_id' => $orderId, 'paid' => 1])) return true;
|
|
return StoreOrderWapModel::paySuccess($orderId);
|
|
} catch (\Exception $e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 会员订单支付成功后 微信公众号 支付宝
|
|
* @param $orderId
|
|
* @param $notify
|
|
* @return bool
|
|
*/
|
|
public static function wechatPaySuccessMember($orderId, $notify)
|
|
{
|
|
try {
|
|
if (StoreOrderWapModel::be(['order_id' => $orderId, 'paid' => 1])) return true;
|
|
return StoreOrderWapModel::payMeSuccess($orderId);
|
|
} catch (\Exception $e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 活动报名订单支付成功后 微信公众号 支付宝
|
|
* @param $orderId
|
|
* @param $notify
|
|
* @return bool
|
|
*/
|
|
public static function wechatPaySuccessSignup($orderId, $notify)
|
|
{
|
|
try {
|
|
if (EventSignUp::be(['order_id' => $orderId, 'paid' => 1])) return true;
|
|
return EventSignUp::paySuccess($orderId);
|
|
} catch (\Exception $e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 试卷订单支付成功后 微信公众号 支付宝
|
|
* @param $orderId
|
|
* @param $notify
|
|
* @return bool
|
|
*/
|
|
public static function wechatPaySuccessTestpaper($orderId, $notify)
|
|
{
|
|
try {
|
|
if (TestPaperOrder::be(['order_id' => $orderId, 'paid' => 1])) return true;
|
|
return TestPaperOrder::payTestPaperSuccess($orderId);
|
|
} catch (\Exception $e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 资料订单支付成功后 微信公众号 支付宝
|
|
* @param $orderId
|
|
* @param $notify
|
|
* @return bool
|
|
*/
|
|
public static function wechatPaySuccessDatadownload($orderId, $notify)
|
|
{
|
|
try {
|
|
if (DataDownloadOrder::be(['order_id' => $orderId, 'paid' => 1])) return true;
|
|
return DataDownloadOrder::payDataDownloadSuccess($orderId);
|
|
} catch (\Exception $e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 商品订单支付成功后 小程序
|
|
* @param $orderId
|
|
* @param $notify
|
|
* @return bool
|
|
*/
|
|
public static function wechatPaySuccessProductr($orderId, $notify)
|
|
{
|
|
try {
|
|
if (StoreOrderRoutineModel::be(['order_id' => $orderId, 'paid' => 1])) return true;
|
|
return StoreOrderRoutineModel::paySuccess($orderId);
|
|
} catch (\Exception $e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 用户充值成功后
|
|
* @param $orderId
|
|
* @param $notify
|
|
* @return bool
|
|
*/
|
|
public static function wechatPaySuccessRecharge($orderId, $notify)
|
|
{
|
|
try {
|
|
if (UserRecharge::be(['order_id' => $orderId, 'paid' => 1])) return true;
|
|
return UserRecharge::rechargeSuccess($orderId);
|
|
} catch (\Exception $e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 使用余额支付订单时
|
|
* @param $userInfo
|
|
* @param $orderInfo
|
|
*/
|
|
public static function yuePayProduct($userInfo, $orderInfo)
|
|
{
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
* 微信支付订单退款
|
|
* @param $orderNo
|
|
* @param array $opt
|
|
*/
|
|
public static function wechatPayOrderRefund($orderNo, array $opt)
|
|
{
|
|
WechatService::payOrderRefund($orderNo, $opt);
|
|
}
|
|
|
|
/**
|
|
* 微信支付充值退款
|
|
* @param $orderNo
|
|
* @param array $opt
|
|
*/
|
|
|
|
public static function userRechargeRefund($orderNo, array $opt)
|
|
{
|
|
WechatService::payOrderRefund($orderNo, $opt);
|
|
}
|
|
}
|
|
|