time()) { return '未开始'; } if ($data['end_time'] < time()) { return '已结束'; } if ($data['start_time'] < time() && $data['end_time'] > time()) { return '生效-进行中'; } return ''; } /** * 处理过的详情数据 */ public static function detailWithTrans($seckill_activity_id) { $model = (new static())->with(['file'])->where('seckill_activity_id', '=', $seckill_activity_id)->find(); return [ 'title' => $model['title'], 'image_id' => $model['image_id'], 'status' => $model['status'], 'sort' => $model['sort'], 'start_time' => $model['start_time'], 'end_time' => $model['end_time'], 'file_path' => $model['file']['file_path'], 'start_date' => date('Y-m-d', $model['start_time']), 'end_date' => date('Y-m-d', $model['end_time']), 'active_time' => [ $model['day_start_time'], $model['day_end_time'], ] ]; } public static function detail($seckill_activity_id) { return (new static())->find($seckill_activity_id); } public function file() { return $this->belongsTo('app\\common\\model\\file\\UploadFile', 'image_id', 'file_id'); } public function seckillProduct() { return $this->hasMany('app\\common\\model\\plus\\seckill\\Product', 'seckill_activity_id', 'seckill_activity_id'); } }