Compare commits

...

32 Commits

Author SHA1 Message Date
陈俊宏 344b7300a9 最新测试环境 env文件 2024-07-09 15:32:28 +08:00
陈俊宏 d80fb0c086 扣款失败后,重试扣款 2024-07-08 17:40:07 +08:00
陈俊宏 11086d363a 扣款失败后,重试扣款 2024-07-08 15:51:37 +08:00
陈俊宏 ce08f7866d 扣款失败后,重试扣款 2024-07-08 15:26:18 +08:00
陈俊宏 6f331a22d5 扣款短信通知Job 2024-07-05 15:22:57 +08:00
陈俊宏 da8a512777 格式化一下代码 2024-07-04 11:50:40 +08:00
陈建文 2488544363 修改配置文件 2024-07-02 16:56:29 +08:00
陈俊宏 7ca041073f 修改配置文件 2024-07-02 16:43:50 +08:00
陈俊宏 1339582dd3 修改配置文件 2024-07-02 16:41:02 +08:00
陈俊宏 62a9ac07c1 修改配置文件 2024-07-02 16:34:06 +08:00
陈俊宏 385af3db6a 修改配置文件 2024-07-02 16:25:51 +08:00
陈俊宏 e754ac32a8 修改配置文件 2024-07-02 16:24:02 +08:00
陈俊宏 2416c2ffd3 修改配置文件 2024-07-02 16:19:15 +08:00
陈俊宏 e5747e98ad 修改配置文件 2024-07-02 16:17:53 +08:00
陈俊宏 c88beb8313 修改配置文件 2024-07-02 16:15:27 +08:00
陈俊宏 b25aece9ae 修改配置文件 2024-07-02 16:14:16 +08:00
陈俊宏 d771b54ae5 修改配置文件 2024-07-02 16:13:36 +08:00
陈俊宏 ee66302549 修改配置文件 2024-07-02 16:11:18 +08:00
陈俊宏 88e02ece62 修改配置文件 2024-07-02 16:09:50 +08:00
陈俊宏 b95d7c0a4a 修改配置文件 2024-07-02 16:08:27 +08:00
陈俊宏 42dd826356 修改配置文件 2024-07-02 16:07:10 +08:00
陈俊宏 20b7842795 修改配置文件 2024-07-02 15:39:03 +08:00
陈俊宏 33ac763000 修改配置文件 2024-07-02 15:33:28 +08:00
陈俊宏 9b8d13460f 修改配置文件 2024-07-02 15:31:08 +08:00
陈俊宏 a1dfb859b8 修改配置文件 2024-07-02 15:07:17 +08:00
陈俊宏 0fe828c2e6 修改配置文件 2024-07-02 15:04:09 +08:00
陈俊宏 7b7504a7c9 修改配置文件 2024-07-02 13:38:41 +08:00
陈俊宏 24d7fcf65e 修改配置文件 2024-07-02 11:00:37 +08:00
陈俊宏 27f6ee1195 加入dockerfile 2024-07-02 10:09:59 +08:00
陈俊宏 c2b5c08d8b Merge branch 'develop' 2024-07-01 18:14:49 +08:00
陈俊宏 8bb29c041d 初始化项目 2024-07-01 16:07:59 +08:00
zhouyonggao 833d412355 Initial commit 2024-07-01 15:47:41 +08:00
18 changed files with 279 additions and 71 deletions

View File

@ -1 +1 @@
APP_DEBUG=true DEFAULT_TIMEZONE=Asia/Shanghai [DATABASE] TYPE=mysql HOSTNAME=192.168.6.193 DATABASE=cmb_youku USERNAME=root PASSWORD=lansexiongdi HOSTPORT=3307 CHARSET=utf8 DEBUG=true PREFIX= [FILESYSTEM] DRIVER=public [REDIS] DATABASE=cmb_youku USERNAME=root PASSWORD=lansexiongdi PREFIX= PASSWORD=lansexiongdi EXPIRE=7200 CHARSET=utf8 [CACHE] DRIVER=redis EXPIRED=7200 [DATABASE] TYPE=mysql [DATABASE] HOSTNAME=192.168.6.193 [DATABASE] DATABASE=cmb_youku [DATABASE] USERNAME=root [DATABASE] PASSWORD=lansexiongdi [DATABASE] HOSTPORT=3307 [DATABASE] CHARSET=utf8 TYPE=mysql IS_PROD= [ALISMS] APP_ID=LTAI5tHw7KKtobnafvkUpqRZ APP_KEY=3cPlaCbfwc9BTqIXlvo5up5WaYgIWs SIGN_NAME=优酷会员 TYPE=mysql USERNAME=root TEMPLATE_ISSUE_CODE= [CMB] CONTINUE_PRICE=7.5 CONTINUE_BONUS=9 PRODUCT_ID=2 USE_BONUS_MOUTH=1 AGREE_PAY_DAY=31 API_HOST=https://open.cmbchina.com/AccessGateway/transIn/ MID=cd9ec20f902d3d4ab6d63127c44e7897 AID=b32894073a844a38a10abe465cae8b34 SM2_PRI_KEY=e7d00ecae794e849d3425959ad7b288d18391cf5ce6cd740960a0f3092d5f0f6 SM2_PUB_KEY=04e59bc357ff33a4ca5e31aac8ebdbdb1e1d0dc1d719c9341722754804b12e49ed2b83f0a533faa9c1de59e8f5c0d9cfb2df7e7f2303096e507dccac26f7202289 HOSTNAME=192.168.6.193 CHARSET=utf8 AGREE_NOTIFY_URL=https://youkucmb.iq1.cn/api/agreement/notify DATABASE=cmb_youku DATABASE=cmb_youku [DATABASE] DATABASE=cmb_youku TYPE=mysql /order/rechargeNotify
APP_DEBUG=true DEFAULT_TIMEZONE=Asia/Shanghai IS_TEST=true [DATABASE] TYPE=mysql HOSTNAME=192.168.6.193 DATABASE=cmb_youku USERNAME=root PASSWORD=lansexiongdi HOSTPORT=3307 CHARSET=utf8 DEBUG=true PREFIX= [FILESYSTEM] DRIVER=public [REDIS] DATABASE=cmb_youku DATABASE=cmb_youku DATABASE=cmb_youku USERNAME=root DATABASE=cmb_youku PASSWORD=lansexiongdi prefix= password=lansexiongdi expire=7200 USERNAME=root [CACHE] DRIVER=redis EXPIRED=7200 USERNAME=root [DATABASE] USERNAME=root TYPE=mysql APP_KEY= SMS_URL= TEMPLATE_CODE= SIGN_NAME= SIGN_NUMBER= TYPE=mysql [DATABASE] APP_ID = APP_KEY = PASSWORD=lansexiongdi PASSWORD=lansexiongdi [DATABASE] TEMPLATE_ISSUE_CODE = [LANG] default_lang = zh-cn PASSWORD=lansexiongdi DATABASE=cmb_youku PASSWORD=lansexiongdi USERNAME=root PASSWORD=lansexiongdi PASSWORD=lansexiongdi PASSWORD=lansexiongdi HOSTPORT=3307 PASSWORD=lansexiongdi CHARSET=utf8 HOSTPORT=3307 [ALISMS] APP_ID=LTAI5tHw7KKtobnafvkUpqRZ APP_KEY=3cPlaCbfwc9BTqIXlvo5up5WaYgIWs SIGN_NAME=优酷视频 TEMPLATE_SMS_CODE=SMS_467595457 HOSTPORT=3307 TYPE=mysql #SIGN_NAME=蓝色兄弟 #TEMPLATE_SMS_CODE=SMS_463925647 TEMPLATE_ISSUE_CODE= [CMB] CONTINUE_PRICE=7.5 CONTINUE_BONUS=9 PRODUCT_ID=4 USE_BONUS_MOUTH=1 AGREE_PAY_DAY=1 API_HOST=https://sandbox.cdcc.cmbchina.com/AccessGateway/transIn/ MID=8258fe390d8e39719619f41d3e62aebb AID=edea4b87342a4d6f9a697265dc9d26f1 SM2_PRI_KEY=e7d00ecae794e849d3425959ad7b288d18391cf5ce6cd740960a0f3092d5f0f6 SM2_PUB_KEY=04e59bc357ff33a4ca5e31aac8ebdbdb1e1d0dc1d719c9341722754804b12e49ed2b83f0a533faa9c1de59e8f5c0d9cfb2df7e7f2303096e507dccac26f7202289 CHARSET=utf8 CHARSET=utf8 [DATABASE] CHARSET=utf8 TYPE=mysql RELEASE_NOTIFY_URL=http://211.137.105.198:8041/agreement/releaseNotify RECHARGE_NOTIFY_URL=http://211.137.105.198:8041/order/rechargeNotify

View File

@ -1,40 +0,0 @@
FROM php:7.4-fpm-alpine
RUN curl -sfL https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \
&& chmod +x /usr/bin/composer \
&& composer self-update --clean-backups 2.0.8 \
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& apk update \
&& apk add --no-cache tzdata \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& apk add --no-cache libstdc++ protobuf make autoconf wget gcc libc-dev automake libtool openssh openrc git supervisor\
&& apk add --no-cache --virtual .build-deps $PHPIZE_DEPS curl-dev openssl-dev pcre-dev pcre2-dev zlib-dev \
&& wget https://lsxd-dockerfile.oss-cn-chengdu.aliyuncs.com/grpc_php_plugin -P /usr/bin/ \
&& chmod +x /usr/bin/grpc_php_plugin \
&& docker-php-ext-install sockets mysqli pdo_mysql \
&& echo -e "yes\nyes\nyes\nyes\nyes\nyes\n" | pecl install swoole-4.8.0 \
&& docker-php-ext-enable swoole \
&& echo -e "yes\n" | pecl install xlswriter \
&& docker-php-ext-enable xlswriter \
&& apk add libzip libzip-dev \
&& docker-php-ext-configure zip --with-zip \
&& docker-php-ext-install -j$(nproc) zip \
&& apk add libwebp-dev libjpeg libjpeg-turbo-dev libpng libpng-dev freetype freetype-dev \
&& docker-php-ext-configure gd --with-webp=/usr/include/webp --with-jpeg=/usr/include --with-freetype=/usr/include/freetype2/ \
&& docker-php-ext-install -j$(nproc) gd \
&& pecl install redis-5.3.4 \
&& docker-php-ext-enable redis \
&& apk del .build-deps
RUN docker-php-ext-install bcmath
ADD ./startup.sh /opt/startup.sh
RUN sed -i 's/\r//g' /opt/startup.sh
RUN mkdir "/var/log/supervisor"
ADD ./supervisord.conf /etc/supervisord.conf
EXPOSE 9000 80 22
WORKDIR /var/project
CMD ["sh", "/opt/startup.sh"]

View File

@ -54,3 +54,5 @@ All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
更多细节参阅 [LICENSE.txt](LICENSE.txt)
招商优酷API

View File

@ -10,6 +10,7 @@ use think\Collection;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\facade\Log;
class AgreementPay extends Command
{
@ -57,6 +58,7 @@ class AgreementPay extends Command
}
}
});
Log::info(sprintf("扣款job执行情况执行成功累计 %s, 受理成功 %s, 失败 %s", $this->count, $this->successCount, $this->failedCount));
$output->writeln(sprintf("执行成功,累计 %s, 受理成功 %s, 失败 %s", $this->count, $this->successCount, $this->failedCount));
}
}

View File

@ -0,0 +1,80 @@
<?php
namespace app\cmd;
use app\config\BusinessCacheKey;
use app\model\Order;
use app\model\Sign;
use app\service\PayService;
use app\service\util\RedisService;
use app\sms\AliSms;
use think\Collection;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\facade\Log;
class AgreementPaySendSms extends Command
{
protected int $count = 0;
protected int $successCount = 0;
protected int $failedCount = 0;
protected function configure()
{
$this->setName('agreementPaySendSms')
->setDescription('招商银行协议扣款前发送短信');
}
protected function execute(Input $input, Output $output)
{
$redis = RedisService::getRedisInstance();
Sign::where(['sign_status' => Sign::SIGN_STATUS_SUCCESS])->field('*')->chunk(50, function (Collection $signCollection) use (&$output, $redis) {
foreach ($signCollection as $collection) {
// 查询是否已经生成过订单
$order = Order::getPaidOrderByAgreementId($collection->m_agreement_id);
if ($order->isEmpty() || empty($collection->agree_recharge_time) || $order->order_status != Order::STATUS_RECHARGE_SUCCESS) {
continue;
}
// 使用redis判断消息短时间不会重复发送
$cacheKeys = BusinessCacheKey::AGREEMENT_PAY_SEND_SMS;
$cacheKey = $cacheKeys['key'] . "_" . $collection->mobile;
$key = $redis->get($cacheKey);
if (!empty($key)) {
continue;
}
// 该协议号扣款订单次数
$orderCount = Order::getCountByAgreementId($collection->m_agreement_id);
if ($orderCount == 12) { // 1年扣款12次
continue;
}
$oneYearAgo = strtotime("-1 year", time());
if ($oneYearAgo > strtotime($collection->create_time)) { // 签约时间超过一年
continue;
}
$currentTimestamp = strtotime(date('Y-m-d'));
$agreeRechargeTime = $collection->agree_recharge_time;
$day = env('cmb.agree_pay_day');
if ($currentTimestamp != $agreeRechargeTime + ($day - 1) * 24 * 60 * 60) { //未到发送短信的时间,只发送刚满30天的记录超过30天不再发送
continue;
}
if (empty($collection->mobile)) {
continue;
}
$this->count += 1;
// 开始发送扣款短信
$res = AliSms::sendSms(['phone_numbers' => $collection->mobile], 3);
$redis->set($cacheKey, true, 'ex', $cacheKeys['ttl']);
if ($res['code'] == 200) {
$this->successCount += 1;
$output->writeln("短信发送受理成功");
} else {
$this->failedCount += 1;
$output->writeln("手机号" . $collection->mobile . "发送短信失败:" . $res['message']);
}
}
});
Log::info(sprintf("扣款前发送短信执行情况:执行成功,累计 %s, 受理成功 %s, 失败 %s", $this->count, $this->successCount, $this->failedCount));
$output->writeln(sprintf("执行成功,累计 %s, 受理成功 %s, 失败 %s", $this->count, $this->successCount, $this->failedCount));
}
}

66
app/cmd/PayOrderRetry.php Normal file
View File

@ -0,0 +1,66 @@
<?php
namespace app\cmd;
use app\model\Order;
use app\model\Sign;
use app\service\AgreementService;
use think\Collection;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\facade\Log;
class PayOrderRetry extends Command
{
protected int $count = 0;
protected int $successCount = 0;
protected int $failedCount = 0;
protected function configure()
{
$this->setName('payOrderRetry')->setDescription('重试扣款失败的订单');
}
/**
* 所有失败订单每天重试一次,重试到订单创建时间的月底。如果还是失败就进行解约操作
* 每天11点执行
* @param Input $input
* @param Output $output
* @return void
*/
protected function execute(Input $input, Output $output)
{
// 本月内的支付失败订单
// 获取本月的开始时间
$startOfMonth = new \DateTime('first day of this month 00:00:00');
$startOfMonthFormatted = $startOfMonth->format('Y-m-d H:i:s');
// 获取本月的结束时间
$endOfMonth = new \DateTime('last day of this month 23:59:59');
$endOfMonthFormatted = $endOfMonth->format('Y-m-d H:i:s');
Order::where(['pay_status' => Order::PAY_STATUS_FAIL])->whereBetweenTime('create_time', strtotime($startOfMonthFormatted), strtotime($endOfMonthFormatted))
->where(['is_retry' => Order::RETRY_STATUS_NO])
->field('id,order_number,agreement_id,user_id')->chunk(100, function (Collection $orderCollection) use (&$output) {
// 拉取支付失败的订单
foreach ($orderCollection as $order) {
// 查询签约状态是否取消
$signInfo = Sign::getByAgreementId($order->agreement_id);
if ($signInfo->isEmpty() || $signInfo->sign_status != Order::STATUS_SIGNED) {
continue;
}
$res = AgreementService::RetryPayOrder($order->order_number, $signInfo->agreement_id);
if ($res['respCode'] == 1000) {
$this->successCount += 1;
$output->writeln("受理成功,等待支付通知");
} else {
$this->failedCount += 1;
$output->writeln("用户" . $order->user_id . "扣款失败:" . $res['respMsg']);
}
}
});
Log::info(sprintf("重试扣款失败的job执行情况执行成功累计 %s, 受理成功 %s, 失败 %s", $this->count, $this->successCount, $this->failedCount));
$output->writeln(sprintf("重试扣款失败的订单执行成功,累计 %s, 受理成功 %s, 失败 %s", $this->count, $this->successCount, $this->failedCount));
}
}

View File

@ -34,4 +34,9 @@ class BusinessCacheKey
'ttl' => self::MINUTE * 5
];
const AGREEMENT_PAY_SEND_SMS = [
'key' => 'agreement_pay_send_sms',
'ttl' => self::DAY * 2
];
}

View File

@ -2,7 +2,6 @@
namespace app\front;
use app\config\ResponseCode;
use app\service\CmbService;
use app\service\OrderService;
use app\service\RechargeService;
@ -12,9 +11,14 @@ class Order extends Base
{
public function list(Request $request): \think\Response
{
if (empty($request->user_id)) {
return responseOk();
}
$params['user_id'] = $request->user_id;
$params['is_retry'] = \app\model\Order::RETRY_STATUS_NO;
return responseOk(app()->make(OrderService::class)->list($params));
}
/**
* 订单退订
* @param Request $request
@ -36,7 +40,7 @@ class Order extends Base
{
$params = $request->post();
$res = (new RechargeService())->rechargeNotify($params);
echo $res;
echo $res;
exit;
}

View File

@ -26,6 +26,9 @@ class Order extends BaseModel
const REFUND_STATUS_WAIT = 1;
const REFUND_STATUS_SUCCESS = 2;
const REFUND_STATUS_FAIL = 3;
// 重试状态
const RETRY_STATUS_NO = 0; // 未重试
const RETRY_STATUS_YES = 1; // 已重试
const STATUS_TEXT = [
self::STATUS_WAIT_SIGN => '待签约',

View File

@ -64,13 +64,13 @@ class AgreementService extends BaseService
$order->create_time = time();
$order->save();
} else {
Sign::create(
['user_id' => $userId,
'open_id' => $user->open_id,
'mobile' => $account,
'request_serial' => $params['requestSerial'],
'm_agreement_id' => $params['mAgreementId']]
);
Sign::create([
'user_id' => $userId,
'open_id' => $user->open_id,
'mobile' => $account,
'request_serial' => $params['requestSerial'],
'm_agreement_id' => $params['mAgreementId']
]);
// 创建订单
$data = [
'user_id' => $user->id,
@ -85,7 +85,7 @@ class AgreementService extends BaseService
Db::rollback();
throw new \LogicException($e->getMessage());
}
return CmbLifeUtils::genProtocol($funcName, $params);
return CmbLifeUtils::genProtocol($funcName, $params);
}
/**
@ -216,6 +216,68 @@ class AgreementService extends BaseService
return CmbHttpUtils::doPost($funcName, $requestParams);
}
/**
* 扣款失败,重试
*
* @param string $orderNumber
* @param string $agreementId
* @return array|mixed|string
*/
public static function RetryPayOrder(string $orderNumber, string $agreementId)
{
// 判断订单状态是否正确
$order = Order::getByOrderNumber($orderNumber);
if ($order->isEmpty() || $order->pay_status != Order::PAY_STATUS_FAIL || $order->is_retry == Order::RETRY_STATUS_YES) {
return ['respCode' => 1000, 'respMsg' => '处理成功'];
}
// 处理订单再次扣款
// 创建新的订单
$productId = $order->product_id;
$product = Product::getBySupplierProductId($productId);
$newOrder = [
'user_id' => $order->user_id,
'order_number' => StringUtil::makeOrderNumber(),
'account' => $order->account,
'type' => $order->type,
'product_id' => $order->product_id,
'price' => $order->price,
'bonus' => $order->bonus,
'agreement_id' => $order->agreement_id,
'order_status' => Order::STATUS_SIGNED
];
// 生成重试订单
Db::startTrans();
try {
// 创建新订单
Order::create($newOrder);
// 更新老订单
$order->is_retry = Order::RETRY_STATUS_YES;
$order->retry_order_num = $newOrder['order_number'];
$res = $order->save();
if (!$res) {
throw new \Exception("重试支付,更新老订单失败,订单号:" . $orderNumber);
}
Db::commit();
} catch (\Exception $e) {
Db::rollback();
Log::error("JobPayOrderRetry错误信息" . $e->getMessage());
return ['respCode' => 1001, 'respMsg' => $e->getMessage()];
}
// 扣款参数
$requestParams = [
'agreementId' => $agreementId,
'billNo' => $newOrder['order_number'],
'amount' => $newOrder['price'] * 100,
'notifyUrl' => config('cmb.pay_notify_url'),
'productName' => $product['name']
];
$funcName = 'agreementPay';
return CmbHttpUtils::doPost($funcName, $requestParams);
}
/**
* 协议扣款回调处理
* @param array $data
@ -252,6 +314,10 @@ class AgreementService extends BaseService
if ($encryptData['result'] == 2) {
RechargeService::rechargeOrder($orderNumber); // 支付成功,到直连天下充值
}
// 支付失败
if ($encryptData['result'] == 3 && BaseService::isLastDayOfMonth()) {
CmbService::releaseMerchant($order->agreement_id);
}
if ($res) {
return ['respCode' => 1000, 'respMsg' => '处理成功'];
} else {
@ -346,6 +412,7 @@ class AgreementService extends BaseService
}
return ['success' => true];
}
/**
* 解约发送验证码
* @throws BusinessException
@ -370,6 +437,7 @@ class AgreementService extends BaseService
$user = User::getUserById($userId);
return ['mobile' => $user->mobile];
}
/**
* 判断是否能兑换
* @param array $params
@ -377,7 +445,7 @@ class AgreementService extends BaseService
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function getExchangeStatus(array $params): array
public static function getExchangeStatus(array $params): array
{
$isCanAgree = self::checkCanAgree($params['user_id'], '');
return ['is_exchange' => $isCanAgree['success']];

View File

@ -44,14 +44,14 @@ class BaseService
$file = $data['file'];
$basePath = config('filesystem.disks.public.root');
validate(['file' => ['fileExt:jpg,png,jpeg,bmp,xlsx,xls,webp|fileSize:20*1024*1024']])->check($data);
$path = '/images/'.date('Y').'/'.date('m').'/'.date('d');
$fullPath = $basePath.$path;
if(!file_exists($fullPath)) {
mkdir($fullPath,0777,true);
$path = '/images/' . date('Y') . '/' . date('m') . '/' . date('d');
$fullPath = $basePath . $path;
if (!file_exists($fullPath)) {
mkdir($fullPath, 0777, true);
}
$imagePath = Filesystem::putFile($path,$file,'md5');
$imagePath = str_replace('\\','/',$imagePath);
return ['image_path' =>config('filesystem.disks.public.url').$imagePath ];
$imagePath = Filesystem::putFile($path, $file, 'md5');
$imagePath = str_replace('\\', '/', $imagePath);
return ['image_path' => config('filesystem.disks.public.url') . $imagePath];
}
public function __call($name, $arguments)
@ -59,4 +59,14 @@ class BaseService
//找不到方法,自动调用模型中基类方法
return call_user_func_array([$this->model, $name], $arguments);
}
public static function isLastDayOfMonth()
{
$date = date('Y-m-d');
// 获取该月的最后一天
$lastDayOfMonth = date('Y-m-t', strtotime($date));
// 比较给定日期和该月的最后一天
return $date === $lastDayOfMonth;
}
}

View File

@ -167,7 +167,8 @@ class CmbService extends BaseService
if ($res['result'] == 2) { // 扣款成功
RechargeService::rechargeOrder($orderNumber);
}
if ($res['result'] == 3) { // 扣款失败 解约
// 月底不进行重试,失败直接解约
if ($res['result'] == 3 && BaseService::isLastDayOfMonth()) { // 扣款失败 解约
self::releaseMerchant($order->agreement_id);
}
return true;

View File

@ -25,7 +25,7 @@ class OrderService extends BaseService
public function list($params)
{
return $this->model->searchPages(['order_number', 'type', 'status', 'create_at', 'user_id'], $params)->toArray();
return $this->model->searchPages(['order_number', 'type', 'status', 'create_at', 'user_id', 'is_retry'], $params)->toArray();
}
/**
@ -33,9 +33,9 @@ class OrderService extends BaseService
* @return array
* @throws \think\db\exception\DbException
*/
public function getMonthSale(): array
public function getMonthSale(): array
{
$count = $this->model->getCountLastMonth();
return ['count' => $count];
$count = $this->model->getCountLastMonth();
return ['count' => $count];
}
}

View File

@ -34,6 +34,8 @@ class AliSms
$template = env('alisms.template_sms_code');
if($type == 2) {
$template = env('alisms.template_issue_code');
} else if ($type == 3) {
$template = env('alisms.template_agreement_pay_code');
}
$client = self::getInstance(env('alisms.app_id'),env('alisms.app_key'));
$sms = new SendSmsRequest([]);

0
app/util/sm/sm Normal file → Executable file
View File

View File

@ -10,6 +10,8 @@ return [
'getPayOrder' => \app\cmd\GetPayOrder::class,
'getRefundOrder' => \app\cmd\getRefundOrder::class,
'queryAgreeStatus' => \app\cmd\QueryAgreeStatus::class,
'queryRechargeOrder' =>\app\cmd\QueryRechargeOrder::class
'queryRechargeOrder' =>\app\cmd\QueryRechargeOrder::class,
'payOrderRetry' =>\app\cmd\PayOrderRetry::class,
'agreementPaySendSms' =>\app\cmd\AgreementPaySendSms::class
],
];

View File

@ -1,6 +1,8 @@
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
location / {
  index index.php index.html;
  if (!-e $request_filename) {
    rewrite ^/index.php(.*)$ /index.php?s=$1 last; #必须在前面
    rewrite ^(.*)$ /index.php?s=$1 last;
    break;
  }
}

View File

@ -43,6 +43,7 @@ if (env('is_test')) {
Route::post('/front/loginSendSms', 'app\front\Login@loginSendSms')->validate(\app\validate\front\LoginValidate::class, 'sendSms')->middleware(\app\middleware\CorsMiddleware::class);
} else {
Route::group('/api', function () {
Route::post('/front/login', 'app\admin\Login@login')->validate(\app\validate\admin\LoginValidate::class);
Route::group('/front', function () {