init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace CashierApi\Business;
|
||||
|
||||
use Common\Model\RetailMerchantConfigModel;
|
||||
use Common\Model\RetailOtherPayModel;
|
||||
//[1.7.14]
|
||||
/**
|
||||
* 其他支付类
|
||||
* Class OtherPay
|
||||
* [
|
||||
* 其他支付使用验证 otherVerify
|
||||
* 查询指定其他支付的状态是否可用 basisIdGetInfo
|
||||
* 查询商户是否开启其他支付 getOtherState
|
||||
* ]
|
||||
* @package Common\Business
|
||||
*/
|
||||
class OtherPay
|
||||
{
|
||||
/**
|
||||
* 其他支付使用验证
|
||||
* @param $param
|
||||
* [
|
||||
* merchant_id
|
||||
* id 其他支付id
|
||||
* ]
|
||||
* @return mixed
|
||||
*/
|
||||
public function otherVerify($param)
|
||||
{
|
||||
$otherStateResult = $this->getOtherState($param); //其他支付是否开启
|
||||
if ($otherStateResult['status'] != 1) {
|
||||
return $otherStateResult;
|
||||
}
|
||||
if (!empty($param['id'])) {
|
||||
$infoResult = $this->basisIdGetInfo([
|
||||
'merchant_id' => $param['merchant_id'],
|
||||
'id' => $param['id']
|
||||
]);
|
||||
return $infoResult;
|
||||
} else {
|
||||
return callBack(statusCode()['success'], "未设置其他支付详情", []);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 依据id获取信息
|
||||
* @param $param
|
||||
* [
|
||||
* merchant_id
|
||||
* id 其他支付id
|
||||
* ]
|
||||
* @return mixed
|
||||
*/
|
||||
public function basisIdGetInfo($param)
|
||||
{
|
||||
if (empty($param['merchant_id']) || empty($param['id'])) {
|
||||
return callBack(statusCode()['error'], "缺少必要参数");
|
||||
}
|
||||
try {
|
||||
$OtherPayModel = new RetailOtherPayModel();
|
||||
$where = [
|
||||
'state' => 1,
|
||||
'status' => 1,
|
||||
'id' => $param['id'],
|
||||
'merchant_id' => $param['merchant_id']
|
||||
];
|
||||
$otherPay = $OtherPayModel->getFind($where);
|
||||
if (empty($otherPay)) {
|
||||
return callBack(statusCode()['error'], "该支付方式不存在");
|
||||
} else {
|
||||
return callBack(statusCode()['success'], "查询成功", $otherPay);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return callBack(statusCode()['error'], "该支付方式不存在");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询商户是否开启其他支付
|
||||
* @param $param
|
||||
* [
|
||||
* merchant_id
|
||||
* ]
|
||||
* @return mixed
|
||||
*/
|
||||
public function getOtherState($param)
|
||||
{
|
||||
try {
|
||||
$MerchantConfigModel = new RetailMerchantConfigModel();
|
||||
$merchantSet = $MerchantConfigModel->getFind(['merchant_id' => $param['merchant_id']]);
|
||||
if (!empty($merchantSet) && $merchantSet['other_pay'] != 1) {
|
||||
return callBack(statusCode()['error'], "商家已关闭其他支付,请重新登录");
|
||||
}else{
|
||||
return callBack(statusCode()['success'], "开启", $merchantSet);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return callBack(statusCode()['error'], "商家已关闭其他支付,请重新登录");
|
||||
}
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户