mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 06:20:50 +00:00
【程序目录】更新
This commit is contained in:
parent
7797336273
commit
1953370289
@ -388,6 +388,7 @@ class UpgradeController
|
||||
$unique = uniqid();
|
||||
//读取配置文件,并替换真实配置数据1
|
||||
$strConfig = file_get_contents(root_path() . 'public/install/.env');
|
||||
$strConfig = str_replace('#APP_KEY#', 'app_key_' . $unique, $strConfig);
|
||||
$strConfig = str_replace('#DB_HOST#', Env::get('DATABASE.HOSTNAME', ''), $strConfig);
|
||||
$strConfig = str_replace('#DB_NAME#', Env::get('DATABASE.DATABASE', ''), $strConfig);
|
||||
$strConfig = str_replace('#DB_USER#', Env::get('DATABASE.USERNAME', ''), $strConfig);
|
||||
|
||||
@ -504,7 +504,8 @@ class StoreProduct extends AuthController
|
||||
['store_name', ''],
|
||||
['cate_id', ''],
|
||||
['type', 1],
|
||||
['sales', 'normal']
|
||||
['sales', 'normal'],
|
||||
['ids', []]
|
||||
]);
|
||||
$where['virtual_type'] = 0;
|
||||
return app('json')->success($this->service->productExportList($where));
|
||||
|
||||
@ -19,6 +19,7 @@ use crmeb\services\CacheService;
|
||||
use app\services\user\LoginServices;
|
||||
use think\exception\ValidateException;
|
||||
use app\api\validate\user\RegisterValidates;
|
||||
use think\facade\Env;
|
||||
|
||||
/**
|
||||
* 微信小程序授权类
|
||||
@ -544,6 +545,9 @@ class LoginController
|
||||
*/
|
||||
public function remoteRegister(Request $request)
|
||||
{
|
||||
if (!Env::get('app_debug', false)) {
|
||||
return app('json')->fail('生产环境无法使用此功能,如需使用请修改.env文件中app_debug项为true');
|
||||
}
|
||||
[$remote_token] = $request->getMore([
|
||||
['remote_token', ''],
|
||||
], true);
|
||||
|
||||
@ -114,6 +114,14 @@ class StoreOrderController
|
||||
$orderInfo['user_address'] = $order['user_address'];
|
||||
$orderInfo['user_mark'] = $order['mark'];
|
||||
$orderInfo['cartInfo'] = $info;
|
||||
$orderInfo['user_name'] = $order['real_name'];
|
||||
$orderInfo['user_phone'] = $order['user_phone'];
|
||||
$orderInfo['send_address'] = $order['user_address'];
|
||||
$orderInfo['send_city'] = $services->addressHandle($order['user_address'])['city'] ?? '';
|
||||
$orderInfo['delivery_type'] = $order['delivery_type'] ?? 1;
|
||||
$address = explode(' ', $order['user_address']);
|
||||
$orderInfo['user_city'] = isset($address[0]) && in_array($address[0], ['北京', '上海', '天津', '重庆', '香港', '澳门', '台湾']) ? $address[0] : ($address[1] ?? '');
|
||||
$orderInfo['user_mark'] = $order['mark'] ?? '';
|
||||
}
|
||||
return app('json')->success([
|
||||
'order' => $orderInfo,
|
||||
@ -245,10 +253,6 @@ class StoreOrderController
|
||||
['fictitious_content', ''],//虚拟发货内容
|
||||
['pickup_time', []]
|
||||
]);
|
||||
if ($data['delivery_type']) {
|
||||
$data['delivery_name'] = $data['delivery_type'];
|
||||
unset($data['delivery_type']);
|
||||
}
|
||||
$services->delivery((int)$id, $data);
|
||||
return app('json')->success('发货成功');
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ class StoreProductController
|
||||
[['type', 'd'], 0],
|
||||
['ids', ''],
|
||||
[['selectId', 'd'], 0],
|
||||
[['productId', 'd'], 0],
|
||||
['productId', ''],
|
||||
[['coupon_category_id', 'd'], 0],
|
||||
['cate_id', ''],
|
||||
['store_label_id', ''],
|
||||
@ -70,6 +70,10 @@ class StoreProductController
|
||||
$where['cid'] = $where['selectId'];
|
||||
}
|
||||
}
|
||||
if ($where['productId'] != '') {
|
||||
$where['ids'] = $where['productId'];
|
||||
unset($where['productId']);
|
||||
}
|
||||
if ($where['ids'] && is_string($where['ids'])) {
|
||||
$where['ids'] = explode(',', $where['ids']);
|
||||
foreach ($where['ids'] as $key => &$item) {
|
||||
|
||||
@ -12,6 +12,7 @@ namespace app\api\controller\v1\user;
|
||||
|
||||
use app\Request;
|
||||
use app\services\user\UserExtractServices;
|
||||
use crmeb\services\CacheService;
|
||||
use think\facade\Config;
|
||||
|
||||
/**
|
||||
@ -61,6 +62,13 @@ class UserExtractController
|
||||
['weixin', ''],
|
||||
['qrcode_url', ''],
|
||||
]);
|
||||
// 每10秒只能提现一次
|
||||
$uid = (int)$request->uid();
|
||||
$cacheKey = 'extract_limit_' . $uid;
|
||||
if (CacheService::has($cacheKey)) {
|
||||
return app('json')->fail('操作过于频繁,请10秒后再试');
|
||||
}
|
||||
CacheService::set($cacheKey, 1, 10);
|
||||
$extractInfo['channel_type'] = $request->getFromType();
|
||||
$extractType = Config::get('pay.extractType', []);
|
||||
if (!in_array($extractInfo['extract_type'], $extractType))
|
||||
@ -78,7 +86,6 @@ class UserExtractController
|
||||
if (!$extractInfo['cardnum']) return app('json')->fail('请输入银行卡账号');
|
||||
if (!$extractInfo['bankname']) return app('json')->fail('请输入开户行信息');
|
||||
}
|
||||
$uid = (int)$request->uid();
|
||||
if ($this->services->cash($uid, $extractInfo))
|
||||
return app('json')->success('申请提现成功');
|
||||
else
|
||||
|
||||
@ -49,9 +49,13 @@ class StoreProductLabelDao extends BaseDao
|
||||
return $this->conditionSearch($where)->count();
|
||||
}
|
||||
|
||||
public function labelUseList()
|
||||
public function labelUseList(bool $is_show = true)
|
||||
{
|
||||
$list = $this->getModel()->where('is_show', 1)->where('status', 1)->where('is_del', 0)->select()->toArray();
|
||||
if ($is_show) {
|
||||
$list = $this->getModel()->where('is_show', 1)->where('status', 1)->where('is_del', 0)->select()->toArray();
|
||||
} else {
|
||||
$list = $this->getModel()->where('status', 1)->where('is_del', 0)->select()->toArray();
|
||||
}
|
||||
$arr = [];
|
||||
foreach ($list as $item) {
|
||||
$arr[$item['cate_id']][] = $item;
|
||||
|
||||
@ -813,6 +813,7 @@ class StoreSeckillServices extends BaseServices
|
||||
$productList = $productServices->searchList(['id' => $productIds, 'is_del' => 0]);
|
||||
$productList = $productList['list'] ?? [];
|
||||
$productInfos = array_combine($productIds, $productInfos);
|
||||
$descriptionArr = app()->make(StoreDescriptionServices::class)->getColumn([['product_id', 'in', $productIds], ['type', '=', 0]], 'description', 'product_id');
|
||||
|
||||
/** @var StoreActivityServices $StoreActivityServices */
|
||||
$StoreActivityServices = app()->make(StoreActivityServices::class);
|
||||
@ -835,7 +836,7 @@ class StoreSeckillServices extends BaseServices
|
||||
$seckillData['unit_name'] = $product['unit_name'] ?? '';
|
||||
$seckillData['section_time'] = $data['section_time'];
|
||||
$seckillData['images'] = $product['slider_image'] ?? '';
|
||||
$seckillData['description'] = $product['description'] ?? '';
|
||||
$seckillData['description'] = htmlspecialchars_decode($descriptionArr[$product['id']] ?? '');
|
||||
$seckillData['status'] = $productInfos[$product['id']]['status'] ?? 1;
|
||||
$seckillData['time_id'] = $timeIds;
|
||||
$seckillData['num'] = $data['num'] ?? 0;
|
||||
@ -861,9 +862,6 @@ class StoreSeckillServices extends BaseServices
|
||||
if (!isset($sattr['price']) || !$sattr['price']) {
|
||||
throw new AdminException('请填写商品(' . $product['store_name'] . ' | ' . $sattr['suk'] . ')活动价');
|
||||
}
|
||||
// if ($sattr['price'] > $sattr['ot_price']) {
|
||||
// throw new AdminException('商品(' . $product['store_name'] . ' | ' . $sattr['suk'] . ')活动价不能大于原价');
|
||||
// }
|
||||
if (!isset($sattr['quota']) || !$sattr['quota']) {
|
||||
throw new AdminException('请填写商品(' . $product['store_name'] . ' | ' . $sattr['suk'] . ')限量');
|
||||
}
|
||||
@ -888,7 +886,6 @@ class StoreSeckillServices extends BaseServices
|
||||
}
|
||||
}
|
||||
$seckillId = $this->dao->value(['activity_id' => $id, 'product_id' => $seckillData['product_id']], 'id') ?? 0;
|
||||
$seckillData['description'] = app()->make(StoreDescriptionServices::class)->getDescription(['product_id' => $seckillData['product_id'], 'type' => 1]);
|
||||
$this->saveData($seckillId, $seckillData);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -830,7 +830,7 @@ class StoreOrderCreateServices extends BaseServices
|
||||
//计算商品金额
|
||||
if (sys_config('user_brokerage_type') == 1) {
|
||||
//按照实际支付价格返佣
|
||||
$price = bcmul((string)bcadd((string)$cart['truePrice'], (string)$cart['postage_price'], 2), $cartNum, 4);
|
||||
$price = bcadd(bcmul((string)$cart['truePrice'], $cartNum, 4), (string)$cart['postage_price'], 4);
|
||||
} else {
|
||||
//按照商品价格返佣
|
||||
if (isset($productInfo['attrInfo'])) {
|
||||
|
||||
@ -2662,15 +2662,16 @@ HTML;
|
||||
// 判断是否开启小程序订单管理
|
||||
$orderData['order_shipping_open'] = false;
|
||||
if (sys_config('order_shipping_open', 0) && $order['pay_price'] > 0 && $order['is_channel'] == 1 && $order['pay_type'] == 'weixin' && MiniOrderService::isManaged()) {
|
||||
// 判断是否存在子未收货子订单
|
||||
if ($order['pid'] > 0) {
|
||||
if ($this->checkSubOrderNotTake((int)$order['pid'], (int)$order['id'])) {
|
||||
$orderData['order_shipping_open'] = true;
|
||||
}
|
||||
} else {
|
||||
$orderData['order_shipping_open'] = true;
|
||||
}
|
||||
// // 判断是否存在子未收货子订单
|
||||
// if ($order['pid'] > 0) {
|
||||
// if ($this->checkSubOrderNotTake((int)$order['pid'], (int)$order['id'])) {
|
||||
// $orderData['order_shipping_open'] = true;
|
||||
// }
|
||||
// } else {
|
||||
// $orderData['order_shipping_open'] = true;
|
||||
// }
|
||||
|
||||
$orderData['order_shipping_open'] = true;
|
||||
}
|
||||
$orderData['is_refund_available'] = $this->isRefundAvailable((int)$order['id']);
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ class StoreProductLabelServices extends BaseServices
|
||||
|
||||
public function labelUseList()
|
||||
{
|
||||
$labelUserList = $this->dao->labelUseList();
|
||||
$labelUserList = $this->dao->labelUseList(false);
|
||||
$labelCateList = app()->make(StoreProductLabelCateServices::class)->getLabelCateList(['is_del' => 0, 'status' => 1]);
|
||||
$data = [];
|
||||
foreach ($labelUserList as $key => $item) {
|
||||
|
||||
@ -832,8 +832,21 @@ class UpgradeServices extends BaseServices
|
||||
throw new AdminException('升级文件异常,请重新下载');
|
||||
}
|
||||
|
||||
if (is_file($serverPackageName) && !$fileService->extractFile($serverPackageName, app()->getRootPath())) {
|
||||
throw new AdminException('服务端解压失败');
|
||||
// 服务端解压前,清空前端相关目录,避免旧文件残留
|
||||
if (is_file($serverPackageName)) {
|
||||
$clearDirs = [
|
||||
app()->getRootPath() . 'public' . DS . 'admin',
|
||||
app()->getRootPath() . 'public' . DS . 'statics' . DS . 'mp_view',
|
||||
app()->getRootPath() . 'public' . DS . 'statics' . DS . 'download',
|
||||
];
|
||||
foreach ($clearDirs as $clearDir) {
|
||||
if (is_dir($clearDir)) {
|
||||
$this->clearDirectory($clearDir);
|
||||
}
|
||||
}
|
||||
if (!$fileService->extractFile($serverPackageName, app()->getRootPath())) {
|
||||
throw new AdminException('服务端解压失败');
|
||||
}
|
||||
}
|
||||
|
||||
if (is_file($clientPackageName) && !$fileService->extractFile($clientPackageName, app()->getRootPath())) {
|
||||
@ -848,6 +861,26 @@ class UpgradeServices extends BaseServices
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空目录下所有文件和子目录(保留目录本身)
|
||||
* @param string $dir 目录路径
|
||||
* @return void
|
||||
*/
|
||||
public function clearDirectory(string $dir): void
|
||||
{
|
||||
$iterator = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS),
|
||||
\RecursiveIteratorIterator::CHILD_FIRST
|
||||
);
|
||||
foreach ($iterator as $file) {
|
||||
if ($file->isDir()) {
|
||||
@rmdir($file->getRealPath());
|
||||
} else {
|
||||
@unlink($file->getRealPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 回滚表结构
|
||||
* @param string $prefix
|
||||
@ -1900,7 +1933,7 @@ class UpgradeServices extends BaseServices
|
||||
if ($current >= $total) {
|
||||
$step = 3;
|
||||
$progress = 90;
|
||||
$failedCount = count(array_filter($sqlLogs, fn($log) => $log['status'] === 'failed'));
|
||||
$failedCount = count(array_filter($sqlLogs, function ($log) { return $log['status'] === 'failed'; }));
|
||||
$stepDetails['sql'] = $failedCount > 0
|
||||
? "SQL执行完成({$failedCount}项失败)"
|
||||
: 'SQL执行完成 ✓';
|
||||
|
||||
@ -296,6 +296,9 @@ class SystemStorageServices extends BaseServices
|
||||
} else {
|
||||
$data['cname'] = $data['domain'];
|
||||
}
|
||||
if (4 === $type) {
|
||||
$data['name'] = $data['name'] . '-' . sys_config('tengxun_appid');
|
||||
}
|
||||
$data['add_time'] = time();
|
||||
$data['update_time'] = time();
|
||||
$config = $this->getStorageConfig($type);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user