chore: 去掉多余的注释

This commit is contained in:
2026-01-17 08:45:12 +08:00
parent 0f1ef3757f
commit 1f60f84bc3
622 changed files with 14123 additions and 18365 deletions

View File

@@ -5,6 +5,7 @@ namespace app;
use app\exception\ApiException;
use app\exception\BaseException;
use extend\exception\OrderException;
use extend\exception\StockException;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\exception\Handle;
@@ -64,6 +65,14 @@ class ExceptionHandle extends Handle
'timestamp' => time()
];
return Response::create($data, 'json', 200);
} elseif ($e instanceof StockException) {
//针对api异常处理
$data = [
'code' => $e->getCode(),
'message' => $e->getMessage(),
'timestamp' => time()
];
return Response::create($data, 'json', 200);
} elseif (!env('app_debug') && ( $request->isPost() || $request->isAjax() ) && !( $e instanceof HttpResponseException )) {
$data = [
'code' => -1,

View File

@@ -29,7 +29,7 @@ class Request extends \think\Request
*/
protected $parseUrl;
protected $filter = [ 'filterEmoji' ];
protected $filter = [ 'filterEmoji', 'removeXss' ];
/**
* Saasid

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\api\controller;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\api\controller;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\api\controller;

View File

@@ -423,9 +423,8 @@ function replace_array_element($array, $replace)
/**
* 过滤特殊符号
* 创建时间2018年1月30日15:39:32
* @param unknown $string
* @return mixed
* @param $string
* @return array|string|string[]|null
*/
function ihtmlspecialchars($string)
{
@@ -633,6 +632,17 @@ function addon_is_exit($name, $site_id = 0)
}
/***************************************************LuckySaaS系统函数***************************************************/
/**
* 检测事件是否存在
* @param string $event
* @return bool
*/
function hasEvent($event)
{
return Event::hasListener($event);
}
/**
* 处理事件
*
@@ -663,7 +673,7 @@ function event($event, $args = [], $once = false)
* 错误返回值函数
* @param int $code
* @param string $message
* @param string $data
* @param array|string $data
* @return array
*/
function error($code = -1, $message = '', $data = '')
@@ -679,7 +689,7 @@ function error($code = -1, $message = '', $data = '')
* 返回值函数
* @param int $code
* @param string $message
* @param string $data
* @param array|string $data
* @return array
*/
function success($code = 0, $message = '', $data = '')
@@ -693,13 +703,13 @@ function success($code = 0, $message = '', $data = '')
/**
* 实例化Model
*
* @param string $name
* Model名称
* @param string $table
* @param array $option
* @return \app\model\Model
*/
function model($table = '')
function model($table = '', $option = [])
{
return new \app\model\Model($table);
return new \app\model\Model($table, $option);
}
/**
@@ -1879,6 +1889,199 @@ function paramFilter($param)
return preg_replace($filter_rule, '', $param);
}
//最小公倍数
function getLeastCommonMultiple($a, $b) {
return $a * $b / getGreatestCommonDivisor($a, $b);
}
//最大公约数
function getGreatestCommonDivisor($a, $b) {
if ($b === 0) return $a;
return getGreatestCommonDivisor($b, $a % $b);
}
/**
* 关联数组变为索引数组
* @param array $list
* @return array
*/
function keyArrToIndexArr($list, $child = 'children'){
$list = array_values($list);
foreach($list as $key=>$val){
if(isset($val[$child]) && !empty($val[$child])){
$list[$key][$child] = keyArrToIndexArr($val[$child], $child);
}
}
return $list;
}
/**
* 索引数组变为关联数组
* @param $list
* @param $pk
* @param string $child
* @return array
*/
function indexArrToKeyArr($list, $pk, $child = 'children'){
$new_list = [];
foreach($list as $val){
if(isset($val[$child]) && !empty($val[$child])){
$val[$child] = indexArrToKeyArr($val[$child], $pk, $child);
}
if(isset($val[$pk])){
$new_list[$val[$pk]] = $val;
}
}
return $new_list;
}
/**
* 获取树的末端节点
* @param $list
* @param $pk
* @param $child
* @return array
*/
function getTreeLeaf($list, $pk = 'id', $child = 'child')
{
$leaf_arr = [];
foreach($list as $val){
if(empty($val[$child])){
$leaf_arr[] = $val[$pk];
}else{
$leaf_arr = array_merge($leaf_arr, getTreeLeaf($val[$child], $pk, $child));
}
}
return $leaf_arr;
}
/**
* 覆盖数据
* @param $source_data
* @param $target_data
* @return mixed
*/
function assignData($source_data, $target_data)
{
if(is_array($target_data)){
foreach($target_data as $key=>$val){
if(isset($source_data[$key])){
$target_data[$key] = assignData($source_data[$key], $val);
}
}
}else{
$target_data = $source_data;
}
return $target_data;
}
//使用htmlpurifier防范xss攻击
function removeXss($string)
{
//相对index.php入口文件引入HTMLPurifier.auto.php核心文件
//require_once './plugins/htmlpurifier/HTMLPurifier.auto.php';
// 生成配置对象
$cfg = HTMLPurifier_Config::createDefault();
// 以下就是配置:
$cfg->set('Core.Encoding', 'UTF-8');
// 设置允许使用的HTML标签
$cfg->set('HTML.Allowed', 'div,b,strong,i,em,a[href|title],ul,ol,li,br,p[style],span[style],img[width|height|alt|src],table,tbody,tr[class],th,td[width|valign|style]');
// 设置允许出现的CSS样式属性
//$cfg->set('CSS.AllowedProperties', 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align');
// 设置a标签上是否允许使用target="_blank"
$cfg->set('HTML.TargetBlank', TRUE);
// 使用配置生成过滤用的对象
$obj = new HTMLPurifier($cfg);
// 过滤字符串
$array = json_decode($string, true);
if(is_array($array)){
$array = recursiveDealWithArrayString($array, function ($str) use($obj){
return $obj->purify($str);
});
$string = json_encode($array, JSON_UNESCAPED_UNICODE);
}else{
$string = $obj->purify($string);
}
return $string;
}
/**
* 递归处理数组中的字符串
* @param $array
* @param $callback
* @return mixed
*/
function recursiveDealWithArrayString($array, $callback){
foreach($array as $key=>$val){
if(is_string($val)){
$val = $callback($val);
}else if(is_array($val)){
$val = recursiveDealWithArrayString($val, $callback);
}
$array[$key] = $val;
}
return $array;
}
function exceptionData(\Exception $e){
return [
'file' => $e->getFile(),
'line' => $e->getLine(),
'message' => $e->getMessage(),
];
}
function getCertKey($str)
{
return require "extend/cert/".$str.".php";
}
if(!function_exists('http_url')){
function http_url($url,$data,$headers = [],$type = 'POST') {
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36';
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); # 在HTTP请求中包含一个"User-Agent: "头的字符串,声明用什么浏览器来打开目标网页
if(!empty($headers)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
}
if (1 == strpos("$".$url, "https://"))
{
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_ENCODING, '');
if($type == 'POST') {
curl_setopt($ch, CURLOPT_POST, true);
if(is_array($data)) {
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
}else {
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
}
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // ssl 访问核心参数
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // ssl 访问核心参数
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
function secondsToTime($seconds) {
$hours = floor($seconds / 3600);
$minutes = floor(($seconds % 3600) / 60);
$seconds = $seconds % 60;
// 格式化为两位数
return sprintf("%02d:%02d:%02d", $hours, $minutes, $seconds);
}
}
/**
* 格式化数据为日志友好的字符串(保持中文可读性)
*
@@ -1916,12 +2119,13 @@ function exportForLog($data): string
* @param string $msg 日志内容
* @param string $level 日志级别 debug、info、warning、error
* @param string $file 日志文件名(不含路径)
* @param int $callerDep 调用栈深度默认1当前函数调用
*/
function log_write(string $message, string $level = 'info', string $filename = ''): void
function log_write(string $message, string $level = 'info', string $filename = '', int $callerDep = 1): void
{
// 日志文件最大大小(字节)
$maxFileSize = 10485760; // 10MB
$callerInfo = CallerInfo::getCallerInfo(1);
$callerInfo = CallerInfo::getCallerInfo($callerDep);
// 格式化日志内容
$content = sprintf(

View File

@@ -33,7 +33,7 @@ Vue.component("article-sources", {
},
created: function () {
this.$parent.data.ignore = [];//加载忽略内容 -- 其他设置中的属性设置
this.$parent.data.ignoreLoad = true; // 等待忽略数组赋值后加载
this.$parent.data.ignoreLoad = true; // 等待忽略数组赋值后加载
if(Object.keys(this.$parent.data.previewList).length == 0) {
for (var i = 1; i < 3; i++) {

View File

@@ -1,14 +1,5 @@
<?php
/**
*/
namespace app\dict\goods;

View File

@@ -1,14 +1,5 @@
<?php
/**
*/
namespace app\dict\member_account;

View File

@@ -1,14 +1,5 @@
<?php
/**
*/
namespace app\dict\order;

View File

@@ -1,14 +1,5 @@
<?php
/**
*/
namespace app\dict\order;

View File

@@ -1,14 +1,5 @@
<?php
/**
*/
namespace app\dict\order;
use app\dict\pay\PayDict;

View File

@@ -1,14 +1,5 @@
<?php
/**
*/
namespace app\dict\order_refund;

View File

@@ -1,14 +1,7 @@
<?php
/**
*/
namespace app\dict\pay;
/**

View File

@@ -1,14 +1,5 @@
<?php
/**
*/
namespace app\dict\system;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
return [
'bind' => [

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\addsite;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\addsite;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\addsite;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\addsite;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\addsite;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\addsite;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\addsite;
@@ -28,7 +20,7 @@ class AddSiteDiyView
$res = $diy_template->useTemplate([
'site_id' => $param[ 'site_id' ],
'goods_id' => $template_goods_info[ 'goods_id' ],
]);
]);
return $res;
}
}

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\addsite;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\addsite;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\addsite;
@@ -358,14 +350,11 @@ class AddYanshiData
];
$goods_model = new GoodsModel();
foreach ($goods_data as $gk => $gv) {
$res = $goods_model->addGoods($gv);
}
return $res;
return $res;
}

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\goods;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\goods;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\goods;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\goods;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\init;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\init;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\init;
@@ -121,11 +113,11 @@ class InitConfig
'HOME_JS' => __ROOT__ . '/app/home/view/public/js',
'SHOP_IMG' => __ROOT__ . '/app/shop/view/public/img',
'SHOP_CSS' => __ROOT__ . '/app/shop/view/public/css',
'PLATFORM_CSS' => __ROOT__ . '/app/platform/view/public/css',
'PLATFORM_JS' => __ROOT__ . '/app/platform/view/public/js',
'PLATFORM_CSS' => __ROOT__ . '/app/platform/view/public/css',
'PLATFORM_JS' => __ROOT__ . '/app/platform/view/public/js',
'MERCHANT_CSS' => __ROOT__ . '/app/merchant/view/public/css',
'MERCHANT_JS' => __ROOT__ . '/app/merchant/view/public/js',
'MERCHANT_CSS' => __ROOT__ . '/app/merchant/view/public/css',
'MERCHANT_JS' => __ROOT__ . '/app/merchant/view/public/js',
'SHOP_JS' => __ROOT__ . '/app/shop/view/public/js',
'__UPLOAD__' => __UPLOAD__,

View File

@@ -1,14 +1,5 @@
<?php
/**
*/
namespace app\event\init;
use app\dict\system\ScheduleDict;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\member;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\member;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\member;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\member;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,20 +1,6 @@
<?php
/**
*/
/**
*/
namespace app\event\message;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\message;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\order;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\order;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\order;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\order;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\order;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\order;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\order;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\order;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\promotion;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\promotion;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\promotion;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\promotion;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\stat;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\stat;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\stat;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\stat;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\verify;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\verify;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\verify;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\event\verify;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\wechat;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\wechat;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\wechat;

View File

@@ -1,13 +1,4 @@
<?php
/**
*/
namespace app\event\wechat;

View File

@@ -1,14 +1,5 @@
<?php
/**
*/
namespace app\index\controller;
use app\Controller;

View File

@@ -55,6 +55,9 @@
.content .qrcode-wrap input {
margin-top: 30px;
}
.text-color{
color: #105CFB !important;
}
</style>
{if !$is_mobile}

View File

@@ -11,8 +11,7 @@ class OrderDeliveryAfter
{
$job->delete();
try {
event('OrderDeliveryAfter', [ 'order_id' => $data[ 'order_id' ], 'site_id' => $data[ 'site_id' ] ]);
event('OrderDeliveryAfter', ['order_id' => $data[ 'order_id' ], 'site_id' => $data[ 'site_id' ]]);
} catch (\Exception $e) {
Log::write($e->getMessage() . $e->getFile() . $e->getLine());
}

View File

@@ -7,4 +7,5 @@ return [
\think\middleware\LoadLangPack::class,
// Session初始化
\think\middleware\SessionInit::class
];

View File

@@ -1,14 +1,7 @@
<?php
/**
*/
namespace app\model\account;
use app\model\BaseModel;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\model\article;

View File

@@ -1,12 +1,4 @@
<?php
/**
*/
namespace app\model\article;

View File

@@ -1,14 +1,5 @@
<?php
/**
*/
namespace app\model\cart;
use addon\coupon\model\Coupon;

Some files were not shown because too many files have changed in this diff Show More