erp/app/common/enum/PayEnum.php
2024-04-26 11:26:12 +08:00

129 lines
3.1 KiB
PHP

<?php
namespace app\common\enum;
/**
* 支付
* Class PayrEnum
* @package app\common\enum
*/
class PayEnum
{
/**
* 支付类型
* @BALANCE 余额
* @WECHAT_PAY 微信支付
* @ALIPAY 支付宝
* @WECHAT_PAY_APP 微信APP
* @ALIPAY_APP 支付宝APP
* @WECHAT_PAY_H5 微信H5
* @ALIPAY_H5 支付宝H5
* @WECHAT_PAY_MINI 微信小程序
* @ALIPAY_MINI 支付宝小程序
* @WECHAT_PAY_JSAPI 微信公众号
* @ALIPAY_PAY_JSAPI 支付宝公众号
* @WECHAT_PAY_BARCODE 微信条码
* @WECHAT_PAY_QRCODE 微信二维码
* @ALIPAY_BARCODE 支付宝条码
* @ALIPAY_QRCODE 支付宝二维码
* @GOODS_FIRST_PAYMENT_LATER 先货后款
* @CORPORATE_TRANSFER 对公转账
*/
const BALANCE_PAY = 3;
const WECHAT_PAY = 1;
const WECHAT_PAY_APP = 4;
const WECHAT_PAY_H5 = 5;
const WECHAT_PAY_JSAPI = 6;
const WECHAT_PAY_MINI = 7;
const WECHAT_PAY_BARCODE = 9;
const WECHAT_PAY_QRCODE = 10;
const ALIPAY = 2;
const ALIPAY_APP = 8;
const ALIPAY_H5 = 11;
const ALIPAY_MINI = 12;
const ALIPAY_BARCODE = 13;
const ALIPAY_QRCODE = 14;
const GOODS_FIRST_PAYMENT_LATER = 15;
const CORPORATE_TRANSFER = 16;
//支付状态
const UNPAID = 0; //未支付
const ISPAID = 1; //已支付
//支付场景
const SCENE_H5 = 1; //H5
const SCENE_OA = 2; //微信公众号
const SCENE_MNP = 3; //微信小程序
const SCENE_APP = 4; //APP
const SCENE_PC = 5; //PC商城
/**
* @notes 获取支付类型
* @param bool $value
* @return string|string[]
* @author 段誉
* @date 2023/2/23 15:36
*/
public static function getPayDesc($value = true)
{
$data = [
self::BALANCE_PAY => '余额支付',
self::WECHAT_PAY => '微信支付',
self::ALIPAY => '支付宝支付',
];
if ($value === true) {
return $data;
}
return $data[$value] ?? '';
}
/**
* @notes 支付状态
* @param bool $value
* @return string|string[]
* @author 段誉
* @date 2023/2/23 15:36
*/
public static function getPayStatusDesc($value = true)
{
$data = [
self::UNPAID => '未支付',
self::ISPAID => '已支付',
];
if ($value === true) {
return $data;
}
return $data[$value] ?? '';
}
/**
* @notes 支付场景
* @param bool $value
* @return string|string[]
* @author 段誉
* @date 2023/2/23 15:36
*/
public static function getPaySceneDesc($value = true)
{
$data = [
self::SCENE_H5 => 'H5',
self::SCENE_OA => '微信公众号',
self::SCENE_MNP => '微信小程序',
self::SCENE_APP => 'APP',
self::SCENE_PC => 'PC',
];
if ($value === true) {
return $data;
}
return $data[$value] ?? '';
}
}