$uid, 'special_id' => $data['special_id'], 'task_id' => $data['task_id']])->find(); if ($viewing) { $dat['viewing_time'] = $data['viewing_time']; $dat['percentage'] = $data['percentage']; $dat['total'] = $data['total']; if ($data['percentage'] > $viewing['percentage']) { return self::edit($dat, $viewing['id']); } else { return true; } } else { $data['uid'] = $uid; $data['add_time'] = time(); return self::set($data); } } /** * 查看素材是否观看 */ public static function whetherWatch($uid, $special_id = 0, $task_id = 0) { return self::where(['uid' => $uid, 'special_id' => $special_id, 'task_id' => $task_id])->find(); } }