fix: 修改文件名大小写

- 优化查单,减少查单范围,限制到只能查询最近一周订单
This commit is contained in:
mzeros 2024-12-27 01:07:15 +08:00
parent afbb5bc3c3
commit 29511e09f5

View File

@ -2,22 +2,23 @@
namespace app\gateway\controller\v4; namespace app\gateway\controller\v4;
use app\channel\service\ChannelService;
use app\channel\service\ProductBaseService;
use app\core\Service; use app\core\Service;
use app\merchant\service\MerchantLogService;
use app\merchant\service\OrderLastHistoryService;
use app\merchant\service\OrderLastweekHistoryService;
use app\merchant\service\OrderTwoHistoryService;
use think\admin\Controller;
use app\gateway\service\AuthService; use app\gateway\service\AuthService;
use app\gateway\service\RedisService; use app\gateway\service\RedisService;
use app\merchant\service\MerchantLogService;
use app\merchant\service\MerchantService; use app\merchant\service\MerchantService;
use app\merchant\service\OrderService;
use app\merchant\service\OrderHistoryService;
use app\merchant\service\OrderAutoService; use app\merchant\service\OrderAutoService;
use app\channel\service\ChannelService; use app\merchant\service\OrderHistoryService;
use app\merchant\service\OrderLastHistoryService;
use app\merchant\service\OrderLastweekHistoryService;
use app\merchant\service\OrderService;
use app\merchant\service\OrderTwoHistoryService;
use app\merchant\service\PercentService;
use app\merchant\service\ProductService as MerchantProductService; use app\merchant\service\ProductService as MerchantProductService;
use dever\Log; use dever\Log;
use think\facade\Db; use think\admin\Controller;
/** /**
* 接口核心控制器 * 接口核心控制器
@ -87,7 +88,8 @@ class Core extends Controller
); );
#找不到方法错误响应 #找不到方法错误响应
public function __call($name, $arguments){ public function __call($name, $arguments)
{
$this->error('请求' . $name . '错误', '{-null-}', -802); $this->error('请求' . $name . '错误', '{-null-}', -802);
} }
@ -118,7 +120,7 @@ class Core extends Controller
$this->proid = input('proid'); $this->proid = input('proid');
if ($this->proid) { if ($this->proid) {
# 根据产品id 获取信息 # 根据产品id 获取信息
$pinfo = \app\channel\service\ProductBaseService::instance()->getOne($this->proid); $pinfo = ProductBaseService::instance()->getOne($this->proid);
if (!$pinfo) { if (!$pinfo) {
$this->no(-2); $this->no(-2);
} }
@ -141,8 +143,6 @@ class Core extends Controller
} }
if (!$this->product) { if (!$this->product) {
$this->no(-2); $this->no(-2);
} }
@ -151,8 +151,6 @@ class Core extends Controller
$this->getMerchant(); $this->getMerchant();
#验证安全进价是否匹配 #验证安全进价是否匹配
if ($this->product && $this->product != 'query' && $this->product != '' && isset($this->input['safe_price'])) { if ($this->product && $this->product != 'query' && $this->product != '' && isset($this->input['safe_price'])) {
$safe_price = $this->input['safe_price']; $safe_price = $this->input['safe_price'];
@ -165,6 +163,7 @@ class Core extends Controller
*/ */
protected function check() protected function check()
{ {
#校验请求类型
if (!str_contains($this->request->header('content_type'), "application/json")) $this->no(-103); if (!str_contains($this->request->header('content_type'), "application/json")) $this->no(-103);
@ -184,36 +183,30 @@ class Core extends Controller
$ip_white_data = $this->merchant['ip_white']; $ip_white_data = $this->merchant['ip_white'];
$request_ip = $this->getRealIp(); $request_ip = $this->getRealIp();
// if()
$ip_white_array = $ip_white_data ? explode(',', $ip_white_data) : []; $ip_white_array = $ip_white_data ? explode(',', $ip_white_data) : [];
if (!$ip_white_array || !in_array($request_ip, $ip_white_array)) { if (!$ip_white_array || !in_array($request_ip, $ip_white_array)) {
$this->no(-801, 'ip:' . $request_ip . ',请求错误,不在白名单内。'); $this->no(-801, 'ip:' . $request_ip . ',请求错误,不在白名单内。');
} }
// var_dump(1);die;
if ($this->proid && !str_contains($this->product, '_cash')) { if ($this->proid && !str_contains($this->product, '_cash')) {
unset($input['cash']); unset($input['cash']);
} }
if($input['appid'] != 'app574223018568' ){#测试验签
if (isset($this->input['signature'])) { if (isset($this->input['signature'])) {
$this->no(-10); $this->no(-10);
} }
// $input['signature'] = $this->input['sign'];
// unset($input['sign']);
#兼容v4.0版本以下接口签名字段方法 #兼容v4.0版本以下接口签名字段方法
$signature = AuthService::check($input, $this->key, $this->sign_type); $signature = AuthService::check($input, $this->key, $this->sign_type);
if (is_numeric($signature)) { if (is_numeric($signature)) {
$this->no($signature); $this->no($signature);
} }
}
if( $this->mid==1 &&isset($this->merchant['other_param']) && str_contains($this->merchant['other_param'],'mnp_SProduct_isp')){
// 检测如果商户开启了特定商品指定携转检测,则进入此验证
if (isset($this->merchant['other_param']) && str_contains($this->merchant['other_param'], 'mnp_SProduct_isp')) {
$other_param = json_decode($this->merchant['other_param'], true); $other_param = json_decode($this->merchant['other_param'], true);
if (is_array($other_param) && isset($other_param['mnp_SProduct_isp'])) { if (is_array($other_param) && isset($other_param['mnp_SProduct_isp'])) {
@ -234,10 +227,9 @@ class Core extends Controller
} }
// var_dump($this->product);die;
} }
// 检测当产品为三网携转识别,则送入携转识别渠道
if ($this->product == 'dhcz_mnp') { if ($this->product == 'dhcz_mnp') {
$this->getMnp_isp($this->input['mobile']); $this->getMnp_isp($this->input['mobile']);
$this->input['product'] = $this->product; $this->input['product'] = $this->product;
@ -246,9 +238,7 @@ class Core extends Controller
} }
unset($this->input['sign']); unset($this->input['sign']);
// unset($this->input['signature']);
if (isset($this->input['nonce'])) { if (isset($this->input['nonce'])) {
unset($this->input['nonce']); unset($this->input['nonce']);
} }
@ -306,7 +296,6 @@ class Core extends Controller
} }
} }
} }
@ -347,7 +336,6 @@ class Core extends Controller
} }
} }
# 检测开放或者维护时间 # 检测开放或者维护时间
@ -419,7 +407,7 @@ class Core extends Controller
} }
# 查找订单 # 查找订单
protected function getOrder($order_id, $merchant_order_id = false) protected function getOrder($order_id, $merchant_order_id = false,$time_type = false)
{ {
$orderService = OrderService::instance(); $orderService = OrderService::instance();
$order = $orderService->get($order_id, $merchant_order_id, $this->mid); $order = $orderService->get($order_id, $merchant_order_id, $this->mid);
@ -427,18 +415,31 @@ class Core extends Controller
$orderLastweekHistoryService = OrderLastweekHistoryService::instance(); $orderLastweekHistoryService = OrderLastweekHistoryService::instance();
$order = $orderLastweekHistoryService->get($order_id, $merchant_order_id, $this->mid); $order = $orderLastweekHistoryService->get($order_id, $merchant_order_id, $this->mid);
} }
# 默认情况下只允许查找最新一周订单
if(!$time_type ){
return $order;
}
if (!$order) { if (!$order) {
$orderLastHistoryService = OrderLastHistoryService::instance(); $orderLastHistoryService = OrderLastHistoryService::instance();
$order = $orderLastHistoryService->get($order_id, $merchant_order_id, $this->mid); $order = $orderLastHistoryService->get($order_id, $merchant_order_id, $this->mid);
} }
if($time_type == 2){
return $order;
}
if (!$order) { if (!$order) {
$orderTwoHistoryService = OrderTwoHistoryService::instance(); $orderTwoHistoryService = OrderTwoHistoryService::instance();
$order = $orderTwoHistoryService->get($order_id, $merchant_order_id, $this->mid); $order = $orderTwoHistoryService->get($order_id, $merchant_order_id, $this->mid);
} }
if($time_type == 3){
return $order;
}
if (!$order) { if (!$order) {
$orderHistoryService = OrderHistoryService::instance(); $orderHistoryService = OrderHistoryService::instance();
$order = $orderHistoryService->get($order_id, $merchant_order_id, $this->mid); $order = $orderHistoryService->get($order_id, $merchant_order_id, $this->mid);
} }
return $order; return $order;
} }
@ -495,7 +496,6 @@ class Core extends Controller
$channelService = ChannelService::instance(); $channelService = ChannelService::instance();
$update = $channelService->call('notify', $order['cid'], $request, false, $order); $update = $channelService->call('notify', $order['cid'], $request, false, $order);
$merchant = MerchantService::instance()->get($order['mid']); $merchant = MerchantService::instance()->get($order['mid']);
if (isset($order['param']) && $order['param']) { if (isset($order['param']) && $order['param']) {
@ -527,7 +527,6 @@ class Core extends Controller
} }
if ($update['status'] == 3 && isset($merchant['stop']) && $merchant['stop'] > 2) { if ($update['status'] == 3 && isset($merchant['stop']) && $merchant['stop'] > 2) {
# 是否暂停 # 是否暂停
$num = $order['num'] + 1; $num = $order['num'] + 1;
@ -546,9 +545,11 @@ class Core extends Controller
if ($die) { if ($die) {
if (isset($update['yes']) && $update['yes']) { if (isset($update['yes']) && $update['yes']) {
echo $update['yes'];die; echo $update['yes'];
die;
} }
echo 'success';die; echo 'success';
die;
} else { } else {
return true; return true;
} }
@ -568,9 +569,11 @@ class Core extends Controller
if ($die) { if ($die) {
if (isset($update['yes']) && $update['yes']) { if (isset($update['yes']) && $update['yes']) {
echo $update['yes'];die; echo $update['yes'];
die;
} }
echo 'success';die; echo 'success';
die;
} else { } else {
return true; return true;
} }
@ -587,7 +590,7 @@ class Core extends Controller
} }
$isp = false; $isp = false;
if (isset($order['isp']) && $order['isp'] && $order['isp'] > 0) { if (isset($order['isp']) && $order['isp'] && $order['isp'] > 0) {
$isp_config = \app\merchant\service\PercentService::instance()->getIsp(); $isp_config = PercentService::instance()->getIsp();
$isp = $isp_config[$order['isp']]; $isp = $isp_config[$order['isp']];
} }
$new_product = $this->getProduct($order['mid'], $order['product_key'], $this->use_product, $order['cash'], $isp); $new_product = $this->getProduct($order['mid'], $order['product_key'], $this->use_product, $order['cash'], $isp);
@ -598,9 +601,11 @@ class Core extends Controller
$channelService->use($order['mid'], $new_product, $order['param'], false, $new_order_id, $this->use_product); $channelService->use($order['mid'], $new_product, $order['param'], false, $new_order_id, $this->use_product);
if ($die) { if ($die) {
if (isset($update['yes']) && $update['yes']) { if (isset($update['yes']) && $update['yes']) {
echo $update['yes'];die; echo $update['yes'];
die;
} }
echo 'success';die; echo 'success';
die;
} else { } else {
return true; return true;
} }
@ -663,16 +668,19 @@ class Core extends Controller
} }
if ($die) { if ($die) {
if (isset($update['yes']) && $update['yes']) { if (isset($update['yes']) && $update['yes']) {
echo $update['yes'];die; echo $update['yes'];
die;
} }
echo 'success';die; echo 'success';
die;
} else { } else {
return true; return true;
} }
} }
} }
if ($die) { if ($die) {
echo 'fail';die; echo 'fail';
die;
} else { } else {
return false; return false;
} }