125 lines
2.7 KiB
PHP
125 lines
2.7 KiB
PHP
![]() |
<?php
|
||
|
|
||
|
namespace app\openapi\controller\maSuDaApi;
|
||
|
|
||
|
use app\channel\service\ChannelService;
|
||
|
use app\gateway\service\AuthService;
|
||
|
use app\gateway\service\CurlService;
|
||
|
use app\gateway\service\RedisService;
|
||
|
use app\merchant\service\MerchantService;
|
||
|
use app\merchant\service\OrderAutoService;
|
||
|
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\ProductService as MerchantProductService;
|
||
|
use dever\Log;
|
||
|
use think\admin\Controller;
|
||
|
|
||
|
/**
|
||
|
* 接口核心控制器
|
||
|
* Class Core
|
||
|
* @package app\gateway\service
|
||
|
*/
|
||
|
class Core extends Controller
|
||
|
{
|
||
|
# 是否检测数据
|
||
|
protected $check = true;
|
||
|
# 商户appid
|
||
|
protected $appid = '';
|
||
|
# 商户id
|
||
|
protected $mid = 0;
|
||
|
# 商户信息
|
||
|
protected $merchant = array();
|
||
|
# token key
|
||
|
protected $key = '';
|
||
|
# product key
|
||
|
protected $product = 'query';
|
||
|
# proid
|
||
|
protected $proid = 0;
|
||
|
# input
|
||
|
protected $input = array();
|
||
|
# use_product
|
||
|
protected $use_product = array();
|
||
|
# sign_type
|
||
|
protected $sign_type = 1;
|
||
|
# code码定义
|
||
|
protected $code = array
|
||
|
(
|
||
|
# 成功
|
||
|
1 => 'ok',
|
||
|
# 小于0为失败
|
||
|
0 => '暂时未处理',
|
||
|
-1 => 'appid为空',
|
||
|
-2 => '产品错误',
|
||
|
-3 => 'appid无效',
|
||
|
-4 => '余额不足或者没有传入价格',
|
||
|
|
||
|
-5 => 'signature不能为空',
|
||
|
-6 => 'nonce不能为空',
|
||
|
-7 => 'time不能为空',
|
||
|
-8 => 'signature已失效',
|
||
|
-9 => 'signature验证失败',
|
||
|
|
||
|
-100 => '请求错误',
|
||
|
-101 => '订单不存在',
|
||
|
-102 => '订单号重复',
|
||
|
|
||
|
1100 => '商品不存在',
|
||
|
401 => '签名错误',
|
||
|
408 => '时间戳过期',
|
||
|
|
||
|
-103 => '正在处理中',
|
||
|
-104 => '锁卡失败',
|
||
|
|
||
|
-1000 => '系统维护中',
|
||
|
|
||
|
);
|
||
|
|
||
|
public function initialize()
|
||
|
{
|
||
|
|
||
|
parent::initialize();
|
||
|
$this->sign_type = sysconf('sign_type');
|
||
|
if ($this->check) {
|
||
|
// $this->check();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
# 获取输入的信息
|
||
|
|
||
|
|
||
|
# 检测开放或者维护时间
|
||
|
protected function checkOpenTime($opentime)
|
||
|
{
|
||
|
if ($opentime && strstr($opentime, ':')) {
|
||
|
$opentime = str_replace(':', '', $opentime);
|
||
|
if (strstr($opentime, '-')) {
|
||
|
$value = explode('-', $opentime);
|
||
|
$cur = intval(date('Hi'));
|
||
|
$value[0] = intval($value[0]);
|
||
|
$value[1] = intval($value[1]);
|
||
|
if ($value[1] < $value[0]) {
|
||
|
if ($cur >= $value[0] || $cur < $value[1]) {
|
||
|
$this->no(-1000);
|
||
|
}
|
||
|
} else {
|
||
|
if ($cur >= $value[0] && $cur < $value[1]) {
|
||
|
$this->no(-1000);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 对输入的信息进行加密
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|