mzeros 0cfae47bab feat(携号转网): 实现携号转网接口并集成到充值系统
- 新增 Baidumnpapi 类处理百度携号转网 API
- 在 Core 中添加携号转网相关的逻辑和接口
- 修改设置页面,增加携号转网配置选项- 新增商户余额监控和预警功能
- 优化订单处理流程,支持携号转网
2024-12-22 17:41:42 +08:00

85 lines
1.7 KiB
PHP

<?php
namespace app\private_api\controller\monitorApi;
use app\merchant\service\MerchantService;
/**
* 接口处理
* Class Handle
* @package app\gateway\api
*/
class Merchant extends Core
{
# 是否检测数据
protected bool $check = false;
#获取商户余额
public function AllBalance()
{
$data = MerchantService::instance()->getAll();
$where['is_deleted'] = 0;
$where['status'] = 1;
$data = MerchantService::instance()->db()->field('name,account_surplus,credit_surplus,appid')->where($where)->select()->toArray();
$this->yes($data);
}
protected function maketime($v): float|false|int|string
{
if (!$v) {
return '';
}
if (is_numeric($v)) {
return $v;
}
if (is_array($v)) {
$v = $v[1];
}
if (strstr($v, ' ')) {
$t = explode(' ', $v);
$v = $t[0];
$s = explode(':', $t[1]);
} else {
$s = array(0, 0, 0);
}
if (!isset($s[1])) {
$s[1] = 0;
}
if (!isset($s[2])) {
$s[2] = 0;
}
if (strstr($v, '-')) {
$t = explode('-', $v);
} elseif (strstr($v, '/')) {
$u = explode('/', $v);
$t[0] = $u[2];
$t[1] = $u[0];
$t[2] = $u[1];
}
if (!isset($t)) {
$t = array(0, 0, 0);
}
if (!isset($t[1])) {
$t[1] = 0;
}
if (!isset($t[2])) {
$t[2] = 0;
}
$v = mktime($s[0], $s[1], $s[2], $t[1], $t[2], $t[0]);
return $v;
}
}