* Refactor tutorialModel::checkNovice, and modify its unit test.

This commit is contained in:
liumengyi
2023-12-07 16:23:56 +08:00
parent 30f0bf9d16
commit f75b575480
3 changed files with 75 additions and 0 deletions
+19
View File
@@ -12,6 +12,25 @@ declare(strict_types=1);
*/
class tutorialModel extends model
{
/**
* 检查新手模式配置。
* Check novice mode config.
*
* @access public
* @return bool
*/
public function checkNovice(): bool
{
$account = $this->app->user->account;
if($account == 'guest') return false;
if(!empty($this->app->user->modifyPassword)) return false;
$count = $this->dao->select('count(*) AS count')->from(TABLE_ACTION)->where('actor')->eq($account)->fetch('count');
if($count < 10) return true;
$this->loadModel('setting')->setItem($account . '.common.global.novice', 0);
return false;
}
/**
* 获取新手模式产品键值对。
* Get tutorial product pairs.