no message

This commit is contained in:
hellcat 2025-06-12 15:47:39 +08:00
parent cd5bce6992
commit aed1f478e4
4 changed files with 131 additions and 48 deletions

View File

@ -44,7 +44,7 @@ class CronController
// $h = "00"; // $h = "00";
//// test end //// test end
if ($h == "00") { if ($h == "00" && $i== "00") {
$iFireWarningLine = ModelBookOption::_hit("fire_warning_line"); $iFireWarningLine = ModelBookOption::_hit("fire_warning_line");

View File

@ -319,7 +319,15 @@ class SakaiController
$s = "/book#main"; $s = "/book#main";
$s = "/book#up__3"; $s = "/book#up__3";
$s = "/book#main"; $s = "/book#main";
$s = "firel"; $s = "/book#unlike";
// $s = "firel";
// $s = "likeg__4 s";
// $s = "like ss";
// $s = "checkId 20";
// $s = "war 8"; // $s = "war 8";
// $s = "no 9"; // $s = "no 9";
// $s = "detail__all 1"; // $s = "detail__all 1";

View File

@ -83,43 +83,88 @@ class Book extends Model
// where // where
if ($iPage !== "all") { if ($iPage !== "all") {
// sort覆盖特殊规则 // dir特殊
if ($oParentRag->type == "dir") { if ($oParentRag->type == "dir") {
if (!empty($oParentRag->sort)) { if (!empty($oParentRag->sort)) {
$aSort = explode("_", $oParentRag->sort); $aSort = explode("_", $oParentRag->sort);
// tomd($aSort, 1);
// self::where("path", $sPath)->where("is_del", $iIsDel);
$oSelf = $oSelf->orWhere("path", $oParentRag->path); $oSelf = $oSelf->orWhere("path", $oParentRag->path);
$oSelf = $oSelf->where($aSort[0], $aSort[1]); $oSelf = $oSelf->where($aSort[0], $aSort[1]);
} }
} else if ($oParentRag->sort) { } else if ($oParentRag->type == "todo") {
$aSort = explode("_", $oParentRag->sort); $sTodoShowRank = BookOption::_hit("todo_show_rank");
$oSelf = $oSelf->where($aSort[0], $aSort[1]); $aTodoShowRank = explode(",", $sTodoShowRank);
$oSelf = $oSelf->where(function($query) use ($aTodoShowRank) {
$query->whereIn("rank", $aTodoShowRank)
->orWhereNull("rank");
});
}
if (isset($aRagOption["where"])) {
$oSelf = $oSelf->whereRaw($aRagOption["where"]);
} else { } else {
if (isset($aRagOption["where"])) { if ($oParentRag->sort) {
$oSelf = $oSelf->whereRaw($aRagOption["where"]);
}
if ($oParentRag->type == "todo") {
$sTodoShowRank = BookOption::_hit("todo_show_rank"); $aSort = explode("_", $oParentRag->sort);
$aTodoShowRank = explode(",", $sTodoShowRank); $oSelf = $oSelf->where($aSort[0], $aSort[1]);
$oSelf = $oSelf->where(function($query) use ($aTodoShowRank) {
$query->whereIn("rank", $aTodoShowRank) } if ($oParentRag->like) {
->orWhereNull("rank");
}); $oSelf = $oSelf->where("rag", "like", "%".$oParentRag->like."%");
} }
} }
// sort覆盖特殊规则
// if ($oParentRag->type == "dir") {
//
// if (!empty($oParentRag->sort)) {
//
// $aSort = explode("_", $oParentRag->sort);
// $oSelf = $oSelf->orWhere("path", $oParentRag->path);
// $oSelf = $oSelf->where($aSort[0], $aSort[1]);
//
// }
//
// } else if ($oParentRag->sort) {
//
// $aSort = explode("_", $oParentRag->sort);
// $oSelf = $oSelf->where($aSort[0], $aSort[1]);
//
// } else {
//
// if (isset($aRagOption["where"])) {
// $oSelf = $oSelf->whereRaw($aRagOption["where"]);
// }
//
// if ($oParentRag->type == "todo") {
//
// $sTodoShowRank = BookOption::_hit("todo_show_rank");
// $aTodoShowRank = explode(",", $sTodoShowRank);
// $oSelf = $oSelf->where(function($query) use ($aTodoShowRank) {
// $query->whereIn("rank", $aTodoShowRank)
// ->orWhereNull("rank");
// });
//
// }
//
// }
} }
@ -127,25 +172,14 @@ class Book extends Model
if ($oParentRag->order == "rank_todo") { if ($oParentRag->order == "rank_todo") {
$sOrderRank = BookOption::_hit("order_rank_todo"); $sOrderRank = BookOption::_hit("order_rank_todo");
// $aTodoOrder = explode(",", $sTodoOrder);
// $sTodoOrder = implode(",", array_reverse($aTodoOrder));
//
// $oSelf = $oSelf->orderByRaw("FIELD(rank, " . $sTodoOrder . ") DESC, (rank IS NULL) ASC");
// $oSelf = $oSelf->orderByRaw("fire DESC, (fire IS NULL) ASC");
//
// $sOrder = "no";
// $sOrderType = "asc";
// 默认也rank排序 // 默认也rank排序
} else { } else {
$sOrderRank = BookOption::_hit("order_rank"); $sOrderRank = BookOption::_hit("order_rank");
// tomd($sOrderRank, 1);
} }
// $sOrderRank = BookOption::_hit("order_rank_todo");
$aOrderRank = explode(",", $sOrderRank); $aOrderRank = explode(",", $sOrderRank);
$sOrderRank = implode(",", array_reverse($aOrderRank)); $sOrderRank = implode(",", array_reverse($aOrderRank));
@ -159,7 +193,7 @@ class Book extends Model
$oSelf = $oSelf->orderBy($sOrder, $sOrderType); $oSelf = $oSelf->orderBy($sOrder, $sOrderType);
$oSelf = $oSelf->orderBy("updated_at", "desc"); $oSelf = $oSelf->orderBy("updated_at", "desc");
// tomd($oSelf->toSql(), 1);
if ($iPage == "all") { if ($iPage == "all") {
$oSelf = $oSelf->get(); $oSelf = $oSelf->get();
@ -169,7 +203,7 @@ class Book extends Model
$oSelf = $oSelf->paginate($iLimit, ['*'], 'page', $iPage); $oSelf = $oSelf->paginate($iLimit, ['*'], 'page', $iPage);
} }
return $oSelf; return $oSelf;
} }

View File

@ -156,15 +156,6 @@ class Book extends Base {
} }
//// 展开 系列 end //// 展开 系列 end
//// like 系列
public function like($aParam)
{
$this->_cd("like");
return $this->open();
}
//// like 系列 end
//// 全局option 系列 //// 全局option 系列
public function g_option($aParam) public function g_option($aParam)
{ {
@ -341,7 +332,8 @@ class Book extends Base {
// tomd($sPath); // tomd($sPath);
$aMap = [ $aMap = [
"mian" => 1, "mian" => 1,
"firel" => 2, "firel" => 2,
"like" => 3,
"/" => 1, "/" => 1,
]; ];
// tomd($aMap[$sPath], 1); // tomd($aMap[$sPath], 1);
@ -1610,7 +1602,7 @@ class Book extends Base {
$sWarningLine = ModelBookOption::_hit("fire_warning_line"); $sWarningLine = ModelBookOption::_hit("fire_warning_line");
$this->aOption["show_id"] = true; $this->aRagOption["show_id"] = true;
$this->aRagOption["is_shadow_list"] = true; $this->aRagOption["is_shadow_list"] = true;
@ -1807,6 +1799,55 @@ class Book extends Base {
$this->_noToId([1, 2]); $this->_noToId([1, 2]);
} }
//// like 系列
public function like($aParam)
{
$v = $aParam["aArg"][1];
$oRagParent = $this->_getParentRag();
$oRagParent->like = $v;
$oRagParent->save();
return $this->openRe();
}
public function unlike()
{
$oRagParent = $this->_getParentRag();
$oRagParent->like = NULL;
$oRagParent->save();
return $this->openRe();
}
public function _like($k, $v)
{
// $oBook = ModelBook::where($k, "like", "%".$v."%")->get();
// $this->_cd("like");
//
// return $this->open();
}
public function likeg($aParam)
{
$iPage = $aParam["aOption"][1] ?? 1;
$sValue = $aParam["aArg"][1] ?? false;
$iOptionLimit = ModelBookOption::_hit("global_like_limit");
$iRowStart = ($iPage - 1) * $iOptionLimit;
$oBook = ModelBook::where("rag", "like", "%".$sValue."%")->offset($iRowStart)->limit($iOptionLimit)->get();
$this->aRagOption["is_shadow_list"] = true;
$this->aRagOption["show_id"] = true;
return $this->bookToStr($oBook);
}
//// like 系列 end
//// rank系列 //// rank系列
// book#rank__1__3 2 // book#rank__1__3 2
// book#rank 2 // book#rank 2
@ -2121,7 +2162,7 @@ class Book extends Base {
$sStr .= "\n"; $sStr .= "\n";
if ($iDeep == 0) { if ($iDeep == 0 || isset($this->aRagOption["is_shadow_list"])) {
$sStr .= "\n"; $sStr .= "\n";
} }
@ -2129,12 +2170,12 @@ class Book extends Base {
$sStr .= $this->_deepToStr($iDeep); $sStr .= $this->_deepToStr($iDeep);
} }
if (@$this->aOption["show_id"]) { if (isset($this->aRagOption["show_id"])) {
$sStr .= $oRag->id."-"; $sStr .= "i".$oRag->id;
} else {
$sStr .= $oRag->no;
} }
$sStr .= $oRag->no;
if ($oRag->checked >= 1) { if ($oRag->checked >= 1) {
$sStr .= ":🎯"; $sStr .= ":🎯";
} }