_getSelfMysql(), 't_user_rookie_task_bind', array( 'account_id' => myself()->_getAccountId(), ) ); if (!$row){ SqlHelper::insert( myself()->_getSelfMysql(), 't_user_rookie_task_bind', array( 'account_id' => myself()->_getAccountId(), 'createtime' => myself()->_getNowTime(), 'modifytime' => myself()->_getNowTime(), ) ); } } public static function getMyStarTime(){ $row = SqlHelper::ormSelectOne( myself()->_getSelfMysql(), 't_user_rookie_task_bind', array( 'account_id' => myself()->_getAccountId(), ) ); if (!$row){ self::bindUser(); $row = SqlHelper::ormSelectOne( myself()->_getSelfMysql(), 't_user_rookie_task_bind', array( 'account_id' => myself()->_getAccountId(), ) ); } return myself()->_getDaySeconds($row['createtime']); } public static function incTaskVal($taskType,$value){ SqlHelper::upsert( myself()->_getSelfMysql(), 't_rookie_task_value', array( 'account_id' => myself()->_getAccountId(), 'task_type' => $taskType, ), array( 'value' => function () use ($value){ return "value + ${value}"; }, 'modifytime' => myself()->_getNowTime(), ), array( 'account_id' => myself()->_getAccountId(), 'task_type' => $taskType, 'value' => $value, 'createtime' => myself()->_getNowTime(), 'modifytime' => myself()->_getNowTime(), ) ); } public static function getCurrentVal($taskType){ $row = SqlHelper::ormSelectOne( myself()->_getSelfMysql(), 't_rookie_task_value', array( 'account_id' => myself()->_getAccountId(), 'task_type' => $taskType, ) ); return $row ? $row['value'] : 0; } public static function find($taskId){ return SqlHelper::ormSelectOne( myself()->_getSelfMysql(), 't_rookie_task', array( 'account_id' => myself()->_getAccountId(), 'task_id' => $taskId, ) ); } public static function add($taskId){ SqlHelper::insert( myself()->_getSelfMysql(), 't_rookie_task', array( 'account_id' => myself()->_getAccountId(), 'task_id' => $taskId, 'createtime' => myself()->_getNowTime(), 'modifytime' => myself()->_getNowTime(), ) ); } }