new files

This commit is contained in:
panchengyong
2026-03-07 22:29:07 +08:00
parent cd7e80b502
commit 7acbf45ff7
12516 changed files with 1808447 additions and 194 deletions

View File

@@ -0,0 +1,55 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\jobs\system;
use app\services\system\log\SystemLogServices;
use crmeb\basic\BaseJobs;
use crmeb\traits\QueueTrait;
/**
* 后台日志
* Class AdminLogJob
* @package app\jobs\system
*/
class AdminLogJob extends BaseJobs
{
use QueueTrait;
/**
* @return mixed
*/
public static function queueName()
{
return 'CRMEB_PRO_LOG';
}
/**
* @param $adminId
* @param $adminName
* @param $module
* @param $rule
* @param $ip
* @param $type
* @return bool
*/
public function doJob($adminId, $adminName, $module, $rule, $ip, $type)
{
try {
/** @var SystemLogServices $services */
$services = app()->make(SystemLogServices::class);
$services->recordAdminLog((int)$adminId, $adminName, $module, $rule, $ip, $type);
} catch (\Exception) {
}
return true;
}
}

View File

@@ -0,0 +1,55 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\jobs\system;
use crmeb\basic\BaseJobs;
use app\services\system\attachment\SystemAttachmentServices;
use crmeb\traits\QueueTrait;
use think\facade\Log;
/**
* 自动清除海报
* Class AutoClearPosterJob
* @package app\jobs\user
*/
class AutoClearPosterJob extends BaseJobs
{
use QueueTrait;
/**
* @return string
*/
protected static function queueName()
{
return 'CRMEB_PRO_TASK';
}
/**
* @param $event
*/
public function doJob()
{
//清除昨日海报
try {
/** @var SystemAttachmentServices $attach */
$attach = app()->make(SystemAttachmentServices::class);
$attach->emptyYesterdayAttachment();
} catch (\Throwable $e) {
response_log_write([
'message' => '清除昨日海报,失败原因:[' . class_basename($this) . ']' . $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine()
]);
}
return true;
}
}

View File

@@ -0,0 +1,54 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\jobs\system;
use crmeb\basic\BaseJobs;
use app\services\message\sms\SmsRecordServices;
use crmeb\traits\QueueTrait;
/**
* 自动更新短信状态
* Class AutoSmsCodeJob
* @package app\jobs\user
*/
class AutoSmsCodeJob extends BaseJobs
{
use QueueTrait;
/**
* @return string
*/
protected static function queueName()
{
return 'CRMEB_PRO_TASK';
}
/**
* @param $event
*/
public function doJob()
{
//清除昨日海报
try {
//修改短信发送记录短信状态
$smsRecord = app()->make(SmsRecordServices::class);
$smsRecord->modifyResultCode();
} catch (\Throwable $e) {
response_log_write([
'message' => '自动更新短信状态:[' . class_basename($this) . ']' . $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine()
]);
}
return true;
}
}

View File

@@ -0,0 +1,121 @@
<?php
namespace app\jobs\system;
use app\services\system\CapitalFlowServices;
use app\services\user\UserServices;
use crmeb\basic\BaseJobs;
use crmeb\traits\QueueTrait;
use think\facade\Log;
/**
* 平台资金流水记录
* Class CapitalFlowJob
* @package app\jobs\system
*/
class CapitalFlowJob extends BaseJobs
{
use QueueTrait;
/**
* @param $order
* @param $type
* @return bool
*/
public function doJob($order, $type)
{
if (!$order || !$type) {
return true;
}
$data = [];
try {
switch ($type) {
case 'order'://订单
if (in_array($order['pay_type'], ['weixin', 'alipay', 'offline'])) {
$userServices = app()->make(UserServices::class);
$userInfo = $userServices->get($order['uid'], ['uid', 'nickname']);
$data = [
'order_id' => $order['order_id'],
'store_id' => $order['store_id'] ?? 0,
'uid' => $order['uid'] ?? 0,
'nickname' => $userInfo['nickname'] ?? '游客' . time(),
'phone' => $order['phone'] ?? '',
'price' => $order['pay_price'],
'pay_type' => $order['pay_type'],
];
}
break;
case 'refund'://退款
//退款写入资金流水
if (in_array($order['pay_type'], ['weixin', 'alipay', 'offline'])) {
$userServices = app()->make(UserServices::class);
$userInfo = $userServices->get($order['uid'], ['uid', 'nickname', 'phone']);
//记录资金流水队列
$data = [
'order_id' => $order['order_id'],
'store_id' => $order['store_id'],
'uid' => $order['uid'],
'nickname' => $userInfo['nickname'],
'phone' => $userInfo['phone'],
'price' => $order['refund_price'],
'pay_type' => $order['pay_type'],
];
}
break;
case 'pay_member'://购买付费会员
if ($order['pay_type'] != 'yue') {
$userServices = app()->make(UserServices::class);
$userInfo = $userServices->get($order['uid'], ['uid', 'nickname', 'phone']);
$data = [
'order_id' => $order['order_id'],
'store_id' => 0,
'uid' => $order['uid'],
'nickname' => $userInfo['nickname'],
'phone' => $userInfo['phone'],
'price' => $order['pay_price'],
'pay_type' => $order['pay_type'],
];
}
break;
case 'recharge'://充值
$data = [
'order_id' => $order['order_id'],
'store_id' => $order['store_id'] ?? 0,
'uid' => $order['uid'],
'nickname' => $order['nickname'],
'phone' => $order['phone'],
'price' => $order['price'],
'pay_type' => $order['recharge_type'] ?? 'weixin',
'add_time' => time(),
];
break;
case 'refund_recharge'://充值退款
$data = [
'order_id' => $order['order_id'],
'store_id' => $order['store_id'] ?? 0,
'uid' => $order['uid'],
'nickname' => $order['nickname'],
'phone' => $order['phone'],
'price' => $order['price'],
'pay_type' => $order['recharge_type'] ?? 'weixin',
];
break;
case 'extract'://提现
$data = $order;
break;
case 'luck'://抽奖
$data = $order;
break;
}
if ($data) {
/** @var CapitalFlowServices $capitalFlowServices */
$capitalFlowServices = app()->make(CapitalFlowServices::class);
$capitalFlowServices->setFlow($data, $type);
}
} catch (\Throwable $e) {
Log::error('写入资金流水错误:[' . class_basename($this) . ']' . $e->getMessage());
}
return true;
}
}

View File

@@ -0,0 +1,63 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\jobs\system;
use crmeb\basic\BaseJobs;
use crmeb\traits\QueueTrait;
use crmeb\services\SpreadsheetExcelService;
use think\facade\Log;
/**
* 导出数据队列
* Class ExportExcelJob
* @package app\jobs
*/
class ExportExcelJob extends BaseJobs
{
use QueueTrait;
/**
* 分批导出excel
* @param $order
* @return bool
*/
public function doJob(array $export = [], string $filename = '', array $header = [], array $title_arr = [], string $suffix = 'xlsx', bool $is_save = false)
{
if (!$export) {
return true;
}
try {
if ($header && $title_arr) {
$title = isset($title_arr[0]) && !empty($title_arr[0]) ? $title_arr[0] : '导出数据';
$name = isset($title_arr[1]) && !empty($title_arr[1]) ? $title_arr[1] : '导出数据';
$info = isset($title_arr[2]) && !empty($title_arr[2]) ? $title_arr[2] : date('Y-m-d H:i:s', time());
SpreadsheetExcelService::instance()
->setExcelHeader($header)
->setExcelTile($title, $name, $info)
->setExcelContent($export)
->excelSave($filename, $suffix, $is_save);
} else {
SpreadsheetExcelService::instance()
->setExcelContent($export)
->excelSave($filename, $suffix, $is_save);
}
} catch (\Throwable $e) {
response_log_write([
'message' => '导出excel' . $title . '失败,原因:' . $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine()
]);
}
return true;
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace app\jobs\system;
use app\services\system\form\SystemFormDataServices;
use crmeb\basic\BaseJobs;
use crmeb\traits\QueueTrait;
use think\facade\Log;
/**
* 系统表单数据收集
* Class SystemFormDataJob
* @package app\jobs\system
*/
class SystemFormDataJob extends BaseJobs
{
use QueueTrait;
/**
* @param $order
* @param $type
* @return bool
*/
public function doJob($data, $type = 1)
{
if (!$data || !(int)$type) {
return true;
}
$form = [];
try {
switch ($type) {
case '1'://订单
$form = [
'type' => 1,
'relation_id' => $data['id'] ?? 0,
'uid' => $data['uid'] ?? 0,
'system_form_id' => $data['system_form_id'] ?? 0,
'value' => is_string($data['custom_form']) ? json_decode($data['custom_form'], true) : $data['custom_form']
];
break;
}
if ($form) {
/** @var SystemFormDataServices $systemFormDataServices */
$systemFormDataServices = app()->make(SystemFormDataServices::class);
$systemFormDataServices->setFormData($form, (int)$type);
}
} catch (\Throwable $e) {
Log::error('写入系统表单收集数据失败,错误:' . $e->getMessage());
}
return true;
}
}