| 1234567891011121314151617181920212223242526 | <?phpnamespace app\common\model;class Article extends \think\Model{    public function createTimeArchive()    {        $create_times = $this->order('create_time desc')->column('create_time');        $timeList = [];        foreach($create_times as $value) {            $yearAndMonth = date("Y-m", $value);            $timeList[] = $yearAndMonth;        }        $timeList = array_unique($timeList);                return $timeList;    }    public static function sort($data)    {        $article = self::find($data['id']);        $article->sort = $data['sort'];                return $article->save();    }}
 |