|
@@ -113,7 +113,11 @@ class User extends Model{
|
|
|
* @param int $id
|
|
|
*/
|
|
|
public function randOtherInfoByShort($short){
|
|
|
- $info = $this->db()->field('id, short')->where("short", "<>", $short)->select();
|
|
|
+ $info = $this->db()->field('id, short')
|
|
|
+ ->where("short", "<>", $short)
|
|
|
+ ->whereTime('last_login', 'between', $this->getNearMonth())
|
|
|
+ ->select();
|
|
|
+
|
|
|
return $this->getUserJsonFile($info);
|
|
|
}
|
|
|
|
|
@@ -123,13 +127,27 @@ class User extends Model{
|
|
|
* @return int
|
|
|
*/
|
|
|
public function randOtherInfoById($id){
|
|
|
- $info = $this->db()->field('id, short')->where("id", "<>", $id)->select();
|
|
|
+ $info = $this->db()->field('id, short')
|
|
|
+ ->where("id", "<>", $id)
|
|
|
+ ->whereTime('last_login', 'between', $this->getNearMonth())
|
|
|
+ ->select();
|
|
|
+
|
|
|
return $this->getUserJsonFile($info);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 得到最近30天日期
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ private function getNearMonth(){
|
|
|
+ $back = date('Y-m-d H:i:s');
|
|
|
+ $front = date('Y-m-d H:i:s',strtotime("-30 day"));
|
|
|
+ return [$front, $back];
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 找到文件路径
|
|
|
- * @param unknown $info
|
|
|
+ * @param array $info
|
|
|
* @param string $id
|
|
|
* @param string $short
|
|
|
* @return string
|